ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-x86_64 / signal.h
1 #ifndef _ASMx8664_SIGNAL_H
2 #define _ASMx8664_SIGNAL_H
3
4 #ifndef __ASSEMBLY__
5 #include <linux/types.h>
6 #include <linux/linkage.h>
7 #include <linux/time.h>
8
9 /* Avoid too many header ordering problems.  */
10 struct siginfo;
11
12 #ifdef __KERNEL__
13 /* Most things should be clean enough to redefine this at will, if care
14    is taken to make libc match.  */
15
16 #define _NSIG           64
17 #define _NSIG_BPW       64
18 #define _NSIG_WORDS     (_NSIG / _NSIG_BPW)
19
20 typedef unsigned long old_sigset_t;             /* at least 32 bits */
21
22 typedef struct {
23         unsigned long sig[_NSIG_WORDS];
24 } sigset_t;
25
26
27 struct pt_regs; 
28 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
29
30
31 #else
32 /* Here we must cater to libcs that poke about in kernel headers.  */
33
34 #define NSIG            32
35 typedef unsigned long sigset_t;
36
37 #endif /* __KERNEL__ */
38 #endif
39
40 #define SIGHUP           1
41 #define SIGINT           2
42 #define SIGQUIT          3
43 #define SIGILL           4
44 #define SIGTRAP          5
45 #define SIGABRT          6
46 #define SIGIOT           6
47 #define SIGBUS           7
48 #define SIGFPE           8
49 #define SIGKILL          9
50 #define SIGUSR1         10
51 #define SIGSEGV         11
52 #define SIGUSR2         12
53 #define SIGPIPE         13
54 #define SIGALRM         14
55 #define SIGTERM         15
56 #define SIGSTKFLT       16
57 #define SIGCHLD         17
58 #define SIGCONT         18
59 #define SIGSTOP         19
60 #define SIGTSTP         20
61 #define SIGTTIN         21
62 #define SIGTTOU         22
63 #define SIGURG          23
64 #define SIGXCPU         24
65 #define SIGXFSZ         25
66 #define SIGVTALRM       26
67 #define SIGPROF         27
68 #define SIGWINCH        28
69 #define SIGIO           29
70 #define SIGPOLL         SIGIO
71 /*
72 #define SIGLOST         29
73 */
74 #define SIGPWR          30
75 #define SIGSYS          31
76 #define SIGUNUSED       31
77
78 /* These should not be considered constants from userland.  */
79 #define SIGRTMIN        32
80 #define SIGRTMAX        _NSIG
81
82 /*
83  * SA_FLAGS values:
84  *
85  * SA_ONSTACK indicates that a registered stack_t will be used.
86  * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
87  * SA_RESTART flag to get restarting signals (which were the default long ago)
88  * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
89  * SA_RESETHAND clears the handler when the signal is delivered.
90  * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
91  * SA_NODEFER prevents the current signal from being masked in the handler.
92  *
93  * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
94  * Unix names RESETHAND and NODEFER respectively.
95  */
96 #define SA_NOCLDSTOP    0x00000001
97 #define SA_NOCLDWAIT    0x00000002
98 #define SA_SIGINFO      0x00000004
99 #define SA_ONSTACK      0x08000000
100 #define SA_RESTART      0x10000000
101 #define SA_NODEFER      0x40000000
102 #define SA_RESETHAND    0x80000000
103
104 #define SA_NOMASK       SA_NODEFER
105 #define SA_ONESHOT      SA_RESETHAND
106 #define SA_INTERRUPT    0x20000000 /* dummy -- ignored */
107
108 #define SA_RESTORER     0x04000000
109
110 /*
111  * sigaltstack controls
112  */
113 #define SS_ONSTACK      1
114 #define SS_DISABLE      2
115
116 #define MINSIGSTKSZ     2048
117 #define SIGSTKSZ        8192
118
119 #ifdef __KERNEL__
120
121 /*
122  * These values of sa_flags are used only by the kernel as part of the
123  * irq handling routines.
124  *
125  * SA_INTERRUPT is also used by the irq handling routines.
126  * SA_SHIRQ is for shared interrupt support on PCI and EISA.
127  */
128 #define SA_PROBE                SA_ONESHOT
129 #define SA_SAMPLE_RANDOM        SA_RESTART
130 #define SA_SHIRQ                0x04000000
131 #endif
132
133 #define SIG_BLOCK          0    /* for blocking signals */
134 #define SIG_UNBLOCK        1    /* for unblocking signals */
135 #define SIG_SETMASK        2    /* for setting the signal mask */
136
137 #ifndef __ASSEMBLY__
138 /* Type of a signal handler.  */
139 typedef void (*__sighandler_t)(int);
140
141 #define SIG_DFL ((__sighandler_t)0)     /* default signal handling */
142 #define SIG_IGN ((__sighandler_t)1)     /* ignore signal */
143 #define SIG_ERR ((__sighandler_t)-1)    /* error return from signal */
144
145 struct sigaction {
146         __sighandler_t sa_handler;
147         unsigned long sa_flags;
148         void (*sa_restorer)(void);
149         sigset_t sa_mask;               /* mask last for extensibility */
150 };
151
152 struct k_sigaction {
153         struct sigaction sa;
154 };
155
156 typedef struct sigaltstack {
157         void *ss_sp;
158         int ss_flags;
159         size_t ss_size;
160 } stack_t;
161
162 #ifdef __KERNEL__
163 #include <asm/sigcontext.h>
164
165 #undef __HAVE_ARCH_SIG_BITOPS
166 #if 0
167
168 extern __inline__ void sigaddset(sigset_t *set, int _sig)
169 {
170         __asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
171 }
172
173 extern __inline__ void sigdelset(sigset_t *set, int _sig)
174 {
175         __asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
176 }
177
178 extern __inline__ int __const_sigismember(sigset_t *set, int _sig)
179 {
180         unsigned long sig = _sig - 1;
181         return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1)));
182 }
183
184 extern __inline__ int __gen_sigismember(sigset_t *set, int _sig)
185 {
186         int ret;
187         __asm__("btq %2,%1\n\tsbbq %0,%0"
188                 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
189         return ret;
190 }
191
192 #define sigismember(set,sig)                    \
193         (__builtin_constant_p(sig) ?            \
194          __const_sigismember((set),(sig)) :     \
195          __gen_sigismember((set),(sig)))
196
197 extern __inline__ int sigfindinword(unsigned long word)
198 {
199         __asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc");
200         return word;
201 }
202 #endif
203 #endif
204
205 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
206
207 #endif /* __KERNEL__ */
208
209 #endif