1 #ifndef _LIBHX_PROC_H 2 #define _LIBHX_PROC_H 3 4 #ifndef __cplusplus 5 # include <stdbool.h> 6 #endif 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 enum { 13 HXPROC_VERBOSE = 1 << 0, 14 HXPROC_EXECV = 1 << 1, 15 HXPROC_A0 = 1 << 2, 16 HXPROC_STDIN = 1 << 3, 17 HXPROC_STDOUT = 1 << 4, 18 HXPROC_STDERR = 1 << 5, 19 HXPROC_NULL_STDIN = 1 << 6, 20 HXPROC_NULL_STDOUT = 1 << 7, 21 HXPROC_NULL_STDERR = 1 << 8, 22 }; 23 24 struct HXproc_ops { 25 void (*p_prefork)(void *); 26 void (*p_postfork)(void *); 27 void (*p_complete)(void *); 28 }; 29 30 struct HXproc { 31 const struct HXproc_ops *p_ops; 32 void *p_data; 33 unsigned int p_flags; 34 35 int p_stdin, p_stdout, p_stderr; 36 int p_pid; 37 char p_status; 38 bool p_exited, p_terminated; 39 }; 40 41 extern int HXproc_run_async(const char *const *, struct HXproc *); 42 extern int HXproc_run_sync(const char *const *, unsigned int); 43 extern int HXproc_wait(struct HXproc *); 44 45 #ifdef __cplusplus 46 } /* extern "C" */ 47 #endif 48 49 #endif /* _LIBHX_PROC_H */ 50