POSIX.2 system() return values

David A Willcox willcox at urbana.mcd.mot.com
Tue Mar 26 02:07:54 AEST 1991

Submitted-by: willcox at urbana.mcd.mot.com (David A Willcox)

rstevens at noao.edu (Rich Stevens) writes:

>Submitted-by: rstevens at noao.edu (Rich Stevens)

>Does anyone know the current draft status of POSIX.2 with regard to
>the system() function and its return code.  

>From POSIX.2 Draft 11 (unchanged for several drafts):

    B.3.1.3 Returns

    If command is NULL, the system() function shall return nonzero.

    If comamnd is not NULL, the system() function shall return the
    termination status of the command language interpreter in the format
    specified by the waitpid() function in POSIX.1.  The termination status
    of the c.l.i. is as specified by the sh utility, except that if some
    error prevents the c.l.i. from executing after the child process is
    created, the return value from system() shall be as of the c.l.i.
    had terminated using exit(127) or _exit(127).  If a child process
    cannot be created, or if the terminaton status of the c.l.i. cannot
    be obtained, system() shall return -1 and set errno to indicate the

David A. Willcox		"Just say 'NO' to universal drug testing"
Motorola TSD - Urbana		UUCP: ...!uiucuxc!udc!willcox
1101 E. University Ave.		INET: willcox at urbana.mcd.mot.com
Urbana, IL 61801		FONE: 217-384-8534

Volume-Number: Volume 23, Number 19

More information about the Comp.std.unix mailing list