1#ifndef POSER_CORE_PROCESS_H
2#define POSER_CORE_PROCESS_H
12#define PSC_ERR_EXEC 127
98 CMETHOD ATTR_NONNULL((2));
108 CMETHOD ATTR_NONNULL((2));
168 CMETHOD ATTR_NONNULL((3));
185 CMETHOD ATTR_NONNULL((3));
212 CMETHOD ATTR_RETNONNULL;
Event arguments for a finished child process.
int PSC_EAProcessDone_signal(const PSC_EAProcessDone *self)
The signal that terminated the child process.
int PSC_EAProcessDone_status(const PSC_EAProcessDone *self)
The exit status of the child process.
PSC_Process * PSC_Process_create(const PSC_ProcessOpts *opts)
PSC_Process default constructor.
int PSC_Process_stop(PSC_Process *self, unsigned forceMs)
Send signals to stop the child process.
int PSC_Process_exec(PSC_Process *self, void *obj, PSC_StreamCallback cb, const char *path)
Execute an external program in the child process.
int PSC_Process_run(PSC_Process *self, void *obj, PSC_StreamCallback cb, PSC_ProcessMain main)
Execute a given function in the child process.
PSC_Event * PSC_Process_done(PSC_Process *self)
The child process finished.
pid_t PSC_Process_pid(const PSC_Process *self)
The process id of the child process.
Creation options for a child process.
int PSC_ProcessOpts_setExecError(PSC_ProcessOpts *self, int execError)
Configure which exit status to use to indicate exec() errors.
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.
void PSC_ProcessOpts_addArg(PSC_ProcessOpts *self, const char *arg)
Add a command-line argument.
PSC_ProcessOpts * PSC_ProcessOpts_create(void)
PSC_ProcessOpts default constructor.
void PSC_ProcessOpts_destroy(PSC_ProcessOpts *self)
PSC_ProcessOpts destructor.
void PSC_ProcessOpts_setName(PSC_ProcessOpts *self, const char *name)
Set the name of the child process.
int(* PSC_ProcessMain)(int argc, char **argv)
A main function for a child process.
Definition: process.h:76
void(* PSC_StreamCallback)(void *obj, PSC_StreamType type, PSC_Connection *conn)
A callback to receive a PSC_Connection for a standard I/O stream.
Definition: process.h:66
PSC_StreamType
Standard I/O streams of the child process.
Definition: process.h:16
@ PSC_ST_STDOUT
standard output
Definition: process.h:18
@ PSC_ST_STDIN
standard input
Definition: process.h:17
@ PSC_ST_STDERR
standard error
Definition: process.h:19
PSC_StreamAction
What to do with a standard I/O stream in a child process.
Definition: process.h:24
@ PSC_SA_CLOSE
close it, so the child can't use it
Definition: process.h:26
@ PSC_SA_NULL
redirect it to /dev/null (silence)
Definition: process.h:27
@ PSC_SA_LEAVE
leave it alone (inherit from parent)
Definition: process.h:25
@ PSC_SA_PIPE
redirect it to a pipe
Definition: process.h:28