poser
A C framework for POsix SERvices
Loading...
Searching...
No Matches
process.h File Reference

declarations for the PSC_Process class More...

#include <poser/decl.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define PSC_ERR_EXEC   127
 The default exit status used for exec() errors.
 

Typedefs

typedef void(* PSC_StreamCallback) (void *obj, PSC_StreamType type, PSC_Connection *conn)
 A callback to receive a PSC_Connection for a standard I/O stream.
 
typedef int(* PSC_ProcessMain) (int argc, char **argv)
 A main function for a child process.
 

Enumerations

enum  PSC_StreamType { PSC_ST_STDIN , PSC_ST_STDOUT , PSC_ST_STDERR }
 Standard I/O streams of the child process. More...
 
enum  PSC_StreamAction { PSC_SA_LEAVE , PSC_SA_CLOSE , PSC_SA_NULL , PSC_SA_PIPE }
 What to do with a standard I/O stream in a child process. More...
 

Detailed Description

declarations for the PSC_Process class

Typedef Documentation

◆ PSC_ProcessMain

typedef int(* PSC_ProcessMain) (int argc, char **argv)

A main function for a child process.

This is called in a child process by PSC_Process_run().

Parameters
argcthe number of arguments, including the process name, which will be NULL if not specified explicitly
argvthe array of arguments
Returns
an exit status [-128..127]

◆ PSC_StreamCallback

typedef void(* PSC_StreamCallback) (void *obj, PSC_StreamType type, PSC_Connection *conn)

A callback to receive a PSC_Connection for a standard I/O stream.

When redirection to a pipe is requested for one of the standard I/O streams, this is called with the stream identifier and a PSC_Connection object representing the parent's end of the pipe.

Parameters
objsome object reference
typethe standard I/O stream
connthe PSC_Connection to use

Enumeration Type Documentation

◆ PSC_StreamAction

What to do with a standard I/O stream in a child process.

Enumerator
PSC_SA_LEAVE 

leave it alone (inherit from parent)

PSC_SA_CLOSE 

close it, so the child can't use it

PSC_SA_NULL 

redirect it to /dev/null (silence)

PSC_SA_PIPE 

redirect it to a pipe

◆ PSC_StreamType

Standard I/O streams of the child process.

Enumerator
PSC_ST_STDIN 

standard input

PSC_ST_STDOUT 

standard output

PSC_ST_STDERR 

standard error