SysProc
SysProc
Description
Opaque platform-dependent handle storing process information.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Proc.c:48:
#endif
struct SysProc {
int exit_code;
bool completed;- In
Proc.c:62:
HANDLE hStderrRead;
#else
# error "Unsupported OS for SysProc"
#endif
};- In
Proc.c:69:
#define WRITE_END 1
SysProc *SysProcCreate(const char *filepath, char **argv, char **envp) {
#if defined(__APPLE__) || defined(__linux__)
int stdin_pipe[2] = {-1};- In
Proc.c:144:
close(stderr_pipe[WRITE_END]);
SysProc *proc = NEW(SysProc);
proc->pid = pid;
proc->stdin_fd = stdin_pipe[WRITE_END];- In
Proc.c:218:
CloseHandle(hStderrWrite); // parent won't write to child's stderr, will read from it
SysProc *proc = NEW(SysProc);
proc->pi = pi;
proc->hStdinWrite = hStdinWrite;- In
Proc.c:228:
}
void SysProcWait(SysProc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");- In
Proc.c:265:
}
SysProcStatus SysProcWaitFor(SysProc *proc, u64 timeout_ms) {
if (!proc) {
LOG_FATAL("Invalid arguments");- In
Proc.c:333:
}
void SysProcTerminate(SysProc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");- In
Proc.c:388:
void SysProcDestroy(SysProc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");- In
Proc.c:407:
}
i32 SysProcWriteToStdin(SysProc *proc, Str *buf) {
if (!proc || !buf) {
LOG_FATAL("Invalid arguments");- In
Proc.c:422:
}
i32 sys_proc_read_internal(SysProc *proc, Str *buf, bool is_stdout) {
if (!proc || !buf) {
LOG_FATAL("Invalid argument");- In
Proc.c:506:
}
i32 SysProcReadFromStdout(SysProc *proc, Str *buf) {
return sys_proc_read_internal(proc, buf, /* is stdout*/ true);
}- In
Proc.c:510:
}
i32 SysProcReadFromStderr(SysProc *proc, Str *buf) {
return sys_proc_read_internal(proc, buf, /* is stdout*/ false);
}- In
Proc.c:514:
}
i32 SysProcGetId(SysProc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");- In
Proc.c:526:
}
i32 SysProcIsRunning(SysProc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");- In
Proc.c:550:
}
i32 SysProcGetExitCode(SysProc *proc) {
if (!proc) {
LOG_FATAL("Invalid argument");- In
SubProcComm.c:9:
int main(int argc, char **argv, char **envp) {
// create a new child process
SysProc *proc = SysProcCreate(argv[1], argv + 1, envp);
// write something to it's stdout
- In
Proc.h:38:
/// FAILURE: NULL.
///
SysProc *SysProcCreate(const char *path, char **argv, char **envp);
///
- In
Proc.h:48:
/// FAILURE: Abort with log message.
///
void SysProcWait(SysProc *proc);
///
- In
Proc.h:61:
/// FAILURE: Abort with log message.
///
SysProcStatus SysProcWaitFor(SysProc *proc, u64 timeout);
///
- In
Proc.h:71:
/// FAILURE: Abort with log message.
///
void SysProcTerminate(SysProc *proc);
///
- In
Proc.h:81:
/// FAILURE: Abort with log message.
///
void SysProcDestroy(SysProc *proc);
///
- In
Proc.h:92:
/// FAILURE: Return -1
///
i32 SysProcWriteToStdin(SysProc *proc, Str *buf);
///
- In
Proc.h:100:
/// FAILURE: Abort with a log message.
///
i32 SysProcGetExitCode(SysProc *proc);
///
- In
Proc.h:111:
/// FAILURE: Return -1
///
i32 SysProcReadFromStdout(SysProc *proc, Str *buf);
///
- In
Proc.h:122:
/// FAILURE: Return -1
///
i32 SysProcReadFromStderr(SysProc *proc, Str *buf);
///
- In
Proc.h:132:
/// FAILURE: Returns -1
///
i32 SysProcGetId(SysProc *proc);
///
- In
Proc.h:139:
/// proc[in] : Child process handle.
///
SysProcStatus SysProcGetStatus(SysProc *proc);
///
Last updated on