2004-11-03 13:51:07 +00:00
|
|
|
.\" Written by Michael Haardt, Fri Nov 25 14:51:42 MET 1994
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
|
|
|
.\" Added siglongjmp, Sun Mar 2 22:03:05 EST 1997, jrv@vanzandt.mv.com
|
|
|
|
.\" Modifications, Sun Feb 26 14:39:45 1995, faith@cs.unc.edu
|
|
|
|
.\" "
|
2009-01-13 03:15:45 +00:00
|
|
|
.TH LONGJMP 3 2009-01-13 "" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
longjmp, siglongjmp \- nonlocal jump to a saved stack context
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
2008-01-11 13:59:47 +00:00
|
|
|
.B #include <setjmp.h>
|
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "void longjmp(jmp_buf " env ", int " val );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "void siglongjmp(sigjmp_buf " env ", int " val );
|
|
|
|
.fi
|
2007-07-08 12:11:40 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR siglongjmp ():
|
2008-08-29 15:50:13 +00:00
|
|
|
_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_C_SOURCE
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR longjmp ()
|
|
|
|
and
|
|
|
|
.BR setjmp (3)
|
|
|
|
are useful for dealing with errors
|
2004-11-03 13:51:07 +00:00
|
|
|
and interrupts encountered in a low-level subroutine of a program.
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR longjmp ()
|
|
|
|
restores the environment saved by the last call of
|
|
|
|
.BR setjmp (3)
|
|
|
|
with the corresponding \fIenv\fP argument.
|
2007-04-12 22:42:49 +00:00
|
|
|
After
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR longjmp ()
|
|
|
|
is completed, program execution continues as if the
|
|
|
|
corresponding call of
|
|
|
|
.BR setjmp (3)
|
|
|
|
had just returned the value
|
2007-05-12 00:30:29 +00:00
|
|
|
\fIval\fP.
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR longjmp ()
|
|
|
|
cannot cause 0 to be returned.
|
|
|
|
If
|
|
|
|
.BR longjmp ()
|
2004-11-03 13:51:07 +00:00
|
|
|
is invoked with a second argument of 0, 1 will be returned instead.
|
|
|
|
.P
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR siglongjmp ()
|
|
|
|
is similar to
|
|
|
|
.BR longjmp ()
|
|
|
|
except for the type of
|
2007-04-12 22:42:49 +00:00
|
|
|
its \fIenv\fP argument.
|
2009-01-13 03:15:45 +00:00
|
|
|
If, and only if, the
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR sigsetjmp (3)
|
|
|
|
call that set this
|
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:40:55 +00:00
|
|
|
\fIenv\fP used a nonzero \fIsavesigs\fP flag,
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR siglongjmp ()
|
2009-01-13 03:40:35 +00:00
|
|
|
also restores the signal mask that was saved by
|
|
|
|
.BR sigsetjmp (3).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
|
|
|
These functions never return.
|
|
|
|
.SH "CONFORMING TO"
|
2007-05-12 09:06:04 +00:00
|
|
|
C89, C99, and POSIX.1-2001 specify
|
|
|
|
.BR longjmp ().
|
|
|
|
POSIX.1-2001 specifies
|
|
|
|
.BR siglongjmp ().
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
2007-05-12 09:06:04 +00:00
|
|
|
POSIX does not specify whether
|
|
|
|
.BR longjmp ()
|
2009-01-13 03:40:35 +00:00
|
|
|
will restore the signal context (see
|
|
|
|
.BR setjmp (3)
|
2009-04-21 02:44:29 +00:00
|
|
|
for some more details).
|
2009-01-13 03:40:35 +00:00
|
|
|
If you want to portably save and restore signal masks, use
|
|
|
|
.BR sigsetjmp ()
|
|
|
|
and
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR siglongjmp ().
|
2004-11-03 13:51:07 +00:00
|
|
|
.P
|
2007-09-06 18:26:17 +00:00
|
|
|
The values of automatic variables are unspecified after a call to
|
|
|
|
.BR longjmp ()
|
|
|
|
if they meet all the following criteria:
|
|
|
|
.IP \(bu 3
|
|
|
|
they are local to the function that made the corresponding
|
2007-09-19 05:25:58 +00:00
|
|
|
.BR setjmp (3)
|
2007-09-06 18:26:17 +00:00
|
|
|
call;
|
|
|
|
.IP \(bu
|
|
|
|
their values are changed between the calls to
|
2007-09-19 05:25:58 +00:00
|
|
|
.BR setjmp (3)
|
2007-09-06 18:26:17 +00:00
|
|
|
and
|
|
|
|
.BR longjmp ();
|
|
|
|
and
|
|
|
|
.IP \(bu
|
|
|
|
they are not declared as
|
|
|
|
.IR volatile .
|
|
|
|
.P
|
|
|
|
Analogous remarks apply for
|
|
|
|
.BR siglongjmp ().
|
|
|
|
.P
|
2007-05-12 09:06:04 +00:00
|
|
|
.BR longjmp ()
|
|
|
|
and
|
|
|
|
.BR siglongjmp ()
|
|
|
|
make programs hard to
|
2007-04-12 22:42:49 +00:00
|
|
|
understand and maintain.
|
|
|
|
If possible an alternative should be used.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR setjmp (3),
|
|
|
|
.BR sigsetjmp (3)
|