2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #ifndef AFS_PTHREAD_NOSIGS_H
11 #define AFS_PTHREAD_NOSIGS_H
13 /* We want servers to only handle signals in the main thread. To do this
14 * we must block signals in the child threads. To do this, wrap pthread_create
19 /* Compilers complain about empty declaration unless at end of decl's */
20 #define AFS_SIGSET_DECL int i_junk
21 #define AFS_SIGSET_CLEAR()
22 #define AFS_SIGSET_RESTORE()
24 #define AFS_SIGSET_DECL sigset_t i_tset, i_oset
26 #define AFS_SET_SIGMASK sigthreadmask
28 #define AFS_SET_SIGMASK pthread_sigmask
31 #define _SETSEGV sigdelset(&i_tset, SIGSEGV);
36 #define _SETBUS sigdelset(&i_tset, SIGBUS);
41 #define _SETILL sigdelset(&i_tset, SIGILL);
46 #define _SETTRAP sigdelset(&i_tset, SIGTRAP);
51 #define _SETABRT sigdelset(&i_tset, SIGABRT);
56 #define _SETFPE sigdelset(&i_tset, SIGFPE);
60 #define AFS_SIGSET_CLEAR() \
62 sigfillset(&i_tset); \
69 assert(AFS_SET_SIGMASK(SIG_BLOCK, &i_tset, &i_oset) == 0); \
72 #define AFS_SIGSET_RESTORE() \
74 assert(AFS_SET_SIGMASK(SIG_SETMASK, &i_oset, NULL) == 0); \
76 #endif /* AFS_NT40_ENV */
78 #endif /* AFS_PTHREAD_NOSIGS_H */