]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/bits/siginfo.h
Update to LGPL v2.1.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / bits / siginfo.h
CommitLineData
e645ed3a 1/* siginfo_t, sigevent and constants. Linux/SPARC version.
5a9339d5 2 Copyright (C) 1997, 1998, 1999, 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
e645ed3a
UD
25#include <bits/wordsize.h>
26
2ace5721
UD
27#if (!defined __have_sigval_t \
28 && (defined _SIGNAL_H || defined __need_siginfo_t \
29 || defined __need_sigevent_t))
30# define __have_sigval_t 1
bd355af0
UD
31
32/* Type for data associated with a signal. */
33typedef union sigval
34 {
35 int sival_int;
36 void *sival_ptr;
37 } sigval_t;
2ace5721
UD
38#endif
39
40#if (!defined __have_siginfo_t \
41 && (defined _SIGNAL_H || defined __need_siginfo_t))
42# define __have_siginfo_t 1
bd355af0 43
4959e310 44# define __SI_MAX_SIZE 128
e645ed3a
UD
45# if __WORDSIZE == 64
46# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
47# else
48# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
49# endif
cbdee279
UD
50
51typedef struct siginfo
52 {
53 int si_signo; /* Signal number. */
54 int si_errno; /* If non-zero, an errno value associated with
55 this signal, as defined in <errno.h>. */
56 int si_code; /* Signal code. */
57
58 union
59 {
4959e310 60 int _pad[__SI_PAD_SIZE];
cbdee279
UD
61
62 /* kill(). */
63 struct
64 {
65 __pid_t si_pid; /* Sending process ID. */
66 __uid_t si_uid; /* Real user ID of sending process. */
67 } _kill;
68
69 /* POSIX.1b timers. */
70 struct
71 {
72 unsigned int _timer1;
73 unsigned int _timer2;
74 } _timer;
75
76 /* POSIX.1b signals. */
77 struct
78 {
79 __pid_t si_pid; /* Sending process ID. */
80 __uid_t si_uid; /* Real user ID of sending process. */
81 sigval_t si_sigval; /* Signal value. */
82 } _rt;
83
84 /* SIGCHLD. */
85 struct
86 {
87 __pid_t si_pid; /* Which child. */
ec986e23 88 __uid_t si_uid; /* Real user ID of sending process. */
cbdee279
UD
89 int si_status; /* Exit value or signal. */
90 __clock_t si_utime;
91 __clock_t si_stime;
92 } _sigchld;
93
94 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */
95 struct
96 {
97 void *si_addr; /* Faulting insn/memory ref. */
98 } _sigfault;
99
100 /* SIGPOLL. */
101 struct
102 {
8ce9ea0c 103 long int si_band; /* Band event for SIGPOLL. */
cbdee279
UD
104 int si_fd;
105 } _sigpoll;
106 } _sifields;
107 } siginfo_t;
108
109
110/* X/Open requires some more fields with fixed names. */
bd355af0
UD
111# define si_pid _sifields._kill.si_pid
112# define si_uid _sifields._kill.si_uid
be1dd949
UD
113# define si_timer1 _sifields._timer._timer1
114# define si_timer2 _sifields._timer._timer2
bd355af0
UD
115# define si_status _sifields._sigchld.si_status
116# define si_utime _sifields._sigchld.si_utime
117# define si_stime _sifields._sigchld.si_stime
118# define si_value _sifields._rt.si_sigval
119# define si_int _sifields._rt.si_sigval.sival_int
120# define si_ptr _sifields._rt.si_sigval.sival_ptr
121# define si_addr _sifields._sigfault.si_addr
122# define si_band _sifields._sigpoll.si_band
123# define si_fd _sifields._sigpoll.si_fd
cbdee279
UD
124
125
126/* Values for `si_code'. Positive values are reserved for kernel-generated
127 signals. */
128enum
129{
2ace5721
UD
130 SI_ASYNCNL = -6, /* Sent by asynch name lookup completion. */
131# define SI_ASYNCNL SI_ASYNCNL
132 SI_SIGIO, /* Sent by queued SIGIO. */
df777c40
UD
133# define SI_SIGIO SI_SIGIO
134 SI_ASYNCIO, /* Sent by AIO completion. */
bd355af0 135# define SI_ASYNCIO SI_ASYNCIO
cbdee279 136 SI_MESGQ, /* Sent by real time mesq state change. */
bd355af0 137# define SI_MESGQ SI_MESGQ
cbdee279 138 SI_TIMER, /* Sent by timer expiration. */
bd355af0 139# define SI_TIMER SI_TIMER
cbdee279 140 SI_QUEUE, /* Sent by sigqueue. */
bd355af0 141# define SI_QUEUE SI_QUEUE
56bd5855 142 SI_USER, /* Sent by kill, sigsend, raise. */
bd355af0 143# define SI_USER SI_USER
56bd5855
UD
144 SI_KERNEL = 0x80 /* Send by kernel. */
145#define SI_KERNEL SI_KERNEL
cbdee279
UD
146};
147
148
149/* `si_code' values for SIGILL signal. */
150enum
151{
152 ILL_ILLOPC = 1, /* Illegal opcode. */
bd355af0 153# define ILL_ILLOPC ILL_ILLOPC
e3efc215 154 ILL_ILLOPN, /* Illegal operand. */
bd355af0 155# define ILL_ILLOPN ILL_ILLOPN
cbdee279 156 ILL_ILLADR, /* Illegal addressing mode. */
bd355af0 157# define ILL_ILLADR ILL_ILLADR
cbdee279 158 ILL_ILLTRP, /* Illegal trap. */
bd355af0 159# define ILL_ILLTRP ILL_ILLTRP
cbdee279 160 ILL_PRVOPC, /* Privileged opcode. */
bd355af0 161# define ILL_PRVOPC ILL_PRVOPC
cbdee279 162 ILL_PRVREG, /* Privileged register. */
bd355af0 163# define ILL_PRVREG ILL_PRVREG
cbdee279 164 ILL_COPROC, /* Coprocessor error. */
bd355af0 165# define ILL_COPROC ILL_COPROC
cbdee279 166 ILL_BADSTK /* Internal stack error. */
bd355af0 167# define ILL_BADSTK ILL_BADSTK
cbdee279
UD
168};
169
170/* `si_code' values for SIGFPE signal. */
171enum
172{
173 FPE_INTDIV = 1, /* Integer divide by zero. */
bd355af0 174# define FPE_INTDIV FPE_INTDIV
cbdee279 175 FPE_INTOVF, /* Integer overflow. */
bd355af0 176# define FPE_INTOVF FPE_INTOVF
cbdee279 177 FPE_FLTDIV, /* Floating point divide by zero. */
bd355af0 178# define FPE_FLTDIV FPE_FLTDIV
cbdee279 179 FPE_FLTOVF, /* Floating point overflow. */
bd355af0 180# define FPE_FLTOVF FPE_FLTOVF
cbdee279 181 FPE_FLTUND, /* Floating point underflow. */
bd355af0 182# define FPE_FLTUND FPE_FLTUND
cbdee279 183 FPE_FLTRES, /* Floating point inexact result. */
bd355af0 184# define FPE_FLTRES FPE_FLTRES
cbdee279 185 FPE_FLTINV, /* Floating point invalid operation. */
bd355af0 186# define FPE_FLTINV FPE_FLTINV
cbdee279 187 FPE_FLTSUB /* Subscript out of range. */
bd355af0 188# define FPE_FLTSUB FPE_FLTSUB
cbdee279
UD
189};
190
191/* `si_code' values for SIGSEGV signal. */
192enum
193{
194 SEGV_MAPERR = 1, /* Address not mapped to object. */
bd355af0 195# define SEGV_MAPERR SEGV_MAPERR
cbdee279 196 SEGV_ACCERR /* Invalid permissions for mapped object. */
bd355af0 197# define SEGV_ACCERR SEGV_ACCERR
cbdee279
UD
198};
199
200/* `si_code' values for SIGBUS signal. */
201enum
202{
203 BUS_ADRALN = 1, /* Invalid address alignment. */
bd355af0 204# define BUS_ADRALN BUS_ADRALN
cbdee279 205 BUS_ADRERR, /* Non-existant physical address. */
bd355af0 206# define BUS_ADRERR BUS_ADRERR
cbdee279 207 BUS_OBJERR /* Object specific hardware error. */
bd355af0 208# define BUS_OBJERR BUS_OBJERR
cbdee279
UD
209};
210
211/* `si_code' values for SIGTRAP signal. */
212enum
213{
214 TRAP_BRKPT = 1, /* Process breakpoint. */
bd355af0 215# define TRAP_BRKPT TRAP_BRKPT
cbdee279 216 TRAP_TRACE /* Process trace trap. */
bd355af0 217# define TRAP_TRACE TRAP_TRACE
cbdee279
UD
218};
219
220/* `si_code' values for SIGCHLD signal. */
221enum
222{
223 CLD_EXITED = 1, /* Child has exited. */
bd355af0 224# define CLD_EXITED CLD_EXITED
cbdee279 225 CLD_KILLED, /* Child was killed. */
bd355af0 226# define CLD_KILLED CLD_KILLED
cbdee279 227 CLD_DUMPED, /* Child terminated abnormally. */
bd355af0 228# define CLD_DUMPED CLD_DUMPED
cbdee279 229 CLD_TRAPPED, /* Traced child has trapped. */
bd355af0 230# define CLD_TRAPPED CLD_TRAPPED
cbdee279 231 CLD_STOPPED, /* Child has stopped. */
bd355af0 232# define CLD_STOPPED CLD_STOPPED
cbdee279 233 CLD_CONTINUED /* Stopped child has continued. */
bd355af0 234# define CLD_CONTINUED CLD_CONTINUED
cbdee279
UD
235};
236
237/* `si_code' values for SIGPOLL signal. */
238enum
239{
240 POLL_IN = 1, /* Data input available. */
bd355af0 241# define POLL_IN POLL_IN
cbdee279 242 POLL_OUT, /* Output buffers available. */
bd355af0 243# define POLL_OUT POLL_OUT
cbdee279 244 POLL_MSG, /* Input message available. */
bd355af0 245# define POLL_MSG POLL_MSG
cbdee279 246 POLL_ERR, /* I/O error. */
bd355af0 247# define POLL_ERR POLL_ERR
cbdee279 248 POLL_PRI, /* High priority input available. */
bd355af0 249# define POLL_PRI POLL_PRI
cbdee279 250 POLL_HUP /* Device disconnected. */
bd355af0 251# define POLL_HUP POLL_HUP
cbdee279
UD
252};
253
bd355af0
UD
254# undef __need_siginfo_t
255#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */
256
257
2ace5721
UD
258#if (defined _SIGNAL_H || defined __need_sigevent_t) \
259 && !defined __have_sigevent_t
bd355af0 260# define __have_sigevent_t 1
cbdee279
UD
261
262/* Structure to transport application-defined values with signals. */
4959e310 263# define __SIGEV_MAX_SIZE 64
e645ed3a
UD
264# if __WORDSIZE == 64
265# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
266# else
267# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
268# endif
cbdee279 269
5a9339d5
UD
270/* Forward declaration of the `pthread_attr_t' type. */
271struct __pthread_attr_s;
272
cbdee279
UD
273typedef struct sigevent
274 {
275 sigval_t sigev_value;
276 int sigev_signo;
277 int sigev_notify;
278
279 union
280 {
4959e310 281 int _pad[__SIGEV_PAD_SIZE];
cbdee279
UD
282
283 struct
284 {
4d3a563f 285 void (*_function) (sigval_t); /* Function to start. */
5a9339d5 286 struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */
cbdee279
UD
287 } _sigev_thread;
288 } _sigev_un;
289 } sigevent_t;
290
291/* POSIX names to access some of the members. */
bd355af0
UD
292# define sigev_notify_function _sigev_un._sigev_thread._function
293# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
cbdee279
UD
294
295/* `sigev_notify' values. */
296enum
297{
298 SIGEV_SIGNAL = 0, /* Notify via signal. */
bd355af0 299# define SIGEV_SIGNAL SIGEV_SIGNAL
cbdee279 300 SIGEV_NONE, /* Other notification: meaningless. */
bd355af0 301# define SIGEV_NONE SIGEV_NONE
cbdee279 302 SIGEV_THREAD /* Deliver via thread creation. */
bd355af0 303# define SIGEV_THREAD SIGEV_THREAD
cbdee279 304};
bd355af0
UD
305
306#endif /* have _SIGNAL_H. */