From: Jonathan Currier diff --git a/MainPanel.h b/MainPanel.h index 8849659..471870b 100644 --- a/MainPanel.h +++ b/MainPanel.h @@ -12,6 +12,7 @@ in the source distribution for its full text. #include "Panel.h" #include "Action.h" #include "Settings.h" +#include "union-arg.h" typedef struct MainPanel_ { Panel super; @@ -21,11 +22,6 @@ typedef struct MainPanel_ { pid_t pidSearch; } MainPanel; -typedef union { - int i; - void* v; -} Arg; - typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg); #define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar) diff --git a/Process.c b/Process.c index 471f529..ae617a6 100644 --- a/Process.c +++ b/Process.c @@ -548,7 +548,9 @@ bool Process_changePriorityBy(Process* this, int delta) { return Process_setPriority(this, this->nice + delta); } -void Process_sendSignal(Process* this, int sgn) { + +void Process_sendSignal(Process* this, Arg arg) { + int sgn = arg.i; CRT_dropPrivileges(); kill(this->pid, (int) sgn); CRT_restorePrivileges(); diff --git a/Process.h b/Process.h index f702ca0..3011845 100644 --- a/Process.h +++ b/Process.h @@ -29,6 +29,7 @@ in the source distribution for its full text. #include "Object.h" #include +#include "union-arg.h" #define PROCESS_FLAG_IO 0x0001 @@ -199,7 +200,7 @@ bool Process_setPriority(Process* this, int priority); bool Process_changePriorityBy(Process* this, int delta); -void Process_sendSignal(Process* this, int sgn); +void Process_sendSignal(Process* this, Arg arg); long Process_pidCompare(const void* v1, const void* v2); diff --git a/union-arg.h b/union-arg.h new file mode 100644 index 0000000..5c8a094 --- /dev/null +++ b/union-arg.h @@ -0,0 +1,9 @@ +#ifndef UNION_ARG_HEADER +#define UNION_ARG_HEADER + +typedef union { + int i; + void* v; +} Arg; + +#endif