X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Fprocess%2Fprocess.h;h=4904ffc8f5126977f1407bcb8d08703ea5b57037;hp=9e2a2d1b013c31c6eeb8af153ddbb54071bbe04d;hb=7aa2d8a3aefc31c4503d8d9e361c791179894b34;hpb=e52a8c61a640ab4fce0b4caaa796ae3e1c4ff8a3 diff --git a/lib/process/process.h b/lib/process/process.h index 9e2a2d1..4904ffc 100644 --- a/lib/process/process.h +++ b/lib/process/process.h @@ -23,6 +23,7 @@ struct process; struct procset; +struct process_info; typedef void (*process_exit_cb)(struct process *); @@ -31,8 +32,12 @@ struct process { const char *path; const char **argv; bool keep_stdout; + bool add_stderr; + bool raw_stdout; process_exit_cb exit_cb; void *data; + waiter_cb stdout_cb; + void *stdout_data; /* runtime data */ pid_t pid; @@ -41,13 +46,14 @@ struct process { /* post-execution information */ int exit_status; + bool cancelled; }; /* Process management system init. process_init must be called before * process_create. The pointer returned can be talloc_free()-ed, or can be * automatically freed through destruction of the ctx talloc tree. */ -struct procset *process_init(void *ctx, struct waitset *set); +struct procset *process_init(void *ctx, struct waitset *set, bool dry_run); struct process *process_create(void *ctx); @@ -73,4 +79,14 @@ int process_run_simple(void *ctx, const char *name, ...) int process_run_async(struct process *process); void process_stop_async(struct process *process); +void process_stop_async_all(void); + +/* helper function to determine if a process exited cleanly, with a non-zero + * exit status */ +bool process_exit_ok(struct process *process); + +/* Functions to assist callers using a custom stdout callback */ +struct process *procinfo_get_process(struct process_info *procinfo); +int process_stdout_custom(struct process_info *procinfo, char **line); + #endif /* PROCESS_H */