aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-06-06 17:37:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:12 -0400
commitb4e74264eb0b03f42097fa70a0766312156244a0 (patch)
treef681b406765648b4fb6dde9b1c672b1276937a79 /kernel/signal.c
parent580d34e42ad621736a3c53c9c11a2152c18a4068 (diff)
signals: introduce kernel_sigaction()
Now that allow_signal() is really trivial we can unify it with disallow_signal(). Add the new helper, kernel_sigaction(), and reimplement allow_signal/disallow_signal as a trivial wrappers. This saves one EXPORT_SYMBOL() and the new helper can have more users. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Richard Weinberger <richard@nod.at> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 3ec405132c79..a4077e90f19f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3067,37 +3067,25 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo,
3067#endif 3067#endif
3068 3068
3069/* 3069/*
3070 * Let kernel threads use this to say that they allow a certain signal. 3070 * For kthreads only, must not be used if cloned with CLONE_SIGHAND
3071 * Must not be used if kthread was cloned with CLONE_SIGHAND.
3072 */ 3071 */
3073void allow_signal(int sig) 3072void kernel_sigaction(int sig, __sighandler_t action)
3074{ 3073{
3075 /*
3076 * Kernel threads handle their own signals. Let the signal code
3077 * know it'll be handled, so that they don't get converted to
3078 * SIGKILL or just silently dropped.
3079 */
3080 spin_lock_irq(&current->sighand->siglock); 3074 spin_lock_irq(&current->sighand->siglock);
3081 current->sighand->action[(sig)-1].sa.sa_handler = (void __user *)2; 3075 current->sighand->action[sig - 1].sa.sa_handler = action;
3082 spin_unlock_irq(&current->sighand->siglock); 3076 if (action == SIG_IGN) {
3083} 3077 sigset_t mask;
3084EXPORT_SYMBOL(allow_signal);
3085 3078
3086void disallow_signal(int sig) 3079 sigemptyset(&mask);
3087{ 3080 sigaddset(&mask, sig);
3088 sigset_t mask;
3089 3081
3090 sigemptyset(&mask); 3082 flush_sigqueue_mask(&mask, &current->signal->shared_pending);
3091 sigaddset(&mask, sig); 3083 flush_sigqueue_mask(&mask, &current->pending);
3092 3084 recalc_sigpending();
3093 spin_lock_irq(&current->sighand->siglock); 3085 }
3094 current->sighand->action[(sig)-1].sa.sa_handler = SIG_IGN;
3095 flush_sigqueue_mask(&mask, &current->signal->shared_pending);
3096 flush_sigqueue_mask(&mask, &current->pending);
3097 recalc_sigpending();
3098 spin_unlock_irq(&current->sighand->siglock); 3086 spin_unlock_irq(&current->sighand->siglock);
3099} 3087}
3100EXPORT_SYMBOL(disallow_signal); 3088EXPORT_SYMBOL(kernel_sigaction);
3101 3089
3102int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) 3090int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
3103{ 3091{