setjmp.3: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-08-14 09:11:00 +02:00
parent 0c545d6712
commit 7736b88651
1 changed files with 19 additions and 19 deletions

View File

@ -25,21 +25,21 @@
.SH NAME
setjmp, sigsetjmp, longjmp, siglongjmp \- performing a nonlocal goto
.SH SYNOPSIS
.B #include <setjmp.h>
.sp
.nf
.B #include <setjmp.h>
.PP
.BI "int setjmp(jmp_buf " env );
.BI "int sigsetjmp(sigjmp_buf " env ", int " savesigs );
.PP
.BI "void longjmp(jmp_buf " env ", int " val );
.BI "void siglongjmp(sigjmp_buf " env ", int " val );
.fi
.sp
.PP
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.sp
.PP
.BR setjmp ():
see NOTES.
.br
@ -55,7 +55,7 @@ function dynamically establishes the target to which control
will later be transferred, and
.BR longjmp ()
performs the transfer of execution.
.PP
The
.BR setjmp ()
function saves various information about the calling environment
@ -68,7 +68,7 @@ for later use by
In this case,
.BR setjmp ()
returns 0.
.PP
The
.BR longjmp ()
function uses the information saved in
@ -83,7 +83,7 @@ the values of some other registers and the process signal mask
may be restored to their state at the time of the
.BR setjmp ()
call.
.PP
Following a successful
.BR longjmp (),
execution continues as if
@ -96,14 +96,14 @@ call because the "fake" return returns the value provided in
If the programmer mistakenly passes the value 0 in
.IR val ,
the "fake" return will instead return 1.
.PP
.SS sigsetjmp() and siglongjmp()
.BR sigsetjmp ()
and
.BR siglongjmp ()
also perform nonlocal gotos, but provide predictable handling of
the process signal mask.
.PP
If, and only if, the
.I savesigs
argument provided to
@ -126,7 +126,7 @@ or
the nonzero value specified in
.I val
is returned.
.PP
The
.BR longjmp ()
or
@ -149,12 +149,12 @@ T{
.BR siglongjmp ()
T} Thread safety MT-Safe
.TE
.PP
.SH CONFORMING TO
.BR setjmp (),
.BR longjmp ():
POSIX.1-2001, POSIX.1-2008, C89, C99.
.PP
.BR sigsetjmp (),
.BR siglongjmp ():
POSIX.1-2001, POSIX.1-2008.
@ -198,7 +198,7 @@ with calls to
with a nonzero
.I savesigs
argument.
.PP
.BR setjmp ()
and
.BR longjmp ()
@ -213,7 +213,7 @@ if you want to portably save and restore signal masks, use
and
.BR siglongjmp ().
See also the discussion of program readability below.
.PP
The compiler may optimize variables into registers, and
.BR longjmp ()
may restore the values of other registers in addition to the
@ -259,13 +259,13 @@ call.
call should employ a unique
.IR jmp_buf
variable.)
.PP
Adding further difficulty, the
.BR setjmp ()
and
.BR longjmp ()
calls may not even be in the same source code module.
.PP
In summary, nonlocal gotos can make programs harder to understand
and maintain, and an alternative should be used if possible.
.\"
@ -276,7 +276,7 @@ returns before
.BR longjmp ()
is called, the behavior is undefined.
Some kind of subtle or unsubtle chaos is sure to result.
.PP
If, in a multithreaded program, a
.BR longjmp ()
call employs an
@ -294,7 +294,7 @@ in a different thread, the behavior is undefined.
.\" (i.e., from a handler that was invoked in response to a signal that was
.\" generated while another signal was already in the process of being
.\" handled), the behavior is undefined.
.PP
POSIX.1-2008 Technical Corrigendum 2 adds
.\" http://austingroupbugs.net/view.php?id=516#c1195
.BR longjmp ()