| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASMx8664_SIGNAL_H | 
 | 2 | #define _ASMx8664_SIGNAL_H | 
 | 3 |  | 
 | 4 | #ifndef __ASSEMBLY__ | 
 | 5 | #include <linux/types.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | #include <linux/time.h> | 
 | 7 |  | 
 | 8 | /* Avoid too many header ordering problems.  */ | 
 | 9 | struct siginfo; | 
 | 10 |  | 
 | 11 | #ifdef __KERNEL__ | 
| David Woodhouse | 75da736 | 2006-09-16 12:15:48 -0700 | [diff] [blame] | 12 | #include <linux/linkage.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | #else | 
 | 28 | /* Here we must cater to libcs that poke about in kernel headers.  */ | 
 | 29 |  | 
 | 30 | #define NSIG		32 | 
 | 31 | typedef unsigned long sigset_t; | 
 | 32 |  | 
 | 33 | #endif /* __KERNEL__ */ | 
 | 34 | #endif | 
 | 35 |  | 
 | 36 | #define SIGHUP		 1 | 
 | 37 | #define SIGINT		 2 | 
 | 38 | #define SIGQUIT		 3 | 
 | 39 | #define SIGILL		 4 | 
 | 40 | #define SIGTRAP		 5 | 
 | 41 | #define SIGABRT		 6 | 
 | 42 | #define SIGIOT		 6 | 
 | 43 | #define SIGBUS		 7 | 
 | 44 | #define SIGFPE		 8 | 
 | 45 | #define SIGKILL		 9 | 
 | 46 | #define SIGUSR1		10 | 
 | 47 | #define SIGSEGV		11 | 
 | 48 | #define SIGUSR2		12 | 
 | 49 | #define SIGPIPE		13 | 
 | 50 | #define SIGALRM		14 | 
 | 51 | #define SIGTERM		15 | 
 | 52 | #define SIGSTKFLT	16 | 
 | 53 | #define SIGCHLD		17 | 
 | 54 | #define SIGCONT		18 | 
 | 55 | #define SIGSTOP		19 | 
 | 56 | #define SIGTSTP		20 | 
 | 57 | #define SIGTTIN		21 | 
 | 58 | #define SIGTTOU		22 | 
 | 59 | #define SIGURG		23 | 
 | 60 | #define SIGXCPU		24 | 
 | 61 | #define SIGXFSZ		25 | 
 | 62 | #define SIGVTALRM	26 | 
 | 63 | #define SIGPROF		27 | 
 | 64 | #define SIGWINCH	28 | 
 | 65 | #define SIGIO		29 | 
 | 66 | #define SIGPOLL		SIGIO | 
 | 67 | /* | 
 | 68 | #define SIGLOST		29 | 
 | 69 | */ | 
 | 70 | #define SIGPWR		30 | 
 | 71 | #define SIGSYS		31 | 
 | 72 | #define	SIGUNUSED	31 | 
 | 73 |  | 
 | 74 | /* These should not be considered constants from userland.  */ | 
 | 75 | #define SIGRTMIN	32 | 
 | 76 | #define SIGRTMAX	_NSIG | 
 | 77 |  | 
 | 78 | /* | 
 | 79 |  * SA_FLAGS values: | 
 | 80 |  * | 
 | 81 |  * SA_ONSTACK indicates that a registered stack_t will be used. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 |  * SA_RESTART flag to get restarting signals (which were the default long ago) | 
 | 83 |  * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | 
 | 84 |  * SA_RESETHAND clears the handler when the signal is delivered. | 
 | 85 |  * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | 
 | 86 |  * SA_NODEFER prevents the current signal from being masked in the handler. | 
 | 87 |  * | 
 | 88 |  * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | 
 | 89 |  * Unix names RESETHAND and NODEFER respectively. | 
 | 90 |  */ | 
 | 91 | #define SA_NOCLDSTOP	0x00000001 | 
 | 92 | #define SA_NOCLDWAIT	0x00000002 | 
 | 93 | #define SA_SIGINFO	0x00000004 | 
 | 94 | #define SA_ONSTACK	0x08000000 | 
 | 95 | #define SA_RESTART	0x10000000 | 
 | 96 | #define SA_NODEFER	0x40000000 | 
 | 97 | #define SA_RESETHAND	0x80000000 | 
 | 98 |  | 
 | 99 | #define SA_NOMASK	SA_NODEFER | 
 | 100 | #define SA_ONESHOT	SA_RESETHAND | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 |  | 
 | 102 | #define SA_RESTORER	0x04000000 | 
 | 103 |  | 
 | 104 | /* | 
 | 105 |  * sigaltstack controls | 
 | 106 |  */ | 
 | 107 | #define SS_ONSTACK	1 | 
 | 108 | #define SS_DISABLE	2 | 
 | 109 |  | 
 | 110 | #define MINSIGSTKSZ	2048 | 
 | 111 | #define SIGSTKSZ	8192 | 
 | 112 |  | 
| Al Viro | b1ecb4c | 2005-05-04 05:40:12 +0100 | [diff] [blame] | 113 | #include <asm-generic/signal.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 |  | 
 | 115 | #ifndef __ASSEMBLY__ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 |  | 
 | 117 | struct sigaction { | 
 | 118 | 	__sighandler_t sa_handler; | 
 | 119 | 	unsigned long sa_flags; | 
 | 120 | 	__sigrestore_t sa_restorer; | 
 | 121 | 	sigset_t sa_mask;		/* mask last for extensibility */ | 
 | 122 | }; | 
 | 123 |  | 
 | 124 | struct k_sigaction { | 
 | 125 | 	struct sigaction sa; | 
 | 126 | }; | 
 | 127 |  | 
 | 128 | typedef struct sigaltstack { | 
 | 129 | 	void __user *ss_sp; | 
 | 130 | 	int ss_flags; | 
 | 131 | 	size_t ss_size; | 
 | 132 | } stack_t; | 
 | 133 |  | 
 | 134 | #ifdef __KERNEL__ | 
 | 135 | #include <asm/sigcontext.h> | 
 | 136 |  | 
 | 137 | #undef __HAVE_ARCH_SIG_BITOPS | 
 | 138 | #if 0 | 
 | 139 |  | 
| Adrian Bunk | 9c0aa0f | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 140 | static inline void sigaddset(sigset_t *set, int _sig) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | { | 
 | 142 | 	__asm__("btsq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | 
 | 143 | } | 
 | 144 |  | 
| Adrian Bunk | 9c0aa0f | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 145 | static inline void sigdelset(sigset_t *set, int _sig) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | { | 
 | 147 | 	__asm__("btrq %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc"); | 
 | 148 | } | 
 | 149 |  | 
| Adrian Bunk | 9c0aa0f | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 150 | static inline int __const_sigismember(sigset_t *set, int _sig) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | { | 
 | 152 | 	unsigned long sig = _sig - 1; | 
 | 153 | 	return 1 & (set->sig[sig / _NSIG_BPW] >> (sig & ~(_NSIG_BPW-1))); | 
 | 154 | } | 
 | 155 |  | 
| Adrian Bunk | 9c0aa0f | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 156 | static inline int __gen_sigismember(sigset_t *set, int _sig) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | { | 
 | 158 | 	int ret; | 
 | 159 | 	__asm__("btq %2,%1\n\tsbbq %0,%0" | 
 | 160 | 		: "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc"); | 
 | 161 | 	return ret; | 
 | 162 | } | 
 | 163 |  | 
 | 164 | #define sigismember(set,sig)			\ | 
 | 165 | 	(__builtin_constant_p(sig) ?		\ | 
 | 166 | 	 __const_sigismember((set),(sig)) :	\ | 
 | 167 | 	 __gen_sigismember((set),(sig))) | 
 | 168 |  | 
| Adrian Bunk | 9c0aa0f | 2005-09-12 18:49:24 +0200 | [diff] [blame] | 169 | static inline int sigfindinword(unsigned long word) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | { | 
 | 171 | 	__asm__("bsfq %1,%0" : "=r"(word) : "rm"(word) : "cc"); | 
 | 172 | 	return word; | 
 | 173 | } | 
 | 174 | #endif | 
 | 175 | #endif | 
 | 176 |  | 
 | 177 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | 
 | 178 |  | 
 | 179 | #endif /* __KERNEL__ */ | 
 | 180 |  | 
 | 181 | #endif |