aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/610-io-priority-only-on-linux.patch
blob: 62db759d09992d13792228e87a975efc26895d85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Index: htop/Process.c
===================================================================
--- htop.orig/Process.c	2014-04-29 21:11:25.000000000 +0300
+++ htop/Process.c	2014-05-01 12:00:02.000000000 +0300
@@ -39,6 +39,10 @@
 #endif
 #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
 
+#ifdef __linux
+#define HAVE_IO_PRIORITY
+#endif
+
 /*{
 #include "Object.h"
 #include "Affinity.h"
@@ -617,6 +621,7 @@
    #ifdef HAVE_OOM
    case OOM: snprintf(buffer, n, Process_pidFormat, this->oom); break;
    #endif
+   #ifdef HAVE_IO_PRIORITY
    case IO_PRIORITY: {
       int klass = IOPriority_class(this->ioPriority);
       if (klass == IOPRIO_CLASS_NONE) {
@@ -635,6 +640,7 @@
       }
       break;
    }
+   #endif
    default:
       snprintf(buffer, n, "- ");
    }
@@ -709,6 +715,7 @@
    return Process_setPriority(this, this->nice + delta);
 }
 
+#ifdef HAVE_IO_PRIORITY
 IOPriority Process_updateIOPriority(Process* this) {
    IOPriority ioprio = syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, this->pid);
    this->ioPriority = ioprio;
@@ -719,6 +726,7 @@
    syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, this->pid, ioprio);
    return (Process_updateIOPriority(this) == ioprio);
 }
+#endif
 
 /*
 [1] Note that before kernel 2.6.26 a process that has not asked for
Index: htop/ProcessList.c
===================================================================
--- htop.orig/ProcessList.c	2014-05-01 11:52:18.000000000 +0300
+++ htop/ProcessList.c	2014-05-01 12:00:02.000000000 +0300
@@ -798,8 +798,10 @@
       unsigned long long int lasttimes = (process->utime + process->stime);
       if (! ProcessList_readStatFile(process, dirname, name, command))
          goto errorReadingProcess;
+      #ifdef HAVE_IO_PRIORITY
       if (this->flags & PROCESS_FLAG_IOPRIO)
          Process_updateIOPriority(process);
+      #endif
       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;
Index: htop/htop.c
===================================================================
--- htop.orig/htop.c	2014-04-29 21:11:25.000000000 +0300
+++ htop/htop.c	2014-05-01 12:00:02.000000000 +0300
@@ -96,7 +96,11 @@
 #if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
    { .key = "      a: ", .info = "set CPU affinity" },
 #endif
+#ifdef HAVE_IO_PRIORITY
    { .key = "      i: ", .info = "set IO prority" },
+#else
+   { .key = "         ", .info = "" },
+#endif
    { .key = "      l: ", .info = "list open files with lsof" },
    { .key = "      s: ", .info = "trace syscalls with strace" },
    { .key = "         ", .info = "" },
@@ -856,6 +860,7 @@
          }
          break;
       }
+      #ifdef HAVE_IO_PRIORITY
       case 'i':
       {
          Process* p = (Process*) Panel_getSelected(panel);
@@ -875,6 +880,7 @@
          refreshTimeout = 0;
          break;
       }
+      #endif
       case 'I':
       {
          refreshTimeout = 0;

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