aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-06-06 17:36:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-06 19:08:11 -0400
commitafe2b0386ac22b6a189a2067b25282cade3fbb4d (patch)
tree794acbfc5e7c0a333ce322301cfe71c96847ed91 /kernel/signal.c
parentc09c144139f227de13330111adcafa1659ebd008 (diff)
signals: cleanup the usage of t/current in do_sigaction()
The usage of "task_struct *t" and "current" in do_sigaction() looks really annoying and chaotic. Initially "t" is used as a cached value of current but not consistently, then it is reused as a loop variable and we have to use "current" again. Clean up this mess and also convert the code to use for_each_thread(). 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.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index c088011f873c..a6d8c3af0ad6 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3068,16 +3068,16 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo,
3068 3068
3069int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) 3069int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
3070{ 3070{
3071 struct task_struct *t = current; 3071 struct task_struct *p = current, *t;
3072 struct k_sigaction *k; 3072 struct k_sigaction *k;
3073 sigset_t mask; 3073 sigset_t mask;
3074 3074
3075 if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig))) 3075 if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))
3076 return -EINVAL; 3076 return -EINVAL;
3077 3077
3078 k = &t->sighand->action[sig-1]; 3078 k = &p->sighand->action[sig-1];
3079 3079
3080 spin_lock_irq(&current->sighand->siglock); 3080 spin_lock_irq(&p->sighand->siglock);
3081 if (oact) 3081 if (oact)
3082 *oact = *k; 3082 *oact = *k;
3083 3083
@@ -3096,17 +3096,16 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
3096 * (for example, SIGCHLD), shall cause the pending signal to 3096 * (for example, SIGCHLD), shall cause the pending signal to
3097 * be discarded, whether or not it is blocked" 3097 * be discarded, whether or not it is blocked"
3098 */ 3098 */
3099 if (sig_handler_ignored(sig_handler(t, sig), sig)) { 3099 if (sig_handler_ignored(sig_handler(p, sig), sig)) {
3100 sigemptyset(&mask); 3100 sigemptyset(&mask);
3101 sigaddset(&mask, sig); 3101 sigaddset(&mask, sig);
3102 flush_sigqueue_mask(&mask, &t->signal->shared_pending); 3102 flush_sigqueue_mask(&mask, &p->signal->shared_pending);
3103 do { 3103 for_each_thread(p, t)
3104 flush_sigqueue_mask(&mask, &t->pending); 3104 flush_sigqueue_mask(&mask, &t->pending);
3105 } while_each_thread(current, t);
3106 } 3105 }
3107 } 3106 }
3108 3107
3109 spin_unlock_irq(&current->sighand->siglock); 3108 spin_unlock_irq(&p->sighand->siglock);
3110 return 0; 3109 return 0;
3111} 3110}
3112 3111