Update.
[glibc.git] / sysdeps / unix / sysv / linux / bits / siginfo.h
blob9426c13ee72f617bd92c25de5bacbd99659325ec
1 /* siginfo_t, sigevent and constants. Linux/SPARC version.
2 Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
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
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #if !defined _SIGNAL_H && !defined __need_siginfo_t
21 # error "Never include this file directly. Use <signal.h> instead"
22 #endif
24 #include <bits/wordsize.h>
26 #if (!defined __have_siginfo_t \
27 && (defined _SIGNAL_H || defined __need_siginfo_t))
28 # define __have_siginfo_t 1
30 /* Type for data associated with a signal. */
31 typedef union sigval
33 int sival_int;
34 void *sival_ptr;
35 } sigval_t;
37 # define __SI_MAX_SIZE 128
38 # if __WORDSIZE == 64
39 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
40 # else
41 # define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
42 # endif
44 typedef struct siginfo
46 int si_signo; /* Signal number. */
47 int si_errno; /* If non-zero, an errno value associated with
48 this signal, as defined in <errno.h>. */
49 int si_code; /* Signal code. */
51 union
53 int _pad[__SI_PAD_SIZE];
55 /* kill(). */
56 struct
58 __pid_t si_pid; /* Sending process ID. */
59 __uid_t si_uid; /* Real user ID of sending process. */
60 } _kill;
62 /* POSIX.1b timers. */
63 struct
65 unsigned int _timer1;
66 unsigned int _timer2;
67 } _timer;
69 /* POSIX.1b signals. */
70 struct
72 __pid_t si_pid; /* Sending process ID. */
73 __uid_t si_uid; /* Real user ID of sending process. */
74 sigval_t si_sigval; /* Signal value. */
75 } _rt;
77 /* SIGCHLD. */
78 struct
80 __pid_t si_pid; /* Which child. */
81 __uid_t si_uid; /* Real user ID of sending process. */
82 int si_status; /* Exit value or signal. */
83 __clock_t si_utime;
84 __clock_t si_stime;
85 } _sigchld;
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
88 struct
90 void *si_addr; /* Faulting insn/memory ref. */
91 } _sigfault;
93 /* SIGPOLL. */
94 struct
96 int si_band; /* Band event for SIGPOLL. */
97 int si_fd;
98 } _sigpoll;
99 } _sifields;
100 } siginfo_t;
103 /* X/Open requires some more fields with fixed names. */
104 # define si_pid _sifields._kill.si_pid
105 # define si_uid _sifields._kill.si_uid
106 # define si_timer1 _sifields._timer._timer1
107 # define si_timer2 _sifields._timer._timer2
108 # define si_status _sifields._sigchld.si_status
109 # define si_utime _sifields._sigchld.si_utime
110 # define si_stime _sifields._sigchld.si_stime
111 # define si_value _sifields._rt.si_sigval
112 # define si_int _sifields._rt.si_sigval.sival_int
113 # define si_ptr _sifields._rt.si_sigval.sival_ptr
114 # define si_addr _sifields._sigfault.si_addr
115 # define si_band _sifields._sigpoll.si_band
116 # define si_fd _sifields._sigpoll.si_fd
119 /* Values for `si_code'. Positive values are reserved for kernel-generated
120 signals. */
121 enum
123 SI_SIGIO = -5, /* Sent by queued SIGIO. */
124 # define SI_SIGIO SI_SIGIO
125 SI_ASYNCIO, /* Sent by AIO completion. */
126 # define SI_ASYNCIO SI_ASYNCIO
127 SI_MESGQ, /* Sent by real time mesq state change. */
128 # define SI_MESGQ SI_MESGQ
129 SI_TIMER, /* Sent by timer expiration. */
130 # define SI_TIMER SI_TIMER
131 SI_QUEUE, /* Sent by sigqueue. */
132 # define SI_QUEUE SI_QUEUE
133 SI_USER, /* Sent by kill, sigsend, raise. */
134 # define SI_USER SI_USER
135 SI_KERNEL = 0x80 /* Send by kernel. */
136 #define SI_KERNEL SI_KERNEL
140 /* `si_code' values for SIGILL signal. */
141 enum
143 ILL_ILLOPC = 1, /* Illegal opcode. */
144 # define ILL_ILLOPC ILL_ILLOPC
145 ILL_ILLOPN, /* Illegal operand. */
146 # define ILL_ILLOPN ILL_ILLOPN
147 ILL_ILLADR, /* Illegal addressing mode. */
148 # define ILL_ILLADR ILL_ILLADR
149 ILL_ILLTRP, /* Illegal trap. */
150 # define ILL_ILLTRP ILL_ILLTRP
151 ILL_PRVOPC, /* Privileged opcode. */
152 # define ILL_PRVOPC ILL_PRVOPC
153 ILL_PRVREG, /* Privileged register. */
154 # define ILL_PRVREG ILL_PRVREG
155 ILL_COPROC, /* Coprocessor error. */
156 # define ILL_COPROC ILL_COPROC
157 ILL_BADSTK /* Internal stack error. */
158 # define ILL_BADSTK ILL_BADSTK
161 /* `si_code' values for SIGFPE signal. */
162 enum
164 FPE_INTDIV = 1, /* Integer divide by zero. */
165 # define FPE_INTDIV FPE_INTDIV
166 FPE_INTOVF, /* Integer overflow. */
167 # define FPE_INTOVF FPE_INTOVF
168 FPE_FLTDIV, /* Floating point divide by zero. */
169 # define FPE_FLTDIV FPE_FLTDIV
170 FPE_FLTOVF, /* Floating point overflow. */
171 # define FPE_FLTOVF FPE_FLTOVF
172 FPE_FLTUND, /* Floating point underflow. */
173 # define FPE_FLTUND FPE_FLTUND
174 FPE_FLTRES, /* Floating point inexact result. */
175 # define FPE_FLTRES FPE_FLTRES
176 FPE_FLTINV, /* Floating point invalid operation. */
177 # define FPE_FLTINV FPE_FLTINV
178 FPE_FLTSUB /* Subscript out of range. */
179 # define FPE_FLTSUB FPE_FLTSUB
182 /* `si_code' values for SIGSEGV signal. */
183 enum
185 SEGV_MAPERR = 1, /* Address not mapped to object. */
186 # define SEGV_MAPERR SEGV_MAPERR
187 SEGV_ACCERR /* Invalid permissions for mapped object. */
188 # define SEGV_ACCERR SEGV_ACCERR
191 /* `si_code' values for SIGBUS signal. */
192 enum
194 BUS_ADRALN = 1, /* Invalid address alignment. */
195 # define BUS_ADRALN BUS_ADRALN
196 BUS_ADRERR, /* Non-existant physical address. */
197 # define BUS_ADRERR BUS_ADRERR
198 BUS_OBJERR /* Object specific hardware error. */
199 # define BUS_OBJERR BUS_OBJERR
202 /* `si_code' values for SIGTRAP signal. */
203 enum
205 TRAP_BRKPT = 1, /* Process breakpoint. */
206 # define TRAP_BRKPT TRAP_BRKPT
207 TRAP_TRACE /* Process trace trap. */
208 # define TRAP_TRACE TRAP_TRACE
211 /* `si_code' values for SIGCHLD signal. */
212 enum
214 CLD_EXITED = 1, /* Child has exited. */
215 # define CLD_EXITED CLD_EXITED
216 CLD_KILLED, /* Child was killed. */
217 # define CLD_KILLED CLD_KILLED
218 CLD_DUMPED, /* Child terminated abnormally. */
219 # define CLD_DUMPED CLD_DUMPED
220 CLD_TRAPPED, /* Traced child has trapped. */
221 # define CLD_TRAPPED CLD_TRAPPED
222 CLD_STOPPED, /* Child has stopped. */
223 # define CLD_STOPPED CLD_STOPPED
224 CLD_CONTINUED /* Stopped child has continued. */
225 # define CLD_CONTINUED CLD_CONTINUED
228 /* `si_code' values for SIGPOLL signal. */
229 enum
231 POLL_IN = 1, /* Data input available. */
232 # define POLL_IN POLL_IN
233 POLL_OUT, /* Output buffers available. */
234 # define POLL_OUT POLL_OUT
235 POLL_MSG, /* Input message available. */
236 # define POLL_MSG POLL_MSG
237 POLL_ERR, /* I/O error. */
238 # define POLL_ERR POLL_ERR
239 POLL_PRI, /* High priority input available. */
240 # define POLL_PRI POLL_PRI
241 POLL_HUP /* Device disconnected. */
242 # define POLL_HUP POLL_HUP
245 # undef __need_siginfo_t
246 #endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */
249 #if defined _SIGNAL_H && !defined __have_sigevent_t
250 # define __have_sigevent_t 1
252 /* Structure to transport application-defined values with signals. */
253 # define __SIGEV_MAX_SIZE 64
254 # if __WORDSIZE == 64
255 # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
256 # else
257 # define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
258 # endif
260 typedef struct sigevent
262 sigval_t sigev_value;
263 int sigev_signo;
264 int sigev_notify;
266 union
268 int _pad[__SIGEV_PAD_SIZE];
270 struct
272 void (*_function) (sigval_t); /* Function to start. */
273 void *_attribute; /* Really pthread_attr_t. */
274 } _sigev_thread;
275 } _sigev_un;
276 } sigevent_t;
278 /* POSIX names to access some of the members. */
279 # define sigev_notify_function _sigev_un._sigev_thread._function
280 # define sigev_notify_attributes _sigev_un._sigev_thread._attribute
282 /* `sigev_notify' values. */
283 enum
285 SIGEV_SIGNAL = 0, /* Notify via signal. */
286 # define SIGEV_SIGNAL SIGEV_SIGNAL
287 SIGEV_NONE, /* Other notification: meaningless. */
288 # define SIGEV_NONE SIGEV_NONE
289 SIGEV_THREAD /* Deliver via thread creation. */
290 # define SIGEV_THREAD SIGEV_THREAD
293 #endif /* have _SIGNAL_H. */