--- htop.c
+++ htop.c
@@ -22,6 +22,7 @@ in the source distribution for its full
 #include "TraceScreen.h"
 #include "OpenFilesScreen.h"
 #include "AffinityPanel.h"
+#include "ioprio_syscalls.h"
 #include "IOPriorityPanel.h"
 
 #include <unistd.h>
@@ -851,6 +852,7 @@ int main(int argc, char** argv) {
          refreshTimeout = 0;
          break;
       }
+#if defined(HAVE_IOPRIO_SYSCALLS)
       case 'i':
       {
          Process* p = (Process*) Panel_getSelected(panel);
@@ -870,6 +872,7 @@ int main(int argc, char** argv) {
          refreshTimeout = 0;
          break;
       }
+#endif /* HAVE_IOPRIO_SYSCALLS */
       case 'I':
       {
          refreshTimeout = 0;
--- IOPriority.c
+++ IOPriority.c
@@ -11,6 +11,8 @@ Released under the terms of the GNU Gene
 
 #include "IOPriority.h"
 
+#if defined(HAVE_IOPRIO_SYSCALLS)
+
 /*{
 
 enum {
@@ -39,3 +41,4 @@ typedef int IOPriority;
 
 }*/
 
+#endif /* HAVE_IOPRIO_SYSCALLS */
--- IOPriority.h
+++ IOPriority.h
@@ -14,6 +14,10 @@ Released under the terms of the GNU Gene
 */
 
 
+#include "ioprio_syscalls.h"
+
+#if defined(HAVE_IOPRIO_SYSCALLS)
+
 enum {
    IOPRIO_CLASS_NONE,
    IOPRIO_CLASS_RT,
@@ -38,6 +42,7 @@ typedef int IOPriority;
 #define IOPriority_None IOPriority_tuple(IOPRIO_CLASS_NONE, 0)
 #define IOPriority_Idle IOPriority_tuple(IOPRIO_CLASS_IDLE, 0)
 
+#endif /* HAVE_IOPRIO_SYSCALLS */
 
 
 #endif
--- IOPriorityPanel.c
+++ IOPriorityPanel.c
@@ -7,6 +7,8 @@ in the source distribution for its full
 
 #include "IOPriorityPanel.h"
 
+#if defined(HAVE_IOPRIO_SYSCALLS)
+
 /*{
 #include "Panel.h"
 #include "IOPriority.h"
@@ -41,3 +43,5 @@ Panel* IOPriorityPanel_new(IOPriority cu
 IOPriority IOPriorityPanel_getIOPriority(Panel* this) {
    return (IOPriority) ( ((ListItem*) Panel_getSelected(this))->key );
 }
+
+#endif /* HAVE_IOPRIO_SYSCALLS */
--- IOPriorityPanel.h
+++ IOPriorityPanel.h
@@ -9,6 +9,10 @@ Released under the GNU GPL, see the COPY
 in the source distribution for its full text.
 */
 
+#include "ioprio_syscalls.h"
+
+#if defined(HAVE_IOPRIO_SYSCALLS)
+
 #include "Panel.h"
 #include "IOPriority.h"
 #include "ListItem.h"
@@ -17,4 +21,6 @@ Panel* IOPriorityPanel_new(IOPriority cu
 
 IOPriority IOPriorityPanel_getIOPriority(Panel* this);
 
+#endif /* HAVE_IOPRIO_SYSCALLS */
+
 #endif
--- ioprio_syscalls.h
+++ ioprio_syscalls.h
@@ -0,0 +1,25 @@
+#ifndef _IOPRIO_SYSCALLS_H_
+#define _IOPRIO_SYSCALLS_H_
+
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#define HAVE_IOPRIO_SYSCALLS 1
+
+#if defined(SYS_ioprio_set)
+# define SYSCALL___ioprio_set SYS_ioprio_set
+#elif defined(_NR_ioprio_set)
+# define SYSCALL___ioprio_set _NR_ioprio_set
+#else
+# undef HAVE_IOPRIO_SYSCALLS
+#endif
+
+#if defined(SYS_ioprio_get)
+# define SYSCALL___ioprio_get SYS_ioprio_get
+#elif defined(_NR_ioprio_get)
+# define SYSCALL___ioprio_get _NR_ioprio_get
+#else
+# undef HAVE_IOPRIO_SYSCALLS
+#endif
+
+#endif /* _IOPRIO_SYSCALLS_H_ */
--- Process.c
+++ Process.c
@@ -12,6 +12,8 @@ in the source distribution for its full
 #include "String.h"
 #include "RichString.h"
 
+#include "ioprio_syscalls.h"
+
 #include <stdio.h>
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -203,7 +205,9 @@ const char *Process_fieldNames[] = {
 #ifdef HAVE_CGROUP
    "CGROUP",
 #endif
+#if defined(HAVE_IOPRIO_SYSCALLS)
    "IO_PRIORITY",
+#endif /* HAVE_IOPRIO_SYSCALLS */
 "*** report bug! ***"
 };
 
@@ -229,7 +233,9 @@ const char *Process_fieldTitles[] = {
 #ifdef HAVE_CGROUP
    "    CGROUP ",
 #endif
+#if defined(HAVE_IOPRIO_SYSCALLS)
    "IO ",
+#endif /* HAVE_IOPRIO_SYSCALLS */
 "*** report bug! ***"
 };
 
@@ -517,6 +523,7 @@ static void Process_writeField(Process*
    #ifdef HAVE_CGROUP
    case CGROUP: snprintf(buffer, n, "%-10s ", this->cgroup); break;
    #endif
+#if defined(HAVE_IOPRIO_SYSCALLS)
    case IO_PRIORITY: {
       int klass = IOPriority_class(this->ioPriority);
       if (klass == IOPRIO_CLASS_NONE) {
@@ -535,6 +542,7 @@ static void Process_writeField(Process*
       }
       break;
    }
+#endif /* HAVE_IOPRIO_SYSCALLS */
    default:
       snprintf(buffer, n, "- ");
    }
@@ -603,14 +611,15 @@ bool Process_changePriorityBy(Process* t
    return Process_setPriority(this, this->nice + delta);
 }
 
+#if defined(HAVE_IOPRIO_SYSCALLS)
 IOPriority Process_updateIOPriority(Process* this) {
-   IOPriority ioprio = syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, this->pid);
+   IOPriority ioprio = syscall(SYSCALL___ioprio_get, IOPRIO_WHO_PROCESS, this->pid);
    this->ioPriority = ioprio;
    return ioprio;
 }
 
 bool Process_setIOPriority(Process* this, IOPriority ioprio) {
-   syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, this->pid, ioprio);
+   syscall(SYSCALL___ioprio_set, IOPRIO_WHO_PROCESS, this->pid, ioprio);
    return (Process_updateIOPriority(this) == ioprio);
 }
 
@@ -623,6 +632,7 @@ dynamically  derived  from  the  cpu  ni
 io_priority = (cpu_nice + 20) / 5. -- From ionice(1) man page
 */
 #define Process_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->nice + 20) / 5) : p_->ioPriority)
+#endif /* HAVE_IOPRIO_SYSCALLS */
 
 #ifdef HAVE_LIBHWLOC
 
@@ -781,8 +791,10 @@ int Process_compare(const void* v1, cons
    case CGROUP:
       return strcmp(p1->cgroup ? p1->cgroup : "", p2->cgroup ? p2->cgroup : "");
    #endif
+   #if defined(HAVE_IOPRIO_SYSCALLS)
    case IO_PRIORITY:
       return Process_effectiveIOPriority(p1) - Process_effectiveIOPriority(p2);
+   #endif /* HAVE_IOPRIO_SYSCALLS */
    default:
       return (p1->pid - p2->pid);
    }
--- Process.h
+++ Process.h
@@ -21,6 +21,7 @@ in the source distribution for its full
 
 #include "Object.h"
 #include "Affinity.h"
+#include "ioprio_syscalls.h"
 #include "IOPriority.h"
 #include <sys/types.h>
 
@@ -54,7 +55,9 @@ typedef enum ProcessField_ {
    #ifdef HAVE_CGROUP
    CGROUP,
    #endif
+   #if defined(HAVE_IOPRIO_SYSCALLS)
    IO_PRIORITY,
+   #endif /* HAVE_IOPRIO_SYSCALLS */
    LAST_PROCESSFIELD
 } ProcessField;
 
@@ -93,7 +96,9 @@ typedef struct Process_ {
    long int priority;
    long int nice;
    long int nlwp;
+   #if defined(HAVE_IOPRIO_SYSCALLS)
    IOPriority ioPriority;
+   #endif /* HAVE_IOPRIO_SYSCALLS */
    char starttime_show[8];
    time_t starttime_ctime;
    #ifdef DEBUG
@@ -180,6 +185,7 @@ bool Process_setPriority(Process* this,
 
 bool Process_changePriorityBy(Process* this, size_t delta);
 
+#if defined(HAVE_IOPRIO_SYSCALLS)
 IOPriority Process_updateIOPriority(Process* this);
 
 bool Process_setIOPriority(Process* this, IOPriority ioprio);
@@ -193,6 +199,7 @@ dynamically  derived  from  the  cpu  ni
 extern io_priority;
 */
 #define Process_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->nice + 20) / 5) : p_->ioPriority)
+#endif /* HAVE_IOPRIO_SYSCALLS */
 
 #ifdef HAVE_LIBHWLOC
 
--- ProcessList.c
+++ ProcessList.c
@@ -685,7 +685,9 @@ static bool ProcessList_processEntries(P
       unsigned long long int lasttimes = (process->utime + process->stime);
       if (! ProcessList_readStatFile(process, dirname, name, command))
          goto errorReadingProcess;
+      #if defined(HAVE_IOPRIO_SYSCALLS)
       Process_updateIOPriority(process);
+      #endif /* HAVE_IOPRIO_SYSCALLS */
       float percent_cpu = (process->utime + process->stime - lasttimes) / period * 100.0;
       process->percent_cpu = MAX(MIN(percent_cpu, cpus*100.0), 0.0);
       if (isnan(process->percent_cpu)) process->percent_cpu = 0.0;
