Hi Mike, 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, Michael > .PP > The function > .BR _Exit () > diff --git a/man3/exit.3 b/man3/exit.3 > index 83f9ac580bd8..1c7c0b6349b8 100644 > --- a/man3/exit.3 > +++ b/man3/exit.3 > @@ -38,10 +38,24 @@ exit \- cause normal process termination > .SH DESCRIPTION > The > .BR exit () > -function causes normal process termination and the > -value of \fIstatus & 0xff\fP is returned to the parent > -(see > -.BR wait (2)). > +function causes normal process termination and makes the value of > +.I status > +available to the parent process. > +When using > +.BR wait (2) > +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. > .PP > All functions registered with > .BR atexit (3) > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html