signal.7: Note the interactions of longjmp() and non-async-signal-safe functions

See http://austingroupbugs.net/view.php?id=516#c1195.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-02-16 15:33:24 +01:00
parent f1d6ee6211
commit 082efcce8b
2 changed files with 9 additions and 3 deletions

View File

@ -299,7 +299,7 @@ POSIX.1-2008 Technical Corrigendum 2 adds
.\" http://austingroupbugs.net/view.php?id=516#c1195
.BR longjmp ()
and
.BR setlongjmp ()
.BR siglongjmp ()
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
@ -324,6 +324,5 @@ call to a non-async-signal-safe function and
no non-async-signal-safe functions are called after
returning from the initial call to
.IR main ().
.IR main ().
.SH SEE ALSO
.BR signal (7)

View File

@ -474,7 +474,14 @@ at some arbitrary point in the execution of the program.
POSIX has the concept of "safe function".
If a signal interrupts the execution of an unsafe function, and
.I handler
calls an unsafe function, then the behavior of the program is undefined.
either calls an unsafe function or
.I handler
terminates via a call to
.BR longjmp ()
or
.BR siglongjmp ()
and the program subsequently calls an unsafe function,
then the behavior of the program is undefined.
POSIX.1-2004 (also known as POSIX.1-2001 Technical Corrigendum 2)
requires an implementation to guarantee that the following