From: Lennart Poettering <mzxreary@0pointer.de>
To: "Américo Wang" <xiyou.wangcong@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] exit: PR_SET_ANCHOR for marking processes as reapers for child processes
Date: Wed, 3 Feb 2010 18:49:47 +0100 [thread overview]
Message-ID: <20100203174947.GA13943@tango.0pointer.de> (raw)
In-Reply-To: <20100203153101.GC4177@hack>
On Wed, 03.02.10 23:31, Américo Wang (xiyou.wangcong@gmail.com) wrote:
> On Tue, Feb 02, 2010 at 01:04:57PM +0100, Lennart Poettering wrote:
> >
> >This patch adds a simple flag for each process that marks it as an
> >"anchor" process for all its children and grandchildren. If a child of
> >such an anchor dies all its children will not be reparented to init, but
> >instead to this anchor, escaping this anchor process is not possible. A
> >task with this flag set hence acts is little "sub-init".
>
> This will break the applictions which using 'getppid() == 1' to check
> if its real parent is dead or not...
Usage of the PR_SETANCHOR flag is optional for a process. It won't
break anything unless enabled. So I don't really see a problem here.
Of course, when this flag is used the behaviour is different from what
traditional Unix says what happens with the children of a process when
it dies. But uh, that's the whole point and that's why this flag is
enabled optionally only.
Also, on a side note: code that checks if its parent process died most
likely should rewritten to use PR_DEATHSIG or something like that
anyway, so that it is notified about the parent dying instead of
polling for it manually.
Lennart
--
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
next prev parent reply other threads:[~2010-02-03 17:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 12:04 [PATCH] exit: PR_SET_ANCHOR for marking processes as reapers for child processes Lennart Poettering
2010-02-03 8:24 ` KOSAKI Motohiro
2010-02-03 9:53 ` Lennart Poettering
2010-02-03 15:31 ` Américo Wang
2010-02-03 17:49 ` Lennart Poettering [this message]
2010-02-05 9:54 ` Américo Wang
2010-02-11 10:21 ` Kay Sievers
2010-02-04 15:42 ` Kay Sievers
2010-02-04 20:59 ` Kay Sievers
2010-03-04 14:08 ` Oleg Nesterov
2010-03-04 22:14 ` Roland McGrath
2010-03-05 18:51 ` Kay Sievers
2010-03-05 19:18 ` Roland McGrath
2010-03-06 0:24 ` Lennart Poettering
2010-03-09 0:45 ` Ray Lee
2010-03-09 13:19 ` Oleg Nesterov
2010-03-06 0:20 ` Lennart Poettering
2010-03-08 23:11 ` Roland McGrath
2010-03-05 4:47 ` KOSAKI Motohiro
2010-03-05 18:55 ` Kay Sievers
2010-03-06 0:16 ` Lennart Poettering
2010-03-11 4:14 ` Eric W. Biederman
2010-03-11 7:56 ` KOSAKI Motohiro
2010-12-20 14:26 ` Scott James Remnant
2010-12-20 14:51 ` Kay Sievers
2010-12-21 9:56 ` Lennart Poettering
2010-12-21 12:05 ` Scott James Remnant
2010-12-23 15:44 ` Lennart Poettering
2010-12-23 16:00 ` Scott James Remnant
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=20100203174947.GA13943@tango.0pointer.de \
--to=mzxreary@0pointer.de \
--cc=linux-kernel@vger.kernel.org \
--cc=xiyou.wangcong@gmail.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;
as well as URLs for NNTP newsgroup(s).