This is the mail archive of the
mailing list for the glibc project.
Re: extending wait4(2) or waitid(2) linux syscall
- From: hpa at zytor dot com
- To: "Dmitry V. Levin" <ldv at altlinux dot org>, Arnd Bergmann <arnd at arndb dot de>
- Cc: Albert ARIBAUD <albert dot aribaud at 3adev dot fr>, GNU C Library <libc-alpha at sourceware dot org>, linux-api at vger dot kernel dot org
- Date: Thu, 15 Nov 2018 07:37:58 -0800
- Subject: Re: extending wait4(2) or waitid(2) linux syscall
- References: <email@example.com> <20181115140441.GA2171@altlinux.org> <CAK8P3a0Gsqa8WTbALOUchRyEA7E2f3P1f=XQ8nD2xQaemfPpcQ@mail.gmail.com> <20181115153008.GC2171@altlinux.org>
On November 15, 2018 7:30:11 AM PST, "Dmitry V. Levin" <firstname.lastname@example.org> wrote:
>On Thu, Nov 15, 2018 at 06:39:03AM -0800, Arnd Bergmann wrote:
>> On Thu, Nov 15, 2018 at 6:05 AM Dmitry V. Levin wrote:
>> > On Thu, Apr 20, 2017 at 03:20:51PM +0200, Albert ARIBAUD wrote:
>> > > https://sourceware.org/glibc/wiki/Y2038ProofnessDesign?rev=146
>> > Is there any rationale for marking wait4 as an obsolete API?
>> In the *kernel* syscall API, wait4(2) is obsoleted by waitid(2),
>> a strict superset of its functionality.
>> In the libc API, this is different, as wait4() does not have a
>> that is exposed to user space directly. I expect glibc to implement
>> wait4() on top of the kernel's waitid().
>> There has not been a final decision on which variant of waitid() that
>> be. The easiest option would be to not change it at all: new
>> (rv32, csky, nanomips/p32, ...) would keep exposing the traditional
>> waitid() in Linux, with its 32-bit time_t based rusage structure, but
>> wait4(). glibc then has to convert between the kernel's rusage and
>> user space rusage indefinitely.
>> Alternatively, we can create a new version like waitid2() that uses
>> 64-bit time_t in some form, either the exact same rusage that we
>> use on 64-bit architectures and x32, or using a new set of arguments
>> to include further improvements.
>In strace, we have two use cases that require an extended version
>of wait4(2) or waitid(2) syscall. From your response I understand that
>you'd recommend extending waitid(2) rather than wait4(2), is it
>These two use cases were mentioned in my talk yesterday at LPC 2018,
>here is a brief summary.
>1. strace needs a race-free invocation of wait4(2) or waitid(2)
>with a different signal mask, this cannot be achieved without
>an extended version of syscall, similar to pselect6(2) extension
>over select(2) and ppoll(2) extension over poll(2).
>Signal mask specification in linux requires two parameters:
>"const sigset_t *sigmask" and "size_t sigsetsize".
>Creating pwait6(2) as an extension of wait4(2) with two arguments
>Creating pwaitid(2) as an extension of waitid(2) that already has 5
>arguments would require an indirection similar to pselect6(2).
>2. The time precision provided by struct rusage returned by wait4(2)
>waitid(2) is too low for syscall time counting (strace -c) nowadays,
>can be observing by running in a row a simple command like "strace -c
>The fix is to return a more appropriate structure than struct rusage
>by the new pwait6(2)/pwaitid(2) syscall mentioned above, where
>struct timeval is replaced with struct timespec or even struct
Arnd: w.r.t. our previous discussion, this would seem to justify going to timespec(64) for these kind of cases.
Sent from my Android device with K-9 Mail. Please excuse my brevity.