public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Oleg Nesterov <oleg@redhat.com>,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: [PATCH] prctl: add PR_{SET,GET}_CHILD_SUBREAPER to allow simple process supervision
Date: Sat, 07 Jan 2012 11:13:50 -0500	[thread overview]
Message-ID: <124669.1325952830@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Sat, 07 Jan 2012 16:56:37 +0100." <1325951797.860.10.camel@mop>

[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]

On Sat, 07 Jan 2012 16:56:37 +0100, Kay Sievers said:
> Resending this, it got lost last year's September.
>
> We still need it to properly implement init-like service managers.

> From: Lennart Poettering <lennart@poettering.net>
> Subject: prctl: add PR_{SET,GET}_CHILD_SUBREAPER to allow simple process supervision

> Users of this will be the systemd per-user instance, which provides
> init-like functionality for the user's login session and D-Bus, which
> activates bus services on-demand. Both need init-like capabilities
> to be able to properly keep track of the services they start.

> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -552,6 +552,18 @@ struct signal_struct {
>  	int			group_stop_count;
>  	unsigned int		flags; /* see SIGNAL_* flags below */
>
> +	/*
> +	 * PR_SET_CHILD_SUBREAPER marks a process, like a service
> +	 * manager, to re-parent orphan (double-forking) child processes
> +	 * to this process instead of 'init'. The service manager is
> +	 * able to receive SIGCHLD signals and is able to investigate
> +	 * the process until it calls wait(). All children of this
> +	 * process will inherit a flag if they should look for a
> +	 * child_subreaper process at exit.
> +	 */
> +	unsigned int		is_child_subreaper:1;
> +	unsigned int		has_child_subreaper:1;

Is there someplace we can stick these two fields where they won't expand the
signal_struct?  Can we stick them in signal_struct->flags instead? Looks like we've
only burned 3 bits of that unsigned int.  Yes, I know that would complicate the
prctl get/set code.

> +		/* find the first ancestor marked as child_subreaper */
> +		for (reaper = father->real_parent;
> +		     reaper != &init_task;
> +		     reaper = reaper->real_parent) {

I admit being insufficiently caffienated - does this DTRT in a PID namespace? That
&init_task looks fishy to me...

[-- Attachment #2: Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2012-01-07 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-07 15:56 [PATCH] prctl: add PR_{SET,GET}_CHILD_SUBREAPER to allow simple process supervision Kay Sievers
2012-01-07 16:13 ` Valdis.Kletnieks [this message]
2012-01-09 15:07   ` Oleg Nesterov
2012-01-14  0:35     ` Andrew Morton
2012-01-14 13:59       ` Kay Sievers
2012-04-23 22:36 ` Michael Kerrisk
2013-01-10 22:48   ` Michael Kerrisk (man-pages)

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=124669.1325952830@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=kay.sievers@vrfy.org \
    --cc=lennart@poettering.net \
    --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