]>
Commit | Line | Data |
---|---|---|
cbdee279 | 1 | /* siginfo_t, sigevent and constants. Stub version. |
2ace5721 | 2 | Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. |
cbdee279 UD |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
cbdee279 UD |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
cbdee279 | 14 | |
41bdb6e2 AJ |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
cbdee279 | 19 | |
2ace5721 UD |
20 | #if !defined _SIGNAL_H && !defined __need_siginfo_t \ |
21 | && !defined __need_sigevent_t | |
cbdee279 UD |
22 | # error "Never include this file directly. Use <signal.h> instead" |
23 | #endif | |
24 | ||
2ace5721 UD |
25 | #if (!defined __have_sigval_t \ |
26 | && (defined _SIGNAL_H || defined __need_siginfo_t \ | |
27 | || defined __need_sigevent_t)) | |
28 | # define __have_sigval_t 1 | |
bd355af0 UD |
29 | |
30 | /* Type for data associated with a signal. */ | |
31 | typedef union sigval | |
32 | { | |
33 | int sival_int; | |
34 | void *sival_ptr; | |
35 | } sigval_t; | |
2ace5721 UD |
36 | #endif |
37 | ||
38 | #if (!defined __have_siginfo_t \ | |
39 | && (defined _SIGNAL_H || defined __need_siginfo_t)) | |
40 | # define __have_siginfo_t 1 | |
bd355af0 | 41 | |
cbdee279 UD |
42 | typedef struct siginfo |
43 | { | |
44 | int si_signo; /* Signal number. */ | |
45 | int si_errno; /* If non-zero, an errno value associated with | |
46 | this signal, as defined in <errno.h>. */ | |
47 | int si_code; /* Signal code. */ | |
48 | __pid_t si_pid; /* Sending process ID. */ | |
49 | __uid_t si_uid; /* Real user ID of sending process. */ | |
50 | void *si_addr; /* Address of faulting instruction. */ | |
51 | int si_status; /* Exit value or signal. */ | |
52 | long int si_band; /* Band event for SIGPOLL. */ | |
53 | union sigval si_value; /* Signal value. */ | |
54 | } siginfo_t; | |
55 | ||
56 | ||
57 | /* Values for `si_code'. Positive values are reserved for kernel-generated | |
58 | signals. */ | |
59 | enum | |
60 | { | |
61 | SI_ASYNCIO = -4, /* Sent by AIO completion. */ | |
bd355af0 | 62 | # define SI_ASYNCIO SI_ASYNCIO |
cbdee279 | 63 | SI_MESGQ, /* Sent by real time mesq state change. */ |
bd355af0 | 64 | # define SI_MESGQ SI_MESGQ |
cbdee279 | 65 | SI_TIMER, /* Sent by timer expiration. */ |
bd355af0 | 66 | # define SI_TIMER SI_TIMER |
cbdee279 | 67 | SI_QUEUE, /* Sent by sigqueue. */ |
bd355af0 | 68 | # define SI_QUEUE SI_QUEUE |
cbdee279 | 69 | SI_USER /* Sent by kill, sigsend, raise. */ |
bd355af0 | 70 | # define SI_USER SI_USER |
cbdee279 UD |
71 | }; |
72 | ||
73 | ||
74 | /* `si_code' values for SIGILL signal. */ | |
75 | enum | |
76 | { | |
77 | ILL_ILLOPC = 1, /* Illegal opcode. */ | |
bd355af0 | 78 | # define ILL_ILLOPC ILL_ILLOPC |
a334319f | 79 | ILL_ILL_OPN, /* Illegal operand. */ |
bd355af0 | 80 | # define ILL_ILLOPN ILL_ILLOPN |
cbdee279 | 81 | ILL_ILLADR, /* Illegal addressing mode. */ |
bd355af0 | 82 | # define ILL_ILLADR ILL_ILLADR |
cbdee279 | 83 | ILL_ILLTRP, /* Illegal trap. */ |
bd355af0 | 84 | # define ILL_ILLTRP ILL_ILLTRP |
cbdee279 | 85 | ILL_PRVOPC, /* Privileged opcode. */ |
bd355af0 | 86 | # define ILL_PRVOPC ILL_PRVOPC |
cbdee279 | 87 | ILL_PRVREG, /* Privileged register. */ |
bd355af0 | 88 | # define ILL_PRVREG ILL_PRVREG |
cbdee279 | 89 | ILL_COPROC, /* Coprocessor error. */ |
bd355af0 | 90 | # define ILL_COPROC ILL_COPROC |
cbdee279 | 91 | ILL_BADSTK /* Internal stack error. */ |
bd355af0 | 92 | # define ILL_BADSTK ILL_BADSTK |
cbdee279 UD |
93 | }; |
94 | ||
95 | /* `si_code' values for SIGFPE signal. */ | |
96 | enum | |
97 | { | |
98 | FPE_INTDIV = 1, /* Integer divide by zero. */ | |
bd355af0 | 99 | # define FPE_INTDIV FPE_INTDIV |
cbdee279 | 100 | FPE_INTOVF, /* Integer overflow. */ |
bd355af0 | 101 | # define FPE_INTOVF FPE_INTOVF |
cbdee279 | 102 | FPE_FLTDIV, /* Floating point divide by zero. */ |
bd355af0 | 103 | # define FPE_FLTDIV FPE_FLTDIV |
cbdee279 | 104 | FPE_FLTOVF, /* Floating point overflow. */ |
bd355af0 | 105 | # define FPE_FLTOVF FPE_FLTOVF |
cbdee279 | 106 | FPE_FLTUND, /* Floating point underflow. */ |
bd355af0 | 107 | # define FPE_FLTUND FPE_FLTUND |
cbdee279 | 108 | FPE_FLTRES, /* Floating point inexact result. */ |
bd355af0 | 109 | # define FPE_FLTRES FPE_FLTRES |
cbdee279 | 110 | FPE_FLTINV, /* Floating point invalid operation. */ |
bd355af0 | 111 | # define FPE_FLTINV FPE_FLTINV |
cbdee279 | 112 | FPE_FLTSUB /* Subscript out of range. */ |
bd355af0 | 113 | # define FPE_FLTSUB FPE_FLTSUB |
cbdee279 UD |
114 | }; |
115 | ||
116 | /* `si_code' values for SIGSEGV signal. */ | |
117 | enum | |
118 | { | |
119 | SEGV_MAPERR = 1, /* Address not mapped to object. */ | |
bd355af0 | 120 | # define SEGV_MAPERR SEGV_MAPERR |
cbdee279 | 121 | SEGV_ACCERR /* Invalid permissions for mapped object. */ |
bd355af0 | 122 | # define SEGV_ACCERR SEGV_ACCERR |
cbdee279 UD |
123 | }; |
124 | ||
125 | /* `si_code' values for SIGBUS signal. */ | |
126 | enum | |
127 | { | |
128 | BUS_ADRALN = 1, /* Invalid address alignment. */ | |
bd355af0 | 129 | # define BUS_ADRALN BUS_ADRALN |
cbdee279 | 130 | BUS_ADRERR, /* Non-existant physical address. */ |
bd355af0 | 131 | # define BUS_ADRERR BUS_ADRERR |
cbdee279 | 132 | BUS_OBJERR /* Object specific hardware error. */ |
bd355af0 | 133 | # define BUS_OBJERR BUS_OBJERR |
cbdee279 UD |
134 | }; |
135 | ||
136 | /* `si_code' values for SIGTRAP signal. */ | |
137 | enum | |
138 | { | |
139 | TRAP_BRKPT = 1, /* Process breakpoint. */ | |
bd355af0 | 140 | # define TRAP_BRKPT TRAP_BRKPT |
cbdee279 | 141 | TRAP_TRACE /* Process trace trap. */ |
bd355af0 | 142 | # define TRAP_TRACE TRAP_TRACE |
cbdee279 UD |
143 | }; |
144 | ||
145 | /* `si_code' values for SIGCHLD signal. */ | |
146 | enum | |
147 | { | |
148 | CLD_EXITED = 1, /* Child has exited. */ | |
bd355af0 | 149 | # define CLD_EXITED CLD_EXITED |
cbdee279 | 150 | CLD_KILLED, /* Child was killed. */ |
bd355af0 | 151 | # define CLD_KILLED CLD_KILLED |
cbdee279 | 152 | CLD_DUMPED, /* Child terminated abnormally. */ |
bd355af0 | 153 | # define CLD_DUMPED CLD_DUMPED |
cbdee279 | 154 | CLD_TRAPPED, /* Traced child has trapped. */ |
bd355af0 | 155 | # define CLD_TRAPPED CLD_TRAPPED |
cbdee279 | 156 | CLD_STOPPED, /* Child has stopped. */ |
bd355af0 | 157 | # define CLD_STOPPED CLD_STOPPED |
cbdee279 | 158 | CLD_CONTINUED /* Stopped child has continued. */ |
bd355af0 | 159 | # define CLD_CONTINUED CLD_CONTINUED |
cbdee279 UD |
160 | }; |
161 | ||
162 | /* `si_code' values for SIGPOLL signal. */ | |
163 | enum | |
164 | { | |
165 | POLL_IN = 1, /* Data input available. */ | |
bd355af0 | 166 | # define POLL_IN POLL_IN |
cbdee279 | 167 | POLL_OUT, /* Output buffers available. */ |
bd355af0 | 168 | # define POLL_OUT POLL_OUT |
cbdee279 | 169 | POLL_MSG, /* Input message available. */ |
bd355af0 | 170 | # define POLL_MSG POLL_MSG |
cbdee279 | 171 | POLL_ERR, /* I/O error. */ |
bd355af0 | 172 | # define POLL_ERR POLL_ERR |
cbdee279 | 173 | POLL_PRI, /* High priority input available. */ |
bd355af0 | 174 | # define POLL_PRI POLL_PRI |
cbdee279 | 175 | POLL_HUP /* Device disconnected. */ |
bd355af0 | 176 | # define POLL_HUP POLL_HUP |
cbdee279 UD |
177 | }; |
178 | ||
bd355af0 UD |
179 | # undef __need_siginfo_t |
180 | #endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ | |
181 | ||
182 | ||
2ace5721 UD |
183 | #if (defined _SIGNAL_H || defined __need_sigevent_t) \ |
184 | && !defined __have_sigevent_t | |
bd355af0 | 185 | # define __have_sigevent_t 1 |
cbdee279 UD |
186 | |
187 | /* Structure to transport application-defined values with signals. */ | |
bd355af0 UD |
188 | # define SIGEV_MAX_SIZE 64 |
189 | # define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE / sizeof (int)) - 3) | |
cbdee279 UD |
190 | |
191 | typedef struct sigevent | |
192 | { | |
193 | sigval_t sigev_value; | |
194 | int sigev_signo; | |
195 | int sigev_notify; | |
bcaad6ee | 196 | void (*sigev_notify_function) (sigval_t); /* Function to start. */ |
cbdee279 UD |
197 | void *sigev_notify_attributes; /* Really pthread_attr_t.*/ |
198 | } sigevent_t; | |
199 | ||
200 | /* `sigev_notify' values. */ | |
201 | enum | |
202 | { | |
203 | SIGEV_SIGNAL = 0, /* Notify via signal. */ | |
bd355af0 | 204 | # define SIGEV_SIGNAL SIGEV_SIGNAL |
cbdee279 | 205 | SIGEV_NONE, /* Other notification: meaningless. */ |
bd355af0 | 206 | # define SIGEV_NONE SIGEV_NONE |
cbdee279 | 207 | SIGEV_THREAD /* Deliver via thread creation. */ |
bd355af0 | 208 | # define SIGEV_THREAD SIGEV_THREAD |
cbdee279 | 209 | }; |
bd355af0 UD |
210 | |
211 | #endif /* have _SIGNAL_H. */ |