system man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

SYSTEM(3C)							    SYSTEM(3C)

NAME
       system - issue a shell command

SYNOPSIS
       #include <stdlib.h>

       int system(const char *string);

DESCRIPTION
       The  system() function causes string to be given to the shell as input,
       as if 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(3C).

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

       The system() function  sets  the	 SIGINT	 and  SIGQUIT  signals	to  be
       ignored,	 and  blocks  the SIGCHLD signal for the calling thread, while
       waiting for the command to terminate. The system()  function  does  not
       affect  the  termination	 status	 of any child of the calling processes
       other than the process it creates.

       The termination status of the process created by the system()  function
       is  not affected by the actions of other threads in the calling process
       (it is invisible to wait(3C)) or by the disposition of the SIGCHLD sig‐
       nal in the calling process, even if it is set to be ignored. No SIGCHLD
       signal is sent to the process containing the calling  thread  when  the
       command terminates.

RETURN VALUES
       The  system()  function	executes  posix_spawn(3C)  to  create  a child
       process running the shell that in turn executes the commands in string.
       If  posix_spawn() fails, system() returns −1 and sets errno to indicate
       the error; otherwise the exit status of the shell is returned.

ERRORS
       The system() function may set errno values as described by fork(2),  in
       particular:

       EAGAIN
		 A  resource  control  or   limit on the total number of  pro‐
		 cesses, tasks or LWPs	under  execution  by  a	 single	 user,
		 task,	 project,  or	zone  has  been exceeded, or the total
		 amount of system memory available   is	 temporarily  insuffi‐
		 cient to duplicate this process.

       ENOMEM
		 There is not enough swap space.

       EPERM
		 The   {PRIV_PROC_FORK}	 privilege  is	 not  asserted	in the
		 effective set of the calling process.

USAGE
       The system() function manipulates the signal handlers  for  SIGINT  and
       SIGQUIT.	 It  is therefore not safe to call system() in a multithreaded
       process, since some other thread that manipulates these signal handlers
       and  a  thread that concurrently calls system() can interfere with each
       other in a destructive manner.  If, however, no such  other  thread  is
       active,	system()  can  safely  be  called  concurrently	 from multiple
       threads.	 See popen(3C) for an alternative to system() that is  thread-
       safe.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌────────────────────┬─────────────────┐
       │  ATTRIBUTE TYPE    │ ATTRIBUTE VALUE │
       ├────────────────────┼─────────────────┤
       │Interface Stability │ Standard	      │
       ├────────────────────┼─────────────────┤
       │MT-Level	    │ Unsafe	      │
       └────────────────────┴─────────────────┘

SEE ALSO
       ksh(1),	 sh(1),	 popen(3C),  posix_spawn(3C),  wait(3C),  waitpid(3C),
       attributes(5), standards(5)

				 Dec 14, 2006			    SYSTEM(3C)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net