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