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: [RFC v3 03/23] sysdeps/wait: Use waitid if avaliable


On Tue, Jul 16, 2019 at 10:31 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Alistair Francis:
>
> > +#ifdef __NR_waitid
>
> I wonder if the condition should be
>
>   #ifndef __NR_wait4
>
> etc.  That would make it less risky for the existing architectures.

Seems fair, I have updated that.

>
> > +    case CLD_DUMPED:
> > +      *stat_loc = 0x80;
> > +    case CLD_KILLED:
> > +      *stat_loc |= infop.si_status;
> > +      break;
>
> The kernel does this (in kernel/exit.c):
>
>         status = (p->signal->flags & SIGNAL_GROUP_EXIT)
>                 ? p->signal->group_exit_code : p->exit_code;
>         wo->wo_stat = status;
> …
>         if (infop) {
>                 if ((status & 0x7f) == 0) {
>                         infop->cause = CLD_EXITED;
>                         infop->status = status >> 8;
>                 } else {
>                         infop->cause = (status & 0x80) ? CLD_DUMPED : CLD_KILLED;
>                         infop->status = status & 0x7f;
>                 }
>                 infop->pid = pid;
>                 infop->uid = uid;
>         }
>
> Therefore, I wonder if you need to propagate the lower bits from
> si_status for CLD_DUMPED, too.

We are propagating the bits due to a fall through in the switch
statement, I have added a comment to indicate that we are falling
through.

>
> For wait/wait3/waitpid, you could probably use the implementations for
> sysdeps/unix/bsd, layered on top of wait4.

I'm not sure what you mean here.

>
> The patch also needs some formatting tweaks regarding the placement of
> braces, and there are missing spaces before parentheses.

Yep, I have tried to fixup all the formatting issues.

Alistair

>
> Thanks,
> Florian


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