|
|
1.1 ! root 1: .\" Copyright (c) 1980 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)setjmp.3 6.2 (Berkeley) 1/9/86 ! 6: .\" ! 7: .TH SETJMP 3 "January 9, 1986" ! 8: .UC 4 ! 9: .SH NAME ! 10: setjmp, longjmp \- non-local goto ! 11: .SH SYNOPSIS ! 12: .nf ! 13: .B #include <setjmp.h> ! 14: .PP ! 15: .B setjmp(env) ! 16: .B jmp_buf env; ! 17: .PP ! 18: .B longjmp(env, val) ! 19: .B jmp_buf env; ! 20: .PP ! 21: .B _setjmp(env) ! 22: .B jmp_buf env; ! 23: .PP ! 24: .B _longjmp(env, val) ! 25: .B jmp_buf env; ! 26: .fi ! 27: .SH DESCRIPTION ! 28: These routines are useful for dealing with errors ! 29: and interrupts encountered in ! 30: a low-level subroutine of a program. ! 31: .PP ! 32: .I Setjmp ! 33: saves its stack environment in ! 34: .I env ! 35: for later use by ! 36: .I longjmp. ! 37: It returns value 0. ! 38: .PP ! 39: .I Longjmp ! 40: restores the environment saved by the last call of ! 41: .IR setjmp . ! 42: It then returns in such a way that execution ! 43: continues as if the call of ! 44: .I setjmp ! 45: had just returned the value ! 46: .I val ! 47: to the function that invoked ! 48: .I setjmp, ! 49: which must not itself have returned in the interim. ! 50: All accessible data have values as of the time ! 51: .I longjmp ! 52: was called. ! 53: .PP ! 54: .I Setjmp ! 55: and ! 56: .I longjmp ! 57: save and restore the signal mask ! 58: .IR sigmask (2), ! 59: while ! 60: .I _setjmp ! 61: and ! 62: .I _longjmp ! 63: manipulate only the C stack and registers. ! 64: .SH ERRORS ! 65: .PP ! 66: If the contents of the ! 67: .B jmp_buf ! 68: are corrupted, or correspond to an environment that has already returned, ! 69: .I longjmp ! 70: calls the routine ! 71: .IR longjmperror . ! 72: If ! 73: .I longjmperror ! 74: returns the program is aborted. ! 75: The default version of ! 76: .I longjmperror ! 77: prints the message ``longjmp botch'' to standard error and returns. ! 78: User programs wishing to exit more gracefully can write their own ! 79: versions of ! 80: .IR longjmperror . ! 81: .SH "SEE ALSO" ! 82: sigvec(2), sigstack(2), signal(3)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.