blob: 20ebeb875ee6250938f883598b0cbf73da4dc31b [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
Ralf Baechle629c83f2005-05-19 12:08:04 +000013#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
15
16#define HAVE_ARCH_SIGINFO_T
17
18/*
19 * We duplicate the generic versions - <asm-generic/siginfo.h> is just borked
20 * by design ...
21 */
22#define HAVE_ARCH_COPY_SIGINFO
23struct siginfo;
24
25/*
26 * Careful to keep union _sifields from shifting ...
27 */
Ralf Baechle875d43e2005-09-03 15:56:16 -070028#ifdef CONFIG_32BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
30#endif
Ralf Baechle875d43e2005-09-03 15:56:16 -070031#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
33#endif
34
35#include <asm-generic/siginfo.h>
36
37typedef struct siginfo {
38 int si_signo;
39 int si_code;
40 int si_errno;
41 int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
42
43 union {
44 int _pad[SI_PAD_SIZE];
45
46 /* kill() */
47 struct {
48 pid_t _pid; /* sender's pid */
49 __ARCH_SI_UID_T _uid; /* sender's uid */
50 } _kill;
51
52 /* POSIX.1b timers */
53 struct {
54 timer_t _tid; /* timer id */
55 int _overrun; /* overrun count */
56 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
57 sigval_t _sigval; /* same as below */
58 int _sys_private; /* not to be passed to user */
59 } _timer;
60
61 /* POSIX.1b signals */
62 struct {
63 pid_t _pid; /* sender's pid */
64 __ARCH_SI_UID_T _uid; /* sender's uid */
65 sigval_t _sigval;
66 } _rt;
67
68 /* SIGCHLD */
69 struct {
70 pid_t _pid; /* which child */
71 __ARCH_SI_UID_T _uid; /* sender's uid */
72 int _status; /* exit code */
73 clock_t _utime;
74 clock_t _stime;
75 } _sigchld;
76
77 /* IRIX SIGCHLD */
78 struct {
79 pid_t _pid; /* which child */
80 clock_t _utime;
81 int _status; /* exit code */
82 clock_t _stime;
83 } _irix_sigchld;
84
85 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
86 struct {
87 void __user *_addr; /* faulting insn/memory ref. */
88#ifdef __ARCH_SI_TRAPNO
89 int _trapno; /* TRAP # which caused the signal */
90#endif
Andi Kleene92ba6d2010-10-08 20:36:15 +020091 short _addr_lsb;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 } _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
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300104 * Again these have been chosen to be IRIX compatible.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 */
106#undef SI_ASYNCIO
107#undef SI_TIMER
108#undef SI_MESGQ
109#define SI_ASYNCIO -2 /* sent by AIO completion */
Ralf Baechle21a151d2007-10-11 23:46:15 +0100110#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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
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 */