Re: [PATCH v3 1/1] waitid: Add support for waiting for the current process group
From: Linus Torvalds
Date: Wed Aug 14 2019 - 13:06:43 EST
On Wed, Aug 14, 2019 at 9:55 AM Rich Felker <dalias@xxxxxxxx> wrote:
>
> I don't think "downsides" sufficiently conveys that this is hard
> breakage of a requirement for waitpid.
Well, let's be honest here. Who has _ever_ seen a signal handler
changing the current process group?
In fact, the SYSV version of setpgid() takes a process ID to set it
*for somebody else*, so the signal safety is not even necessarily
relevant, since it might be racing with _another_ thread doing it
(which even the kernel side won't fix - it's just user space doing odd
things).
So yes - it's technically true that it's impossible to emulate
properly in user space.
But I doubt it makes _any_ difference what-so-ever, and glibc might as
well do something like
ret = waitid(P_PGID, 0, ..);
if (ret == -EINVAL) { do the emulation }
which makes it work with older kernels, and has zero downside in practice.
Hmm?
Linus