summaryrefslogtreecommitdiffstats
path: root/Process.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-27 21:26:45 +0100
committercgzones <cgzones@googlemail.com>2020-10-28 19:57:10 +0100
commit887dfde3082bcb1057a965d365206b2ed3d0263b (patch)
tree317eadcd0e4c27be8d02740edb080450512a51a2 /Process.h
parent76797f8d928a9278f7356e270ef07cea1db5510a (diff)
Implement Process_getParentPid and Process_isChildOf as functions
Make it more readable and fix unenclosed macro arguments
Diffstat (limited to 'Process.h')
-rw-r--r--Process.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/Process.h b/Process.h
index 2432918f..b2c82080 100644
--- a/Process.h
+++ b/Process.h
@@ -129,9 +129,13 @@ typedef struct ProcessClass_ {
#define As_Process(this_) ((const ProcessClass*)((this_)->super.klass))
-#define Process_getParentPid(process_) (process_->tgid == process_->pid ? process_->ppid : process_->tgid)
+static inline pid_t Process_getParentPid(const Process* this) {
+ return this->tgid == this->pid ? this->ppid : this->tgid;
+}
-#define Process_isChildOf(process_, pid_) (process_->tgid == pid_ || (process_->tgid == process_->pid && process_->ppid == pid_))
+static inline bool Process_isChildOf(const Process* this, pid_t pid) {
+ return pid == Process_getParentPid(this);
+}
#define Process_sortState(state) ((state) == 'I' ? 0x100 : (state))

© 2014-2024 Faster IT GmbH | imprint | privacy policy