diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-12-05 22:57:07 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-12-06 16:20:55 +0100 |
commit | 57d9ecc5519a44d4d08f1739ab4b741ccfc2d35a (patch) | |
tree | 9643df67c42db491a6c81fbf3121001216daed6d /openbsd/OpenBSDProcess.c | |
parent | 3d15ba51974827693ed7d34149290c812d652dd9 (diff) |
OpenBSD update
- compilation failures like `return &this->this;` -> `return &this->super;`
- iwyu update
- misc cleanup
Diffstat (limited to 'openbsd/OpenBSDProcess.c')
-rw-r--r-- | openbsd/OpenBSDProcess.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c index 4b79ea36..df5002ac 100644 --- a/openbsd/OpenBSDProcess.c +++ b/openbsd/OpenBSDProcess.c @@ -6,26 +6,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Process.h" -#include "ProcessList.h" #include "OpenBSDProcess.h" -#include "Platform.h" -#include "CRT.h" #include <stdlib.h> -#include <unistd.h> -#include <sys/syscall.h> +#include "CRT.h" +#include "Process.h" +#include "RichString.h" +#include "XUtils.h" -const ProcessClass OpenBSDProcess_class = { - .super = { - .extends = Class(Process), - .display = Process_display, - .delete = Process_delete, - .compare = OpenBSDProcess_compare - }, - .writeField = OpenBSDProcess_writeField, -}; ProcessFieldData Process_fields[] = { [0] = { @@ -200,7 +189,7 @@ Process* OpenBSDProcess_new(const Settings* settings) { OpenBSDProcess* this = xCalloc(sizeof(OpenBSDProcess), 1); Object_setClass(this, Class(OpenBSDProcess)); Process_init(&this->super, settings); - return &this->this; + return &this->super; } void Process_delete(Object* cast) { @@ -209,8 +198,8 @@ void Process_delete(Object* cast) { free(this); } -void OpenBSDProcess_writeField(const Process* this, RichString* str, ProcessField field) { - //OpenBSDProcess* fp = (OpenBSDProcess*) this; +static void OpenBSDProcess_writeField(const Process* this, RichString* str, ProcessField field) { + //const OpenBSDProcess* op = (const OpenBSDProcess*) this; char buffer[256]; buffer[255] = '\0'; int attr = CRT_colors[DEFAULT_COLOR]; //int n = sizeof(buffer) - 1; @@ -223,7 +212,7 @@ void OpenBSDProcess_writeField(const Process* this, RichString* str, ProcessFiel RichString_append(str, attr, buffer); } -long OpenBSDProcess_compare(const void* v1, const void* v2) { +static long OpenBSDProcess_compare(const void* v1, const void* v2) { const OpenBSDProcess *p1, *p2; const Settings *settings = ((const Process*)v1)->settings; @@ -235,6 +224,9 @@ long OpenBSDProcess_compare(const void* v1, const void* v2) { p1 = (const OpenBSDProcess*)v2; } + // remove if actually used + (void)p1; (void)p2; + switch (settings->sortKey) { // add OpenBSD-specific fields here default: @@ -242,6 +234,16 @@ long OpenBSDProcess_compare(const void* v1, const void* v2) { } } +const ProcessClass OpenBSDProcess_class = { + .super = { + .extends = Class(Process), + .display = Process_display, + .delete = Process_delete, + .compare = OpenBSDProcess_compare + }, + .writeField = OpenBSDProcess_writeField, +}; + bool Process_isThread(const Process* this) { - return (Process_isKernelThread(this)); + return Process_isKernelThread(this) || Process_isUserlandThread(this); } |