From: Pavel Emelyanov <xemul@openvz.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Oleg Nesterov <oleg@tv-sign.ru>
Subject: [PATCH 3/3] Consolidate checking for ignored/legacy signals
Date: Tue, 12 Feb 2008 13:25:29 +0300 [thread overview]
Message-ID: <47B17419.4080303@openvz.org> (raw)
Two callers for send_signal() - the specific_send_sig_info and
the __group_send_sig_info - both check for sig to be ignored or
already queued.
Move these checks into send_signal() and make it return 1 to
indicate that the signal is dropped, but there's no error in
this.
Besides, merge comments and spell-check them.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
kernel/signal.c | 37 +++++++++++++++----------------------
1 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index 384d188..f98ec5f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -668,6 +668,14 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
struct sigqueue * q = NULL;
/*
+ * Short-circuit ignored signals and support queuing
+ * exactly one non-rt signal, so that we can get more
+ * detailed information about the cause of the signal.
+ */
+ if (sig_ignored(t, sig) || legacy_queue(signals, sig))
+ return 1;
+
+ /*
* Deliver the signal to listening signalfds. This must be called
* with the sighand lock held.
*/
@@ -766,21 +774,13 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
BUG_ON(!irqs_disabled());
assert_spin_locked(&t->sighand->siglock);
- /* Short-circuit ignored signals. */
- if (sig_ignored(t, sig))
- goto out;
-
- /* Support queueing exactly one non-rt signal, so that we
- can get more detailed information about the cause of
- the signal. */
- if (legacy_queue(&t->pending, sig))
- goto out;
-
ret = send_signal(sig, info, t, &t->pending);
+ if (ret < 0)
+ return ret;
+
if (!ret && !sigismember(&t->blocked, sig))
signal_wake_up(t, sig == SIGKILL);
-out:
- return ret;
+ return 0;
}
/*
@@ -930,24 +930,17 @@ __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
assert_spin_locked(&p->sighand->siglock);
handle_stop_signal(sig, p);
- /* Short-circuit ignored signals. */
- if (sig_ignored(p, sig))
- return ret;
-
- if (legacy_queue(&p->signal->shared_pending, sig))
- /* This is a non-RT signal and we already have one queued. */
- return ret;
-
/*
* Put this signal on the shared-pending queue, or fail with EAGAIN.
* We always use the shared queue for process-wide signals,
* to avoid several races.
*/
ret = send_signal(sig, info, p, &p->signal->shared_pending);
- if (unlikely(ret))
+ if (unlikely(ret < 0))
return ret;
- __group_complete_signal(sig, p);
+ if (!ret)
+ __group_complete_signal(sig, p);
return 0;
}
--
1.5.3.4
reply other threads:[~2008-02-12 10:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47B17419.4080303@openvz.org \
--to=xemul@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox