Mercurial > emacs
annotate src/syssignal.h @ 2915:2c9dde3bd3a0
Initial revision
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Thu, 20 May 1993 02:04:15 +0000 |
parents | 409c1022bad5 |
children | e94a593c3952 |
rev | line source |
---|---|
563 | 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 | |
2913
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
21 |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
22 #include <signal.h> |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
23 |
563 | 24 #define SIGMASKTYPE sigset_t |
25 | |
26 #define SIGEMPTYMASK (empty_mask) | |
27 #define SIGFULLMASK (full_mask) | |
28 extern sigset_t empty_mask, full_mask, temp_mask; | |
29 | |
637 | 30 /* POSIX pretty much destroys any possibility of writing sigmask as a |
31 macro in standard C. */ | |
2913
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
32 #ifndef sigmask |
637 | 33 #ifdef __GNUC__ |
34 #define sigmask(SIG) \ | |
35 ({ \ | |
36 sigset_t _mask; \ | |
37 sigemptyset (&_mask); \ | |
38 sigaddset (&_mask, SIG); \ | |
39 _mask; \ | |
40 }) | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
41 #else /* ! defined (__GNUC__) */ |
637 | 42 #define sigmask(SIG) (sys_sigmask (SIG)) |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
43 #endif /* ! defined (__GNUC__) */ |
2913
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
44 #endif |
624 | 45 |
637 | 46 #define sigpause(SIG) sys_sigpause(SIG) |
47 #define sigblock(SIG) sys_sigblock(SIG) | |
48 #define sigunblock(SIG) sys_sigunblock(SIG) | |
49 #define sigsetmask(SIG) sys_sigsetmask(SIG) | |
563 | 50 #define sighold(SIG) ONLY_USED_IN_BSD_4_1 |
51 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1 | |
52 | |
2913
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
53 /* Whether this is what all systems want or not, this is what |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
54 appears to be assumed in the source, for example data.c:arith_error() */ |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
55 typedef RETSIGTYPE (*signal_handler_t) (int); |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
56 |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
57 signal_handler_t sys_signal (int signal_number, int (*action)()); |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
58 int sys_sigpause (sigset_t new_mask); |
409c1022bad5
Some changes from Michael K. Johnson for Linux.
Jim Blandy <jimb@redhat.com>
parents:
2122
diff
changeset
|
59 sigset_t sys_sigblock (sigset_t new_mask); |
563 | 60 sigset_t sys_sigunblock (sigset_t new_mask); |
61 sigset_t sys_sigsetmask (sigset_t new_mask); | |
62 | |
63 #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG) | |
64 | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
65 #else /* ! defined (POSIX_SIGNALS) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
66 #ifdef USG5_4 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
67 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
68 #define sigunblock(sig) (sigprocmask(SIG_SETMASK, SIGFULLMASK & ~(sig), NULL)) |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
69 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
70 #else |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
71 #ifdef USG |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
72 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
73 #define sigunblock(sig) |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
74 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
75 #else |
563 | 76 |
77 #define sigunblock(SIG) \ | |
78 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); } | |
79 | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
80 #endif /* ! defined (USG) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
81 #endif /* ! defined (USG5_4) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
82 #endif /* ! defined (POSIX_SIGNALS) */ |
563 | 83 |
84 #ifndef SIGMASKTYPE | |
85 #define SIGMASKTYPE int | |
86 #endif | |
87 | |
88 #ifndef SIGEMPTYMASK | |
637 | 89 #define SIGEMPTYMASK (0) |
90 #endif | |
91 | |
92 #ifndef SIGFULLMASK | |
93 #define SIGFULLMASK (0xffffffff) | |
563 | 94 #endif |
95 | |
96 #ifndef sigmask | |
97 #define sigmask(no) (1L << ((no) - 1)) | |
98 #endif | |
99 | |
637 | 100 #ifndef sigunblock |
101 #define sigunblock(SIG) \ | |
102 { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); } | |
103 #endif | |
104 | |
105 /* It would be very nice if we could somehow clean up all this trash. */ | |
106 | |
107 #ifndef BSD4_1 | |
108 #define sigfree() sigsetmask (SIGEMPTYMASK) | |
109 #define sigholdx(sig) sigsetmask (sigmask (sig)) | |
110 #define sigblockx(sig) sigblock (sigmask (sig)) | |
111 #define sigunblockx(sig) sigblock (SIGEMPTYMASK) | |
112 #define sigpausex(sig) sigpause (0) | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
113 #endif /* BSD4_1 */ |
637 | 114 |
563 | 115 #ifdef BSD4_1 |
116 #define SIGIO SIGTINT | |
117 /* sigfree and sigholdx are in sysdep.c */ | |
637 | 118 #define sigblockx(sig) sighold (sig) |
119 #define sigunblockx(sig) sigrelse (sig) | |
120 #define sigpausex(sig) sigpause (sig) | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
121 #endif /* ! defined (BSD4_1) */ |
563 | 122 |
123 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. | |
124 Must do that using the killpg call. */ | |
125 #ifdef BSD | |
126 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo))) | |
127 #else | |
128 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo))) | |
129 #endif | |
130 | |
131 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals | |
132 testing SIGCHLD. */ | |
133 #ifndef VMS | |
134 #ifdef SIGCLD | |
135 #ifndef SIGCHLD | |
136 #define SIGCHLD SIGCLD | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
137 #endif /* SIGCHLD */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
138 #endif /* ! defined (SIGCLD) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
139 #endif /* VMS */ |