Re: [PATCH] _exit.2/exit.3: fix old definition of "status"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18 May 2018 17:48, Michael Kerrisk (man-pages) wrote:
> On 05/14/2018 05:45 PM, Mike Frysinger wrote:
> > From: Mike Frysinger <vapier@xxxxxxxxxxxx>
> > 
> > Starting with POSIX (2016 edition), the value of status has been
> > extended to say that the full 32-bits are available via waitid
> > and signal handlers.  The 2013 and older editions only mention
> > the low 8-bits.  Update _exit(2) and exit(3) accordingly.
> > 
> > URL: http://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/exit.html
> > URL: http://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/exit.html
> > URL: http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/functions/exit.html
> > Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
> 
> Thanks for the heads-up on this. I recall seeing discussion of
> this change in POSIX, but missed the fact that it actually
> went in.
> 
> > ---
> > Note: feel free to wordsmith :P.
> > 
> >  man2/_exit.2 | 20 ++++++++++++++++----
> >  man3/exit.3  | 22 ++++++++++++++++++----
> >  2 files changed, 34 insertions(+), 8 deletions(-)
> > 
> > diff --git a/man2/_exit.2 b/man2/_exit.2
> > index 82406e2aac34..3cc0e5d59e69 100644
> > --- a/man2/_exit.2
> > +++ b/man2/_exit.2
> > @@ -65,11 +65,23 @@ The process's parent is sent a
> >  signal.
> >  .PP
> >  The value
> > -.I "status & 0xff"
> > -is returned to the parent process as the process's exit status, and
> > -can be collected using one of the
> > +.I status
> > +is made available to the parent process.
> > +When using
> >  .BR wait (2)
> > -family of calls.
> > +or
> > +.BR waitpid (2),
> > +only the 8 least significant bits are accessible (e.g.
> > +.IR "status & 0xff" ")."
> > +The full value is available in the
> > +.I siginfo_t
> > +structure when using
> > +.BR waitid (2)
> > +or in signal handlers registered via
> > +.BR sigaction (2)
> > +with the
> > +.I SA_SIGINFO
> > +flag.
> 
> I know that the above is what POSIX.1-2016 now says, but is it
> true on Linux? I just did a very quick test with sigaction(SA_SIGINFO),
> and the value is just 8 bits worth in si_status, and indeed in the
> kernel source there is (in do_notify_parent()):
> 
>         info.si_status = tsk->exit_code & 0x7f;
> 
> Did I miss something?

thanks for double checking ... Linux does indeed look like it has not
caught up.  let me investigate the kernel side and see if we can't get
it fixed and then circle back here.

in the mean time, should we update the NOTES section to discuss POSIX
and Linux deviations ?
-mike

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux