* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / asm-sh / siginfo.h
blobca0b5a15738fe5aa13a5afe841a9e48980b6d103
1 #ifndef __ASM_SH_SIGINFO_H
2 #define __ASM_SH_SIGINFO_H
4 #include <linux/types.h>
6 /* XXX: This structure was copied from the Alpha; is there an iBCS version? */
8 typedef union sigval {
9 int sival_int;
10 void *sival_ptr;
11 } sigval_t;
13 #define SI_MAX_SIZE 128
14 #define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3)
16 typedef struct siginfo {
17 int si_signo;
18 int si_errno;
19 int si_code;
21 union {
22 int _pad[SI_PAD_SIZE];
24 /* kill() */
25 struct {
26 pid_t _pid; /* sender's pid */
27 uid_t _uid; /* sender's uid */
28 } _kill;
30 /* POSIX.1b timers */
31 struct {
32 unsigned int _timer1;
33 unsigned int _timer2;
34 } _timer;
36 /* POSIX.1b signals */
37 struct {
38 pid_t _pid; /* sender's pid */
39 uid_t _uid; /* sender's uid */
40 sigval_t _sigval;
41 } _rt;
43 /* SIGCHLD */
44 struct {
45 pid_t _pid; /* which child */
46 uid_t _uid; /* sender's uid */
47 int _status; /* exit code */
48 clock_t _utime;
49 clock_t _stime;
50 } _sigchld;
52 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
53 struct {
54 void *_addr; /* faulting insn/memory ref. */
55 } _sigfault;
57 /* SIGPOLL */
58 struct {
59 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
60 int _fd;
61 } _sigpoll;
62 } _sifields;
63 } siginfo_t;
66 * How these fields are to be accessed.
68 #define si_pid _sifields._kill._pid
69 #define si_uid _sifields._kill._uid
70 #define si_status _sifields._sigchld._status
71 #define si_utime _sifields._sigchld._utime
72 #define si_stime _sifields._sigchld._stime
73 #define si_value _sifields._rt._sigval
74 #define si_int _sifields._rt._sigval.sival_int
75 #define si_ptr _sifields._rt._sigval.sival_ptr
76 #define si_addr _sifields._sigfault._addr
77 #define si_band _sifields._sigpoll._band
78 #define si_fd _sifields._sigpoll._fd
81 * si_code values
82 * Digital reserves positive values for kernel-generated signals.
84 #define SI_USER 0 /* sent by kill, sigsend, raise */
85 #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
86 #define SI_QUEUE -1 /* sent by sigqueue */
87 #define SI_TIMER -2 /* sent by timer expiration */
88 #define SI_MESGQ -3 /* sent by real time mesq state change */
89 #define SI_ASYNCIO -4 /* sent by AIO completion */
90 #define SI_SIGIO -5 /* sent by queued SIGIO */
92 #define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
93 #define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
96 * SIGILL si_codes
98 #define ILL_ILLOPC 1 /* illegal opcode */
99 #define ILL_ILLOPN 2 /* illegal operand */
100 #define ILL_ILLADR 3 /* illegal addressing mode */
101 #define ILL_ILLTRP 4 /* illegal trap */
102 #define ILL_PRVOPC 5 /* privileged opcode */
103 #define ILL_PRVREG 6 /* privileged register */
104 #define ILL_COPROC 7 /* coprocessor error */
105 #define ILL_BADSTK 8 /* internal stack error */
106 #define NSIGILL 8
109 * SIGFPE si_codes
111 #define FPE_INTDIV 1 /* integer divide by zero */
112 #define FPE_INTOVF 2 /* integer overflow */
113 #define FPE_FLTDIV 3 /* floating point divide by zero */
114 #define FPE_FLTOVF 4 /* floating point overflow */
115 #define FPE_FLTUND 5 /* floating point underflow */
116 #define FPE_FLTRES 6 /* floating point inexact result */
117 #define FPE_FLTINV 7 /* floating point invalid operation */
118 #define FPE_FLTSUB 8 /* subscript out of range */
119 #define NSIGFPE 8
122 * SIGSEGV si_codes
124 #define SEGV_MAPERR 1 /* address not mapped to object */
125 #define SEGV_ACCERR 2 /* invalid permissions for mapped object */
126 #define NSIGSEGV 2
129 * SIGBUS si_codes
131 #define BUS_ADRALN 1 /* invalid address alignment */
132 #define BUS_ADRERR 2 /* non-existant physical address */
133 #define BUS_OBJERR 3 /* object specific hardware error */
134 #define NSIGBUS 3
137 * SIGTRAP si_codes
139 #define TRAP_BRKPT 1 /* process breakpoint */
140 #define TRAP_TRACE 2 /* process trace trap */
141 #define NSIGTRAP 2
144 * SIGCHLD si_codes
146 #define CLD_EXITED 1 /* child has exited */
147 #define CLD_KILLED 2 /* child was killed */
148 #define CLD_DUMPED 3 /* child terminated abnormally */
149 #define CLD_TRAPPED 4 /* traced child has trapped */
150 #define CLD_STOPPED 5 /* child has stopped */
151 #define CLD_CONTINUED 6 /* stopped child has continued */
152 #define NSIGCHLD
155 * SIGPOLL si_codes
157 #define POLL_IN 1 /* data input available */
158 #define POLL_OUT 2 /* output buffers available */
159 #define POLL_MSG 3 /* input message available */
160 #define POLL_ERR 4 /* i/o error */
161 #define POLL_PRI 5 /* high priority input available */
162 #define POLL_HUP 6 /* device disconnected */
163 #define NSIGPOLL 6
166 * sigevent definitions
168 * It seems likely that SIGEV_THREAD will have to be handled from
169 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
170 * thread manager then catches and does the appropriate nonsense.
171 * However, everything is written out here so as to not get lost.
173 #define SIGEV_SIGNAL 0 /* notify via signal */
174 #define SIGEV_NONE 1 /* other notification: meaningless */
175 #define SIGEV_THREAD 2 /* deliver via thread creation */
177 #define SIGEV_MAX_SIZE 64
178 #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
180 typedef struct sigevent {
181 sigval_t sigev_value;
182 int sigev_signo;
183 int sigev_notify;
184 union {
185 int _pad[SIGEV_PAD_SIZE];
187 struct {
188 void (*_function)(sigval_t);
189 void *_attribute; /* really pthread_attr_t */
190 } _sigev_thread;
191 } _sigev_un;
192 } sigevent_t;
194 #define sigev_notify_function _sigev_un._sigev_thread._function
195 #define sigev_notify_attributes _sigev_un._sigev_thread._attribute
197 #endif /* __ASM_SH_SIGINFO_H */