Base WG Resolution Ref: bwg97-007
Topic: SA_NOCLDWAIT inheritence

This is an approved Base Working Group Resolution for XSH Issue 5 / Issue 4 Version 2.

Last update: 23 February,1998

								97 #007


	Topic:			SA_NOCLDWAIT inheritence
	Relevant Sections:	exec
	Spec:			XSH Issue 5 / Issue 4 Version 2

Resolution Request:

UNIX 98 / UNIX 95 require SA_NOCLDWAIT be preserved on exec. This
is deduced from the following sentence in the man page for execve:

        All other process attributes defined in this document will be the
        same in the new and old process images.

Looking at existing practice (particularly SVR4 as in Solaris 2.5.1)
this would not seem to be the case. 
This does not seem to be tested by the existing test suites.

Consider a simple program that forks a child process and wants to recover
the child's exit code.  Most programs would do something like:

        pid = fork();
        if (pid == 0) {
        if (waitpid(pid, &status, 0) == -1) {

Under UNIX 98 this is broken unless it clears SA_NOCLDWAIT first.
This is because it could inherit a signal action of SIG_IGN for SIGCHLD
(in POSIX), or a SA_NOCLDWAIT flag for SIGCHLD (in Unix98).
In that case, if the child process terminates before the call to waitpid(),
then waitpid() returns with errno=ECHILD.  If the child does not terminate
early, then waitpid() correctly recovers the child's exit status.  Thus a
race condition occurs.
I believe that clearing SA_NOCLDWAIT on exec (as does SunOS 5.5.1) would
be sufficient. 

Resolution Response

Withdrawn by the Originator - this is being considered
at PASC and WG15.

Circulated for review: Sep 17th 1997
Approved:  Feb 1998