more changes on original files
[linux-2.4.git] / include / asm-sh / signal.h
1 #ifndef __ASM_SH_SIGNAL_H
2 #define __ASM_SH_SIGNAL_H
3
4 #include <linux/types.h>
5
6 /* Avoid too many header ordering problems.  */
7 struct siginfo;
8
9 #define _NSIG           64
10 #define _NSIG_BPW       32
11 #define _NSIG_WORDS     (_NSIG / _NSIG_BPW)
12
13 typedef unsigned long old_sigset_t;             /* at least 32 bits */
14
15 typedef struct {
16         unsigned long sig[_NSIG_WORDS];
17 } sigset_t;
18
19 #define SIGHUP           1
20 #define SIGINT           2
21 #define SIGQUIT          3
22 #define SIGILL           4
23 #define SIGTRAP          5
24 #define SIGABRT          6
25 #define SIGIOT           6
26 #define SIGBUS           7
27 #define SIGFPE           8
28 #define SIGKILL          9
29 #define SIGUSR1         10
30 #define SIGSEGV         11
31 #define SIGUSR2         12
32 #define SIGPIPE         13
33 #define SIGALRM         14
34 #define SIGTERM         15
35 #define SIGSTKFLT       16
36 #define SIGCHLD         17
37 #define SIGCONT         18
38 #define SIGSTOP         19
39 #define SIGTSTP         20
40 #define SIGTTIN         21
41 #define SIGTTOU         22
42 #define SIGURG          23
43 #define SIGXCPU         24
44 #define SIGXFSZ         25
45 #define SIGVTALRM       26
46 #define SIGPROF         27
47 #define SIGWINCH        28
48 #define SIGIO           29
49 #define SIGPOLL         SIGIO
50 /*
51 #define SIGLOST         29
52 */
53 #define SIGPWR          30
54 #define SIGSYS          31
55 #define SIGUNUSED       31
56
57 /* These should not be considered constants from userland.  */
58 #define SIGRTMIN        32
59 #define SIGRTMAX        (_NSIG-1)
60
61 /*
62  * SA_FLAGS values:
63  *
64  * SA_ONSTACK indicates that a registered stack_t will be used.
65  * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
66  * SA_RESTART flag to get restarting signals (which were the default long ago)
67  * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
68  * SA_RESETHAND clears the handler when the signal is delivered.
69  * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
70  * SA_NODEFER prevents the current signal from being masked in the handler.
71  *
72  * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
73  * Unix names RESETHAND and NODEFER respectively.
74  */
75 #define SA_NOCLDSTOP    0x00000001
76 #define SA_NOCLDWAIT    0x00000002 /* not supported yet */
77 #define SA_SIGINFO      0x00000004
78 #define SA_ONSTACK      0x08000000
79 #define SA_RESTART      0x10000000
80 #define SA_NODEFER      0x40000000
81 #define SA_RESETHAND    0x80000000
82
83 #define SA_NOMASK       SA_NODEFER
84 #define SA_ONESHOT      SA_RESETHAND
85 #define SA_INTERRUPT    0x20000000 /* dummy -- ignored */
86
87 #define SA_RESTORER     0x04000000
88
89 /* 
90  * sigaltstack controls
91  */
92 #define SS_ONSTACK      1
93 #define SS_DISABLE      2
94
95 #define MINSIGSTKSZ     2048
96 #define SIGSTKSZ        8192
97
98 #ifdef __KERNEL__
99
100 /*
101  * These values of sa_flags are used only by the kernel as part of the
102  * irq handling routines.
103  *
104  * SA_INTERRUPT is also used by the irq handling routines.
105  * SA_SHIRQ is for shared interrupt support on PCI and EISA.
106  */
107 #define SA_PROBE                SA_ONESHOT
108 #define SA_SAMPLE_RANDOM        SA_RESTART
109 #define SA_SHIRQ                0x04000000
110 #endif
111
112 #define SIG_BLOCK          0    /* for blocking signals */
113 #define SIG_UNBLOCK        1    /* for unblocking signals */
114 #define SIG_SETMASK        2    /* for setting the signal mask */
115
116 /* Type of a signal handler.  */
117 typedef void (*__sighandler_t)(int);
118
119 #define SIG_DFL ((__sighandler_t)0)     /* default signal handling */
120 #define SIG_IGN ((__sighandler_t)1)     /* ignore signal */
121 #define SIG_ERR ((__sighandler_t)-1)    /* error return from signal */
122
123 #ifdef __KERNEL__
124 struct old_sigaction {
125         __sighandler_t sa_handler;
126         old_sigset_t sa_mask;
127         unsigned long sa_flags;
128         void (*sa_restorer)(void);
129 };
130
131 struct sigaction {
132         __sighandler_t sa_handler;
133         unsigned long sa_flags;
134         void (*sa_restorer)(void);
135         sigset_t sa_mask;               /* mask last for extensibility */
136 };
137
138 struct k_sigaction {
139         struct sigaction sa;
140 };
141 #else
142 /* Here we must cater to libcs that poke about in kernel headers.  */
143
144 struct sigaction {
145         union {
146           __sighandler_t _sa_handler;
147           void (*_sa_sigaction)(int, struct siginfo *, void *);
148         } _u;
149         sigset_t sa_mask;
150         unsigned long sa_flags;
151         void (*sa_restorer)(void);
152 };
153
154 #define sa_handler      _u._sa_handler
155 #define sa_sigaction    _u._sa_sigaction
156
157 #endif /* __KERNEL__ */
158
159 typedef struct sigaltstack {
160         void *ss_sp;
161         int ss_flags;
162         size_t ss_size;
163 } stack_t;
164
165 #ifdef __KERNEL__
166 #include <asm/sigcontext.h>
167
168 #define sigmask(sig)    (1UL << ((sig) - 1))
169
170 #endif /* __KERNEL__ */
171
172 #endif /* __ASM_SH_SIGNAL_H */