Ns_Exec3
External process execution
Usage
#include "ns.h"
int
Ns_ExecArgblk(char *exec, char *dir, int fdin, int fdout,
char *args, Ns_Set *env)
int
Ns_ExecArgv(char *exec, char *dir, int fdin, int fdout,
char **argv, Ns_Set *env)
int
Ns_ExecProc(char *exec, char **argv)
int
Ns_ExecProcess(char *exec, char *dir, int fdin, int fdout,
char *args, Ns_Set *env)
int
Ns_Fork(void)
char
**Ns_GetEnviron(void)
int
Ns_WaitForProcess(int pid, int *statusPtr)
int
Ns_WaitProcess(int pid)
int
ns_fork(void)
Overview
These functions handle fork and exec operations. See files:
nsd/exec.c, nsd/tclenv.c and nsthread/fork.c.
Ns_ExecArgblk(exec, dir, fdin, fdout, args, env)
Executes a command in a child process. Return process id of
child process exec´ing the command or -1 on failure. Provides extended
error checking and error messages.
Ns_ExecArgv(exec, dir, fdin, fdout, argv, env)
Execute a command in a child process using fork(2) and execve(2),
returns the process id of child process exec´ing the command or
-1 on failure. The child sends an extended error message to the
parent.
Ns_ExecProc(exec, argv)
Executes a command in a child process. Returns the process id
of the child process exec´ing the command or -1 on failure.
Simplifies call to Ns_ExecArgv.
Ns_ExecProcess(exec, dir, fdin, fdout, args, env)
Executes a command in a child process. Returns the process id
of the child process exec´ing the command or -1 on failure.
Calls Ns_ExecArgblk with same arguments.
Ns_Fork()
Posix style fork(), using fork1() on Solaris if needed. See
fork) man page. Calls ns_fork.
Ns_GetEnviron()
Returns pointer to the environment vector.
Ns_WaitForProcess(pid, statusPtr)
Wait for child process. Returns NS_OK on success, or
NS_ERROR on failure. *statusPtr is set to the exit
code of the child process.
Ns_WaitProcess(pid)
Wait for child process. Calls Ns_WaitForProcess with NULL
statusPtr. Returns NS_OK on success, or NS_ERROR on failure.
ns_fork()
Posix style fork(), using fork1() on Solaris if needed.
Keywords
Releases
Unchanged in 2 releases since Debian 3.1 (Sarge).