#ifndef _PROCESS_H #define _PROCESS_H #include #include #include #include #include #include #include #include struct event_handler; typedef int (handle_event_fn_t)(struct event_handler *); typedef int (work_fn_t)(void *); struct event_handler { int fd; uint32_t events; handle_event_fn_t *handle_event; char *name; }; int register_event_handler(struct event_handler *handler); int init_jobcontrol(int max_jobs_requested); int poll_job_requests(int timeout); int do_fork(void); int run(const char *p, char *const argv[]); int clear_zombie(int pid); int run_piped(const char *cmd, char *const argv[], int *stdinfd, int *stdoutfd, int *stderrfd); int run_piped_stream(const char *cmd, char *const argv[], FILE **stdinf, FILE **stdoutf, FILE **stderrf); enum { WORK_PRIORITY_HIGH, WORK_PRIORITY_LOW, WORK_PRIORITIES_NUM, }; int queue_work(unsigned int priority, char *name, int (work_fn)(void *arg), void *arg); #endif