annotate src/syssignal.h @ 590:1a6483439acc

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Fri, 20 Mar 1992 06:01:16 +0000
parents 5080bb8d0593
children 2bb7f23b7ea5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
563
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* syssignal.h - System-dependent definitions for signals.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 Copyright (C) 1992 Free Software Foundation, Inc.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 the Free Software Foundation; either version 1, or (at your option)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 #ifdef POSIX_SIGNALS
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 #define SIGMASKTYPE sigset_t
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 #define SIGEMPTYMASK (empty_mask)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 #define SIGFULLMASK (full_mask)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 extern sigset_t empty_mask, full_mask, temp_mask;
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 #define sigmask(SIG) \
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 (sigemptyset (&temp_mask), sigaddset (&temp_mask, SIG), temp_mask)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 /* May need a local mask. There could be problems if code using any
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 of the 3 macros below could be reentered due to a signal occurring.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 This can't happen in Emacs 18.57, so we don't worry. - DJB
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 These macros also require GCC. */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 #define sigpause(SIG) ({ sigset_t _mask; sys_sigpause(SIG); })
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 #define sigblock(SIG) ({ sigset_t _mask; sys_sigblock(SIG); })
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 #define sigunblock(SIG) ({ sigset_t _mask; sys_sigunblock(SIG); })
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 #define sigsetmask(SIG) ({ sigset_t _mask; sys_sigsetmask(SIG); })
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 #define sighold(SIG) ONLY_USED_IN_BSD_4_1
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 #define sigrelse(SIG) ONLY_USED_IN_BSD_4_1
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 int (*sys_signal (int signal_number, int (*action)())) ();
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 int sys_sigpause (int signal_number);
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 sigset_t sys_sigblock (sigset_t new_mask);
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 sigset_t sys_sigunblock (sigset_t new_mask);
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 sigset_t sys_sigsetmask (sigset_t new_mask);
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 #define sys_sigdel(MASK,SIG) sigdelset(&MASK,SIG)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 #else /* not POSIX_SIGNALS */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 #define sigunblock(SIG) \
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 { SIGMASKTYPE omask = sigblock (SIGEMPTYMASK); sigsetmask (omask & ~SIG); }
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 #endif /* not POSIX_SIGNALS */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 #ifndef SIGMASKTYPE
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 #define SIGMASKTYPE int
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 #endif
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 #ifndef SIGEMPTYMASK
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 #define SIGEMPTYMASK 0
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 #endif
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 #ifndef sigmask
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 #define sigmask(no) (1L << ((no) - 1))
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 #endif
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 #ifndef BSD4_1
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 #define sigfree() sigsetmask (SIGEMPTYMASK)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 #define sigholdx(sig) sigsetmask (sigmask (sig))
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 #define sigblockx(sig) sigblock (sigmask (sig))
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 #define sigunblockx(sig) sigblock (SIGEMPTYMASK)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 #define sigpausex(sig) sigpause (0)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 #endif /* not BSD4_1 */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 #ifdef BSD4_1
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 #define SIGIO SIGTINT
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 /* sigfree and sigholdx are in sysdep.c */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 #define sigblockx(sig) sighold (sig)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 #define sigunblockx(sig) sigrelse (sig)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 #define sigpausex(sig) sigpause (sig)
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 #endif /* BSD4_1 */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 Must do that using the killpg call. */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 #ifdef BSD
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 #else
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 #endif
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 testing SIGCHLD. */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 #ifndef VMS
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 #ifdef SIGCLD
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 #ifndef SIGCHLD
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 #define SIGCHLD SIGCLD
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 #endif /* not SIGCHLD */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 #endif /* SIGCLD */
5080bb8d0593 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 #endif /* not VMS */