mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-22 14:30:29 +00:00
187 lines
5.0 KiB
Groff
187 lines
5.0 KiB
Groff
.\" Copyright (c) 1990, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
.\" the American National Standards Committee X3, on Information
|
|
.\" Processing Systems.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)setjmp.3 8.1 (Berkeley) 6/4/93
|
|
.\"
|
|
.TH SETJMP 3 "28 January 1997" GNO "Library Routines"
|
|
.SH NAME
|
|
.BR sigsetjmp ,
|
|
.BR siglongjmp ,
|
|
.BR setjmp ,
|
|
.BR longjmp ,
|
|
.BR _setjmp ,
|
|
.BR _longjmp ,
|
|
.BR longjmperror
|
|
\- non-local jumps
|
|
.SH SYNOPSIS
|
|
#include <setjmp.h>
|
|
.sp 1
|
|
int
|
|
\fBsigsetjmp\fR (sigjmp_buf \fIenv\fR, int \fIsavemask\fR);
|
|
.br
|
|
void
|
|
\fBsiglongjmp\fR (sigjmp_buf \fIenv\fR, int \fIval\fR);
|
|
.br
|
|
int
|
|
\fBsetjmp\fR (jmp_buf \fIenv\fR);
|
|
.br
|
|
void
|
|
\fBlongjmp\fR (jmp_buf \fIenv\fR, int \fIval\fR);
|
|
.br
|
|
int
|
|
\fB_setjmp\fR (jmp_buf \fIenv\fR);
|
|
.br
|
|
void
|
|
\fB_longjmp\fR (jmp_buf \fIenv\fR, int \fIval\fR);
|
|
.br
|
|
void
|
|
\fBlongjmperror\fR (void);
|
|
.SH DESCRIPTION
|
|
The
|
|
.BR sigsetjmp ,
|
|
.BR setjmp ,
|
|
and
|
|
.BR _setjmp
|
|
functions save their calling environment in
|
|
.RI ( env )
|
|
Each of these functions returns 0.
|
|
.LP
|
|
The corresponding
|
|
.BR longjmp
|
|
functions restore the environment saved by their most recent respective
|
|
invocations
|
|
of the
|
|
.BR setjmp
|
|
function.
|
|
They then return so that program execution continues as if the corresponding
|
|
invocation of the
|
|
.BR setjmp
|
|
call had just returned the value specified by
|
|
.IR val ,
|
|
instead of 0.
|
|
.LP
|
|
Pairs of calls may be intermixed, i.e. both
|
|
.BR sigsetjmp
|
|
and
|
|
.BR siglongjmp
|
|
and
|
|
.BR setjmp
|
|
and
|
|
.BR longjmp
|
|
combinations may be used in the same program, however, individual
|
|
calls may not, e.g. the
|
|
.I env
|
|
argument to
|
|
.BR setjmp
|
|
may not be passed to
|
|
.BR siglongjmp .
|
|
.LP
|
|
The
|
|
.BR longjmp
|
|
routines may not be called after the routine which called the
|
|
.BR setjmp
|
|
routines returns.
|
|
.LP
|
|
All accessible objects have values as of the time
|
|
.BR longjmp
|
|
routine was called, except that the values of objects of automatic storage
|
|
invocation duration that do not have the
|
|
.IR volatile
|
|
type and have been changed between the
|
|
.BR setjmp
|
|
invocation and
|
|
.BR longjmp
|
|
call are indeterminate.
|
|
.LP
|
|
The
|
|
.BR setjmp / longjmp
|
|
pairs save and restore the signal mask while
|
|
.BR _setjmp / _longjmp
|
|
pairs save and restore only the register set and the stack.
|
|
(See
|
|
.BR sigprocmask (2).)
|
|
.LP
|
|
The
|
|
.BR sigsetjmp / siglongjmp
|
|
function
|
|
pairs save and restore the signal mask if the argument
|
|
.I savemask
|
|
is non-zero, otherwise only the register set and the stack are saved.
|
|
.SH ERRORS
|
|
If the contents of the
|
|
.I env
|
|
are corrupted, or correspond to an environment that has already returned,
|
|
the
|
|
.BR longjmp
|
|
routine calls the routine
|
|
.BR longjmperror (3).
|
|
If
|
|
.BR longjmperror
|
|
returns the program is aborted (see
|
|
.BR abort (3)).
|
|
The default version of
|
|
.BR longjmperror
|
|
prints the message
|
|
.I "longjmp botch"
|
|
to standard error and returns.
|
|
User programs wishing to exit more gracefully should write their own
|
|
versions of
|
|
.BR longjmperror .
|
|
.SH NOTES
|
|
The implementation of these routines differs from the Orca/C version,
|
|
as does type of
|
|
.BR jump_buf
|
|
defined in <setjmp.h>. The two are not compatible and cannot be mixed.
|
|
.LP
|
|
.BR sigsetjmp
|
|
and
|
|
.BR siglongjmp
|
|
are not currently implemented under GNO.
|
|
.SH SEE ALSO
|
|
.BR sigaction (2),
|
|
.BR sigaltstack (2),
|
|
.BR signal (3)
|
|
.SH STANDARDS
|
|
The
|
|
.BR setjmp
|
|
and
|
|
.BR longjmp
|
|
functions conform to ANSI/C.
|
|
The
|
|
.BR sigsetjmp
|
|
and
|
|
.BR siglongjmp
|
|
functions conform to POSIX 1003.1-88.
|