1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers. 3*7c478bd9Sstevel@tonic-gate * All rights reserved. 4*7c478bd9Sstevel@tonic-gate * 5*7c478bd9Sstevel@tonic-gate * By using this file, you agree to the terms and conditions set 6*7c478bd9Sstevel@tonic-gate * forth in the LICENSE file which can be found at the top level of 7*7c478bd9Sstevel@tonic-gate * the sendmail distribution. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * $Id: setjmp.h,v 1.3 2001/03/08 03:23:08 ca Exp $ 10*7c478bd9Sstevel@tonic-gate */ 11*7c478bd9Sstevel@tonic-gate 12*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 13*7c478bd9Sstevel@tonic-gate 14*7c478bd9Sstevel@tonic-gate #ifndef SM_SETJMP_H 15*7c478bd9Sstevel@tonic-gate # define SM_SETJMP_H 16*7c478bd9Sstevel@tonic-gate 17*7c478bd9Sstevel@tonic-gate # include <sm/config.h> 18*7c478bd9Sstevel@tonic-gate # include <setjmp.h> 19*7c478bd9Sstevel@tonic-gate 20*7c478bd9Sstevel@tonic-gate /* 21*7c478bd9Sstevel@tonic-gate ** sm_setjmp_sig is a setjmp that saves the signal mask. 22*7c478bd9Sstevel@tonic-gate ** sm_setjmp_nosig is a setjmp that does *not* save the signal mask. 23*7c478bd9Sstevel@tonic-gate ** SM_JMPBUF_T is used with both of the above macros. 24*7c478bd9Sstevel@tonic-gate ** 25*7c478bd9Sstevel@tonic-gate ** On most systems, these can be implemented using sigsetjmp. 26*7c478bd9Sstevel@tonic-gate ** Some old BSD systems do not have sigsetjmp, but they do have 27*7c478bd9Sstevel@tonic-gate ** setjmp and _setjmp, which are just as good. 28*7c478bd9Sstevel@tonic-gate */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate # if SM_CONF_SIGSETJMP 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate typedef sigjmp_buf SM_JMPBUF_T; 33*7c478bd9Sstevel@tonic-gate # define sm_setjmp_sig(buf) sigsetjmp(buf, 1) 34*7c478bd9Sstevel@tonic-gate # define sm_setjmp_nosig(buf) sigsetjmp(buf, 0) 35*7c478bd9Sstevel@tonic-gate # define sm_longjmp_sig(buf, val) siglongjmp(buf, val) 36*7c478bd9Sstevel@tonic-gate # define sm_longjmp_nosig(buf, val) siglongjmp(buf, val) 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate # else /* SM_CONF_SIGSETJMP */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate typedef jmp_buf SM_JMPBUF_T; 41*7c478bd9Sstevel@tonic-gate # define sm_setjmp_sig(buf) setjmp(buf) 42*7c478bd9Sstevel@tonic-gate # define sm_longjmp_sig(buf, val) longjmp(buf, val) 43*7c478bd9Sstevel@tonic-gate # define sm_setjmp_nosig(buf) _setjmp(buf) 44*7c478bd9Sstevel@tonic-gate # define sm_longjmp_nosig(buf, val) _longjmp(buf, val) 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate # endif /* SM_CONF_SIGSETJMP */ 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate #endif /* ! SM_SETJMP_H */ 49