[PATCH v3 1/1] waitid: Add support for waiting for the current process group
Linus Torvalds
torvalds@linux-foundation.org
Wed Aug 14 17:06:00 GMT 2019
On Wed, Aug 14, 2019 at 9:55 AM Rich Felker <dalias@libc.org> 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
More information about the Libc-alpha
mailing list