From 0bdade1b6cb40c5bd374a93ac0489058a7421bb5 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 2 May 2023 09:02:22 +1000 Subject: Introduce Machine class for host-specific info (split from ProcessList) First stage in sanitizing the process list structure so that htop can support other types of lists too (cgroups, filesystems, ...), in the not-too-distant future. This introduces struct Machine for system-wide information while keeping process-list information in ProcessList (now much less). Next step is to propogate this separation into each platform, to match these core changes. --- Process.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Process.h') diff --git a/Process.h b/Process.h index db32ecc1..ad89fd45 100644 --- a/Process.h +++ b/Process.h @@ -82,7 +82,7 @@ typedef enum ProcessState_ { SLEEPING } ProcessState; -struct Settings_; +struct Machine_; /* Holds information about regions of the cmdline that should be * highlighted (e.g. program basename, delimiter, comm). */ @@ -108,9 +108,8 @@ typedef struct Process_ { /* Super object for emulated OOP */ Object super; - /* Pointer to quasi-global data structures */ - const struct ProcessList_* processList; - const struct Settings_* settings; + /* Pointer to quasi-global data */ + const struct Machine_* host; /* Process identifier */ pid_t pid; @@ -305,7 +304,7 @@ extern uint8_t Process_fieldWidths[LAST_PROCESSFIELD]; extern int Process_pidDigits; extern int Process_uidDigits; -typedef Process* (*Process_New)(const struct Settings_*); +typedef Process* (*Process_New)(const struct Machine_*); typedef void (*Process_WriteField)(const Process*, RichString*, ProcessField); typedef int (*Process_CompareByKey)(const Process*, const Process*, ProcessField); @@ -389,7 +388,7 @@ void Process_done(Process* this); extern const ProcessClass Process_class; -void Process_init(Process* this, const struct Settings_* settings); +void Process_init(Process* this, const struct Machine_* host); void Process_toggleTag(Process* this); -- cgit v1.2.3