1SIGSETJMP(3P) POSIX Programmer's Manual SIGSETJMP(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 sigsetjmp — set jump point for a non-local goto
13
15 #include <setjmp.h>
16
17 int sigsetjmp(sigjmp_buf env, int savemask);
18
20 The sigsetjmp() function shall be equivalent to the setjmp() function,
21 except as follows:
22
23 * References to setjmp() are equivalent to sigsetjmp().
24
25 * References to longjmp() are equivalent to siglongjmp().
26
27 * If the value of the savemask argument is not 0, sigsetjmp() shall
28 also save the current signal mask of the calling thread as part of
29 the calling environment.
30
32 If the return is from a successful direct invocation, sigsetjmp() shall
33 return 0. If the return is from a call to siglongjmp(), sigsetjmp()
34 shall return a non-zero value.
35
37 No errors are defined.
38
39 The following sections are informative.
40
42 None.
43
45 The distinction between setjmp()/longjmp() and sigsetjmp()/siglongjmp()
46 is only significant for programs which use sigaction(), sigprocmask(),
47 or sigsuspend().
48
49 Note that since this function is defined in terms of setjmp(), if save‐
50 mask is zero, it is unspecified whether the signal mask is saved.
51
53 The ISO C standard specifies various restrictions on the usage of the
54 setjmp() macro in order to permit implementors to recognize the name in
55 the compiler and not implement an actual function. These same restric‐
56 tions apply to the sigsetjmp() macro.
57
58 There are processors that cannot easily support these calls, but this
59 was not considered a sufficient reason to exclude them.
60
61 4.2 BSD, 4.3 BSD, and XSI-conformant systems provide functions named
62 _setjmp() and _longjmp() that, together with setjmp() and longjmp(),
63 provide the same functionality as sigsetjmp() and siglongjmp(). On
64 those systems, setjmp() and longjmp() save and restore signal masks,
65 while _setjmp() and _longjmp() do not. On System V Release 3 and in
66 corresponding issues of the SVID, setjmp() and longjmp() are explicitly
67 defined not to save and restore signal masks. In order to permit exist‐
68 ing practice in both cases, the relation of setjmp() and longjmp() to
69 signal masks is not specified, and a new set of functions is defined
70 instead.
71
72 The longjmp() and siglongjmp() functions operate as in the previous
73 issue provided the matching setjmp() or sigsetjmp() has been performed
74 in the same thread. Non-local jumps into contexts saved by other
75 threads would be at best a questionable practice and were not consid‐
76 ered worthy of standardization.
77
79 None.
80
82 pthread_sigmask(), siglongjmp(), signal(), sigsuspend()
83
84 The Base Definitions volume of POSIX.1‐2017, <setjmp.h>
85
87 Portions of this text are reprinted and reproduced in electronic form
88 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
89 table Operating System Interface (POSIX), The Open Group Base Specifi‐
90 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
91 Electrical and Electronics Engineers, Inc and The Open Group. In the
92 event of any discrepancy between this version and the original IEEE and
93 The Open Group Standard, the original IEEE and The Open Group Standard
94 is the referee document. The original Standard can be obtained online
95 at http://www.opengroup.org/unix/online.html .
96
97 Any typographical or formatting errors that appear in this page are
98 most likely to have been introduced during the conversion of the source
99 files to man page format. To report such errors, see https://www.ker‐
100 nel.org/doc/man-pages/reporting_bugs.html .
101
102
103
104IEEE/The Open Group 2017 SIGSETJMP(3P)