From: Roland McGrath <roland@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jerome Marchand <jmarchan@redhat.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] ptrace: reintroduce __ptrace_detach() as a callee of ptrace_exit()
Date: Wed, 4 Feb 2009 17:23:34 -0800 (PST) [thread overview]
Message-ID: <20090205012334.9E60FFC381@magilla.sf.frob.com> (raw)
In-Reply-To: Oleg Nesterov's message of Thursday, 29 January 2009 05:29:20 +0100 <20090129042920.GA5111@redhat.com>
> No functional changes, preparation for the next patch.
>
> Move the "should we release this child" logic into the separate handler,
> __ptrace_detach().
My inclination is to use bool in new code for true/false return values,
but I don't really care.
Please canonicalize the comment formatting for your new comments.
The preserved comment no longer makes sense, there is no "dead list" in
that function. Make it a coherent comment at the top that explains the
return value.
Given its content, this function now better belongs in ptrace.c, I think.
Thanks,
Roland
=====
/*
* Called with tasklist_lock held for writing.
* Unlink a traced task, and clean it up if it was a traced zombie.
* Return true if it needs to be reaped with release_task().
* (We can't call release_task() here because we already hold tasklist_lock.)
*
* If it's a zombie, our attachedness prevented normal parent notification
* or self-reaping. Do notification now if it would have happened earlier.
* If it should reap itself, return true.
*
* If it's our own child, there is no notification to do.
* But if our normal children self-reap, then this child
* was prevented by ptrace and we must reap it now.
*/
bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
{
__ptrace_unlink(p);
if (p->exit_state == EXIT_ZOMBIE) {
if (!task_detached(p) && thread_group_empty(p)) {
if (!same_thread_group(p->real_parent, tracer))
do_notify_parent(p, p->exit_signal);
else if (ignoring_children(tracer->sighand))
p->exit_signal = -1;
}
if (task_detached(p)) {
/*
* Mark it as in the process of being reaped.
*/
p->exit_state = EXIT_DEAD;
return true;
}
}
return false;
}
next prev parent reply other threads:[~2009-02-05 1:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-29 4:29 Oleg Nesterov
2009-02-05 1:23 ` Roland McGrath [this message]
2009-02-05 14:39 ` Oleg Nesterov
2009-02-05 20:37 ` Roland McGrath
2009-02-05 22:06 ` Oleg Nesterov
2009-02-09 2:14 ` Roland McGrath
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=20090205012334.9E60FFC381@magilla.sf.frob.com \
--to=roland@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dvlasenk@redhat.com \
--cc=jmarchan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@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®