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