]> git.ipfire.org Git - people/ms/linux.git/blob - include/asm-mips/siginfo.h
Linux-2.6.12-rc2
[people/ms/linux.git] / include / asm-mips / 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, 2003 Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9 #ifndef _ASM_SIGINFO_H
10 #define _ASM_SIGINFO_H
11
12 #include <linux/config.h>
13
14 #define SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
15 #define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE-SIGEV_HEAD_SIZE) / sizeof(int))
16 #undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
17
18 #define HAVE_ARCH_SIGINFO_T
19
20 /*
21 * We duplicate the generic versions - <asm-generic/siginfo.h> is just borked
22 * by design ...
23 */
24 #define HAVE_ARCH_COPY_SIGINFO
25 struct siginfo;
26
27 /*
28 * Careful to keep union _sifields from shifting ...
29 */
30 #ifdef CONFIG_MIPS32
31 #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
32 #endif
33 #ifdef CONFIG_MIPS64
34 #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
35 #endif
36
37 #include <asm-generic/siginfo.h>
38
39 typedef struct siginfo {
40 int si_signo;
41 int si_code;
42 int si_errno;
43 int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
44
45 union {
46 int _pad[SI_PAD_SIZE];
47
48 /* kill() */
49 struct {
50 pid_t _pid; /* sender's pid */
51 __ARCH_SI_UID_T _uid; /* sender's uid */
52 } _kill;
53
54 /* POSIX.1b timers */
55 struct {
56 timer_t _tid; /* timer id */
57 int _overrun; /* overrun count */
58 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
59 sigval_t _sigval; /* same as below */
60 int _sys_private; /* not to be passed to user */
61 } _timer;
62
63 /* POSIX.1b signals */
64 struct {
65 pid_t _pid; /* sender's pid */
66 __ARCH_SI_UID_T _uid; /* sender's uid */
67 sigval_t _sigval;
68 } _rt;
69
70 /* SIGCHLD */
71 struct {
72 pid_t _pid; /* which child */
73 __ARCH_SI_UID_T _uid; /* sender's uid */
74 int _status; /* exit code */
75 clock_t _utime;
76 clock_t _stime;
77 } _sigchld;
78
79 /* IRIX SIGCHLD */
80 struct {
81 pid_t _pid; /* which child */
82 clock_t _utime;
83 int _status; /* exit code */
84 clock_t _stime;
85 } _irix_sigchld;
86
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
88 struct {
89 void __user *_addr; /* faulting insn/memory ref. */
90 #ifdef __ARCH_SI_TRAPNO
91 int _trapno; /* TRAP # which caused the signal */
92 #endif
93 } _sigfault;
94
95 /* SIGPOLL, SIGXFSZ (To do ...) */
96 struct {
97 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
98 int _fd;
99 } _sigpoll;
100 } _sifields;
101 } siginfo_t;
102
103 /*
104 * si_code values
105 * Again these have been choosen to be IRIX compatible.
106 */
107 #undef SI_ASYNCIO
108 #undef SI_TIMER
109 #undef SI_MESGQ
110 #define SI_ASYNCIO -2 /* sent by AIO completion */
111 #define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
112 #define SI_MESGQ __SI_CODE(__SI_MESGQ,-4) /* sent by real time mesq state change */
113
114 #ifdef __KERNEL__
115
116 /*
117 * Duplicated here because of <asm-generic/siginfo.h> braindamage ...
118 */
119 #include <linux/string.h>
120
121 static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
122 {
123 if (from->si_code < 0)
124 memcpy(to, from, sizeof(*to));
125 else
126 /* _sigchld is currently the largest know union member */
127 memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
128 }
129
130 #endif
131
132 #endif /* _ASM_SIGINFO_H */