aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-13 15:55:48 +0200
committerDaniel Lange <DLange@git.local>2016-04-13 16:04:16 +0200
commit3d90f42e81876dbb9dabcbd227f7f211b18756d1 (patch)
treeb0bb479504bcdcba111e4a949f100aa3c500bdea
parentadefe52ce2ad43c442c0b40bfe637e238e454246 (diff)
downloaddebian_htop-3d90f42e81876dbb9dabcbd227f7f211b18756d1.tar.gz
debian_htop-3d90f42e81876dbb9dabcbd227f7f211b18756d1.tar.bz2
debian_htop-3d90f42e81876dbb9dabcbd227f7f211b18756d1.zip
Clean up patches from 1.0.3 -> 2.0.1
* 600-openvz-veid-on-kernels-gt-2.6.18.patch replaced by 601-openvz-new-ctid-vpid.patch from Alexander Pisarev * 610-io-priority-only-on-linux.patch was only needed for GNU/kFreeBSD support * 700-ltrace-support.patch has not been upstreamed in 7 years and the underlying code has been completely refactored so re-writing the patch seems unreasonable. Note: This results in a loss of functionality for Debian users. htop has no longer bound the key L to run ltrace as comfortably as strace.
-rw-r--r--debian/patches/600-openvz-veid-on-kernels-gt-2.6.18.patch42
-rw-r--r--debian/patches/601-openvz-new-ctid-vpid.patch121
-rw-r--r--debian/patches/610-io-priority-only-on-linux.patch94
-rw-r--r--debian/patches/700-ltrace-support.patch167
-rw-r--r--debian/patches/series4
-rw-r--r--debian/source/format1
6 files changed, 123 insertions, 306 deletions
diff --git a/debian/patches/600-openvz-veid-on-kernels-gt-2.6.18.patch b/debian/patches/600-openvz-veid-on-kernels-gt-2.6.18.patch
deleted file mode 100644
index 8ab16bc..0000000
--- a/debian/patches/600-openvz-veid-on-kernels-gt-2.6.18.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-Fix determining OpenVZ VEID on Linux kernels >= 2.6.18.
-Index: htop/ProcessList.c
-===================================================================
---- htop.orig/ProcessList.c 2014-05-01 11:43:17.000000000 +0300
-+++ htop/ProcessList.c 2014-05-01 11:43:26.000000000 +0300
-@@ -586,19 +586,26 @@
- return;
- }
- char filename[MAX_NAME+1];
-- snprintf(filename, MAX_NAME, "%s/%s/stat", dirname, name);
-+ snprintf(filename, MAX_NAME, "%s/%s/status", dirname, name);
- FILE* file = fopen(filename, "r");
- if (!file)
- return;
-- fscanf(file,
-- "%*32u %*32s %*1c %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
-- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
-- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
-- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
-- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
-- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u "
-- "%*32u %*32u %32u %32u",
-- &process->vpid, &process->ctid);
-+
-+ char buffer[256];
-+ process->ctid = 0;
-+ while (!feof(file)) {
-+ char* ok = fgets(buffer, 255, file);
-+ if (!ok)
-+ break;
-+
-+ if (String_startsWith(buffer, "envID:")) {
-+ int ctid;
-+ int ok = sscanf(buffer, "envID:\t%d", &ctid);
-+ if (ok >= 1) {
-+ process->ctid = ctid;
-+ }
-+ }
-+ }
- fclose(file);
- }
-
diff --git a/debian/patches/601-openvz-new-ctid-vpid.patch b/debian/patches/601-openvz-new-ctid-vpid.patch
new file mode 100644
index 0000000..83ed8b7
--- /dev/null
+++ b/debian/patches/601-openvz-new-ctid-vpid.patch
@@ -0,0 +1,121 @@
+This replaces the old 600-openvz-veid-on-kernels-gt-2.6.18.patch
+Source: https://patch-diff.githubusercontent.com/raw/hishamhm/htop/pull/464.patch
+From: Alexander Pisarev <apisarev@virtuozzo.com>
+Date: Wed, 6 Apr 2016 14:47:28 +0300
+Subject: [PATCH] Add support of UUID CTID used in the new version of OpenVZ
+
+In the new version of OpenVZ (Virtuozzo 7), containers could be identified by UUIDs and integer numbers like before (so called legacy CTID). Existing support of OpenVZ can't work with UUIDs. This patch fix it.
+
+CTIDs and VPIDs are now read from /proc/[id]/status instead of /proc/[id]/stat because of the following reasons:
+* the /proc/[id]/status has named fields and OpenVZ kernel writes either CTID or UUID to envID field (depending on which type is used);
+* OpenVZ kernel appends own data to /proc/[id]/stat file, a change in parameters reported by vanilla kernel would also shift the position of OpenVZ data so it would not be read correctly.
+
+As UUIDs are much longer than old numerical CTIDs, the UUID strings will get truncated in output (although sorting is still done using complete UUIDs).
+---
+ linux/LinuxProcess.c | 9 ++++++---
+ linux/LinuxProcess.h | 2 +-
+ linux/LinuxProcessList.c | 38 +++++++++++++++++++++++---------------
+ 3 files changed, 30 insertions(+), 19 deletions(-)
+--- a/linux/LinuxProcess.c
++++ b/linux/LinuxProcess.c
+@@ -114,7 +114,7 @@ typedef struct LinuxProcess_ {
+ double io_rate_write_bps;
+ #endif
+ #ifdef HAVE_OPENVZ
+- unsigned int ctid;
++ char* ctid;
+ unsigned int vpid;
+ #endif
+ #ifdef HAVE_VSERVER
+@@ -251,6 +251,9 @@ LinuxProcess* LinuxProcess_new(Settings*
+ void Process_delete(Object* cast) {
+ LinuxProcess* this = (LinuxProcess*) cast;
+ Process_done((Process*)cast);
++#ifdef HAVE_OPENVZ
++ free(this->ctid);
++#endif
+ #ifdef HAVE_CGROUP
+ free(this->cgroup);
+ #endif
+@@ -321,7 +324,7 @@ void LinuxProcess_writeField(Process* th
+ }
+ #endif
+ #ifdef HAVE_OPENVZ
+- case CTID: snprintf(buffer, n, "%7u ", lp->ctid); break;
++ case CTID: snprintf(buffer, n, "%8.8s ", lp->ctid); break;
+ case VPID: snprintf(buffer, n, Process_pidFormat, lp->vpid); break;
+ #endif
+ #ifdef HAVE_VSERVER
+@@ -396,7 +399,7 @@ long LinuxProcess_compare(const void* v1
+ #endif
+ #ifdef HAVE_OPENVZ
+ case CTID:
+- return (p2->ctid - p1->ctid);
++ return strcmp(p1->ctid ?: "", p2->ctid ?: "");
+ case VPID:
+ return (p2->vpid - p1->vpid);
+ #endif
+--- a/linux/LinuxProcess.h
++++ b/linux/LinuxProcess.h
+@@ -106,7 +106,7 @@ typedef struct LinuxProcess_ {
+ double io_rate_write_bps;
+ #endif
+ #ifdef HAVE_OPENVZ
+- unsigned int ctid;
++ char* ctid;
+ unsigned int vpid;
+ #endif
+ #ifdef HAVE_VSERVER
+--- a/linux/LinuxProcessList.c
++++ b/linux/LinuxProcessList.c
+@@ -336,27 +336,35 @@ static bool LinuxProcessList_readStatmFi
+ #ifdef HAVE_OPENVZ
+
+ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* dirname, const char* name) {
+- if ( (access("/proc/vz", R_OK) != 0)) {
+- process->vpid = process->super.pid;
+- process->ctid = 0;
++ process->vpid = process->super.pid;
++ free(process->ctid);
++ process->ctid = xStrdup("0");
++ if ( (access("/proc/vz", R_OK) != 0))
+ return;
+- }
+ char filename[MAX_NAME+1];
+- snprintf(filename, MAX_NAME, "%s/%s/stat", dirname, name);
++ snprintf(filename, MAX_NAME, "%s/%s/status", dirname, name);
+ FILE* file = fopen(filename, "r");
+ if (!file)
+ return;
+- (void) fscanf(file,
+- "%*32u %*32s %*1c %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
+- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
+- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
+- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
+- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u %*32u "
+- "%*32u %*32u %*32u %*32u %*32u %*32u %*32u "
+- "%*32u %*32u %32u %32u",
+- &process->vpid, &process->ctid);
++ char buffer[PROC_LINE_LENGTH + 1];
++ while (fgets(buffer, PROC_LINE_LENGTH, file)) {
++ if (String_startsWith(buffer, "envID:")) {
++ char ctid[PROC_LINE_LENGTH + 1];
++ int ok = sscanf(buffer, "envID:\t%36s", ctid);
++ if (ok == 1) {
++ free(process->ctid);
++ process->ctid = xStrdup(ctid);
++ }
++ }
++ else if (String_startsWith(buffer, "VPid:")) {
++ unsigned int vpid;
++ int ok = sscanf(buffer, "VPid:\t%32u", &vpid);
++ if (ok == 1) {
++ process->vpid = vpid;
++ }
++ }
++ }
+ fclose(file);
+- return;
+ }
+
+ #endif
diff --git a/debian/patches/610-io-priority-only-on-linux.patch b/debian/patches/610-io-priority-only-on-linux.patch
deleted file mode 100644
index 62db759..0000000
--- a/debian/patches/610-io-priority-only-on-linux.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-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;
diff --git a/debian/patches/700-ltrace-support.patch b/debian/patches/700-ltrace-support.patch
deleted file mode 100644
index 44b5d70..0000000
--- a/debian/patches/700-ltrace-support.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-Add support for 'ltrace' in addition to 'strace' support.
-Index: htop/TraceScreen.c
-===================================================================
---- htop.orig/TraceScreen.c 2014-05-01 12:58:42.000000000 +0300
-+++ htop/TraceScreen.c 2014-05-01 12:59:07.000000000 +0300
-@@ -29,10 +29,16 @@
- #include "Panel.h"
- #include "FunctionBar.h"
-
-+typedef enum TraceType_ {
-+ STRACE,
-+ LTRACE
-+} TraceType;
-+
- typedef struct TraceScreen_ {
- Process* process;
- Panel* display;
- bool tracing;
-+ TraceType type;
- } TraceScreen;
-
- }*/
-@@ -43,9 +49,10 @@
-
- static int tsEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27};
-
--TraceScreen* TraceScreen_new(Process* process) {
-+TraceScreen* TraceScreen_new(Process* process, TraceType type) {
- TraceScreen* this = (TraceScreen*) malloc(sizeof(TraceScreen));
- this->process = process;
-+ this->type = type;
- this->display = Panel_new(0, 1, COLS, LINES-2, false, Class(ListItem));
- this->tracing = true;
- return this;
-@@ -59,7 +66,14 @@
- static void TraceScreen_draw(TraceScreen* this, IncSet* inc) {
- attrset(CRT_colors[PANEL_HEADER_FOCUS]);
- mvhline(0, 0, ' ', COLS);
-- mvprintw(0, 0, "Trace of process %d - %s", this->process->pid, this->process->comm);
-+ switch(this->type) {
-+ case STRACE:
-+ mvprintw(0, 0, "Trace of process %d - %s (STRACE)", this->process->pid, this->process->comm);
-+ break;
-+ case LTRACE:
-+ mvprintw(0, 0, "Trace of process %d - %s (LTRACE)", this->process->pid, this->process->comm);
-+ break;
-+ }
- attrset(CRT_colors[DEFAULT_COLOR]);
- IncSet_drawBar(inc);
- }
-@@ -90,16 +104,31 @@
- int ok = fcntl(fdpair[1], F_SETFL, O_NONBLOCK);
- if (ok != -1) {
- sprintf(buffer, "%d", this->process->pid);
-- execlp("strace", "strace", "-p", buffer, NULL);
-+ switch(this->type) {
-+ case STRACE:
-+ execlp("strace", "strace", "-p", buffer, NULL);
-+ break;
-+ case LTRACE:
-+ execlp("ltrace", "ltrace", "-p", buffer, NULL);
-+ break;
-+ }
-+ }
-+ const char* message;
-+ switch(this->type) {
-+ case STRACE:
-+ message = "Could not execute 'strace'. Please make sure it is available in your $PATH.";
-+ break;
-+ case LTRACE:
-+ message = "Could not execute 'ltrace'. Please make sure it is available in your $PATH.";
-+ break;
- }
-- const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH.";
- write(fdpair[1], message, strlen(message));
- exit(1);
- }
- fcntl(fdpair[0], F_SETFL, O_NONBLOCK);
-- FILE* strace = fdopen(fdpair[0], "r");
-+ FILE* trace = fdopen(fdpair[0], "r");
- Panel* panel = this->display;
-- int fd_strace = fileno(strace);
-+ int fd_trace = fileno(trace);
- CRT_disableDelay();
- bool contLine = false;
- bool follow = false;
-@@ -125,13 +154,13 @@
- fd_set fds;
- FD_ZERO(&fds);
- // FD_SET(STDIN_FILENO, &fds);
-- FD_SET(fd_strace, &fds);
-+ FD_SET(fd_trace, &fds);
- struct timeval tv;
- tv.tv_sec = 0; tv.tv_usec = 500;
-- int ready = select(fd_strace+1, &fds, NULL, NULL, &tv);
-+ int ready = select(fd_trace+1, &fds, NULL, NULL, &tv);
- int nread = 0;
-- if (ready > 0 && FD_ISSET(fd_strace, &fds))
-+ if (ready > 0 && FD_ISSET(fd_trace, &fds))
-- nread = fread(buffer, 1, 1000, strace);
-+ nread = fread(buffer, 1, 1000, trace);
- if (nread && this->tracing) {
- char* line = buffer;
- buffer[nread] = '\0';
-@@ -224,6 +253,6 @@
-
- kill(child, SIGTERM);
- waitpid(child, NULL, 0);
-- fclose(strace);
-+ fclose(trace);
- CRT_enableDelay();
- }
-Index: htop/htop.1.in
-===================================================================
---- htop.orig/htop.1.in 2014-05-01 12:58:42.000000000 +0300
-+++ htop/htop.1.in 2014-05-01 12:59:07.000000000 +0300
-@@ -67,6 +67,11 @@
- Display open files for a process: if lsof(1) is installed, pressing this key
- will display the list of file descriptors opened by the process.
- .TP
-+.B L
-+Trace process library calls: if ltrace(1) is installed, pressing this key
-+will attach it to the currently selected process, presenting a live
-+update of library calls issued by the process.
-+.TP
- .B F1, h, ?
- Go to the help screen
- .TP
-Index: htop/htop.c
-===================================================================
---- htop.orig/htop.c 2014-05-01 12:58:42.000000000 +0300
-+++ htop/htop.c 2014-05-01 12:59:07.000000000 +0300
-@@ -103,7 +103,7 @@
- #endif
- { .key = " l: ", .info = "list open files with lsof" },
- { .key = " s: ", .info = "trace syscalls with strace" },
-- { .key = " ", .info = "" },
-+ { .key = " L: ", .info = "trace library calls with ltrace" },
- { .key = " F2 S: ", .info = "setup" },
- { .key = " F1 h: ", .info = "show this help screen" },
- { .key = " F10 q: ", .info = "quit" },
-@@ -711,11 +711,24 @@
- Panel_onKey(panel, KEY_DOWN);
- break;
- }
-+ case 'L':
-+ {
-+ Process* p = (Process*) Panel_getSelected(panel);
-+ if (!p) break;
-+ TraceScreen* ts = TraceScreen_new(p, LTRACE);
-+ TraceScreen_run(ts);
-+ TraceScreen_delete(ts);
-+ clear();
-+ FunctionBar_draw(defaultBar, NULL);
-+ refreshTimeout = 0;
-+ CRT_enableDelay();
-+ break;
-+ }
- case 's':
- {
- Process* p = (Process*) Panel_getSelected(panel);
- if (!p) break;
-- TraceScreen* ts = TraceScreen_new(p);
-+ TraceScreen* ts = TraceScreen_new(p, STRACE);
- TraceScreen_run(ts);
- TraceScreen_delete(ts);
- clear();
diff --git a/debian/patches/series b/debian/patches/series
index c366e92..a437421 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1 @@
-600-openvz-veid-on-kernels-gt-2.6.18.patch
-610-io-priority-only-on-linux.patch
-700-ltrace-support.patch
+601-openvz-new-ctid-vpid.patch
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)

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