system(3) — Subroutines
OSF
NAME
system − Executes a shell command
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <stdio.h>
#include <stdlib.h> int system (
const char ∗string );
PARAMETERS
stringSpecifies a valid sh shell command.
DESCRIPTION
The system() function passes the string parameter to the sh command, which interprets string as a command and executes it.
The system() function invokes the fork() function to create a child process that in turn uses the exec function to run 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.
NOTES
AES Support Level:
Full use
RETURN VALUES
Upon successful completion, the system() function returns the exit status of the shell. Otherwise, the system() function returns a value of -1 and sets errno to indicate the error. Exit status 127 indicates that the shell could not be executed.
ERRORS
If the system() function fails, errno may be set to one of the following values:
[EAGAIN]The system-imposed limit on the total number of processes under execution, system-wide or by a single user ID, would be exceeded.
[EINTR]The system() function was interrupted by a signal which was caught.
[ENOMEM]There is not enough space left for this process.
RELATED INFORMATION
Functions: exec(2), exit(2), fork(2), wait(2)
Commands: sh(1)