Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_spawnvp(3)		    Library Functions Manual		   xt_spawnvp(3)

NAME
     xt_spawnvp() - Fork and exec a new process from an argv-style array

LIBRARY
     #include <xtend/proc.h>
     -lxtend

SYNOPSIS
     // FIXME: Ugly stop-gap for now.  sig_t is not portable, so don't use it.
     #if defined(__sun__)
     typedef void (*sig_t)(int);
     #endif
     int     xt_spawnvp(int parent_action, int echo, char *argv[],
     char *infile, char *outfile, char *errfile)

ARGUMENTS
     parent_action:  P_WAIT or P_NOWAIT
     echo:	     P_ECHO or P_NOECHO
     infile:	     File to which stdin of child is redirected or NULL
     outfile:	     File to which stdout of child is redirected or NULL
     errfile:	     File to which stderr of child is redirected or NULL

DESCRIPTION
     xt_spawnvp() and xt_spawnlp() are wrappers around fork(2) and exec(3) which
     make  it  easy to run a child process without an intermediate shell process
     as is used by system(3).  The xt_spawnlp() function spawns a child  process
     using  a  variable argument list.	The 6th argument is passed to argv[0] of
     the child, the 7th to argv[1], etc.

     The xt_spawnvp() function spawns a process using the command  contained  in
     an argv[] array constructed by the caller.  xt_spawnlp() automatically con-
     structs such an argv[] array and calls xt_spawnvp().

     The  calling process waits for the child to complete if P_WAIT is passed to
     parent_action, or continues immediately if P_NOWAIT is passed.   If  P_ECHO
     is  passed  as  the  echo	argument,  the command is echoed, the command is
     echoed to the parent's stdout.

     If infile, outfile, or errfile are not NULL, then	the  corresponding  file
     streams stdin, stdout, or stderr are redirected to the filename provided.

RETURN VALUES
     The  exit	status	of  the child process if P_WAIT is passed The PID of the
     child process if P_NOWAIT is passed

SEE ALSO
     xt_spawnlp(3), fork(2), exec(3)

								   xt_spawnvp(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_spawnvp&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help