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