From d8dfbbd37ca7855be44391697424edac9015f14f Mon Sep 17 00:00:00 2001 From: marcluque Date: Tue, 12 Oct 2021 00:45:09 +0200 Subject: Tidy up process state handling --- Process.h | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'Process.h') diff --git a/Process.h b/Process.h index bbdcbf66..26f64349 100644 --- a/Process.h +++ b/Process.h @@ -60,6 +60,26 @@ typedef enum ProcessField_ { LAST_PROCESSFIELD } ProcessField; +/* Core process states (shared by platforms) + * NOTE: The enum has an ordering that is important! + * See processStateChar in process.c for ProcessSate -> letter mapping */ +typedef enum ProcessState_ { + UNKNOWN = 1, + RUNNABLE, + RUNNING, + QUEUED, + WAITING, + UNINTERRUPTIBLE_WAIT, + BLOCKED, + PAGING, + STOPPED, + TRACED, + ZOMBIE, + DEFUNCT, + IDLE, + SLEEPING +} ProcessState; + struct Settings_; /* Holds information about regions of the cmdline that should be @@ -202,20 +222,8 @@ typedef struct Process_ { /* Number of major faults the process has made which have required loading a memory page from disk */ unsigned long int majflt; - /* - * Process state (platform dependent): - * D - Waiting - * I - Idle - * L - Acquiring lock - * R - Running - * S - Sleeping - * T - Stopped (on a signal) - * X - Dead - * Z - Zombie - * t - Tracing stop - * ? - Unknown - */ - char state; + /* Process state enum field (platform dependent) */ + ProcessState state; /* Whether the process was updated during the current scan */ bool updated; -- cgit v1.2.3