This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extending wait4(2) or waitid(2) linux syscall


On Fri, Nov 16, 2018 at 2:27 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Arnd Bergmann:
>
> > On Thu, Nov 15, 2018 at 7:38 AM <hpa@zytor.com> wrote:
> >> On November 15, 2018 7:30:11 AM PST, "Dmitry V. Levin" <ldv@altlinux.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:
> >
> >> >2. The time precision provided by struct rusage returned by wait4(2)
> >> >and waitid(2) is too low for syscall time counting (strace -c) nowadays,
> >> >this can be observing by running in a row a simple command like "strace -c
> >> >pwd".
> >> >
> >> >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
> >> >timespec64.
> >>
> >> Arnd: w.r.t. our previous discussion, this would seem to justify going to timespec(64) for these kind of cases.
> >
> > Ok, and I assume we want the same layout for getrusage(2) then, right?
>
> Or introduce something that covers FreeBSD's wait6 functionality as well
> (resource usage by subprocesses of the subprocess).

Ok, so combining that with the request for a signal mask, we'd want
something like

int wait9(idtype_t idtype, id_t id, siginfo_t *infop, int options,
       /* waitid subset */
           int *status, struct rusage64 *self, struct rusage64
*children,  /* wait4, wait6, time64 */
           const sigset_t *sigmask, size_t sigsetsize);
       /* suggested by Dmitry */

which I think could over all use cases mentioned in this thread, but
already has nine arguments instead of the allowed six, so it can't
be the signature of the system call entry.

We can get that down to six arguments in the familiar ways:
- like Linux waitid, wait4-style status can be computed from infop
- like wait6, self and children can be in one pointer
- like io_pgetevents, sigmask and sigsetsize can be an indirect struct

int waitid6(idtype_t idtype, id_t id, siginfo_t *infop, int options,
          struct __wrusage64 *wrusage, struct __wait_sigset *sigset);

Alternatively, we could combine even more arguments into a single
structure if inputs, in various ways.

        Arnd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]