Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / asm-mips / compat-signal.h
blob368a99e5c3e1e2213928fb27996252614ad7b848
1 #ifndef __ASM_COMPAT_SIGNAL_H
2 #define __ASM_COMPAT_SIGNAL_H
4 #include <linux/bug.h>
5 #include <linux/compat.h>
6 #include <linux/compiler.h>
8 #include <asm/signal.h>
9 #include <asm/siginfo.h>
11 #include <asm/uaccess.h>
13 #define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
15 typedef struct compat_siginfo {
16 int si_signo;
17 int si_code;
18 int si_errno;
20 union {
21 int _pad[SI_PAD_SIZE32];
23 /* kill() */
24 struct {
25 compat_pid_t _pid; /* sender's pid */
26 compat_uid_t _uid; /* sender's uid */
27 } _kill;
29 /* SIGCHLD */
30 struct {
31 compat_pid_t _pid; /* which child */
32 compat_uid_t _uid; /* sender's uid */
33 int _status; /* exit code */
34 compat_clock_t _utime;
35 compat_clock_t _stime;
36 } _sigchld;
38 /* IRIX SIGCHLD */
39 struct {
40 compat_pid_t _pid; /* which child */
41 compat_clock_t _utime;
42 int _status; /* exit code */
43 compat_clock_t _stime;
44 } _irix_sigchld;
46 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
47 struct {
48 s32 _addr; /* faulting insn/memory ref. */
49 } _sigfault;
51 /* SIGPOLL, SIGXFSZ (To do ...) */
52 struct {
53 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
54 int _fd;
55 } _sigpoll;
57 /* POSIX.1b timers */
58 struct {
59 timer_t _tid; /* timer id */
60 int _overrun; /* overrun count */
61 compat_sigval_t _sigval;/* same as below */
62 int _sys_private; /* not to be passed to user */
63 } _timer;
65 /* POSIX.1b signals */
66 struct {
67 compat_pid_t _pid; /* sender's pid */
68 compat_uid_t _uid; /* sender's uid */
69 compat_sigval_t _sigval;
70 } _rt;
72 } _sifields;
73 } compat_siginfo_t;
75 static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
76 const sigset_t *s)
78 int err;
80 BUG_ON(sizeof(*d) != sizeof(*s));
81 BUG_ON(_NSIG_WORDS != 2);
83 err = __put_user(s->sig[0], &d->sig[0]);
84 err |= __put_user(s->sig[0] >> 32, &d->sig[1]);
85 err |= __put_user(s->sig[1], &d->sig[2]);
86 err |= __put_user(s->sig[1] >> 32, &d->sig[3]);
88 return err;
91 static inline int __copy_conv_sigset_from_user(sigset_t *d,
92 const compat_sigset_t __user *s)
94 int err;
95 union sigset_u {
96 sigset_t s;
97 compat_sigset_t c;
98 } *u = (union sigset_u *) d;
100 BUG_ON(sizeof(*d) != sizeof(*s));
101 BUG_ON(_NSIG_WORDS != 2);
103 #ifdef CONFIG_CPU_BIG_ENDIAN
104 err = __get_user(u->c.sig[1], &s->sig[0]);
105 err |= __get_user(u->c.sig[0], &s->sig[1]);
106 err |= __get_user(u->c.sig[3], &s->sig[2]);
107 err |= __get_user(u->c.sig[2], &s->sig[3]);
108 #endif
109 #ifdef CONFIG_CPU_LITTLE_ENDIAN
110 err = __get_user(u->c.sig[0], &s->sig[0]);
111 err |= __get_user(u->c.sig[1], &s->sig[1]);
112 err |= __get_user(u->c.sig[2], &s->sig[2]);
113 err |= __get_user(u->c.sig[3], &s->sig[3]);
114 #endif
116 return err;
119 #endif /* __ASM_COMPAT_SIGNAL_H */