Commit | Line | Data |
---|---|---|
9ab9afa9 JB |
1 | /* syssignal.h - System-dependent definitions for signals. |
2 | Copyright (C) 1992 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU Emacs. | |
5 | ||
6 | GNU Emacs is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 1, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU Emacs is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU Emacs; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | #ifdef POSIX_SIGNALS | |
21 | #define SIGMASKTYPE sigset_t | |
22 | ||
23 | #define SIGEMPTYMASK (empty_mask) | |
24 | #define SIGFULLMASK (full_mask) | |
25 | extern sigset_t empty_mask, full_mask, temp_mask; | |
26 | ||
1b1f8f85 JB |
27 | /* POSIX pretty much destroys any possibility of writing sigmask as a |
28 | macro in standard C. */ | |
29 | #ifdef __GNUC__ | |
30 | #define sigmask(SIG) \ | |
31 | ({ \ | |
32 | sigset_t _mask; \ | |
33 | sigemptyset (&_mask); \ | |
34 | sigaddset (&_mask, SIG); \ | |
35 | _mask; \ | |
36 | }) | |
37 | #else | |
38 | #define sigmask(SIG) (sys_sigmask (SIG)) | |
39 | #endif | |
40 | ||
41 | #define sigpause(SIG) sys_sigpause(SIG) | |
42 | #define sigblock(SIG) sys_sigblock(SIG) | |
43 | #define sigunblock(SIG) sys_sigunblock(SIG) | |
44 | #define sigsetmask(SIG) sys_sigsetmask(SIG) | |
9ab9afa9 JB |
45 | #define sighold(SIG) ONLY_USED_IN_BSD_4_1 |
46 | #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1 | |
47 | ||
48 | int (*sys_signal (int signal_number, int (*action)())) (); | |
49 | int sys_sigpause (int signal_number); | |
50 | sigset_t sys_sigblock (sigset_t new_mask); | |
51 | sigset_t sys_sigunblock (sigset_t new_mask); | |
52 | sigset_t sys_sigsetmask (sigset_t new_mask); | |
53 | ||
54 | #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG) | |
55 | ||
1b1f8f85 | 56 | #else /* not POSIX_SIGNALS */ |
9ab9afa9 JB |
57 | |
58 | #define sigunblock(SIG) \ | |
59 | { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); } | |
60 | ||
1b1f8f85 | 61 | #endif /* not POSIX_SIGNALS */ |
9ab9afa9 JB |
62 | |
63 | #ifndef SIGMASKTYPE | |
64 | #define SIGMASKTYPE int | |
65 | #endif | |
66 | ||
67 | #ifndef SIGEMPTYMASK | |
1b1f8f85 JB |
68 | #define SIGEMPTYMASK (0) |
69 | #endif | |
70 | ||
71 | #ifndef SIGFULLMASK | |
72 | #define SIGFULLMASK (0xffffffff) | |
9ab9afa9 JB |
73 | #endif |
74 | ||
75 | #ifndef sigmask | |
76 | #define sigmask(no) (1L << ((no) - 1)) | |
77 | #endif | |
78 | ||
1b1f8f85 JB |
79 | #ifndef sigunblock |
80 | #define sigunblock(SIG) \ | |
81 | { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); } | |
82 | #endif | |
83 | ||
84 | /* It would be very nice if we could somehow clean up all this trash. */ | |
85 | ||
86 | #ifndef BSD4_1 | |
87 | #define sigfree() sigsetmask (SIGEMPTYMASK) | |
88 | #define sigholdx(sig) sigsetmask (sigmask (sig)) | |
89 | #define sigblockx(sig) sigblock (sigmask (sig)) | |
90 | #define sigunblockx(sig) sigblock (SIGEMPTYMASK) | |
91 | #define sigpausex(sig) sigpause (0) | |
92 | #endif /* not BSD4_1 */ | |
93 | ||
9ab9afa9 JB |
94 | #ifdef BSD4_1 |
95 | #define SIGIO SIGTINT | |
96 | /* sigfree and sigholdx are in sysdep.c */ | |
1b1f8f85 JB |
97 | #define sigblockx(sig) sighold (sig) |
98 | #define sigunblockx(sig) sigrelse (sig) | |
99 | #define sigpausex(sig) sigpause (sig) | |
100 | #endif /* BSD4_1 */ | |
9ab9afa9 JB |
101 | |
102 | /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. | |
103 | Must do that using the killpg call. */ | |
104 | #ifdef BSD | |
105 | #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo))) | |
106 | #else | |
107 | #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo))) | |
108 | #endif | |
109 | ||
110 | /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals | |
111 | testing SIGCHLD. */ | |
9ab9afa9 JB |
112 | #ifndef VMS |
113 | #ifdef SIGCLD | |
114 | #ifndef SIGCHLD | |
115 | #define SIGCHLD SIGCLD | |
1b1f8f85 JB |
116 | #endif /* not SIGCHLD */ |
117 | #endif /* SIGCLD */ | |
118 | #endif /* not VMS */ |