27 lines
590 B
C
27 lines
590 B
C
#ifndef _SPAWN_H_
|
|
#define _SPAWN_H_
|
|
|
|
#include <sys/types.h>
|
|
|
|
struct child_process {
|
|
struct list_head list;
|
|
|
|
char **argv;
|
|
char *pwd;
|
|
int fd[3];
|
|
|
|
pid_t pid;
|
|
|
|
void (*exit_cb)(struct child_process *child, int exit_code, void *privdata);
|
|
void *privdata;
|
|
};
|
|
|
|
struct child_process * alloc_child_process(char *const argv[], const char *pwd);
|
|
void free_child_process(struct child_process *child);
|
|
|
|
pid_t spawn_child(struct child_process *child, void (*exit_cb)(struct child_process *child, int exit_code, void *privdata), void *privdata);
|
|
|
|
void sigchld_handler(int sig);
|
|
|
|
#endif // _SPAWN_H_
|