1 /* @(#)jmpdefs.h	1.10 18/06/04 Copyright 1998-2018 J. Schilling */
2 /*
3  *	Definitions that help to handle a jmp_buf
4  *
5  *	Copyright (c) 1998-2018 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef	_SCHILY_JMPDEFS_H
22 #define	_SCHILY_JMPDEFS_H
23 
24 #ifndef _SCHILY_MCONFIG_H
25 #include <schily/mconfig.h>
26 #endif
27 
28 #ifndef	_SCHILY_SETJMP_H
29 #include <schily/setjmp.h>
30 #endif
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct {
37 	jmp_buf	jb;
38 } jmps_t;
39 
40 #if defined(HAVE_SIGSETJMP) && defined(HAVE_SIGLONGJMP)
41 #define	HAVE_SIGJMPS_T
42 
43 typedef struct {
44 	sigjmp_buf jb;
45 } sigjmps_t;
46 
47 #else
48 
49 /*
50  * Make sure to use the best available
51  */
52 #define	sigjmp_buf		jmp_buf
53 #define	sigjmps_t		jmps_t
54 #define	sigsetjmp(je, sm)	setjmp(je)
55 #define	siglongjmp		longjmp
56 
57 #endif
58 
59 #ifdef	__cplusplus
60 }
61 #endif
62 
63 #endif	/* _SCHILY_JMPDEFS_H */
64