From: Oleg Nesterov <oleg@tv-sign.ru>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
mingo@elte.hu, akpm@linux-foundation.org,
Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH] fix handling of SIGCHILD from reaped child
Date: Tue, 20 Feb 2007 17:22:57 +0300 [thread overview]
Message-ID: <20070220142257.GA155@tv-sign.ru> (raw)
In-Reply-To: <20070220183220.41b3f1ca.kamezawa.hiroyu@jp.fujitsu.com>
On 02/20, KAMEZAWA Hiroyuki wrote:
>
> SUSv3 says
> ==
> if SIGCHLD is blocked, if wait() or waitpid() return because the status of a
> child process is available, any pending SIGCHLD signal shall be cleared unless
> the status of another child process is available.
> ==
Ingo, Roland, should we implement this?
I must admit, I don't understand the text above, "blocked" is per-thread, but
wait() is process wide (any sub-thread can reap a dead child).
> -static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
> +static int collect_signal(int sig, struct sigpending *list, siginfo_t *info, pid_t checkpid)
> {
> - list_for_each_entry(q, &list->list, list) {
> - if (q->info.si_signo == sig) {
> - if (first) {
> - still_pending = 1;
> - break;
> + if (unlikely(checkpid)) {
> + list_for_each_entry(q, &list->list, list) {
> + if (q->info.si_signo == sig) {
> + if (q->info.si_pid == checkpid)
> + first = q;
> + else
> + still_pending = 1;
> + }
> + }
> + } else {
> + list_for_each_entry(q, &list->list, list) {
> + if (q->info.si_signo == sig) {
> + if (first) {
> + still_pending = 1;
> + break;
> + }
> + first = q;
> }
> - first = q;
I'd suggest to make a separate function, but not complicate collect_signal().
> --- linux-2.6.20-devel.orig/kernel/exit.c
> +++ linux-2.6.20-devel/kernel/exit.c
> @@ -1252,8 +1252,12 @@ static int wait_task_zombie(struct task_
> }
> write_unlock_irq(&tasklist_lock);
> }
> - if (p != NULL)
> + if (p != NULL) {
> release_task(p);
> + /* if we received sigchild from "p" and p is released,
> + we remove sigchild from it. */
current may be ptracer, not a parent. Should be ok, clear_stale_sigchild(pid)
can't have a false positive (until we have namespace for pid_t), but the comment
is misleading a bit.
> + clear_stale_sigchild(current, retval);
But we are not checking that SIGCHLD is blocked?
Oleg.
next prev parent reply other threads:[~2007-02-20 14:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 9:32 KAMEZAWA Hiroyuki
2007-02-20 14:22 ` Oleg Nesterov [this message]
2007-02-20 15:25 ` KAMEZAWA Hiroyuki
2007-02-20 17:20 ` Oleg Nesterov
2007-02-20 23:10 ` Roland McGrath
2007-02-21 0:51 ` KAMEZAWA Hiroyuki
2007-02-21 0:42 ` KAMEZAWA Hiroyuki
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=20070220142257.GA155@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
/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
all inboxes | Powered by JetHome®