Data Structures | |
struct | bg_subprocess_t |
Subprocess handle. More... | |
Functions | |
bg_subprocess_t * | bg_subprocess_create (const char *command, int do_stdin, int do_stdout, int do_stderr) |
Create a subprocess. | |
void | bg_subprocess_kill (bg_subprocess_t *proc, int signal) |
Send a signal to a process. | |
int | bg_subprocess_close (bg_subprocess_t *proc) |
Close a subprocess and free all associated memory. | |
int | bg_subprocess_read_line (int fd, char **ret, int *ret_alloc, int timeout) |
Read a line from stdout or stderr of a process. | |
int | bg_subprocess_read_data (int fd, uint8_t *ret, int len) |
Read data from stdout or stderr of a process. |
bg_subprocess_t* bg_subprocess_create | ( | const char * | command, | |
int | do_stdin, | |||
int | do_stdout, | |||
int | do_stderr | |||
) |
Create a subprocess.
command | Command, will be passed to /bin/sh | |
do_stdin | 1 if stdin should be connected by a pipe, 0 else | |
do_stdout | 1 if stdout should be connected by a pipe, 0 else | |
do_stderr | 1 if stderr should be connected by a pipe, 0 else |
void bg_subprocess_kill | ( | bg_subprocess_t * | proc, | |
int | signal | |||
) |
Send a signal to a process.
proc | A subprocess | |
signal | Which signal to send |
int bg_subprocess_close | ( | bg_subprocess_t * | proc | ) |
Close a subprocess and free all associated memory.
proc | A subprocess |
int bg_subprocess_read_line | ( | int | fd, | |
char ** | ret, | |||
int * | ret_alloc, | |||
int | timeout | |||
) |
Read a line from stdout or stderr of a process.
fd | The filesecriptor | |
ret | String (will be realloced) | |
ret_alloc | Allocated size of the string (will be changed with each realloc) | |
timeout | Timeout in milliseconds |
int bg_subprocess_read_data | ( | int | fd, | |
uint8_t * | ret, | |||
int | len | |||
) |
Read data from stdout or stderr of a process.
fd | The filesecriptor | |
ret | Pointer to allocated memory, where the data will be placed | |
len | How many bytes to read |