summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-02-14 12:05:35 -0200
committerHisham <hisham@gobolinux.org>2016-02-14 12:05:35 -0200
commit35657208d7dc6262c477f5d9d5626dba5d8dc05c (patch)
tree243f17f79fcfebf6182343f67d921576bf9ba37c /linux
parentae823c375acddb03755632118c930c3a7ce55e5e (diff)
Disable the syscall on systems that don't have it.
Got a report in #397 that htop runs in NetBSD masquerading as Linux and using a compatibility /proc (like we used to in FreeBSD) and that it builds fine apart from this syscall.
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcess.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index c6c3112d..17790f65 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -268,13 +268,20 @@ io_priority = (cpu_nice + 20) / 5. -- From ionice(1) man page
#define LinuxProcess_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->super.nice + 20) / 5) : p_->ioPriority)
IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this) {
- IOPriority ioprio = syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, this->super.pid);
+ IOPriority ioprio = 0;
+// Other OSes masquerading as Linux (NetBSD?) don't have this syscall
+#ifdef SYS_ioprio_get
+ ioprio = syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, this->super.pid);
+#endif
this->ioPriority = ioprio;
return ioprio;
}
bool LinuxProcess_setIOPriority(LinuxProcess* this, IOPriority ioprio) {
+// Other OSes masquerading as Linux (NetBSD?) don't have this syscall
+#ifdef SYS_ioprio_set
syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, this->super.pid, ioprio);
+#endif
return (LinuxProcess_updateIOPriority(this) == ioprio);
}

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