fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-i386 / signal.h
index e3397cd..53945c9 100644 (file)
@@ -2,13 +2,16 @@
 #define _ASMi386_SIGNAL_H
 
 #include <linux/types.h>
-#include <linux/linkage.h>
 #include <linux/time.h>
+#include <linux/compiler.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
 
 #ifdef __KERNEL__
+
+#include <linux/linkage.h>
+
 /* Most things should be clean enough to redefine this at will, if care
    is taken to make libc match.  */
 
@@ -76,7 +79,6 @@ typedef unsigned long sigset_t;
  * SA_FLAGS values:
  *
  * SA_ONSTACK indicates that a registered stack_t will be used.
- * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
  * SA_RESTART flag to get restarting signals (which were the default long ago)
  * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
  * SA_RESETHAND clears the handler when the signal is delivered.
@@ -96,7 +98,6 @@ typedef unsigned long sigset_t;
 
 #define SA_NOMASK      SA_NODEFER
 #define SA_ONESHOT     SA_RESETHAND
-#define SA_INTERRUPT   0x20000000 /* dummy -- ignored */
 
 #define SA_RESTORER    0x04000000
 
@@ -109,43 +110,20 @@ typedef unsigned long sigset_t;
 #define MINSIGSTKSZ    2048
 #define SIGSTKSZ       8192
 
-#ifdef __KERNEL__
-
-/*
- * These values of sa_flags are used only by the kernel as part of the
- * irq handling routines.
- *
- * SA_INTERRUPT is also used by the irq handling routines.
- * SA_SHIRQ is for shared interrupt support on PCI and EISA.
- */
-#define SA_PROBE               SA_ONESHOT
-#define SA_SAMPLE_RANDOM       SA_RESTART
-#define SA_SHIRQ               0x04000000
-#endif
-
-#define SIG_BLOCK          0   /* for blocking signals */
-#define SIG_UNBLOCK        1   /* for unblocking signals */
-#define SIG_SETMASK        2   /* for setting the signal mask */
-
-/* Type of a signal handler.  */
-typedef void (*__sighandler_t)(int);
-
-#define SIG_DFL        ((__sighandler_t)0)     /* default signal handling */
-#define SIG_IGN        ((__sighandler_t)1)     /* ignore signal */
-#define SIG_ERR        ((__sighandler_t)-1)    /* error return from signal */
+#include <asm-generic/signal.h>
 
 #ifdef __KERNEL__
 struct old_sigaction {
        __sighandler_t sa_handler;
        old_sigset_t sa_mask;
        unsigned long sa_flags;
-       void (*sa_restorer)(void);
+       __sigrestore_t sa_restorer;
 };
 
 struct sigaction {
        __sighandler_t sa_handler;
        unsigned long sa_flags;
-       void (*sa_restorer)(void);
+       __sigrestore_t sa_restorer;
        sigset_t sa_mask;               /* mask last for extensibility */
 };
 
@@ -171,7 +149,7 @@ struct sigaction {
 #endif /* __KERNEL__ */
 
 typedef struct sigaltstack {
-       void *ss_sp;
+       void __user *ss_sp;
        int ss_flags;
        size_t ss_size;
 } stack_t;
@@ -181,14 +159,37 @@ typedef struct sigaltstack {
 
 #define __HAVE_ARCH_SIG_BITOPS
 
-static __inline__ void sigaddset(sigset_t *set, int _sig)
+#define sigaddset(set,sig)                 \
+       (__builtin_constant_p(sig) ?       \
+       __const_sigaddset((set),(sig)) :   \
+       __gen_sigaddset((set),(sig)))
+
+static __inline__ void __gen_sigaddset(sigset_t *set, int _sig)
 {
-       __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
+       __asm__("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
 }
 
-static __inline__ void sigdelset(sigset_t *set, int _sig)
+static __inline__ void __const_sigaddset(sigset_t *set, int _sig)
 {
-       __asm__("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
+       unsigned long sig = _sig - 1;
+       set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
+}
+
+#define sigdelset(set,sig)                 \
+       (__builtin_constant_p(sig) ?       \
+       __const_sigdelset((set),(sig)) :   \
+       __gen_sigdelset((set),(sig)))
+
+
+static __inline__ void __gen_sigdelset(sigset_t *set, int _sig)
+{
+       __asm__("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
+}
+
+static __inline__ void __const_sigdelset(sigset_t *set, int _sig)
+{
+       unsigned long sig = _sig - 1;
+       set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
 }
 
 static __inline__ int __const_sigismember(sigset_t *set, int _sig)
@@ -217,8 +218,12 @@ static __inline__ int sigfindinword(unsigned long word)
 }
 
 struct pt_regs;
-extern int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
-#define ptrace_signal_deliver(regs, cookie) do { } while (0)
+
+#define ptrace_signal_deliver(regs, cookie)            \
+       do {                                            \
+               if (test_and_clear_thread_flag(TIF_FORCED_TF)) \
+                       (regs)->eflags &= ~TF_MASK;     \
+       } while (0)
 
 #endif /* __KERNEL__ */