groff 1.23.0 added .MR to its -man macro package. The NEWS file states
that the inclusion of the macro "was prompted by its introduction to
Plan 9 from User Space's troff in August 2020." From d32deab it seems
that the name for Plan 9 from User Space's implementation was suggested
by groff maintainer G. Brandon Robinson.
Not sure if the intention was to make these definitions compatible, but
it would be nice if they were.
Currently, Plan 9 from User Space's .MR expects its second argument to
be parenthesized. groff's .MR does not. This results in extra
parentheses appearing in manual references when viewing Plan 9 from User
Space's manual pages on a system using groff.
89 lines
1.6 KiB
Groff
89 lines
1.6 KiB
Groff
.TH SETJMP 3
|
|
.SH NAME
|
|
setjmp, longjmp, notejmp \- non-local goto
|
|
.SH SYNOPSIS
|
|
.B #include <u.h>
|
|
.br
|
|
.B #include <libc.h>
|
|
.PP
|
|
.ta \w'\fLvoid 'u
|
|
.B
|
|
int setjmp(jmp_buf env)
|
|
.PP
|
|
.B
|
|
void longjmp(jmp_buf env, int val)
|
|
.PP
|
|
.B
|
|
void notejmp(void *uregs, jmp_buf env, int val)
|
|
.SH DESCRIPTION
|
|
These routines are useful for dealing with errors
|
|
and interrupts encountered in
|
|
a low-level subroutine of a program.
|
|
.PP
|
|
.I Setjmp
|
|
saves its stack environment in
|
|
.I env
|
|
for later use by
|
|
.IR longjmp .
|
|
It returns value 0.
|
|
.PP
|
|
.I Longjmp
|
|
restores the environment saved by the last call of
|
|
.IR setjmp .
|
|
It then causes execution to
|
|
continue as if the call of
|
|
.I setjmp
|
|
had just returned with value
|
|
.IR val .
|
|
The invoker of
|
|
.I setjmp
|
|
must not itself have returned in the interim.
|
|
All accessible data have values as of the time
|
|
.I longjmp
|
|
was called.
|
|
.PP
|
|
.I Notejmp
|
|
is the same as
|
|
.I longjmp
|
|
except that it is to be called from within a note handler (see
|
|
.MR notify 3 ).
|
|
The
|
|
.I uregs
|
|
argument should be the first argument passed to the note handler.
|
|
.PP
|
|
.I Setjmp
|
|
and
|
|
.I longjmp
|
|
can also be used to switch stacks.
|
|
.SH SOURCE
|
|
.B \*9/src/lib9/jmp.c
|
|
.SH SEE ALSO
|
|
.MR notify 3
|
|
.SH BUGS
|
|
.PP
|
|
.I Notejmp
|
|
cannot recover from an address trap or bus error (page fault) on the 680x0
|
|
architectures.
|
|
.PP
|
|
To avoid name conflicts with the underlying system,
|
|
.IR setjmp ,
|
|
.IR longjmp ,
|
|
.IR notejmp ,
|
|
and
|
|
.I jmp_buf
|
|
are preprocessor macros defined as
|
|
.IR p9setjmp ,
|
|
.IR p9longjmp ,
|
|
.IR p9notejmp ,
|
|
and
|
|
.IR p9jmp_buf ;
|
|
see
|
|
.MR intro 3 .
|
|
.PP
|
|
.I P9setjmp
|
|
is implemented as a preprocessor macro that calls
|
|
.I sigsetjmp
|
|
(see
|
|
Unix's
|
|
.IR setjmp (3)).
|