1 /* $Id: signal.h,v 1.5 2002/10/29 04:45:18 rex Exp $
6 * signals. Conforming to the Single UNIX(r) Specification Version 2,
7 * System Interface & Headers Issue 5
9 * This file is part of the ReactOS Operating System.
12 * Created by KJK::Hyperion <noog@libero.it>
14 * THIS SOFTWARE IS NOT COPYRIGHTED
16 * This source code is offered for use in the public domain. You may
17 * use, modify or distribute it freely.
19 * This code is distributed in the hope that it will be useful but
20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21 * DISCLAMED. This includes but is not limited to warranties of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 #ifndef __SIGNAL_H_INCLUDED__
26 #define __SIGNAL_H_INCLUDED__
30 #include <sys/types.h>
35 /* pre-declaration of time.h types to suppress warnings caused by circular
39 typedef int sig_atomic_t; /* Integral type of an object that can be
40 accessed as an atomic entity, even in the
41 presence of asynchronous interrupts */
43 typedef unsigned long int sigset_t
; /* Integral or structure type of an object
44 used to represent sets of signals. */
48 int sival_int
; /* integer signal value */
49 void* sival_ptr
; /* pointer signal value */
54 int sigev_notify
; /* notification type */
55 int sigev_signo
; /* signal number */
56 union sigval sigev_value
; /* signal value */
57 void (* sigev_notify_function
)(union sigval
); /* notification function */
58 pthread_attr_t
* sigev_notify_attributes
; /* notification attributes */
62 typedef struct __tagsiginfo_t
64 int si_signo
; /* signal number */
65 int si_errno
; /* if non-zero, an errno value associated with
66 this signal, as defined in <errno.h> */
67 int si_code
; /* signal code */
68 pid_t si_pid
; /* sending process ID */
69 uid_t si_uid
; /* real user ID of sending process */
70 void *si_addr
; /* address of faulting instruction */
71 int si_status
; /* exit value or signal */
72 long si_band
; /* band event for SIGPOLL */
73 union sigval si_value
; /* signal value */
78 void (* sa_handler
)(int); /* what to do on receipt of signal */
79 sigset_t sa_mask
; /* set of signals to be blocked during
80 execution of the signal handling function */
81 int sa_flags
; /* special flags */
82 void (* sa_sigaction
)(int, siginfo_t
*, void *);
83 /* pointer to signal handler function
84 or one of the macros SIG_IGN or SIG_DFL */
87 typedef struct __tagstack_t
89 void *ss_sp
; /* stack base or pointer */
90 size_t ss_size
; /* stack size */
91 int ss_flags
; /* flags */
96 int ss_onstack
; /* non-zero when signal stack is in use */
97 void *ss_sp
; /* signal stack pointer */
101 #define SIG_DFL ((void (*)(int))(0xFFFFFFFF)) /* Request for default signal handling. */
102 #define SIG_ERR ((void (*)(int))(0x00000000)) /* Return value from signal() in case of error. */
103 #define SIG_IGN ((void (*)(int))(0x00000001)) /* Request that signal be ignored. */
104 #define SIG_HOLD ((void (*)(int))(0x00000002)) /* Request that signal be held. */
106 #define SIGEV_NONE (0) /* No asynchronous notification will be delivered \
107 when the event of interest occurs. */
108 #define SIGEV_SIGNAL (1) /* A queued signal, with an application-defined \
109 value, will be generated when the event of \
111 #define SIGEV_THREAD (2) /* A notification function will be called to perform \
114 /* TODO: realtime features not supported yet */
115 #define SIGRTMIN (-1)
116 #define SIGRTMAX (-1)
118 #define SIGABRT ( 1) /* Process abort signal. */
119 #define SIGALRM ( 2) /* Alarm clock. */
120 #define SIGFPE ( 3) /* Erroneous arithmetic operation. */
121 #define SIGHUP ( 4) /* Hangup. */
122 #define SIGILL ( 5) /* Illegal instruction. */
123 #define SIGINT ( 6) /* Terminal interrupt signal. */
124 #define SIGKILL ( 7) /* Kill (cannot be caught or ignored). */
125 #define SIGPIPE ( 8) /* Write on a pipe with no one to read it. */
126 #define SIGQUIT ( 9) /* Terminal quit signal. */
127 #define SIGSEGV (10) /* Invalid memory reference. */
128 #define SIGTERM (11) /* Termination signal. */
129 #define SIGUSR1 (12) /* User-defined signal 1. */
130 #define SIGUSR2 (13) /* User-defined signal 2. */
131 #define SIGCHLD (14) /* Child process terminated or stopped. */
132 #define SIGCONT (15) /* Continue executing, if stopped. */
133 #define SIGSTOP (16) /* Stop executing (cannot be caught or ignored). */
134 #define SIGTSTP (17) /* Terminal stop signal. */
135 #define SIGTTIN (18) /* Background process attempting read. */
136 #define SIGTTOU (19) /* Background process attempting write. */
137 #define SIGBUS (20) /* Access to an undefined portion of a memory object. */
138 #define SIGPOLL (21) /* Pollable event. */
139 #define SIGPROF (22) /* Profiling timer expired. */
140 #define SIGSYS (23) /* Bad system call. */
141 #define SIGTRAP (24) /* Trace/breakpoint trap. */
142 #define SIGURG (25) /* High bandwidth data is available at a socket. */
143 #define SIGVTALRM (26) /* Virtual timer expired. */
144 #define SIGXCPU (27) /* CPU time limit exceeded. */
145 #define SIGXFSZ (28) /* File size limit exceeded. */
147 /* FIXME: the following constants need to be reviewed */
148 /* Do not generate SIGCHLD when children stop. */
149 #define SA_NOCLDSTOP (0x00000001)
150 /* The resulting set is the union of the current set and the signal set
151 pointed to by the argument set. */
152 #define SA_ONSTACK (0x00000002)
153 /* Causes signal dispositions to be set to SIG_DFL on entry to signal
155 #define SA_RESETHAND (0x00000004)
156 /* Causes certain functions to become restartable. */
157 #define SA_RESTART (0x00000008)
158 /* Causes extra information to be passed to signal handlers at the time
159 of receipt of a signal. */
160 #define SA_SIGINFO (0x00000010)
161 /* Causes implementations not to create zombie processes on child death. */
162 #define SA_NOCLDWAIT (0x00000020)
163 /* Causes signal not to be automatically blocked on entry to signal
165 #define SA_NODEFER (0x00000040)
167 /* FIXME: the following constants need to be reviewed */
168 /* The resulting set is the intersection of the current set and the
169 complement of the signal set pointed to by the argument set. */
170 #define SIG_BLOCK (1)
171 /* The resulting set is the signal set pointed to by the argument
173 #define SIG_UNBLOCK (2)
174 /* Causes signal delivery to occur on an alternate stack. */
175 #define SIG_SETMASK (3)
177 /* FIXME: the following constants need to be reviewed */
178 /* Process is executing on an alternate signal stack. */
179 #define SS_ONSTACK (1)
180 /* Alternate signal stack is disabled. */
181 #define SS_DISABLE (2)
183 /* Minimum stack size for a signal handler. */ /* FIXME */
184 #define MINSIGSTKSZ (0)
185 /* Default size in bytes for the alternate signal stack. */ /* FIXME */
189 signal-specific reasons why the signal was generated
193 #define ILL_ILLOPC (1)
194 /* illegal operand */
195 #define ILL_ILLOPN (2)
196 /* illegal addressing mode */
197 #define ILL_ILLADR (3)
199 #define ILL_ILLTRP (4)
200 /* privileged opcode */
201 #define ILL_PRVOPC (5)
202 /* privileged register */
203 #define ILL_PRVREG (6)
204 /* coprocessor error */
205 #define ILL_COPROC (7)
206 /* internal stack error */
207 #define ILL_BADSTK (8)
210 /* integer divide by zero */
212 /* integer overflow */
214 /* floating point divide by zero */
216 /* floating point overflow */
218 /* floating point underflow */
220 /* floating point inexact result */
222 /* invalid floating point operation */
224 /* subscript out of range */
228 /* address not mapped to object */
230 /* invalid permissions for mapped object */
234 /* invalid address alignment */
236 /* non-existent physical address */
238 /* object specific hardware error */
242 /* process breakpoint */
244 /* process trace trap */
248 /* child has exited */
250 /* child has terminated abnormally and did not create a core file */
252 /* child has terminated abnormally and created a core file */
254 /* traced child has trapped */
256 /* child has stopped */
258 /* stopped child has continued */
259 #define CLD_CONTINUED
262 /* data input available */
264 /* output buffers available */
266 /* input message available */
270 /* high priority input available */
272 /* device disconnected */
274 /* signal sent by kill() */
276 /* signal sent by the sigqueue() */
278 /* signal generated by expiration of a timer set by timer_settime() */
280 /* signal generated by completion of an asynchronous I/O request */
282 /* signal generated by arrival of a message on an empty message queue */
286 void (*bsd_signal(int, void (*)(int)))(int);
287 int kill(pid_t
, int);
288 int killpg(pid_t
, int);
289 int pthread_kill(pthread_t
, int);
290 int pthread_sigmask(int, const sigset_t
*, sigset_t
*);
292 int sigaction(int, const struct sigaction
*, struct sigaction
*);
293 int sigaddset(sigset_t
*, int);
294 int sigaltstack(const stack_t
*, stack_t
*);
295 int sigdelset(sigset_t
*, int);
296 int sigemptyset(sigset_t
*);
297 int sigfillset(sigset_t
*);
300 int siginterrupt(int, int);
301 int sigismember(const sigset_t
*, int);
302 void (*signal(int, void (*)(int)))(int);
304 int sigpending(sigset_t
*);
305 int sigprocmask(int, const sigset_t
*, sigset_t
*);
306 int sigqueue(pid_t
, int, const union sigval
);
308 void (*sigset(int, void (*)(int)))(int);
309 int sigstack(struct sigstack
*ss
,
310 struct sigstack
*oss
); /* LEGACY */
311 int sigsuspend(const sigset_t
*);
312 int sigtimedwait(const sigset_t
*, siginfo_t
*,
313 const struct timespec
*);
314 int sigwait(const sigset_t
*set
, int *sig
);
315 int sigwaitinfo(const sigset_t
*, siginfo_t
*);
319 #endif /* __SIGNAL_H_INCLUDED__ */