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