Mercurial > emacs
annotate src/syssignal.h @ 2436:80aafda1127b
* keyboard.c (parse_modifiers, apply_modifiers): Make sure we're
not trying to create modifier masks using integers which are
unrepresentable as lisp values.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 31 Mar 1993 07:19:25 +0000 |
parents | f3c105f296b2 |
children | 409c1022bad5 |
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 | |
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 | |
637 | 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 }) | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
37 #else /* ! defined (__GNUC__) */ |
637 | 38 #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
|
39 #endif /* ! defined (__GNUC__) */ |
624 | 40 |
637 | 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) | |
563 | 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 | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
56 #else /* ! defined (POSIX_SIGNALS) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
57 #ifdef USG5_4 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
58 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
59 #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
|
60 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
61 #else |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
62 #ifdef USG |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
63 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
64 #define sigunblock(sig) |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
65 |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
66 #else |
563 | 67 |
68 #define sigunblock(SIG) \ | |
69 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); } | |
70 | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
71 #endif /* ! defined (USG) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
72 #endif /* ! defined (USG5_4) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
73 #endif /* ! defined (POSIX_SIGNALS) */ |
563 | 74 |
75 #ifndef SIGMASKTYPE | |
76 #define SIGMASKTYPE int | |
77 #endif | |
78 | |
79 #ifndef SIGEMPTYMASK | |
637 | 80 #define SIGEMPTYMASK (0) |
81 #endif | |
82 | |
83 #ifndef SIGFULLMASK | |
84 #define SIGFULLMASK (0xffffffff) | |
563 | 85 #endif |
86 | |
87 #ifndef sigmask | |
88 #define sigmask(no) (1L << ((no) - 1)) | |
89 #endif | |
90 | |
637 | 91 #ifndef sigunblock |
92 #define sigunblock(SIG) \ | |
93 { SIGMASKTYPE omask = sigblock (SIGFULLMASK); sigsetmask (omask & ~SIG); } | |
94 #endif | |
95 | |
96 /* It would be very nice if we could somehow clean up all this trash. */ | |
97 | |
98 #ifndef BSD4_1 | |
99 #define sigfree() sigsetmask (SIGEMPTYMASK) | |
100 #define sigholdx(sig) sigsetmask (sigmask (sig)) | |
101 #define sigblockx(sig) sigblock (sigmask (sig)) | |
102 #define sigunblockx(sig) sigblock (SIGEMPTYMASK) | |
103 #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
|
104 #endif /* BSD4_1 */ |
637 | 105 |
563 | 106 #ifdef BSD4_1 |
107 #define SIGIO SIGTINT | |
108 /* sigfree and sigholdx are in sysdep.c */ | |
637 | 109 #define sigblockx(sig) sighold (sig) |
110 #define sigunblockx(sig) sigrelse (sig) | |
111 #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
|
112 #endif /* ! defined (BSD4_1) */ |
563 | 113 |
114 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. | |
115 Must do that using the killpg call. */ | |
116 #ifdef BSD | |
117 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo))) | |
118 #else | |
119 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo))) | |
120 #endif | |
121 | |
122 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals | |
123 testing SIGCHLD. */ | |
124 #ifndef VMS | |
125 #ifdef SIGCLD | |
126 #ifndef SIGCHLD | |
127 #define SIGCHLD SIGCLD | |
2122
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
128 #endif /* SIGCHLD */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
129 #endif /* ! defined (SIGCLD) */ |
f3c105f296b2
* syssignal.h (sigunblock): Add definition which works under SYSVr4.
Jim Blandy <jimb@redhat.com>
parents:
637
diff
changeset
|
130 #endif /* VMS */ |