diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2016-02-16 15:26:34 +0100 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2016-02-16 15:48:36 +0100 |
| commit | f1d6ee621182f84ba729faad1f71fae1a606ee96 (patch) | |
| tree | ec9964908791d625b024af5678bb75d071f562cf | |
| parent | b76f24dd413e0e7b351c09bf428b360ac7f17213 (diff) | |
| download | man-pages-f1d6ee621182f84ba729faad1f71fae1a606ee96.tar.gz | |
setjmp.3: Note the interactions of longjmp() and non-async-signal-safe functions
POSIX.1-2008 TC2 adds explicit text on this point.
See http://austingroupbugs.net/view.php?id=516#c1195
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man3/setjmp.3 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/man3/setjmp.3 b/man3/setjmp.3 index be388a75ff..2241929bad 100644 --- a/man3/setjmp.3 +++ b/man3/setjmp.3 @@ -294,5 +294,36 @@ in a different thread, the behavior is undefined. .\" (i.e., from a handler that was invoked in response to a signal that was .\" generated while another signal was already in the process of being .\" handled), the behavior is undefined. + +POSIX.1-2008 Technical Corrigendum 2 adds +.\" http://austingroupbugs.net/view.php?id=516#c1195 +.BR longjmp () +and +.BR setlongjmp () +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 +.BR exit (3) +that occur upon a return from the initial call to +.IR main ()), +the behavior is undefined if the program subsequently makes a call to +a non-async-signal-safe. +The only way of avoiding undefined behavior is to ensure one of the following: +.IP * 3 +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 +.IR main (). +.IP * +Any signal whose handler performs a long jump must be blocked during +.I 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 +.IR main (). +.IR main (). .SH SEE ALSO .BR signal (7) |
