94a667468bc2de26752203a69ac6eb8bcba64694
1 /* $Id: signal.h,v 1.2 2002/02/20 09:17:54 hyperion 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 */ /* FIXME? */
43 typedef struct __tagsigset_t
46 } sigset_t
; /* Integral or structure type of an object used to represent
47 sets of signals. */ /* TODO */
51 int sival_int
; /* integer signal value */
52 void* sival_ptr
; /* pointer signal value */
57 int sigev_notify
; /* notification type */
58 int sigev_signo
; /* signal number */
59 union sigval sigev_value
; /* signal value */
60 void (* sigev_notify_function
)(union sigval
); /* notification function */
61 pthread_attr_t
* sigev_notify_attributes
; /* notification attributes */
65 typedef struct __tagsiginfo_t
67 int si_signo
; /* signal number */
68 int si_errno
; /* if non-zero, an errno value associated with
69 this signal, as defined in <errno.h> */
70 int si_code
; /* signal code */
71 pid_t si_pid
; /* sending process ID */
72 uid_t si_uid
; /* real user ID of sending process */
73 void *si_addr
; /* address of faulting instruction */
74 int si_status
; /* exit value or signal */
75 long si_band
; /* band event for SIGPOLL */
76 union sigval si_value
; /* signal value */
81 void (* sa_handler
)(int); /* what to do on receipt of signal */
82 sigset_t sa_mask
; /* set of signals to be blocked during
83 execution of the signal handling
85 int sa_flags
; /* special flags */
86 void (* sa_sigaction
)(int, siginfo_t
*, void *);
87 /* pointer to signal handler function
88 or one of the macros SIG_IGN or SIG_DFL */
91 typedef struct __tagstack_t
93 void *ss_sp
; /* stack base or pointer */
94 size_t ss_size
; /* stack size */
95 int ss_flags
; /* flags */
100 int ss_onstack
; /* non-zero when signal stack is in use */
101 void *ss_sp
; /* signal stack pointer */
105 /* Request for default signal handling. */
106 #define SIG_DFL ((void (*)(int))(0))
107 /* Return value from signal() in case of error. */
108 #define SIG_ERR ((void (*)(int))(1))
109 /* Request that signal be held. */
110 #define SIG_HOLD ((void (*)(int))(2))
111 /* Request that signal be ignored. */
112 #define SIG_IGN ((void (*)(int))(3))
114 /* No asynchronous notification will be delivered when the event of
116 #define SIGEV_NONE (0)
117 /* A queued signal, with an application-defined value, will be generated
118 when the event of interest occurs. */
119 #define SIGEV_SIGNAL (1)
120 /* A notification function will be called to perform notification. */
121 #define SIGEV_THREAD (2)
123 /* TODO: realtime features not supported yet */
124 #define SIGRTMIN (-1)
125 #define SIGRTMAX (-1)
127 /* Process abort signal. */
131 /* Erroneous arithmetic operation. */
135 /* Illegal instruction. */
137 /* Terminal interrupt signal. */
139 /* Kill (cannot be caught or ignored). */
141 /* Write on a pipe with no one to read it. */
143 /* Terminal quit signal. */
145 /* Invalid memory reference. */
147 /* Termination signal. */
149 /* User-defined signal 1. */
151 /* User-defined signal 2. */
153 /* Child process terminated or stopped. */
155 /* Continue executing, if stopped. */
157 /* Stop executing (cannot be caught or ignored). */
159 /* Terminal stop signal. */
161 /* Background process attempting read. */
163 /* Background process attempting write. */
165 /* Access to an undefined portion of a memory object. */
167 /* Pollable event. */
169 /* Profiling timer expired. */
171 /* Bad system call. */
173 /* Trace/breakpoint trap. */
175 /* High bandwidth data is available at a socket. */
177 /* Virtual timer expired. */
178 #define SIGVTALRM (26)
179 /* CPU time limit exceeded. */
181 /* File size limit exceeded. */
184 /* FIXME: the following constants need to be reviewed */
185 /* Do not generate SIGCHLD when children stop. */
186 #define SA_NOCLDSTOP (0x00000001)
187 /* The resulting set is the union of the current set and the signal set
188 pointed to by the argument set. */
189 #define SA_ONSTACK (0x00000002)
190 /* Causes signal dispositions to be set to SIG_DFL on entry to signal
192 #define SA_RESETHAND (0x00000004)
193 /* Causes certain functions to become restartable. */
194 #define SA_RESTART (0x00000008)
195 /* Causes extra information to be passed to signal handlers at the time
196 of receipt of a signal. */
197 #define SA_SIGINFO (0x00000010)
198 /* Causes implementations not to create zombie processes on child death. */
199 #define SA_NOCLDWAIT (0x00000020)
200 /* Causes signal not to be automatically blocked on entry to signal
202 #define SA_NODEFER (0x00000040)
204 /* FIXME: the following constants need to be reviewed */
205 /* The resulting set is the intersection of the current set and the
206 complement of the signal set pointed to by the argument set. */
207 #define SIG_BLOCK (1)
208 /* The resulting set is the signal set pointed to by the argument
210 #define SIG_UNBLOCK (2)
211 /* Causes signal delivery to occur on an alternate stack. */
212 #define SIG_SETMASK (3)
214 /* FIXME: the following constants need to be reviewed */
215 /* Process is executing on an alternate signal stack. */
216 #define SS_ONSTACK (1)
217 /* Alternate signal stack is disabled. */
218 #define SS_DISABLE (2)
220 /* Minimum stack size for a signal handler. */ /* FIXME */
221 #define MINSIGSTKSZ (0)
222 /* Default size in bytes for the alternate signal stack. */ /* FIXME */
226 signal-specific reasons why the signal was generated
230 #define ILL_ILLOPC (1)
231 /* illegal operand */
232 #define ILL_ILLOPN (2)
233 /* illegal addressing mode */
234 #define ILL_ILLADR (3)
236 #define ILL_ILLTRP (4)
237 /* privileged opcode */
238 #define ILL_PRVOPC (5)
239 /* privileged register */
240 #define ILL_PRVREG (6)
241 /* coprocessor error */
242 #define ILL_COPROC (7)
243 /* internal stack error */
244 #define ILL_BADSTK (8)
247 /* integer divide by zero */
249 /* integer overflow */
251 /* floating point divide by zero */
253 /* floating point overflow */
255 /* floating point underflow */
257 /* floating point inexact result */
259 /* invalid floating point operation */
261 /* subscript out of range */
265 /* address not mapped to object */
267 /* invalid permissions for mapped object */
271 /* invalid address alignment */
273 /* non-existent physical address */
275 /* object specific hardware error */
279 /* process breakpoint */
281 /* process trace trap */
285 /* child has exited */
287 /* child has terminated abnormally and did not create a core file */
289 /* child has terminated abnormally and created a core file */
291 /* traced child has trapped */
293 /* child has stopped */
295 /* stopped child has continued */
296 #define CLD_CONTINUED
299 /* data input available */
301 /* output buffers available */
303 /* input message available */
307 /* high priority input available */
309 /* device disconnected */
311 /* signal sent by kill() */
313 /* signal sent by the sigqueue() */
315 /* signal generated by expiration of a timer set by timer_settime() */
317 /* signal generated by completion of an asynchronous I/O request */
319 /* signal generated by arrival of a message on an empty message queue */
323 void (*bsd_signal(int, void (*)(int)))(int);
324 int kill(pid_t
, int);
325 int killpg(pid_t
, int);
326 int pthread_kill(pthread_t
, int);
327 int pthread_sigmask(int, const sigset_t
*, sigset_t
*);
329 int sigaction(int, const struct sigaction
*, struct sigaction
*);
330 int sigaddset(sigset_t
*, int);
331 int sigaltstack(const stack_t
*, stack_t
*);
332 int sigdelset(sigset_t
*, int);
333 int sigemptyset(sigset_t
*);
334 int sigfillset(sigset_t
*);
337 int siginterrupt(int, int);
338 int sigismember(const sigset_t
*, int);
339 void (*signal(int, void (*)(int)))(int);
341 int sigpending(sigset_t
*);
342 int sigprocmask(int, const sigset_t
*, sigset_t
*);
343 int sigqueue(pid_t
, int, const union sigval
);
345 void (*sigset(int, void (*)(int)))(int);
346 int sigstack(struct sigstack
*ss
,
347 struct sigstack
*oss
); /* LEGACY */
348 int sigsuspend(const sigset_t
*);
349 int sigtimedwait(const sigset_t
*, siginfo_t
*,
350 const struct timespec
*);
351 int sigwait(const sigset_t
*set
, int *sig
);
352 int sigwaitinfo(const sigset_t
*, siginfo_t
*);
356 #endif /* __SIGNAL_H_INCLUDED__ */