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


* 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.

> +    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.

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

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

Thanks,
Florian


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