Re: [PATCH RFC 0/2] pidfd: add CLONE_AUTOREAP

From: Linus Torvalds

Date: Mon Feb 16 2026 - 10:28:11 EST


On Mon, 16 Feb 2026 at 05:49, Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> CLONE_AUTOREAP requires CLONE_PIDFD because the process will never be
> visible to wait().

This seems an unnecessary and counter-productive limitation.

The very *traditional* unix way to do auto-reaping is to fork twice,
and have the "middle" parent just exit.

That makes the final child be re-parented to init, and it is invisible
to wait() - all very much on purpose.

This was (perhaps still is?) very commonly used for starting up
background daemons (together with disassociating from the tty etc).

So I don't mind th enew flag, but I think the restriction is
unnecessary and not logical. Sometimes you simply don't *want*
processes visible to wait - or care about a pidfd.

Linus