summaryrefslogtreecommitdiff
path: root/jbwrap.h
blob: 4bf0ffe669e7aea6879a1794e073637bef8394a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <setjmp.h>

/* If we have POSIX sigjmp_buf and friends, use them.  If we don't, just
use a jmp_buf.  This probably fails on a traditional SysV machine, where
jmp_bufs don't preserve signal masks.  I'm not worrying about this till
someone reports it as a bug :-). */

#if HAVE_SIGSETJMP
#else
#define sigjmp_buf jmp_buf
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp longjmp
#endif /* HAVE_SIGSETJMP */


/* Certain braindamaged environments don't define jmp_buf as an array,
so wrap it in a structure.  Potentially, we could use configure to do
this only where it needs to be done, but the effort is probably not
worth it. */

struct Jbwrap {
	sigjmp_buf j;
};


/* The slowbuf jump buffer is used to prevent "slow" system calls being
restarted on systems like BSD where they are restarted after a signal. */

#if HAVE_RESTARTABLE_SYSCALLS || READLINE
extern Jbwrap slowbuf;
#endif