3 Copyright 2004, 2005, 2006, 2011 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11 #ifndef _CYGWIN_SIGNAL_H
12 #define _CYGWIN_SIGNAL_H
24 unsigned long dataoff;
25 unsigned long datasel;
26 unsigned char _st[80];
39 struct _fpstate fpstate;
56 unsigned char _internal;
57 unsigned long oldmask;
60 #define __COPY_CONTEXT_SIZE ((unsigned) &((struct ucontext *) 0)->_internal)
64 int sival_int; /* integer signal value */
65 void *sival_ptr; /* pointer signal value */
68 typedef struct sigevent
70 sigval_t sigev_value; /* signal value */
71 int sigev_signo; /* signal number */
72 int sigev_notify; /* notification type */
73 void (*sigev_notify_function) (sigval_t); /* notification function */
74 pthread_attr_t *sigev_notify_attributes; /* notification attributes */
81 void *_si_read_handle;
82 void *_si_write_handle;
83 void *_si_process_handle;
87 void *_si_pipe_fhandler;
94 int si_signo; /* signal number */
95 int si_code; /* signal code */
96 pid_t si_pid; /* sender's pid */
97 uid_t si_uid; /* sender's uid */
98 int si_errno; /* errno associated with signal */
102 __uint32_t __pad[32]; /* plan for future growth */
103 struct _sigcommune _si_commune; /* cygwin ipc */
113 timer_t si_tid; /* timer id */
114 unsigned int si_overrun; /* overrun count */
116 sigval_t si_sigval; /* signal value */
117 sigval_t si_value; /* signal value */
125 int si_status; /* exit code */
126 clock_t si_utime; /* user time */
127 clock_t si_stime; /* system time */
130 /* core dumping signals */
131 void *si_addr; /* faulting address */
138 SI_USER = 0, /* sent by kill, raise, pthread_kill */
139 SI_ASYNCIO = 2, /* sent by AIO completion (currently
141 SI_MESGQ, /* sent by real time mesq state change
142 (currently unimplemented) */
143 SI_TIMER, /* sent by timer expiration */
144 SI_QUEUE, /* sent by sigqueue (currently
146 SI_KERNEL, /* sent by system */
148 ILL_ILLOPC, /* illegal opcode */
149 ILL_ILLOPN, /* illegal operand */
150 ILL_ILLADR, /* illegal addressing mode */
151 ILL_ILLTRP, /* illegal trap*/
152 ILL_PRVOPC, /* privileged opcode */
153 ILL_PRVREG, /* privileged register */
154 ILL_COPROC, /* coprocessor error */
155 ILL_BADSTK, /* internal stack error */
157 FPE_INTDIV, /* integer divide by zero */
158 FPE_INTOVF, /* integer overflow */
159 FPE_FLTDIV, /* floating point divide by zero */
160 FPE_FLTOVF, /* floating point overflow */
161 FPE_FLTUND, /* floating point underflow */
162 FPE_FLTRES, /* floating point inexact result */
163 FPE_FLTINV, /* floating point invalid operation */
164 FPE_FLTSUB, /* subscript out of range */
166 SEGV_MAPERR, /* address not mapped to object */
167 SEGV_ACCERR, /* invalid permissions for mapped object */
169 BUS_ADRALN, /* invalid address alignment. */
170 BUS_ADRERR, /* non-existant physical address. */
171 BUS_OBJERR, /* object specific hardware error. */
173 CLD_EXITED, /* child has exited */
174 CLD_KILLED, /* child was killed */
175 CLD_DUMPED, /* child terminated abnormally */
176 CLD_TRAPPED, /* traced child has trapped */
177 CLD_STOPPED, /* child has stopped */
178 CLD_CONTINUED /* stopped child has continued */
183 SIGEV_SIGNAL = 0, /* a queued signal, with an application
184 defined value, is generated when the
185 event of interest occurs */
186 SIGEV_NONE, /* no asynchronous notification is
187 delivered when the event of interest
189 SIGEV_THREAD /* a notification function is called to
190 perform notification */
193 typedef void (*_sig_func_ptr)(int);
199 _sig_func_ptr sa_handler; /* SIG_DFL, SIG_IGN, or pointer to a function */
200 void (*sa_sigaction) ( int, siginfo_t *, void * );
206 #define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children
208 #define SA_SIGINFO 2 /* Invoke the signal catching function
209 with three arguments instead of one
211 #define SA_RESTART 0x10000000 /* Restart syscall on signal return */
212 #define SA_NODEFER 0x40000000 /* Don't automatically block the signal
213 when its handler is being executed */
214 #define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler */
215 #define SA_ONESHOT SA_RESETHAND /* Historical linux name */
216 #define SA_NOMASK SA_NODEFER /* Historical linux name */
218 /* Used internally by cygwin. Included here to group everything in one place.
220 #define _SA_INTERNAL_MASK 0xf000 /* bits in this range are internal */
222 #define SIGHUP 1 /* hangup */
223 #define SIGINT 2 /* interrupt */
224 #define SIGQUIT 3 /* quit */
225 #define SIGILL 4 /* illegal instruction (not reset when caught) */
226 #define SIGTRAP 5 /* trace trap (not reset when caught) */
227 #define SIGABRT 6 /* used by abort */
228 #define SIGEMT 7 /* EMT instruction */
229 #define SIGFPE 8 /* floating point exception */
230 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
231 #define SIGBUS 10 /* bus error */
232 #define SIGSEGV 11 /* segmentation violation */
233 #define SIGSYS 12 /* bad argument to system call */
234 #define SIGPIPE 13 /* write on a pipe with no one to read it */
235 #define SIGALRM 14 /* alarm clock */
236 #define SIGTERM 15 /* software termination signal from kill */
237 #define SIGURG 16 /* urgent condition on IO channel */
238 #define SIGSTOP 17 /* sendable stop signal not from tty */
239 #define SIGTSTP 18 /* stop signal from tty */
240 #define SIGCONT 19 /* continue a stopped process */
241 #define SIGCHLD 20 /* to parent on child stop or exit */
242 #define SIGCLD 20 /* System V name for SIGCHLD */
243 #define SIGTTIN 21 /* to readers pgrp upon background tty read */
244 #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
245 #define SIGIO 23 /* input/output possible signal */
246 #define SIGPOLL SIGIO /* System V name for SIGIO */
247 #define SIGXCPU 24 /* exceeded CPU time limit */
248 #define SIGXFSZ 25 /* exceeded file size limit */
249 #define SIGVTALRM 26 /* virtual time alarm */
250 #define SIGPROF 27 /* profiling time alarm */
251 #define SIGWINCH 28 /* window changed */
252 #define SIGLOST 29 /* resource lost (eg, record-lock lost) */
253 #define SIGPWR SIGLOST /* power failure */
254 #define SIGUSR1 30 /* user defined signal 1 */
255 #define SIGUSR2 31 /* user defined signal 2 */
257 /* Real-Time signals per SUSv3. RT_SIGMAX is defined as 8 in limits.h */
259 #define SIGRTMAX ((SIGRTMIN) + 0)
260 #define NSIG 33 /* signal 0 implied */
262 #define SIG_HOLD ((_sig_func_ptr)2) /* Signal in signal mask */
264 void psiginfo (const siginfo_t *, const char *);
265 int sigwait (const sigset_t *, int *);
266 int sigwaitinfo (const sigset_t *, siginfo_t *);
270 _sig_func_ptr sigset (int, _sig_func_ptr);
272 int sigqueue(pid_t, int, const union sigval);
273 int siginterrupt (int, int);
274 #ifdef __INSIDE_CYGWIN__
275 extern const char *sys_sigabbrev[];
276 extern const char *sys_siglist[];
278 extern const char __declspec(dllimport) *sys_sigabbrev[];
279 extern const char __declspec(dllimport) *sys_siglist[];
285 #endif /*_CYGWIN_SIGNAL_H*/