/[debburn]/nonameyet/trunk/include/sigdefs.h
ViewVC logotype

Contents of /nonameyet/trunk/include/sigdefs.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download)
Fri Aug 18 17:34:13 2006 UTC (6 years, 9 months ago) by blade
File MIME type: text/plain
File size: 1845 byte(s)
Imported the resorted version a08
1 /* @(#)sigdefs.h 1.5 02/01/19 Copyright 1997 J. Schilling */
2 /*
3 * Signal abstraction for BSD/SVR4 signals
4 *
5 * Copyright (c) 1997 J. Schilling
6 */
7 /*
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; see the file COPYING. If not, write to the Free Software
19 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 #ifndef _SIGDEFS_H
23 #define _SIGDEFS_H
24
25 #ifndef _MCONFIG_H
26 #include <mconfig.h>
27 #endif
28
29 #ifdef HAVE_SIGSET
30 /*
31 * Try to by default use the function that sets up signal handlers in a way
32 * that does not reset the handler after it has been called.
33 */
34 #define signal sigset
35 #endif
36
37 #ifdef HAVE_SIGPROCMASK
38 #define block_sigs(a) { \
39 sigset_t __new; \
40 \
41 sigfillset(&__new); \
42 sigprocmask(SIG_BLOCK, &__new, &a);\
43 }
44 #define unblock_sig(s) { \
45 sigset_t __new; \
46 \
47 sigemptyset(&__new); \
48 sigaddset(&__new, (s)); \
49 sigprocmask(SIG_UNBLOCK, &__new, NULL);\
50 }
51 #define restore_sigs(a) sigprocmask(SIG_SETMASK, &a, 0);
52
53 #else /* !HAVE_SIGPROCMASK */
54
55 #define sigset_t int
56 #define block_sigs(a) a = sigblock(0xFFFFFFFF)
57 #define restore_sigs(a) sigsetmask(a);
58 #define unblock_sig(s) { \
59 int __old, __new; \
60 \
61 block_sigs(__old); \
62 __new = sigmask(s); \
63 __new = __old & ~__new; \
64 sigsetmask(__new); \
65 }
66
67 #endif /* HAVE_SIGPROCMASK */
68
69 #endif /* _SIGDEFS_H */

  ViewVC Help
Powered by ViewVC 1.1.5