netlib.narod.ru< Назад | Оглавление | Далее >

include/asm-i386/signal.h

12017 #ifndef _ASMi386_SIGNAL_H
12018 #define _ASMi386_SIGNAL_H
12019 
12020 #include <linux/types.h>
12021 
12022 /* Avoid too many header ordering problems.  */
12023 struct siginfo;
12024 
12025 #ifdef __KERNEL__
12026 /* Most things should be clean enough to redefine this at
12027  * will, if care is taken to make libc match.  */
12028 
12029 #define _NSIG           64
12030 #define _NSIG_BPW       32
12031 #define _NSIG_WORDS     (_NSIG / _NSIG_BPW)
12032 
12033 typedef unsigned long old_sigset_t; /* at least 32 bits*/
12034 
 Комментарий
12035 typedef struct {
12036   unsigned long sig[_NSIG_WORDS];
12037 } sigset_t;
12038 
12039 #else
12040 /* Here we must cater to libcs that poke about in kernel
12041  * headers.  */
12042 
12043 #define NSIG            32
12044 typedef unsigned long sigset_t;
12045 
12046 #endif /* __KERNEL__ */
12047 
12048 #define SIGHUP           1
12049 #define SIGINT           2
12050 #define SIGQUIT          3
12051 #define SIGILL           4
12052 #define SIGTRAP          5
12053 #define SIGABRT          6
12054 #define SIGIOT           6
12055 #define SIGBUS           7
12056 #define SIGFPE           8
12057 #define SIGKILL          9
12058 #define SIGUSR1         10
12059 #define SIGSEGV         11
12060 #define SIGUSR2         12
12061 #define SIGPIPE         13
12062 #define SIGALRM         14
12063 #define SIGTERM         15
12064 #define SIGSTKFLT       16
12065 #define SIGCHLD         17
12066 #define SIGCONT         18
12067 #define SIGSTOP         19
12068 #define SIGTSTP         20
12069 #define SIGTTIN         21
12070 #define SIGTTOU         22
12071 #define SIGURG          23
12072 #define SIGXCPU         24
12073 #define SIGXFSZ         25
12074 #define SIGVTALRM       26
12075 #define SIGPROF         27
12076 #define SIGWINCH        28
12077 #define SIGIO           29
12078 #define SIGPOLL         SIGIO
12079 /*
12080 #define SIGLOST         29
12081 */
12082 #define SIGPWR          30
12083 #define SIGUNUSED       31
12084 
12085 /* These should not be considered constants from
12086  * userland.  */
12087 #define SIGRTMIN        32
12088 #define SIGRTMAX        (_NSIG-1)
12089 
12090 /* SA_FLAGS values:
12091  *
12092  * SA_ONSTACK indicates that a registered stack_t will be
12093  * used.
12094  * SA_INTERRUPT is a no-op, but left due to historical
12095  * reasons. Use the
12096  * SA_RESTART flag to get restarting signals (which were
12097  * the default long ago)
12098  * SA_NOCLDSTOP flag to turn off SIGCHLD when children
12099  * stop.
12100  * SA_RESETHAND clears the handler when the signal is
12101  * delivered.
12102  * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
12103  * SA_NODEFER prevents the current signal from being
12104  * masked in the handler.
12105  * SA_ONESHOT and SA_NOMASK are the historical Linux
12106  * names for the Single Unix names RESETHAND and NODEFER
12107  * respectively.  */
12108 #define SA_NOCLDSTOP    0x00000001
12109 #define SA_NOCLDWAIT    0x00000002 /* not supported yet*/
12110 #define SA_SIGINFO      0x00000004
12111 #define SA_ONSTACK      0x08000000
12112 #define SA_RESTART      0x10000000
12113 #define SA_NODEFER      0x40000000
12114 #define SA_RESETHAND    0x80000000
12115 
12116 #define SA_NOMASK       SA_NODEFER
12117 #define SA_ONESHOT      SA_RESETHAND
12118 #define SA_INTERRUPT    0x20000000 /* dummy -- ignored */
12119 
12120 #define SA_RESTORER     0x04000000
12121 
12122 /* sigaltstack controls */
12123 #define SS_ONSTACK      1
12124 #define SS_DISABLE      2
12125 
12126 #define MINSIGSTKSZ     2048
12127 #define SIGSTKSZ        8192
12128 
12129 #ifdef __KERNEL__
12130 
12131 /* These values of sa_flags are used only by the kernel
12132  * as part of the irq handling routines.
12133  *
12134  * SA_INTERRUPT is also used by the irq handling
12135  * routines.
12136  * SA_SHIRQ is for shared interrupt support on PCI and
12137  * EISA.  */
12138 #define SA_PROBE                SA_ONESHOT
12139 #define SA_SAMPLE_RANDOM        SA_RESTART
12140 #define SA_SHIRQ                0x04000000
12141 #endif
12142 
12143 #define SIG_BLOCK    0  /* for blocking signals */
12144 #define SIG_UNBLOCK  1  /* for unblocking signals */
12145 #define SIG_SETMASK  2  /* for setting the signal mask */
12146 
12147 /* Type of a signal handler.  */
12148 typedef void (*__sighandler_t)(int);
12149 
12150 /* default signal handling */
12151 #define SIG_DFL ((__sighandler_t)0)
12152 /* ignore signal */
12153 #define SIG_IGN ((__sighandler_t)1)
12154 /* error return from signal */
12155 #define SIG_ERR ((__sighandler_t)-1)
12156 
12157 #ifdef __KERNEL__
12158 struct old_sigaction {
12159   __sighandler_t sa_handler;
12160   old_sigset_t sa_mask;
12161   unsigned long sa_flags;
12162   void (*sa_restorer)(void);
12163 };
12164 
 Комментарий
12165 struct sigaction {
12166   __sighandler_t sa_handler;
12167   unsigned long sa_flags;
12168   void (*sa_restorer)(void);
12169   sigset_t sa_mask;  /* mask last for extensibility */
12170 };
12171 
12172 struct k_sigaction {
12173   struct sigaction sa;
12174 };
12175 #else
12176 /* Here we must cater to libcs that poke about in kernel
12177  * headers.  */
12178 struct sigaction {
12179   union {
12180     __sighandler_t _sa_handler;
12181     void (*_sa_sigaction)(int, struct siginfo *, void *);
12182   } _u;
12183   sigset_t sa_mask;
12184   unsigned long sa_flags;
12185   void (*sa_restorer)(void);
12186 };
12187 
12188 #define sa_handler      _u._sa_handler
12189 #define sa_sigaction    _u._sa_sigaction
12190 
12191 #endif /* __KERNEL__ */
12192 
12193 typedef struct sigaltstack {
12194   void *ss_sp;
12195   int ss_flags;
12196   size_t ss_size;
12197 } stack_t;
12198 
12199 #ifdef __KERNEL__
12200 #include <asm/sigcontext.h>
12201 
12202 #define __HAVE_ARCH_SIG_BITOPS
12203 
 Комментарий
12204 extern __inline__ void sigaddset(sigset_t *set, int _sig)
12205 {
12206   __asm__("btsl %1,%0" : "=m"(*set) : "ir"(_sig - 1)
12207           : "cc");
12208 }
12209 
 Комментарий
12210 extern __inline__ void sigdelset(sigset_t *set, int _sig)
12211 {
12212   __asm__("btrl %1,%0" : "=m"(*set) : "ir"(_sig - 1)
12213           : "cc");
12214 }
12215 
12216 extern __inline__ int __const_sigismember(sigset_t *set,
12217                                           int _sig)
12218 {
12219   unsigned long sig = _sig - 1;
12220   return 1 & (set->sig[sig / _NSIG_BPW] >>
12221               (sig % _NSIG_BPW));
12222 }
12223 
12224 extern __inline__ int __gen_sigismember(sigset_t *set,
12225                                         int _sig)
12226 {
12227   int ret;
12228   __asm__("btl %2,%1\n\tsbbl %0,%0"
12229     : "=r"(ret) : "m"(*set), "ir"(_sig-1) : "cc");
12230   return ret;
12231 }
12232 
 Комментарий
12233 #define sigismember(set,sig)                            \
12234   (__builtin_constant_p(sig) ?                          \
12235    __const_sigismember((set),(sig)) :                   \
12236    __gen_sigismember((set),(sig)))
12237 
 Комментарий
12238 #define sigmask(sig)    (1UL << ((sig) - 1))
12239 
 Комментарий
12240 extern __inline__ int sigfindinword(unsigned long word)
12241 {
12242   __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
12243   return word;
12244 }
12245 
12246 #endif /* __KERNEL__ */
12247 
12248 #endif

netlib.narod.ru< Назад | Оглавление | Далее >

Сайт управляется системой uCoz