aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/610-io-priority-only-on-linux.patch
blob: 12e29a9ce3d4b109b7bbfafc59c6f65d7321bf97 (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
95
96
97
98
99
--- a/Process.c
+++ b/Process.c
@@ -39,6 +39,10 @@ in the source distribution for its full text.
 #endif
 #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
 
+#ifdef __linux
+#define HAVE_IO_PRIORITY
+#endif
+
 /*{
 #include "Object.h"
 #include "Affinity.h"
@@ -517,6 +521,7 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
    #ifdef HAVE_CGROUP
    case CGROUP: snprintf(buffer, n, "%-10s ", this->cgroup); break;
    #endif
+   #ifdef HAVE_IO_PRIORITY
    case IO_PRIORITY: {
       int klass = IOPriority_class(this->ioPriority);
       if (klass == IOPRIO_CLASS_NONE) {
@@ -535,6 +540,7 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
       }
       break;
    }
+   #endif
    default:
       snprintf(buffer, n, "- ");
    }
@@ -603,6 +609,7 @@ bool Process_changePriorityBy(Process* this, size_t delta) {
    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;
@@ -613,6 +620,7 @@ bool Process_setIOPriority(Process* this, IOPriority ioprio) {
    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
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -685,7 +685,9 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
       unsigned long long int lasttimes = (process->utime + process->stime);
       if (! ProcessList_readStatFile(process, dirname, name, command))
          goto errorReadingProcess;
+      #ifdef HAVE_IO_PRIORITY
       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;
--- a/htop.c
+++ b/htop.c
@@ -126,7 +126,11 @@ static void showHelp(ProcessList* pl) {
    mvaddstr(13, 0, "  Space: tag processes                      F: cursor follows process");
    mvaddstr(14, 0, "      U: untag all processes              + -: expand/collapse tree");
    mvaddstr(15, 0, "   F9 k: kill process/tagged processes  P M T: sort by CPU%, MEM% or TIME");
+#ifdef HAVE_IO_PRIORITY
    mvaddstr(16, 0, "   ] F7: higher priority (root only)        i: set IO priority");
+#else
+   mvaddstr(16, 0, "   ] F7: higher priority (root only)");
+#endif
    mvaddstr(17, 0, "   [ F8: lower priority (+ nice)            I: invert sort order");
 #if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
    if (pl->cpuCount > 1)
@@ -146,7 +150,10 @@ static void showHelp(ProcessList* pl) {
    mvaddstr(13, 0, "  Space"); mvaddstr(13,40, "    F");
    mvaddstr(14, 0, "      U"); mvaddstr(14,40, "  + -");
    mvaddstr(15, 0, "   F9 k"); mvaddstr(15,40, "P M T");
-   mvaddstr(16, 0, "   ] F7"); mvaddstr(16,40, "    i");
+   mvaddstr(16, 0, "   ] F7");
+#ifdef HAVE_IO_PRIORITY
+                               mvaddstr(16,40, "    i");
+#endif
    mvaddstr(17, 0, "   [ F8"); mvaddstr(17,40, "    I");
                                mvaddstr(18,40, " F6 >");
 #if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
@@ -851,6 +858,7 @@ int main(int argc, char** argv) {
          refreshTimeout = 0;
          break;
       }
+      #ifdef HAVE_IO_PRIORITY
       case 'i':
       {
          Process* p = (Process*) Panel_getSelected(panel);
@@ -870,6 +878,7 @@ int main(int argc, char** argv) {
          refreshTimeout = 0;
          break;
       }
+      #endif
       case 'I':
       {
          refreshTimeout = 0;

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