summaryrefslogtreecommitdiff
path: root/man3p/sigsetjmp.3p
blob: 627f9cacdf66bbaa536eaf21f07fb1e0a3a7e6aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "SIGSETJMP" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" sigsetjmp 
.SH NAME
sigsetjmp \- set jump point for a non-local goto
.SH SYNOPSIS
.LP
\fB#include <setjmp.h>
.br
.sp
int sigsetjmp(sigjmp_buf\fP \fIenv\fP\fB, int\fP \fIsavemask\fP\fB);
\fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
The \fIsigsetjmp\fP() function shall be equivalent to the \fIsetjmp\fP()
function,
except as follows:
.IP " *" 3
References to \fIsetjmp\fP() are equivalent to \fIsigsetjmp\fP().
.LP
.IP " *" 3
References to \fIlongjmp\fP() are equivalent to \fIsiglongjmp\fP().
.LP
.IP " *" 3
If the value of the \fIsavemask\fP argument is not 0, \fIsigsetjmp\fP()
shall also save the current signal mask of the calling
thread as part of the calling environment.
.LP
.SH RETURN VALUE
.LP
If the return is from a successful direct invocation, \fIsigsetjmp\fP()
shall return 0. If the return is from a call to \fIsiglongjmp\fP(),
\fIsigsetjmp\fP() shall return a non-zero value.
.SH ERRORS
.LP
No errors are defined.
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
The distinction between \fIsetjmp\fP()/ \fIlongjmp\fP() and \fIsigsetjmp\fP()/
\fIsiglongjmp\fP() is only significant for programs which use \fIsigaction\fP(),
\fIsigprocmask\fP(), or \fIsigsuspend\fP().
.LP
Note that since this function is defined in terms of \fIsetjmp\fP(),
if \fIsavemask\fP
is zero, it is unspecified whether the signal mask is saved.
.SH RATIONALE
.LP
The ISO\ C standard specifies various restrictions on the usage of
the \fIsetjmp\fP() macro in order to permit implementors to recognize
the name in the compiler and not
implement an actual function. These same restrictions apply to the
\fIsigsetjmp\fP() macro.
.LP
There are processors that cannot easily support these calls, but this
was not considered a sufficient reason to exclude
them.
.LP
4.2 BSD, 4.3 BSD, and XSI-conformant systems provide functions named
\fI_setjmp\fP()
and \fI_longjmp\fP() that, together with \fIsetjmp\fP() and \fIlongjmp\fP(),
provide the same
functionality as \fIsigsetjmp\fP() and \fIsiglongjmp\fP(). On those
systems, \fIsetjmp\fP() and \fIlongjmp\fP() save and restore signal
masks, while \fI_setjmp\fP() and \fI_longjmp\fP() do not. On System
V Release 3 and in corresponding issues of the SVID, \fIsetjmp\fP()
and \fIlongjmp\fP() are explicitly defined
not to save and restore signal masks. In order to permit existing
practice in both cases, the relation of \fIsetjmp\fP() and \fIlongjmp\fP()
to signal masks is not
specified, and a new set of functions is defined instead.
.LP
The \fIlongjmp\fP() and \fIsiglongjmp\fP()
functions operate as in the previous issue provided the matching \fIsetjmp\fP()
or
\fIsigsetjmp\fP() has been performed in the same thread. Non-local
jumps into contexts saved by other threads would be at best a
questionable practice and were not considered worthy of standardization.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIsiglongjmp\fP() , \fIsignal\fP() , \fIsigprocmask\fP() , \fIsigsuspend\fP()
, the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, \fI<setjmp.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .