poser
A C framework for POsix SERvices
|
Creation options for a child process. More...
#include <poser/core/process.h>
Public Member Functions | |
PSC_ProcessOpts * | PSC_ProcessOpts_create (void) |
PSC_ProcessOpts default constructor. | |
void | PSC_ProcessOpts_setName (PSC_ProcessOpts *self, const char *name) |
Set the name of the child process. | |
void | PSC_ProcessOpts_addArg (PSC_ProcessOpts *self, const char *arg) |
Add a command-line argument. | |
int | PSC_ProcessOpts_streamAction (PSC_ProcessOpts *self, PSC_StreamType stream, PSC_StreamAction action) |
Configure an action for a standard I/O stream of the child process. | |
int | PSC_ProcessOpts_setExecError (PSC_ProcessOpts *self, int execError) |
Configure which exit status to use to indicate exec() errors. | |
void | PSC_ProcessOpts_destroy (PSC_ProcessOpts *self) |
PSC_ProcessOpts destructor. | |
Creation options for a child process.
void PSC_ProcessOpts_addArg | ( | PSC_ProcessOpts * | self, |
const char * | arg | ||
) |
Add a command-line argument.
All arguments added here are passed in argv[] to the child process.
self | the PSC_ProcessOpts |
arg | the argment to add |
PSC_ProcessOpts * PSC_ProcessOpts_create | ( | void | ) |
PSC_ProcessOpts default constructor.
Creates a new PSC_ProcessOpts
void PSC_ProcessOpts_destroy | ( | PSC_ProcessOpts * | self | ) |
PSC_ProcessOpts destructor.
self | the PSC_ProcessOpts |
int PSC_ProcessOpts_setExecError | ( | PSC_ProcessOpts * | self, |
int | execError | ||
) |
Configure which exit status to use to indicate exec() errors.
If not set, the default value PSC_ERR_EXEC (127) is used, which is also what most shells use. This should be a status code (in the range [-128..127]) the program you intend to execute never uses. 127 is typically a safe choice.
self | the PSC_ProcessOpts |
execError | the status code to use for exec() errors |
void PSC_ProcessOpts_setName | ( | PSC_ProcessOpts * | self, |
const char * | name | ||
) |
Set the name of the child process.
If set, this is passed as argv[0], and also becomes the display name for tools like ps(1) when PSC_Process_exec() is used. If not set, argv[0] will be NULL for PSC_Process_run(), while PSC_Process_exec() will default to the path executed.
self | the PSC_ProcessOpts |
name | the process name |
int PSC_ProcessOpts_streamAction | ( | PSC_ProcessOpts * | self, |
PSC_StreamType | stream, | ||
PSC_StreamAction | action | ||
) |
Configure an action for a standard I/O stream of the child process.
self | the PSC_ProcessOpts |
stream | which stream to configure |
action | what to do with the stream |