Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

libunwind-setjmp(3) [debian man page]

LIBUNWIND-SETJMP(3)					       Programming Library					       LIBUNWIND-SETJMP(3)

NAME
libunwind-setjmp -- libunwind-based non-local gotos SYNOPSIS
#include <setjmp.h> int setjmp(jmp_buf env); void longjmp(jmp_buf env, int val); int _setjmp(jmp_buf env); void _longjmp(jmp_buf env, int val); int setjmp(sigjmp_buf env, int savemask); void siglongjmp(sigjmp_buf env, int val); DESCRIPTION
The unwind-setjmp library offers a libunwind-based implementation of non-local gotos. This implementation is intended to be a drop-in replacement for the normal, system-provided routines of the same name. The main advantage of using the unwind-setjmp library is that set- ting up a non-local goto via one of the setjmp() routines is very fast. Typically, just 2 or 3 words need to be saved in the jump-buffer (plus one call to sigprocmask(2), in the case of sigsetjmp). On the other hand, executing a non-local goto by calling one of the longjmp() routines tends to be much slower than with the system-provided routines. In fact, the time spent on a longjmp() will be proportional to the number of call frames that exist between the points where setjmp() and longjmp() were called. For this reason, the unwind-setjmp library is beneficial primarily in applications that frequently call setjmp() but only rarely call longjmp(). CAVEATS
* The correct operation of this library depends on the presence of correct unwind information. On newer platforms, this is rarely an issue. On older platforms, care needs to be taken to ensure that each of the functions whose stack frames may have to be unwound during a longjmp() have correct unwind information (on those platforms, there is usually a compiler-switch, such as -funwind-tables, to request the generation of unwind information). * The contents of jmp_buf and sigjmp_buf as setup and used by these routines is completely different from the ones used by the sys- tem-provided routines. Thus, a jump-buffer created by the libunwind-based setjmp()/_setjmp may only be used in a call to the libun- wind-based longjmp()/_longjmp(). The analogous applies for sigjmp_buf with sigsetjmp() and siglongjmp(). FILES
-lunwind-setjmp The library an application should be linked against to ensure it uses the libunwind-based non-local goto routines. SEE ALSO
libunwind(3), setjmp(3), longjmp(3), _setjmp(3), _longjmp(3), sigsetjmp(3), siglongjmp(3) AUTHOR
David Mosberger-Tang Email: dmosberger@gmail.com WWW: http://www.nongnu.org/libunwind/. Programming Library 16 August 2007 LIBUNWIND-SETJMP(3)

Check Out this Related Man Page

SETJMP(3)						   BSD Library Functions Manual 						 SETJMP(3)

NAME
_longjmp, _setjmp, longjmp, longjmperror, setjmp, siglongjmp, sigsetjmp -- non-local jumps LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <setjmp.h> void _longjmp(jmp_buf env, int val); int _setjmp(jmp_buf env); void longjmp(jmp_buf env, int val); void longjmperror(void); int setjmp(jmp_buf env); void siglongjmp(sigjmp_buf env, int val); int sigsetjmp(sigjmp_buf env, int savemask); DESCRIPTION
The sigsetjmp(), setjmp(), and _setjmp() functions save their calling environment in env. Each of these functions returns 0. The corresponding longjmp() functions restore the environment saved by their most recent respective invocations of the setjmp() function. They then return, so that program execution continues as if the corresponding invocation of the setjmp() call had just returned the value specified by val, instead of 0. Pairs of calls may be intermixed (i.e., both sigsetjmp() and siglongjmp() and setjmp() and longjmp() combinations may be used in the same program); however, individual calls may not (e.g. the env argument to setjmp() may not be passed to siglongjmp()). The longjmp() routines may not be called after the routine which called the setjmp() routines returns. All accessible objects have values as of the time longjmp() routine was called, except that the values of objects of automatic storage invo- cation duration that do not have the volatile type and have been changed between the setjmp() invocation and longjmp() call are indetermi- nate. The setjmp()/longjmp() pairs save and restore the signal mask while _setjmp()/_longjmp() pairs save and restore only the register set and the stack. (See sigprocmask(2).) The sigsetjmp()/siglongjmp() function pairs save and restore the signal mask if the argument savemask is non-zero; otherwise, only the regis- ter set and the stack are saved. ERRORS
If the contents of the env are corrupted, or correspond to an environment that has already returned, the longjmp() routine calls the routine longjmperror(3). If longjmperror() returns, the program is aborted (see abort(3)). The default version of longjmperror() prints the message ``longjmp botch'' to standard error and returns. User programs wishing to exit more gracefully should write their own versions of longjmperror(). SEE ALSO
sigaction(2), sigaltstack(2), signal(3) STANDARDS
The setjmp() and longjmp() functions conform to ISO/IEC 9899:1990 (``ISO C90''). The sigsetjmp() and siglongjmp() functions conform to IEEE Std 1003.1-1988 (``POSIX.1''). BSD
June 4, 1993 BSD
Man Page