aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man3/setjmp.331
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)