*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> system (3s)              


system(3S)							    system(3S)

NAME    [Toc]    [Back]

     system - issue a shell command

SYNOPSIS    [Toc]    [Back]

     #include <stdlib.h>

     int system	(const char *string);

DESCRIPTION    [Toc]    [Back]

     system causes the string to be given to the shell [see sh(1)] as input,
     as	if the string had been typed as	a command at a terminal.  The current
     process 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 /sbin/sh exists and is
     executable.  If /sbin/sh is available, system returns non-zero; otherwise
     it	returns	zero.

     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 allowed by the
		 system-imposed	maximum	MAXMEM.

SEE ALSO    [Toc]    [Back]

     exec(2), waitpid(2), sh(1).

DIAGNOSTICS    [Toc]    [Back]

     system forks to create a child process that in turn execs /sbin/sh	in
     order to execute string.  If the fork or exec fails, system returns -1
     and sets errno.

NOTES    [Toc]    [Back]

     Calling system(3S)	in a program that is set user ID to root is difficult
     to	do without creating unintended security	problems.  For example,	since
     system invokes a copy of sh(1) to execute the supplied command, the
     programmer	must be	extremely careful not to allow critical	environment
     variables,	such as	PATH, which determine the behavior of the shell	to be
     passed through from the environment of the	invoking user without
     modification.  It is recommended that system(3S) not be used by set user
     ID	programs.

									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
system IRIX issue a shell command from Fortran
sh Tru64 Shell, the standard command language interpreter (POSIX Shell)
sh Tru64 The Bourne shell, an interactive command interpreter and command programming language
Rsh Tru64 The Bourne shell, an interactive command interpreter and command programming language
VkForkIO IRIX Command-line interface to shell command component
sh FreeBSD command interpreter (shell)
omshell FreeBSD OMAPI Command Shell
system FreeBSD pass a command to the shell
system NetBSD pass a command to the shell
system Linux execute a shell command
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service