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 #ifndef SM_SETJMP_H
13*7c478bd9Sstevel@tonic-gate # define SM_SETJMP_H
14*7c478bd9Sstevel@tonic-gate 
15*7c478bd9Sstevel@tonic-gate # include <sm/config.h>
16*7c478bd9Sstevel@tonic-gate # include <setjmp.h>
17*7c478bd9Sstevel@tonic-gate 
18*7c478bd9Sstevel@tonic-gate /*
19*7c478bd9Sstevel@tonic-gate **  sm_setjmp_sig is a setjmp that saves the signal mask.
20*7c478bd9Sstevel@tonic-gate **  sm_setjmp_nosig is a setjmp that does *not* save the signal mask.
21*7c478bd9Sstevel@tonic-gate **  SM_JMPBUF_T is used with both of the above macros.
22*7c478bd9Sstevel@tonic-gate **
23*7c478bd9Sstevel@tonic-gate **  On most systems, these can be implemented using sigsetjmp.
24*7c478bd9Sstevel@tonic-gate **  Some old BSD systems do not have sigsetjmp, but they do have
25*7c478bd9Sstevel@tonic-gate **  setjmp and _setjmp, which are just as good.
26*7c478bd9Sstevel@tonic-gate */
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate # if SM_CONF_SIGSETJMP
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate typedef sigjmp_buf SM_JMPBUF_T;
31*7c478bd9Sstevel@tonic-gate #  define sm_setjmp_sig(buf)		sigsetjmp(buf, 1)
32*7c478bd9Sstevel@tonic-gate #  define sm_setjmp_nosig(buf)		sigsetjmp(buf, 0)
33*7c478bd9Sstevel@tonic-gate #  define sm_longjmp_sig(buf, val)	siglongjmp(buf, val)
34*7c478bd9Sstevel@tonic-gate #  define sm_longjmp_nosig(buf, val)	siglongjmp(buf, val)
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate # else /* SM_CONF_SIGSETJMP */
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate typedef jmp_buf SM_JMPBUF_T;
39*7c478bd9Sstevel@tonic-gate #  define sm_setjmp_sig(buf)		setjmp(buf)
40*7c478bd9Sstevel@tonic-gate #  define sm_longjmp_sig(buf, val)	longjmp(buf, val)
41*7c478bd9Sstevel@tonic-gate #   define sm_setjmp_nosig(buf)		_setjmp(buf)
42*7c478bd9Sstevel@tonic-gate #   define sm_longjmp_nosig(buf, val)	_longjmp(buf, val)
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate # endif /* SM_CONF_SIGSETJMP */
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #endif /* ! SM_SETJMP_H */
47