OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-sparc64/] [siginfo.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
#ifndef _SPARC64_SIGINFO_H
2
#define _SPARC64_SIGINFO_H
3
 
4
#include <linux/types.h>
5
 
6
typedef union sigval {
7
        int sival_int;
8
        void *sival_ptr;
9
} sigval_t;
10
 
11
#ifdef __KERNEL__
12
 
13
typedef union sigval32 {
14
        int sival_int;
15
        u32 sival_ptr;
16
} sigval_t32;
17
 
18
#endif /* __KERNEL__ */
19
 
20
#define SI_MAX_SIZE     128
21
#define SI_PAD_SIZE     ((SI_MAX_SIZE/sizeof(int)) - 4)
22
#define SI_PAD_SIZE32   ((SI_MAX_SIZE/sizeof(int)) - 3)
23
 
24
typedef struct siginfo {
25
        int si_signo;
26
        int si_errno;
27
        int si_code;
28
 
29
        union {
30
                int _pad[SI_PAD_SIZE];
31
 
32
                /* kill() */
33
                struct {
34
                        pid_t _pid;             /* sender's pid */
35
                        uid_t _uid;             /* sender's uid */
36
                } _kill;
37
 
38
                /* POSIX.1b timers */
39
                struct {
40
                        unsigned int _timer1;
41
                        unsigned int _timer2;
42
                } _timer;
43
 
44
                /* POSIX.1b signals */
45
                struct {
46
                        pid_t _pid;             /* sender's pid */
47
                        uid_t _uid;             /* sender's uid */
48
                        sigval_t _sigval;
49
                } _rt;
50
 
51
                /* SIGCHLD */
52
                struct {
53
                        pid_t _pid;             /* which child */
54
                        uid_t _uid;             /* sender's uid */
55
                        int _status;            /* exit code */
56
                        clock_t _utime;
57
                        clock_t _stime;
58
                } _sigchld;
59
 
60
                /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
61
                struct {
62
                        void *_addr; /* faulting insn/memory ref. */
63
                        int  _trapno; /* TRAP # which caused the signal */
64
                } _sigfault;
65
 
66
                /* SIGPOLL */
67
                struct {
68
                        long _band;     /* POLL_IN, POLL_OUT, POLL_MSG */
69
                        int _fd;
70
                } _sigpoll;
71
        } _sifields;
72
} siginfo_t;
73
 
74
#ifdef __KERNEL__
75
 
76
typedef struct siginfo32 {
77
        int si_signo;
78
        int si_errno;
79
        int si_code;
80
 
81
        union {
82
                int _pad[SI_PAD_SIZE32];
83
 
84
                /* kill() */
85
                struct {
86
                        __kernel_pid_t32 _pid;          /* sender's pid */
87
                        unsigned int _uid;              /* sender's uid */
88
                } _kill;
89
 
90
                /* POSIX.1b timers */
91
                struct {
92
                        unsigned int _timer1;
93
                        unsigned int _timer2;
94
                } _timer;
95
 
96
                /* POSIX.1b signals */
97
                struct {
98
                        __kernel_pid_t32 _pid;          /* sender's pid */
99
                        unsigned int _uid;              /* sender's uid */
100
                        sigval_t32 _sigval;
101
                } _rt;
102
 
103
                /* SIGCHLD */
104
                struct {
105
                        __kernel_pid_t32 _pid;          /* which child */
106
                        unsigned int _uid;              /* sender's uid */
107
                        int _status;                    /* exit code */
108
                        __kernel_clock_t32 _utime;
109
                        __kernel_clock_t32 _stime;
110
                } _sigchld;
111
 
112
                /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
113
                struct {
114
                        u32 _addr; /* faulting insn/memory ref. */
115
                        int _trapno;
116
                } _sigfault;
117
 
118
                /* SIGPOLL */
119
                struct {
120
                        int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
121
                        int _fd;
122
                } _sigpoll;
123
        } _sifields;
124
} siginfo_t32;
125
 
126
#endif /* __KERNEL__ */
127
 
128
/*
129
 * How these fields are to be accessed.
130
 */
131
#define si_pid          _sifields._kill._pid
132
#define si_uid          _sifields._kill._uid
133
#define si_status       _sifields._sigchld._status
134
#define si_utime        _sifields._sigchld._utime
135
#define si_stime        _sifields._sigchld._stime
136
#define si_value        _sifields._rt._sigval
137
#define si_int          _sifields._rt._sigval.sival_int
138
#define si_ptr          _sifields._rt._sigval.sival_ptr
139
#define si_addr         _sifields._sigfault._addr
140
#define si_trapno       _sifields._sigfault._trapno
141
#define si_band         _sifields._sigpoll._band
142
#define si_fd           _sifields._sigpoll._fd
143
 
144
#ifdef __KERNEL__
145
#define __SI_MASK       0xffff0000
146
#define __SI_KILL       (0 << 16)
147
#define __SI_TIMER      (1 << 16)
148
#define __SI_POLL       (2 << 16)
149
#define __SI_FAULT      (3 << 16)
150
#define __SI_CHLD       (4 << 16)
151
#define __SI_RT         (5 << 16)
152
#define __SI_CODE(T,N)  ((T) << 16 | ((N) & 0xffff))
153
#else
154
#define __SI_KILL       0
155
#define __SI_TIMER      0
156
#define __SI_POLL       0
157
#define __SI_FAULT      0
158
#define __SI_CHLD       0
159
#define __SI_RT         0
160
#define __SI_CODE(T,N)  (N)
161
#endif
162
 
163
/*
164
 * si_code values
165
 * Digital reserves positive values for kernel-generated signals.
166
 */
167
#define SI_NOINFO       32767           /* no information in siginfo_t */
168
#define SI_USER         0                /* sent by kill, sigsend, raise */
169
#define SI_KERNEL       0x80            /* sent by the kernel from somewhere */
170
#define SI_QUEUE        -1              /* sent by sigqueue */
171
#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
172
#define SI_MESGQ        -3              /* sent by real time mesq state change */
173
#define SI_ASYNCIO      -4              /* sent by AIO completion */
174
#define SI_SIGIO        -5              /* sent by queued SIGIO */
175
#define SI_TKILL        -6              /* sent by tkill system call */
176
 
177
#define SI_FROMUSER(siptr)      ((siptr)->si_code <= 0)
178
#define SI_FROMKERNEL(siptr)    ((siptr)->si_code > 0)
179
 
180
/*
181
 * SIGILL si_codes
182
 */
183
#define ILL_ILLOPC      (__SI_FAULT|1)  /* illegal opcode */
184
#define ILL_ILLOPN      (__SI_FAULT|2)  /* illegal operand */
185
#define ILL_ILLADR      (__SI_FAULT|3)  /* illegal addressing mode */
186
#define ILL_ILLTRP      (__SI_FAULT|4)  /* illegal trap */
187
#define ILL_PRVOPC      (__SI_FAULT|5)  /* privileged opcode */
188
#define ILL_PRVREG      (__SI_FAULT|6)  /* privileged register */
189
#define ILL_COPROC      (__SI_FAULT|7)  /* coprocessor error */
190
#define ILL_BADSTK      (__SI_FAULT|8)  /* internal stack error */
191
#define NSIGILL         8
192
 
193
/*
194
 * SIGFPE si_codes
195
 */
196
#define FPE_INTDIV      (__SI_FAULT|1)  /* integer divide by zero */
197
#define FPE_INTOVF      (__SI_FAULT|2)  /* integer overflow */
198
#define FPE_FLTDIV      (__SI_FAULT|3)  /* floating point divide by zero */
199
#define FPE_FLTOVF      (__SI_FAULT|4)  /* floating point overflow */
200
#define FPE_FLTUND      (__SI_FAULT|5)  /* floating point underflow */
201
#define FPE_FLTRES      (__SI_FAULT|6)  /* floating point inexact result */
202
#define FPE_FLTINV      (__SI_FAULT|7)  /* floating point invalid operation */
203
#define FPE_FLTSUB      (__SI_FAULT|8)  /* subscript out of range */
204
#define NSIGFPE         8
205
 
206
/*
207
 * SIGSEGV si_codes
208
 */
209
#define SEGV_MAPERR     (__SI_FAULT|1)  /* address not mapped to object */
210
#define SEGV_ACCERR     (__SI_FAULT|2)  /* invalid permissions for mapped object */
211
#define NSIGSEGV        2
212
 
213
/*
214
 * SIGBUS si_codes
215
 */
216
#define BUS_ADRALN      (__SI_FAULT|1)  /* invalid address alignment */
217
#define BUS_ADRERR      (__SI_FAULT|2)  /* non-existant physical address */
218
#define BUS_OBJERR      (__SI_FAULT|3)  /* object specific hardware error */
219
#define NSIGBUS         3
220
 
221
/*
222
 * SIGTRAP si_codes
223
 */
224
#define TRAP_BRKPT      (__SI_FAULT|1)  /* process breakpoint */
225
#define TRAP_TRACE      (__SI_FAULT|2)  /* process trace trap */
226
#define NSIGTRAP        2
227
 
228
/*
229
 * SIGCHLD si_codes
230
 */
231
#define CLD_EXITED      (__SI_CHLD|1)   /* child has exited */
232
#define CLD_KILLED      (__SI_CHLD|2)   /* child was killed */
233
#define CLD_DUMPED      (__SI_CHLD|3)   /* child terminated abnormally */
234
#define CLD_TRAPPED     (__SI_CHLD|4)   /* traced child has trapped */
235
#define CLD_STOPPED     (__SI_CHLD|5)   /* child has stopped */
236
#define CLD_CONTINUED   (__SI_CHLD|6)   /* stopped child has continued */
237
#define NSIGCHLD        6
238
 
239
/*
240
 * SIGPOLL si_codes
241
 */
242
#define POLL_IN         (__SI_POLL|1)   /* data input available */
243
#define POLL_OUT        (__SI_POLL|2)   /* output buffers available */
244
#define POLL_MSG        (__SI_POLL|3)   /* input message available */
245
#define POLL_ERR        (__SI_POLL|4)   /* i/o error */
246
#define POLL_PRI        (__SI_POLL|5)   /* high priority input available */
247
#define POLL_HUP        (__SI_POLL|6)   /* device disconnected */
248
#define NSIGPOLL        6
249
 
250
/*
251
 * SIGEMT si_codes
252
 */
253
#define EMT_TAGOVF      (__SI_FAULT|1)  /* tag overflow */
254
#define NSIGEMT         1
255
 
256
/*
257
 * sigevent definitions
258
 *
259
 * It seems likely that SIGEV_THREAD will have to be handled from
260
 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
261
 * thread manager then catches and does the appropriate nonsense.
262
 * However, everything is written out here so as to not get lost.
263
 */
264
#define SIGEV_SIGNAL    0        /* notify via signal */
265
#define SIGEV_NONE      1       /* other notification: meaningless */
266
#define SIGEV_THREAD    2       /* deliver via thread creation */
267
 
268
#define SIGEV_MAX_SIZE  64
269
#define SIGEV_PAD_SIZE  ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
270
#define SIGEV_PAD_SIZE32 ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
271
 
272
typedef struct sigevent {
273
        sigval_t sigev_value;
274
        int sigev_signo;
275
        int sigev_notify;
276
        union {
277
                int _pad[SIGEV_PAD_SIZE];
278
 
279
                struct {
280
                        void (*_function)(sigval_t);
281
                        void *_attribute;       /* really pthread_attr_t */
282
                } _sigev_thread;
283
        } _sigev_un;
284
} sigevent_t;
285
 
286
#ifdef __KERNEL__
287
 
288
typedef struct sigevent32 {
289
        sigval_t sigev_value;
290
        int sigev_signo;
291
        int sigev_notify;
292
        union {
293
                int _pad[SIGEV_PAD_SIZE32];
294
 
295
                struct {
296
                        u32 _function;
297
                        u32 _attribute; /* really pthread_attr_t */
298
                } _sigev_thread;
299
        } _sigev_un;
300
} sigevent_t32;
301
 
302
#include <linux/string.h>
303
 
304
extern inline void copy_siginfo(siginfo_t *to, siginfo_t *from)
305
{
306
        if (from->si_code < 0)
307
                *to = *from;
308
        else
309
                /* _sigchld is currently the largest know union member */
310
                memcpy(to, from, 4*sizeof(int) + sizeof(from->_sifields._sigchld));
311
}
312
 
313
extern int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from);
314
extern int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
315
 
316
#endif /* __KERNEL__ */
317
 
318
#define sigev_notify_function   _sigev_un._sigev_thread._function
319
#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
320
 
321
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.