also update spec file ...
[linux-flexiantxendom0-3.2.10.git] / include / asm-mips64 / siginfo.h
1 /*
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, 2001 Ralf Baechle
7  * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8  */
9 #ifndef _ASM_SIGINFO_H
10 #define _ASM_SIGINFO_H
11
12 /* This structure matches IRIX 32/n32 ABIs for binary compatibility but
13    has Linux extensions.  */
14
15 #define SIGEV_PAD_SIZE  ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
16 #define SI_PAD_SIZE     ((SI_MAX_SIZE/sizeof(int)) - 4)
17 #define SI_PAD_SIZE32   ((SI_MAX_SIZE/sizeof(int)) - 3)
18
19 #define HAVE_ARCH_SIGINFO_T
20 #define HAVE_ARCH_SIGEVENT_T
21
22 /*
23  * We duplicate the generic versions - <asm-generic/siginfo.h> is just borked
24  * by design ...
25  */
26 #define HAVE_ARCH_COPY_SIGINFO
27 struct siginfo;
28
29 #include <asm-generic/siginfo.h>
30
31 typedef struct siginfo {
32         int si_signo;
33         int si_code;
34         int si_errno;
35
36         union {
37                 int _pad[SI_PAD_SIZE];
38
39                 /* kill() */
40                 struct {
41                         pid_t _pid;             /* sender's pid */
42                         uid_t _uid;             /* sender's uid */
43                 } _kill;
44
45                 /* SIGCHLD */
46                 struct {
47                         pid_t _pid;             /* which child */
48                         uid_t _uid;             /* sender's uid */
49                         clock_t _utime;
50                         int _status;            /* exit code */
51                         clock_t _stime;
52                 } _sigchld;
53
54                 /* IRIX SIGCHLD */
55                 struct {
56                         pid_t _pid;             /* which child */
57                         clock_t _utime;
58                         int _status;            /* exit code */
59                         clock_t _stime;
60                 } _irix_sigchld;
61
62                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
63                 struct {
64                         void *_addr; /* faulting insn/memory ref. */
65                 } _sigfault;
66
67                 /* SIGPOLL, SIGXFSZ (To do ...)  */
68                 struct {
69                         long _band;     /* POLL_IN, POLL_OUT, POLL_MSG */
70                         int _fd;
71                 } _sigpoll;
72
73                 /* POSIX.1b timers */
74                 struct {
75                         timer_t _tid;           /* timer id */
76                         int _overrun;           /* overrun count */
77                         char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
78                         sigval_t _sigval;       /* same as below */
79                         int _sys_private;       /* not to be passed to user */
80                 } _timer;
81
82                 /* POSIX.1b signals */
83                 struct {
84                         pid_t _pid;             /* sender's pid */
85                         uid_t _uid;             /* sender's uid */
86                         sigval_t _sigval;
87                 } _rt;
88
89         } _sifields;
90 } siginfo_t;
91
92 #ifdef __KERNEL__
93
94 typedef union sigval32 {
95         int sival_int;
96         s32 sival_ptr;
97 } sigval_t32;
98
99 typedef struct siginfo32 {
100         int si_signo;
101         int si_code;
102         int si_errno;
103
104         union {
105                 int _pad[SI_PAD_SIZE32];
106
107                 /* kill() */
108                 struct {
109                         __kernel_pid_t32 _pid;  /* sender's pid */
110                         __kernel_uid_t32 _uid;  /* sender's uid */
111                 } _kill;
112
113                 /* SIGCHLD */
114                 struct {
115                         __kernel_pid_t32 _pid;  /* which child */
116                         __kernel_uid_t32 _uid;  /* sender's uid */
117                         __kernel_clock_t32 _utime;
118                         int _status;            /* exit code */
119                         __kernel_clock_t32 _stime;
120                 } _sigchld;
121
122                 /* IRIX SIGCHLD */
123                 struct {
124                         __kernel_pid_t32 _pid;  /* which child */
125                         __kernel_clock_t32 _utime;
126                         int _status;            /* exit code */
127                         __kernel_clock_t32 _stime;
128                 } _irix_sigchld;
129
130                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
131                 struct {
132                         s32 _addr; /* faulting insn/memory ref. */
133                 } _sigfault;
134
135                 /* SIGPOLL, SIGXFSZ (To do ...)  */
136                 struct {
137                         int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
138                         int _fd;
139                 } _sigpoll;
140
141                 /* POSIX.1b timers */
142                 struct {
143                         unsigned int _timer1;
144                         unsigned int _timer2;
145                 } _timer;
146
147                 /* POSIX.1b signals */
148                 struct {
149                         __kernel_pid_t32 _pid;  /* sender's pid */
150                         __kernel_uid_t32 _uid;  /* sender's uid */
151                         sigval_t32 _sigval;
152                 } _rt;
153
154         } _sifields;
155 } siginfo_t32;
156
157 #endif /* __KERNEL__ */
158
159 /*
160  * si_code values
161  * Again these have been choosen to be IRIX compatible.
162  */
163 #undef SI_ASYNCIO
164 #undef SI_TIMER
165 #undef SI_MESGQ
166 #define SI_ASYNCIO      -2      /* sent by AIO completion */
167 #define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
168 #define SI_MESGQ        -4      /* sent by real time mesq state change */
169
170 /*
171  * sigevent definitions
172  *
173  * It seems likely that SIGEV_THREAD will have to be handled from
174  * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
175  * thread manager then catches and does the appropriate nonsense.
176  * However, everything is written out here so as to not get lost.
177  */
178 #undef SIGEV_NONE
179 #undef SIGEV_SIGNAL
180 #undef SIGEV_THREAD
181 #define SIGEV_NONE      128     /* other notification: meaningless */
182 #define SIGEV_SIGNAL    129     /* notify via signal */
183 #define SIGEV_CALLBACK  130     /* ??? */
184 #define SIGEV_THREAD    131     /* deliver via thread creation */
185
186 /* XXX This one isn't yet IRIX / ABI compatible.  */
187 typedef struct sigevent {
188         int     sigev_notify;
189         sigval_t        sigev_value;
190         int     sigev_signo;
191         union {
192                 int     _pad[SIGEV_PAD_SIZE];
193                 int     _tid;
194
195                 struct {
196                         void    (*_function)(sigval_t);
197                         void    *_attribute;    /* really pthread_attr_t */
198                 } _sigev_thread;
199         } _sigev_un;
200 } sigevent_t;
201
202 #ifdef __KERNEL__
203
204 /*
205  * Duplicated here because of <asm-generic/siginfo.h> braindamage ...
206  */
207 #include <linux/string.h>
208
209 static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
210 {
211         if (from->si_code < 0)
212                 memcpy(to, from, sizeof(*to));
213         else
214                 /* _sigchld is currently the largest know union member */
215                 memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
216 }
217
218 #endif
219
220 #endif /* _ASM_SIGINFO_H */