LONGJMP

Section: Library functions (3)
Updated: November 25, 1994
Index Return to Main Contents
 

NAME

longjmp - non-local jump to a saved stack context  

SYNOPSIS

#include <setjmp.h>

void longjmp(jmp_buf env, int val);  

DESCRIPTION

longjmp() and setjmp(3) are useful for dealing with errors and interrupts encountered in a low-level subroutine of a program. longjmp() restores the environment saved by the last call of setjmp() with the corresponding env argument. After longjmp() is completed, program execution continues as if the corresponding call of setjmp() had just returned the value val. longjmp() cannot cause 0 to be returned. If longjmp is invoked with a second argument of 0, 1 will be returned instead.  

RETURN VALUE

This function never returns.  

CONFORMING TO

POSIX  

NOTES

POSIX does not specify if the signal context will be restored or not. If you want to save restore signal masks, use siglongjmp(3) longjmp() makes programs hard to understand and maintain. If possible an alternative should be used.  

SEE ALSO

setjmp(3), sigsetjmp(2), siglongjmp(2)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
CONFORMING TO
NOTES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 12:23:49 GMT, March 22, 2025