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