This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 1/1] waitid: Add support for waiting for the current process group
- From: Linus Torvalds <torvalds at linux-foundation dot org>
- To: Rich Felker <dalias at libc dot org>
- Cc: Christian Brauner <christian dot brauner at ubuntu dot com>, Oleg Nesterov <oleg at redhat dot com>, Linux List Kernel Mailing <linux-kernel at vger dot kernel dot org>, GNU C Library <libc-alpha at sourceware dot org>, Alistair Francis <alistair23 at gmail dot com>, "Eric W. Biederman" <ebiederm at xmission dot com>, Arnd Bergmann <arnd at arndb dot de>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Palmer Dabbelt <palmer at sifive dot com>, macro at wdc dot com, Zong Li <zongbox at gmail dot com>, Andrew Morton <akpm at linux-foundation dot org>, Al Viro <viro at zeniv dot linux dot org dot uk>, Peter Anvin <hpa at zytor dot com>
- Date: Wed, 14 Aug 2019 10:06:19 -0700
- Subject: Re: [PATCH v3 1/1] waitid: Add support for waiting for the current process group
- References: <CAKmqyKMJPQAOKn11xepzAwXOd4e9dU0Cyz=A0T-uMEgUp5yJjA@mail.gmail.com> <20190814154400.6371-1-christian.brauner@ubuntu.com> <20190814154400.6371-2-christian.brauner@ubuntu.com> <20190814160917.GG11595@redhat.com> <20190814161517.ldbn62mulk2pmqo5@wittgenstein> <20190814163443.6odsksff4jbta7be@wittgenstein> <20190814165501.GJ9017@brightrain.aerifal.cx>
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