diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-04-30 03:52:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:35 -0400 |
commit | 6e65acba7ca8169e38ab55d62d52f29a75fb141f (patch) | |
tree | a691ee9392b0f2ed8a434e5a5cd6e6a213b70f1b | |
parent | c99fcf28b87d8cab592db7571e3164f5cb54c5b3 (diff) |
signals: move handle_stop_signal() into send_signal()
Move handle_stop_signal() into send_signal(). This factors out a couple of
callsites and allows us to do further unifications.
Also, with this change specific_send_sig_info() does handle_stop_signal().
Not that this is really important, we never send STOP/CONT via send_sig() and
friends, but still this looks more consistent.
The only (afaics) special case is get_signal_to_deliver(). If the traced task
dequeues SIGCONT, it can re-send it to itself after ptrace_stop() if the
signal was blocked by debugger. In that case handle_stop_signal() is
unnecessary, but hopefully not a problem.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/signal.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index db442c59219e..b3dedf1f9323 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -660,8 +660,10 @@ static inline int legacy_queue(struct sigpending *signals, int sig) | |||
660 | static int send_signal(int sig, struct siginfo *info, struct task_struct *t, | 660 | static int send_signal(int sig, struct siginfo *info, struct task_struct *t, |
661 | struct sigpending *signals) | 661 | struct sigpending *signals) |
662 | { | 662 | { |
663 | struct sigqueue * q = NULL; | 663 | struct sigqueue *q; |
664 | 664 | ||
665 | assert_spin_locked(&t->sighand->siglock); | ||
666 | handle_stop_signal(sig, t); | ||
665 | /* | 667 | /* |
666 | * Short-circuit ignored signals and support queuing | 668 | * Short-circuit ignored signals and support queuing |
667 | * exactly one non-rt signal, so that we can get more | 669 | * exactly one non-rt signal, so that we can get more |
@@ -766,9 +768,6 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t) | |||
766 | { | 768 | { |
767 | int ret; | 769 | int ret; |
768 | 770 | ||
769 | BUG_ON(!irqs_disabled()); | ||
770 | assert_spin_locked(&t->sighand->siglock); | ||
771 | |||
772 | ret = send_signal(sig, info, t, &t->pending); | 771 | ret = send_signal(sig, info, t, &t->pending); |
773 | if (ret <= 0) | 772 | if (ret <= 0) |
774 | return ret; | 773 | return ret; |
@@ -923,9 +922,6 @@ __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) | |||
923 | { | 922 | { |
924 | int ret; | 923 | int ret; |
925 | 924 | ||
926 | assert_spin_locked(&p->sighand->siglock); | ||
927 | handle_stop_signal(sig, p); | ||
928 | |||
929 | /* | 925 | /* |
930 | * Put this signal on the shared-pending queue, or fail with EAGAIN. | 926 | * Put this signal on the shared-pending queue, or fail with EAGAIN. |
931 | * We always use the shared queue for process-wide signals, | 927 | * We always use the shared queue for process-wide signals, |
@@ -2241,7 +2237,6 @@ static int do_tkill(int tgid, int pid, int sig) | |||
2241 | */ | 2237 | */ |
2242 | if (!error && sig && p->sighand) { | 2238 | if (!error && sig && p->sighand) { |
2243 | spin_lock_irq(&p->sighand->siglock); | 2239 | spin_lock_irq(&p->sighand->siglock); |
2244 | handle_stop_signal(sig, p); | ||
2245 | error = specific_send_sig_info(sig, &info, p); | 2240 | error = specific_send_sig_info(sig, &info, p); |
2246 | spin_unlock_irq(&p->sighand->siglock); | 2241 | spin_unlock_irq(&p->sighand->siglock); |
2247 | } | 2242 | } |