[RFC v3 03/23] sysdeps/wait: Use waitid if avaliable

Linus Torvalds torvalds@linux-foundation.org
Sun Jul 21 17:22:00 GMT 2019


On Sun, Jul 21, 2019 at 8:45 AM Eric W. Biederman <ebiederm@xmission.com> wrote:
>
> We either add P_PROCESS_PGID to the kernel's waitid or we add wait4.

Do we actually need a new flag?

Why not just allow people to pass in pid = 0 with the existing P_PGID flag?

Those are the traditional and documented waitpid() semantics. Why
wouldn't we use those semantics for waitid() too?

And since our current (broken) waitid() returns EINVAL for that case,
it's even trivial to test for in user space (and fall back on the
broken racy code in user space - which you have to do anyway).

Honestly, that seems like the simplest soilution, but also like the
only sane model. The fact that P_PGID with a zero pid doesn't work
seems to simply be a bug right now, and keeps waitid() from being a
proper superset of waitpid().

              Linus



More information about the Libc-alpha mailing list