From bb1a5fc74769301c0a792cb83d3fa0bda8a780cb Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 2 Mar 2015 23:30:16 +0100 Subject: Add prototypes for process management... --- src/common/include/proc.h | 18 ++++++++++++++++++ src/common/include/syscallproto.h | 18 ++++-------------- 2 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 src/common/include/proc.h (limited to 'src/common') diff --git a/src/common/include/proc.h b/src/common/include/proc.h new file mode 100644 index 0000000..01a6722 --- /dev/null +++ b/src/common/include/proc.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +#define PS_LOADING 1 +#define PS_RUNNING 2 +#define PS_DONE 3 +#define PS_FAILURE 4 // exception or segfault or stuff +#define PS_KILLED 5 + +typedef struct { + int pid; + int state; // one of PS_* + int return_code; // an error code if state == PS_FAILURE +} proc_status_t; + +/* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/src/common/include/syscallproto.h b/src/common/include/syscallproto.h index 7b85a49..518cdb4 100644 --- a/src/common/include/syscallproto.h +++ b/src/common/include/syscallproto.h @@ -1,5 +1,6 @@ #pragma once +#include #define SC_MAX 128 // maximum number of syscalls @@ -40,8 +41,9 @@ #define SC_PROC_EXEC 55 // args: pid, exec_name, exec_name_strlen -- execute binary in process #define SC_PROC_STATUS 56 // args: pid, proc_status_t* #define SC_PROC_KILL 57 // args: pid, proc_status_t* -- inconditionnally kill child process -#define SC_PROC_WAIT 58 // args: pid, proc_status_t* -#define SC_PROC_WAIT_ANY 59 // args: proc_status_t* +#define SC_PROC_WAIT 58 // args: pid?, block?, proc_status_t* + +#define INVALID_PID 0 // do a wait with this PID to wayt for any child typedef struct { const char* driver; @@ -71,16 +73,4 @@ typedef struct { int bind_to_pid; // used only for SC_BIND_SUBFS } sc_subfs_args_t; -#define PS_LOADING 1 -#define PS_RUNNING 2 -#define PS_DONE 3 -#define PS_FAILURE 4 // exception or segfault or stuff -#define PS_KILLED 5 -typedef struct { - int pid; - int state; // one of PS_* - int return_code; // an error code if state == PS_FAILURE -} proc_status_t; - - /* vim: set ts=4 sw=4 tw=0 noet :*/ -- cgit v1.2.3