Catching termination of child process and system() call

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Tue Feb 19 11:07:46 AEST 1991


In article <2608 at root44.co.uk> gwc at root.co.uk (Geoff Clare) writes:
> The discussion does have some relevance to 'C' since
> it is about the format of the status returned by wait(),

No. It has absolutely nothing to do with C. We just happen to be talking
about it in C.

> POSIX does not specify the precise encoding of information in the status
> returned by wait(), system(), etc., so portable programs should not
> rely on the traditional encoding Chris describes above.  Instead macros
> are provided in <sys/wait.h> to extract the relevant data from the status:

Wrong. A program written according to your advice is decidedly
nonportable: it will work only on POSIX systems. A program written
according to Chris's advice will work under System V, BSD, and most
POSIX-based systems to boot. Someone who wants to plan for the future
should conditionally compile the POSIX code, though of course he'll
still have to use w & 0200 to get the core dump bit.

Portability is defined by the real world, not a standards committee.

---Dan



More information about the Comp.unix.programmer mailing list