1 |
199 |
simons |
/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
2 |
|
|
This file is part of the GNU C Library.
|
3 |
|
|
|
4 |
|
|
The GNU C Library is free software; you can redistribute it and/or
|
5 |
|
|
modify it under the terms of the GNU Library General Public License as
|
6 |
|
|
published by the Free Software Foundation; either version 2 of the
|
7 |
|
|
License, or (at your option) any later version.
|
8 |
|
|
|
9 |
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
10 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12 |
|
|
Library General Public License for more details.
|
13 |
|
|
|
14 |
|
|
You should have received a copy of the GNU Library General Public
|
15 |
|
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
16 |
|
|
not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
|
17 |
|
|
Cambridge, MA 02139, USA. */
|
18 |
|
|
|
19 |
|
|
/*
|
20 |
|
|
* ANSI Standard: 4.7 SIGNAL HANDLING <signal.h>
|
21 |
|
|
*/
|
22 |
|
|
|
23 |
|
|
#ifndef _SIGNAL_H
|
24 |
|
|
#define _SIGNAL_H
|
25 |
|
|
|
26 |
|
|
#include <features.h>
|
27 |
|
|
#include <sys/types.h>
|
28 |
|
|
#include <linux/signal.h>
|
29 |
|
|
|
30 |
|
|
#ifndef SIGCLD
|
31 |
|
|
#define SIGCLD SIGCHLD
|
32 |
|
|
#endif
|
33 |
|
|
|
34 |
|
|
/* SVR4 */
|
35 |
|
|
#ifndef SA_RESETHAND
|
36 |
|
|
#define SA_RESETHAND SA_ONESHOT
|
37 |
|
|
#endif
|
38 |
|
|
|
39 |
|
|
/* SVR4 */
|
40 |
|
|
#ifndef SA_NODEFER
|
41 |
|
|
#define SA_NODEFER SA_NOMASK
|
42 |
|
|
#endif
|
43 |
|
|
|
44 |
|
|
typedef int sig_atomic_t;
|
45 |
|
|
|
46 |
|
|
typedef __sighandler_t SignalHandler;
|
47 |
|
|
|
48 |
|
|
#ifndef BADSIG
|
49 |
|
|
#define BADSIG SIG_ERR
|
50 |
|
|
#endif
|
51 |
|
|
|
52 |
|
|
/* The Interviews version also has these ... */
|
53 |
|
|
|
54 |
|
|
#define SignalBad ((SignalHandler)-1)
|
55 |
|
|
#define SignalDefault ((SignalHandler)0)
|
56 |
|
|
#define SignalIgnore ((SignalHandler)1)
|
57 |
|
|
|
58 |
|
|
__BEGIN_DECLS
|
59 |
|
|
|
60 |
|
|
extern __const char * __const sys_siglist[];
|
61 |
|
|
extern __const char * __const _sys_siglist[];
|
62 |
|
|
|
63 |
|
|
extern __sighandler_t
|
64 |
|
|
signal __P ((int __sig, __sighandler_t));
|
65 |
|
|
extern __sighandler_t
|
66 |
|
|
__signal __P ((int __sig, __sighandler_t, int flags));
|
67 |
|
|
extern int raise __P ((int __sig));
|
68 |
|
|
extern int __kill __P ((pid_t __pid, int __sig));
|
69 |
|
|
extern int kill __P ((pid_t __pid, int __sig));
|
70 |
|
|
extern int killpg __P ((int __pgrp, int __sig));
|
71 |
|
|
extern int sigaddset __P ((sigset_t *__mask, int __sig));
|
72 |
|
|
extern int sigdelset __P ((sigset_t *__mask, int __sig));
|
73 |
|
|
extern int sigemptyset __P ((sigset_t *__mask));
|
74 |
|
|
extern int sigfillset __P ((sigset_t *__mask));
|
75 |
|
|
extern int sigismember __P ((__const sigset_t *__mask, int __sig));
|
76 |
|
|
extern int sigpending __P ((sigset_t *__set));
|
77 |
|
|
|
78 |
|
|
extern int __sigprocmask __P ((int __how, __const sigset_t *__set,
|
79 |
|
|
sigset_t *__oldset));
|
80 |
|
|
extern int sigprocmask __P ((int __how, __const sigset_t *__set,
|
81 |
|
|
sigset_t *__oldset));
|
82 |
|
|
|
83 |
|
|
extern int sigsuspend __P ((__const sigset_t *sigmask));
|
84 |
|
|
|
85 |
|
|
extern int __sigaction __P ((int __sig, struct sigaction *__act,
|
86 |
|
|
struct sigaction *__oldact));
|
87 |
|
|
extern int sigaction __P ((int __sig, struct sigaction *__act,
|
88 |
|
|
struct sigaction *__oldact));
|
89 |
|
|
|
90 |
|
|
#define __sigemptyset(set) ((*(set) = 0L), 0)
|
91 |
|
|
#define __sigfillset(set) ((*(set) = -1L), 0)
|
92 |
|
|
#define __sigaddset(set, sig) ((*(set) |= __sigmask (sig)), 0)
|
93 |
|
|
#define __sigdelset(set, sig) ((*(set) &= ~__sigmask (sig)), 0)
|
94 |
|
|
#define __sigismember(set, sig) ((*(set) & __sigmask (sig)) ? 1 : 0)
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
#if 1
|
98 |
|
|
#define sigemptyset __sigemptyset
|
99 |
|
|
#define sigfillset __sigfillset
|
100 |
|
|
|
101 |
|
|
/* We don't do that any more since it causes problems due to
|
102 |
|
|
* "sig" > _NSIG and "sig" < 1. It isn't worth the touble to make
|
103 |
|
|
* them inline and static. Use __sigxxxxx if you want speed with
|
104 |
|
|
* correct "sig".
|
105 |
|
|
*/
|
106 |
|
|
#if 1
|
107 |
|
|
#define sigaddset __sigaddset
|
108 |
|
|
#define sigdelset __sigdelset
|
109 |
|
|
#define sigismember __sigismember
|
110 |
|
|
#endif
|
111 |
|
|
|
112 |
|
|
#endif
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
/* Return a mask that includes SIG only. */
|
116 |
|
|
#define __sigmask(sig) (1 << ((sig) - 1))
|
117 |
|
|
|
118 |
|
|
extern int __sigsetmask __P ((int __mask));
|
119 |
|
|
extern int __siggetmask __P ((void));
|
120 |
|
|
extern int __sigblock __P ((int __mask));
|
121 |
|
|
extern int __sigpause __P ((int __mask));
|
122 |
|
|
|
123 |
|
|
#ifdef __USE_SVID
|
124 |
|
|
/* SVID names for the same things. */
|
125 |
|
|
extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler));
|
126 |
|
|
extern int gsignal __P ((int __sig));
|
127 |
|
|
|
128 |
|
|
#endif /* Use SVID. */
|
129 |
|
|
|
130 |
|
|
/* BSD */
|
131 |
|
|
#ifdef __USE_BSD
|
132 |
|
|
#define sigmask __sigmask
|
133 |
|
|
|
134 |
|
|
extern int sigblock __P ((int __mask));
|
135 |
|
|
extern int sigpause __P ((int __mask));
|
136 |
|
|
extern int sigsetmask __P ((int __mask));
|
137 |
|
|
extern int siggetmask __P ((void));
|
138 |
|
|
extern void psignal __P ((int __sig, __const char *__str));
|
139 |
|
|
|
140 |
|
|
extern int siginterrupt __P ((int __sig, int __flag));
|
141 |
|
|
|
142 |
|
|
/* The `sig' bit is set if the interrupt on it
|
143 |
|
|
* is enabled via siginterrupt (). */
|
144 |
|
|
extern sigset_t _sigintr;
|
145 |
|
|
|
146 |
|
|
#endif /* Use BSD. */
|
147 |
|
|
|
148 |
|
|
#ifdef __USE_BSD_SIGNAL
|
149 |
|
|
|
150 |
|
|
extern __sighandler_t
|
151 |
|
|
__bsd_signal __P ((int __sig, __sighandler_t));
|
152 |
|
|
#define signal __bsd_signal
|
153 |
|
|
|
154 |
|
|
#endif /* __USE_BSD_SIGNAL */
|
155 |
|
|
|
156 |
|
|
__END_DECLS
|
157 |
|
|
|
158 |
|
|
#if _MIT_POSIX_THREADS
|
159 |
|
|
#define __SIGFILLSET 0xffffffff
|
160 |
|
|
#define __SIGEMPTYSET 0
|
161 |
|
|
#define __SIGADDSET(s,n) ((*s) |= (1 << ((n) - 1)))
|
162 |
|
|
#define __SIGDELSET(s,n) ((*s) &= ~(1 << ((n) - 1)))
|
163 |
|
|
#define __SIGISMEMBER(s,n) ((*s) & (1 << ((n) - 1)))
|
164 |
|
|
#endif
|
165 |
|
|
|
166 |
|
|
#endif /* _SIGNAL_H */
|