c7afdc63da8dffb2a8d03953a20264d5dfa2c731
4 * signals. Conforming to the Single UNIX(r) Specification Version 2,
5 * System Interface & Headers Issue 5
7 * This file is part of the ReactOS Operating System.
10 * Created by KJK::Hyperion <noog@libero.it>
12 * THIS SOFTWARE IS NOT COPYRIGHTED
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
17 * This code is distributed in the hope that it will be useful but
18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19 * DISCLAMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __SIGNAL_H_INCLUDED__
24 #define __SIGNAL_H_INCLUDED__
28 #include <sys/types.h>
33 /* pre-declaration of time.h types to suppress warnings caused by circular
37 typedef int sig_atomic_t; /* Integral type of an object that can be
38 accessed as an atomic entity, even in the
39 presence of asynchronous interrupts */ /* FIXME? */
41 typedef struct __tagsigset_t
44 } sigset_t
; /* Integral or structure type of an object used to represent
45 sets of signals. */ /* TODO */
49 int sival_int
; /* integer signal value */
50 void* sival_ptr
; /* pointer signal value */
55 int sigev_notify
; /* notification type */
56 int sigev_signo
; /* signal number */
57 union sigval sigev_value
; /* signal value */
58 void (* sigev_notify_function
)(union sigval
); /* notification function */
59 pthread_attr_t
* sigev_notify_attributes
; /* notification attributes */
63 typedef struct __tagsiginfo_t
65 int si_signo
; /* signal number */
66 int si_errno
; /* if non-zero, an errno value associated with
67 this signal, as defined in <errno.h> */
68 int si_code
; /* signal code */
69 pid_t si_pid
; /* sending process ID */
70 uid_t si_uid
; /* real user ID of sending process */
71 void *si_addr
; /* address of faulting instruction */
72 int si_status
; /* exit value or signal */
73 long si_band
; /* band event for SIGPOLL */
74 union sigval si_value
; /* signal value */
79 void (* sa_handler
)(int); /* what to do on receipt of signal */
80 sigset_t sa_mask
; /* set of signals to be blocked during
81 execution of the signal handling
83 int sa_flags
; /* special flags */
84 void (* sa_sigaction
)(int, siginfo_t
*, void *);
85 /* pointer to signal handler function
86 or one of the macros SIG_IGN or SIG_DFL */
89 typedef struct __tagstack_t
91 void *ss_sp
; /* stack base or pointer */
92 size_t ss_size
; /* stack size */
93 int ss_flags
; /* flags */
98 int ss_onstack
; /* non-zero when signal stack is in use */
99 void *ss_sp
; /* signal stack pointer */
103 /* Request for default signal handling. */
104 #define SIG_DFL ((void (*)(int))(0))
105 /* Return value from signal() in case of error. */
106 #define SIG_ERR ((void (*)(int))(1))
107 /* Request that signal be held. */
108 #define SIG_HOLD ((void (*)(int))(2))
109 /* Request that signal be ignored. */
110 #define SIG_IGN ((void (*)(int))(3))
112 /* No asynchronous notification will be delivered when the event of
114 #define SIGEV_NONE (0)
115 /* A queued signal, with an application-defined value, will be generated
116 when the event of interest occurs. */
117 #define SIGEV_SIGNAL (1)
118 /* A notification function will be called to perform notification. */
119 #define SIGEV_THREAD (2)
121 /* TODO: realtime features not supported yet */
122 #define SIGRTMIN (-1)
123 #define SIGRTMAX (-1)
125 /* Process abort signal. */
129 /* Erroneous arithmetic operation. */
133 /* Illegal instruction. */
135 /* Terminal interrupt signal. */
137 /* Kill (cannot be caught or ignored). */
139 /* Write on a pipe with no one to read it. */
141 /* Terminal quit signal. */
143 /* Invalid memory reference. */
145 /* Termination signal. */
147 /* User-defined signal 1. */
149 /* User-defined signal 2. */
151 /* Child process terminated or stopped. */
153 /* Continue executing, if stopped. */
155 /* Stop executing (cannot be caught or ignored). */
157 /* Terminal stop signal. */
159 /* Background process attempting read. */
161 /* Background process attempting write. */
163 /* Access to an undefined portion of a memory object. */
165 /* Pollable event. */
167 /* Profiling timer expired. */
169 /* Bad system call. */
171 /* Trace/breakpoint trap. */
173 /* High bandwidth data is available at a socket. */
175 /* Virtual timer expired. */
176 #define SIGVTALRM (26)
177 /* CPU time limit exceeded. */
179 /* File size limit exceeded. */
182 /* FIXME: the following constants need to be reviewed */
183 /* Do not generate SIGCHLD when children stop. */
184 #define SA_NOCLDSTOP (0x00000001)
185 /* The resulting set is the union of the current set and the signal set
186 pointed to by the argument set. */
187 #define SA_ONSTACK (0x00000002)
188 /* Causes signal dispositions to be set to SIG_DFL on entry to signal
190 #define SA_RESETHAND (0x00000004)
191 /* Causes certain functions to become restartable. */
192 #define SA_RESTART (0x00000008)
193 /* Causes extra information to be passed to signal handlers at the time
194 of receipt of a signal. */
195 #define SA_SIGINFO (0x00000010)
196 /* Causes implementations not to create zombie processes on child death. */
197 #define SA_NOCLDWAIT (0x00000020)
198 /* Causes signal not to be automatically blocked on entry to signal
200 #define SA_NODEFER (0x00000040)
202 /* FIXME: the following constants need to be reviewed */
203 /* The resulting set is the intersection of the current set and the
204 complement of the signal set pointed to by the argument set. */
205 #define SIG_BLOCK (1)
206 /* The resulting set is the signal set pointed to by the argument
208 #define SIG_UNBLOCK (2)
209 /* Causes signal delivery to occur on an alternate stack. */
210 #define SIG_SETMASK (3)
212 /* FIXME: the following constants need to be reviewed */
213 /* Process is executing on an alternate signal stack. */
214 #define SS_ONSTACK (1)
215 /* Alternate signal stack is disabled. */
216 #define SS_DISABLE (2)
218 /* Minimum stack size for a signal handler. */ /* FIXME */
219 #define MINSIGSTKSZ (0)
220 /* Default size in bytes for the alternate signal stack. */ /* FIXME */
224 signal-specific reasons why the signal was generated
228 #define ILL_ILLOPC (1)
229 /* illegal operand */
230 #define ILL_ILLOPN (2)
231 /* illegal addressing mode */
232 #define ILL_ILLADR (3)
234 #define ILL_ILLTRP (4)
235 /* privileged opcode */
236 #define ILL_PRVOPC (5)
237 /* privileged register */
238 #define ILL_PRVREG (6)
239 /* coprocessor error */
240 #define ILL_COPROC (7)
241 /* internal stack error */
242 #define ILL_BADSTK (8)
245 /* integer divide by zero */
247 /* integer overflow */
249 /* floating point divide by zero */
251 /* floating point overflow */
253 /* floating point underflow */
255 /* floating point inexact result */
257 /* invalid floating point operation */
259 /* subscript out of range */
263 /* address not mapped to object */
265 /* invalid permissions for mapped object */
269 /* invalid address alignment */
271 /* non-existent physical address */
273 /* object specific hardware error */
277 /* process breakpoint */
279 /* process trace trap */
283 /* child has exited */
285 /* child has terminated abnormally and did not create a core file */
287 /* child has terminated abnormally and created a core file */
289 /* traced child has trapped */
291 /* child has stopped */
293 /* stopped child has continued */
294 #define CLD_CONTINUED
297 /* data input available */
299 /* output buffers available */
301 /* input message available */
305 /* high priority input available */
307 /* device disconnected */
309 /* signal sent by kill() */
311 /* signal sent by the sigqueue() */
313 /* signal generated by expiration of a timer set by timer_settime() */
315 /* signal generated by completion of an asynchronous I/O request */
317 /* signal generated by arrival of a message on an empty message queue */
321 void (*bsd_signal(int, void (*)(int)))(int);
322 int kill(pid_t
, int);
323 int killpg(pid_t
, int);
324 int pthread_kill(pthread_t
, int);
325 int pthread_sigmask(int, const sigset_t
*, sigset_t
*);
327 int sigaction(int, const struct sigaction
*, struct sigaction
*);
328 int sigaddset(sigset_t
*, int);
329 int sigaltstack(const stack_t
*, stack_t
*);
330 int sigdelset(sigset_t
*, int);
331 int sigemptyset(sigset_t
*);
332 int sigfillset(sigset_t
*);
335 int siginterrupt(int, int);
336 int sigismember(const sigset_t
*, int);
337 void (*signal(int, void (*)(int)))(int);
339 int sigpending(sigset_t
*);
340 int sigprocmask(int, const sigset_t
*, sigset_t
*);
341 int sigqueue(pid_t
, int, const union sigval
);
343 void (*sigset(int, void (*)(int)))(int);
344 int sigstack(struct sigstack
*ss
,
345 struct sigstack
*oss
); /* LEGACY */
346 int sigsuspend(const sigset_t
*);
347 int sigtimedwait(const sigset_t
*, siginfo_t
*,
348 const struct timespec
*);
349 int sigwait(const sigset_t
*set
, int *sig
);
350 int sigwaitinfo(const sigset_t
*, siginfo_t
*);
354 #endif /* __SIGNAL_H_INCLUDED__ */