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

Subversion Repositories or1k

[/] [or1k/] [tags/] [LINUX_2_4_26_OR32/] [linux/] [linux-2.4/] [include/] [asm-ppc/] [siginfo.h] - Blame information for rev 1780

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

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

powered by: WebSVN 2.1.0

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