diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-01-18 20:43:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-18 22:20:29 -0500 |
commit | 150256d8aadb3a337c31efa9e175cbd25bf06b06 (patch) | |
tree | 8cd7e2a0bc6af23984682c5ea3ca687809580c5a /kernel | |
parent | a60fc5190a31d98508ea6a76f74217f4104e74b7 (diff) |
[PATCH] Generic sys_rt_sigsuspend()
The TIF_RESTORE_SIGMASK flag allows us to have a generic implementation of
sys_rt_sigsuspend() instead of duplicating it for each architecture. This
provides such an implementation and makes arch/powerpc use it.
It also tidies up the ppc32 sys_sigsuspend() to use TIF_RESTORE_SIGMASK.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/compat.c | 28 | ||||
-rw-r--r-- | kernel/signal.c | 26 |
2 files changed, 54 insertions, 0 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index 256e5d9f0647..1867290c37e3 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -871,3 +871,31 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr) | |||
871 | } | 871 | } |
872 | 872 | ||
873 | #endif /* __ARCH_WANT_COMPAT_SYS_TIME */ | 873 | #endif /* __ARCH_WANT_COMPAT_SYS_TIME */ |
874 | |||
875 | #ifdef __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND | ||
876 | asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat_size_t sigsetsize) | ||
877 | { | ||
878 | sigset_t newset; | ||
879 | compat_sigset_t newset32; | ||
880 | |||
881 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
882 | if (sigsetsize != sizeof(sigset_t)) | ||
883 | return -EINVAL; | ||
884 | |||
885 | if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t))) | ||
886 | return -EFAULT; | ||
887 | sigset_from_compat(&newset, &newset32); | ||
888 | sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
889 | |||
890 | spin_lock_irq(¤t->sighand->siglock); | ||
891 | current->saved_sigmask = current->blocked; | ||
892 | current->blocked = newset; | ||
893 | recalc_sigpending(); | ||
894 | spin_unlock_irq(¤t->sighand->siglock); | ||
895 | |||
896 | current->state = TASK_INTERRUPTIBLE; | ||
897 | schedule(); | ||
898 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
899 | return -ERESTARTNOHAND; | ||
900 | } | ||
901 | #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 5dafbd36d62e..d3efafd8109a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -2721,6 +2721,32 @@ sys_pause(void) | |||
2721 | 2721 | ||
2722 | #endif | 2722 | #endif |
2723 | 2723 | ||
2724 | #ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
2725 | asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize) | ||
2726 | { | ||
2727 | sigset_t newset; | ||
2728 | |||
2729 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
2730 | if (sigsetsize != sizeof(sigset_t)) | ||
2731 | return -EINVAL; | ||
2732 | |||
2733 | if (copy_from_user(&newset, unewset, sizeof(newset))) | ||
2734 | return -EFAULT; | ||
2735 | sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
2736 | |||
2737 | spin_lock_irq(¤t->sighand->siglock); | ||
2738 | current->saved_sigmask = current->blocked; | ||
2739 | current->blocked = newset; | ||
2740 | recalc_sigpending(); | ||
2741 | spin_unlock_irq(¤t->sighand->siglock); | ||
2742 | |||
2743 | current->state = TASK_INTERRUPTIBLE; | ||
2744 | schedule(); | ||
2745 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
2746 | return -ERESTARTNOHAND; | ||
2747 | } | ||
2748 | #endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ | ||
2749 | |||
2724 | void __init signals_init(void) | 2750 | void __init signals_init(void) |
2725 | { | 2751 | { |
2726 | sigqueue_cachep = | 2752 | sigqueue_cachep = |