Catching termination of child process and system() call

Doug Gwyn gwyn at smoke.brl.mil
Thu Jan 31 06:40:13 AEST 1991


In article <1356 at geovision.UUCP> pt at geovision.gvc.com writes:
>gwyn at smoke.brl.mil (Doug Gwyn) writes:
>>No, it's wait((int*)0) in all flavors of UNIX and POSIX.
>So Doug: is Ultrix not a flavour of unix?

Well, that's a question I prefer not to answer.
However, I explained the "union wait" situation previously.
Here it is again:

Some "helpful" soul at UCB decided that it would be "nicer" to declare
a union type for the wait() status, with bit field members designating
the "subfields" of the status, than to simply announce, as had been
the case universally in UNIX to that point, which bits of the int-type
status had which meanings.  Unfortunately, because of the lack of
standard bit-field allocation semantics, to accommodate all previously
existing C code that had been written according to the rules to that
point, porting 4.nBSD to a new platform always required that the BSD
porter check the bit-field definition and if necessary adjust it to
accurately reflect the REAL definition of the wait() status, which has
always been in terms of the lowest 16 bits of an int representation.

I just examined the 4.3BSD kernel source code and found no use of the
w_* identifiers that are declared/defined in <sys/wait.h>.  I did,
however, find places where the kernel treated the wait() status as
type int.  This even more strongly indicates that the true type is int
and that <sys/wait.h> is simply a bogus invention.  Note that int* and
union wait* need not have the same representation (although they do in
many implementations including VAX 4.3BSD PCC), so it does matter what
the argument type really is.  It is int*.



More information about the Comp.lang.c mailing list