system(3,F) AIX Technical Reference system(3,F)
-------------------------------------------------------------------------------
system
PURPOSE
Runs a shell command.
LIBRARY
Standard C Library (libc.a)
SYNTAX
#include <stdio.h>
int system (string)
char *string;
DESCRIPTION
The system subroutine passes the string parameter to the sh command as input.
Then sh interprets string as a command and runs it.
The system subroutine invokes the runl system call to create a child process to
run /bin/sh, which interprets the shell command contained in the string
parameter. The current process waits until the shell has completed, then
returns the exit status of the shell.
Note: The system subroutine runs only sh shell commands (also called Bourne
shell commands). The results are unpredictable if the string parameter
is not a valid sh shell command.
RETURN VALUE
The system subroutine is implemented using runl and waitpid. If either fails,
a value of -1 is returned and errno is set to indicate the error.
FILE
/bin/sh
ERROR CONDITIONS
The system subroutine fails if one or more of the following are true:
EAGAIN The system-imposed limit on the total number of processes under
execution, system-wide or by a single user ID (CHILD_MAX), would be
exceeded.
Processed November 7, 1990 system(3,F) 1
system(3,F) AIX Technical Reference system(3,F)
EINTR The system subroutine was interrupted by a signal.
ENOMEM Insufficient storage space is available.
RELATED INFORMATION
In this book: "exit, _exit," "run: runl, runv, runle, runve, runlp, runvp,"
and "wait, waitpid."
The sh command in AIX Operating System Commands Reference.
Processed November 7, 1990 system(3,F) 2