poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
PSC_ProcessOpts Class Reference

Creation options for a child process. More...

#include <poser/core/process.h>

Public Member Functions

PSC_ProcessOptsPSC_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.
 

Detailed Description

Creation options for a child process.

Member Function Documentation

◆ PSC_ProcessOpts_addArg()

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.

Parameters
selfthe PSC_ProcessOpts
argthe argment to add

◆ PSC_ProcessOpts_create()

PSC_ProcessOpts * PSC_ProcessOpts_create ( void  )

PSC_ProcessOpts default constructor.

Creates a new PSC_ProcessOpts

Returns
a newly created PSC_ProcessOpts

◆ PSC_ProcessOpts_destroy()

void PSC_ProcessOpts_destroy ( PSC_ProcessOpts self)

PSC_ProcessOpts destructor.

Parameters
selfthe PSC_ProcessOpts

◆ PSC_ProcessOpts_setExecError()

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.

Parameters
selfthe PSC_ProcessOpts
execErrorthe status code to use for exec() errors
Returns
0 on success, -1 if an invalid status code was passed

◆ PSC_ProcessOpts_setName()

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.

Parameters
selfthe PSC_ProcessOpts
namethe process name

◆ PSC_ProcessOpts_streamAction()

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.

Parameters
selfthe PSC_ProcessOpts
streamwhich stream to configure
actionwhat to do with the stream
Returns
0 on success, -1 if invalid values were passed

The documentation for this class was generated from the following file: