|
|
1.1 root 1: .\" Copyright (c) 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted
5: .\" provided that: (1) source distributions retain this entire copyright
6: .\" notice and comment, and (2) distributions including binaries display
7: .\" the following acknowledgement: ``This product includes software
8: .\" developed by the University of California, Berkeley and its contributors''
9: .\" in the documentation or other materials provided with the distribution
10: .\" and in all advertising materials mentioning features or use of this
11: .\" software. Neither the name of the University nor the names of its
12: .\" contributors may be used to endorse or promote products derived
13: .\" from this software without specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15: .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16: .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)setjmp.3 6.4 (Berkeley) 5/27/90
19: .\"
20: .TH SETJMP 3 "May 27, 1990"
21: .UC 4
22: .SH NAME
23: sigsetjmp, siglongjmp, setjmp, longjmp, _setjmp, _longjmp longjmperror \-
24: non-local jumps
25: .SH SYNOPSIS
26: .nf
27: .ft B
28: #include <setjmp.h>
29:
30: sigsetjmp(sigjmp_buf env, int savemask);
31:
32: void
33: siglongjmp(sigjmp_buf env, int val);
34:
35: setjmp(jmp_buf env);
36:
37: void
38: longjmp(jmp_buf env, int val);
39:
40: _setjmp(jmp_buf env);
41:
42: void
43: _longjmp(jmp_buf env, int val);
44:
45: void
46: longjmperror();
47: .ft R
48: .fi
49: .SH DESCRIPTION
50: The
51: .IR sigsetjmp ,
52: .IR setjmp ,
53: and
54: .IR _setjmp
55: functions save their calling environment in
56: .IR env .
57: Each of these functions returns 0.
58: .PP
59: The corresponding
60: .I longjmp
61: functions restore the environment saved by their respective versions
62: of the
63: .I setjmp
64: function.
65: They then return so that program execution continues as if the
66: .I setjmp
67: call had returned
68: .IR val ,
69: instead of 0.
70: .PP
71: Pairs of calls may be intermixed, i.e. both
72: .I sigsetjmp
73: and
74: .I siglongjmp
75: and
76: .I setjmp
77: and
78: .I longjmp
79: combinations may be used in the same program, however, individual
80: calls may not, i.e. the
81: .I env
82: argument to
83: .I sigsetjmp
84: may not be passed to
85: .IR longjmp .
86: .PP
87: The
88: .I longjmp
89: routines may not be called after the routine which called the
90: .I setjmp
91: routines returns.
92: .PP
93: All accessible data have values as of the time the
94: .I longjmp
95: routine was called.
96: .PP
97: .I Setjmp/longjmp
98: pairs save and restore the signal mask (see
99: .IR sigmask (2)),
100: while
101: .I _setjmp/_longjmp
102: pairs save and restore only the register set and the stack.
103: .PP
104: .I Sigsetjmp/siglongjmp
105: pairs save and restore the signal mask if the argument
106: .I savemask
107: is non-zero, otherwise only the register set and the stack are saved.
108: .SH ERRORS
109: If the contents of the
110: .I env
111: are corrupted, or correspond to an environment that has already returned,
112: the
113: .I longjmp
114: routine calls the routine
115: .IR longjmperror (3).
116: If
117: .I longjmperror
118: returns the program is aborted (see abort(2)).
119: The default version of
120: .I longjmperror
121: prints the message ``longjmp botch'' to standard error and returns.
122: User programs wishing to exit more gracefully should write their own
123: versions of
124: .IR longjmperror .
125: .SH "SEE ALSO"
126: sigvec(2), sigstack(2), signal(3)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.