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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-mips/] [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
/*
2
 * This file is subject to the terms and conditions of the GNU General Public
3
 * License.  See the file "COPYING" in the main directory of this archive
4
 * for more details.
5
 *
6
 * Copyright (C) 1998, 1999, 2003 by Ralf Baechle
7
 */
8
#ifndef _ASM_SIGINFO_H
9
#define _ASM_SIGINFO_H
10
 
11
#include <linux/types.h>
12
 
13
/* This structure matches IRIX 32/n32 ABIs for binary compatibility. */
14
 
15
typedef union sigval {
16
        int sival_int;
17
        void *sival_ptr;
18
} sigval_t;
19
 
20
/* This structure matches IRIX 32/n32 ABIs for binary compatibility but
21
   has Linux extensions.  */
22
 
23
#define SI_MAX_SIZE     128
24
#define SI_PAD_SIZE     ((SI_MAX_SIZE/sizeof(int)) - 3)
25
 
26
typedef struct siginfo {
27
        int si_signo;
28
        int si_code;
29
        int si_errno;
30
 
31
        union {
32
                int _pad[SI_PAD_SIZE];
33
 
34
                /* kill() */
35
                struct {
36
                        pid_t _pid;             /* sender's pid */
37
                        uid_t _uid;             /* sender's uid */
38
                } _kill;
39
 
40
                /* SIGCHLD */
41
                struct {
42
                        pid_t _pid;             /* which child */
43
                        uid_t _uid;             /* sender's uid */
44
                        clock_t _utime;
45
                        int _status;            /* exit code */
46
                        clock_t _stime;
47
                } _sigchld;
48
 
49
                /* IRIX SIGCHLD */
50
                struct {
51
                        pid_t _pid;             /* which child */
52
                        clock_t _utime;
53
                        int _status;            /* exit code */
54
                        clock_t _stime;
55
                } _irix_sigchld;
56
 
57
                /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
58
                struct {
59
                        void *_addr; /* faulting insn/memory ref. */
60
                } _sigfault;
61
 
62
                /* SIGPOLL, SIGXFSZ (To do ...)  */
63
                struct {
64
                        int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
65
                        int _fd;
66
                } _sigpoll;
67
 
68
                /* POSIX.1b timers */
69
                struct {
70
                        unsigned int _timer1;
71
                        unsigned int _timer2;
72
                } _timer;
73
 
74
                /* POSIX.1b signals */
75
                struct {
76
                        pid_t _pid;             /* sender's pid */
77
                        uid_t _uid;             /* sender's uid */
78
                        sigval_t _sigval;
79
                } _rt;
80
 
81
        } _sifields;
82
} siginfo_t;
83
 
84
/*
85
 * How these fields are to be accessed.
86
 */
87
#define si_pid          _sifields._kill._pid
88
#define si_uid          _sifields._kill._uid
89
#define si_status       _sifields._sigchld._status
90
#define si_utime        _sifields._sigchld._utime
91
#define si_stime        _sifields._sigchld._stime
92
#define si_value        _sifields._rt._sigval
93
#define si_int          _sifields._rt._sigval.sival_int
94
#define si_ptr          _sifields._rt._sigval.sival_ptr
95
#define si_addr         _sifields._sigfault._addr
96
#define si_band         _sifields._sigpoll._band
97
#define si_fd           _sifields._sigpoll._fd
98
 
99
#ifdef __KERNEL__
100
#define __SI_MASK       0xffff0000
101
#define __SI_KILL       (0 << 16)
102
#define __SI_TIMER      (1 << 16)
103
#define __SI_POLL       (2 << 16)
104
#define __SI_FAULT      (3 << 16)
105
#define __SI_CHLD       (4 << 16)
106
#define __SI_RT         (5 << 16)
107
#define __SI_CODE(T,N)  ((T) << 16 | ((N) & 0xffff))
108
#else
109
#define __SI_KILL       0
110
#define __SI_TIMER      0
111
#define __SI_POLL       0
112
#define __SI_FAULT      0
113
#define __SI_CHLD       0
114
#define __SI_RT         0
115
#define __SI_CODE(T,N)  (N)
116
#endif
117
 
118
/*
119
 * si_code values
120
 * Again these have been choosen to be IRIX compatible.
121
 */
122
#define SI_USER         0        /* sent by kill, sigsend, raise */
123
#define SI_KERNEL       0x80    /* sent by the kernel from somewhere */
124
#define SI_QUEUE        -1      /* sent by sigqueue */
125
#define SI_ASYNCIO      -2      /* sent by AIO completion */
126
#define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
127
#define SI_MESGQ        -4      /* sent by real time mesq state change */
128
#define SI_SIGIO        -5      /* sent by queued SIGIO */
129
#define SI_TKILL        -6      /* sent by tkill system call */
130
 
131
#define SI_FROMUSER(siptr)      ((siptr)->si_code <= 0)
132
#define SI_FROMKERNEL(siptr)    ((siptr)->si_code > 0)
133
 
134
/*
135
 * SIGILL si_codes
136
 */
137
#define ILL_ILLOPC      (__SI_FAULT|1)  /* illegal opcode */
138
#define ILL_ILLOPN      (__SI_FAULT|2)  /* illegal operand */
139
#define ILL_ILLADR      (__SI_FAULT|3)  /* illegal addressing mode */
140
#define ILL_ILLTRP      (__SI_FAULT|4)  /* illegal trap */
141
#define ILL_PRVOPC      (__SI_FAULT|5)  /* privileged opcode */
142
#define ILL_PRVREG      (__SI_FAULT|6)  /* privileged register */
143
#define ILL_COPROC      (__SI_FAULT|7)  /* coprocessor error */
144
#define ILL_BADSTK      (__SI_FAULT|8)  /* internal stack error */
145
#define NSIGILL         8
146
 
147
/*
148
 * SIGFPE si_codes
149
 */
150
#define FPE_INTDIV      (__SI_FAULT|1)  /* integer divide by zero */
151
#define FPE_INTOVF      (__SI_FAULT|2)  /* integer overflow */
152
#define FPE_FLTDIV      (__SI_FAULT|3)  /* floating point divide by zero */
153
#define FPE_FLTOVF      (__SI_FAULT|4)  /* floating point overflow */
154
#define FPE_FLTUND      (__SI_FAULT|5)  /* floating point underflow */
155
#define FPE_FLTRES      (__SI_FAULT|6)  /* floating point inexact result */
156
#define FPE_FLTINV      (__SI_FAULT|7)  /* floating point invalid operation */
157
#define FPE_FLTSUB      (__SI_FAULT|8)  /* subscript out of range */
158
#define NSIGFPE         8
159
 
160
/*
161
 * SIGSEGV si_codes
162
 */
163
#define SEGV_MAPERR     (__SI_FAULT|1)  /* address not mapped to object */
164
#define SEGV_ACCERR     (__SI_FAULT|2)  /* invalid permissions for mapped object */
165
#define NSIGSEGV        2
166
 
167
/*
168
 * SIGBUS si_codes
169
 */
170
#define BUS_ADRALN      (__SI_FAULT|1)  /* invalid address alignment */
171
#define BUS_ADRERR      (__SI_FAULT|2)  /* non-existant physical address */
172
#define BUS_OBJERR      (__SI_FAULT|3)  /* object specific hardware error */
173
#define NSIGBUS         3
174
 
175
/*
176
 * SIGTRAP si_codes
177
 */
178
#define TRAP_BRKPT      (__SI_FAULT|1)  /* process breakpoint */
179
#define TRAP_TRACE      (__SI_FAULT|2)  /* process trace trap */
180
#define NSIGTRAP        2
181
 
182
/*
183
 * SIGCHLD si_codes
184
 */
185
#define CLD_EXITED      (__SI_CHLD|1)   /* child has exited */
186
#define CLD_KILLED      (__SI_CHLD|2)   /* child was killed */
187
#define CLD_DUMPED      (__SI_CHLD|3)   /* child terminated abnormally */
188
#define CLD_TRAPPED     (__SI_CHLD|4)   /* traced child has trapped */
189
#define CLD_STOPPED     (__SI_CHLD|5)   /* child has stopped */
190
#define CLD_CONTINUED   (__SI_CHLD|6)   /* stopped child has continued */
191
#define NSIGCHLD        6
192
 
193
/*
194
 * SIGPOLL si_codes
195
 */
196
#define POLL_IN         (__SI_POLL|1)   /* data input available */
197
#define POLL_OUT        (__SI_POLL|2)   /* output buffers available */
198
#define POLL_MSG        (__SI_POLL|3)   /* input message available */
199
#define POLL_ERR        (__SI_POLL|4)   /* i/o error */
200
#define POLL_PRI        (__SI_POLL|5)   /* high priority input available */
201
#define POLL_HUP        (__SI_POLL|6)   /* device disconnected */
202
#define NSIGPOLL        6
203
 
204
/*
205
 * sigevent definitions
206
 *
207
 * It seems likely that SIGEV_THREAD will have to be handled from
208
 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
209
 * thread manager then catches and does the appropriate nonsense.
210
 * However, everything is written out here so as to not get lost.
211
 */
212
#define SIGEV_SIGNAL    0        /* notify via signal */
213
#define SIGEV_NONE      1       /* other notification: meaningless */
214
#define SIGEV_THREAD    2       /* deliver via thread creation */
215
 
216
#define SIGEV_MAX_SIZE  64
217
#define SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
218
#define SIGEV_PAD_SIZE  ((SIGEV_MAX_SIZE-SIGEV_HEAD_SIZE) / sizeof(int))
219
 
220
typedef struct sigevent {
221
        sigval_t sigev_value;
222
        int sigev_signo;
223
        int sigev_notify;
224
        union {
225
                int _pad[SIGEV_PAD_SIZE];
226
 
227
                struct {
228
                        void (*_function)(sigval_t);
229
                        void *_attribute;       /* really pthread_attr_t */
230
                } _sigev_thread;
231
        } _sigev_un;
232
} sigevent_t;
233
 
234
#define sigev_notify_function   _sigev_un._sigev_thread._function
235
#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
236
 
237
#ifdef __KERNEL__
238
#include <linux/string.h>
239
 
240
static inline void copy_siginfo(siginfo_t *to, siginfo_t *from)
241
{
242
        if (from->si_code < 0)
243
                memcpy(to, from, sizeof(siginfo_t));
244
        else
245
                /* _sigchld is currently the largest know union member */
246
                memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
247
}
248
 
249
extern int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from);
250
 
251
#endif /* __KERNEL__ */
252
 
253
#endif /* _ASM_SIGINFO_H */

powered by: WebSVN 2.1.0

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