From 7224d0e0831ee53d5028915f87dffd51ffa0d6fa Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 10 Apr 2021 14:08:26 +0200 Subject: Move kernel/userland thread handling to platform-independent implementation --- Process.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Process.h') diff --git a/Process.h b/Process.h index 2a198441..f70ab571 100644 --- a/Process.h +++ b/Process.h @@ -110,6 +110,12 @@ typedef struct Process_ { /* Foreground group identifier of the controlling terminal */ int tpgid; + /* This is a kernel (helper) task */ + bool isKernelThread; + + /* This is a userland thread / LWP */ + bool isUserlandThread; + /* Controlling terminal identifier of the process */ unsigned long int tty_nr; @@ -260,7 +266,6 @@ typedef struct ProcessFieldData_ { void Process_writeField(const Process* this, RichString* str, ProcessField field); int Process_compare(const void* v1, const void* v2); void Process_delete(Object* cast); -bool Process_isThread(const Process* this); extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD]; #define PROCESS_MAX_PID_DIGITS 19 extern int Process_pidDigits; @@ -290,6 +295,18 @@ static inline bool Process_isChildOf(const Process* this, pid_t pid) { return pid == Process_getParentPid(this); } +static inline bool Process_isKernelThread(const Process *this) { + return this->isKernelThread; +} + +static inline bool Process_isUserlandThread(const Process *this) { + return this->isUserlandThread; +} + +static inline bool Process_isThread(const Process *this) { + return Process_isUserlandThread(this) || Process_isKernelThread(this); +} + #define CMDLINE_HIGHLIGHT_FLAG_SEPARATOR 0x00000001 #define CMDLINE_HIGHLIGHT_FLAG_BASENAME 0x00000002 #define CMDLINE_HIGHLIGHT_FLAG_COMM 0x00000004 -- cgit v1.2.3