up | Inhaltsverzeichniss | Kommentar

Manual page for system(3S)

system - issue a shell command

SYNOPSIS

#include <stdlib.h>

int system(const char *string);

MT-LEVEL

MT-Safe

DESCRIPTION

system() causes the string to be given to the shell as input, as if the string had been typed as a command at a terminal. The invoker waits until the shell has completed, then returns the exit status of the shell in the format specified by waitpid.2

If string is a null pointer, system() checks if the shell exists and is executable. If the shell is available, system() returns non-zero; otherwise it returns zero.

Solaris
system() uses /usr/bin/sh (see sh.1
XPG4
system() uses the XPG4-compliant shell /usr/bin/ksh (see ksh.1

RETURN VALUES

system() forks to create a child process that in turn execs the shell in order to execute string. If the fork() or exec() fails, system() returns a value of -1 and sets errno.

ERRORS

system() fails if one or more of the following are true:

EAGAIN
The system-imposed limit on the total number of processes under execution by a single user would be exceeded.
EINTR
system() was interrupted by a signal.
ENOMEM
The new process requires more memory than is available.

SEE ALSO

ksh.1 sh.1 useradd.1m exec.2 fork.2 setuid.2 waitpid.2 xpg4.5

NOTES

system() will fail to execute setuid() or setgid() if either the uid or gid of the application's owner/group is less than 100. (see useradd.1m and setuid.2


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97