SIGINT, longjmp, getaddrinfo

Stephan Bergmann sbergman@redhat.com
Wed Feb 17 10:46:00 GMT 2016


On 02/16/2016 04:00 PM, Michael Kerrisk wrote:
> And now I've added this text to the completely revamped setjmp(2) man page[1]:
>
>         POSIX.1-2008  Technical  Corrigendum  2  adds  longjmp() and sig‐
>         longjmp() to the list of async-signal-safe  functions.   However,
>         the  standard recommends avoiding the use of these functions from
>         signal handlers and goes on to point out that if these  functions
>         are  called  from  a  signal handler that interrupted a call to a
>         non-async-signal-safe function (or some equivalent, such  as  the
>         steps  equivalent  to  exit(3)  that occur upon a return from the
>         initial call to main()), the behavior is undefined if the program
>         subsequently  makes  a call to a non-async-signal-safe.  The only

Looks like there is "function" missing after "non-async-signal-safe" above.

>         way of avoiding undefined behavior is to ensure one of  the  fol‐
>         lowing:
>
>         *  After  long  jumping from the signal handler, the program does
>            not call any  non-async-signal-safe  functions  and  does  not
>            return from the initial call to main().
>
>         *  Any  signal whose handler performs a long jump must be blocked
>            during every call to a non-async-signal-safe function  and  no
>            non-async-signal-safe  functions  are  called  after returning
>            from the initial call to main().



More information about the Libc-help mailing list