From 375c6648cb948b3cd442b8609d63a42cd530fa0f Mon Sep 17 00:00:00 2001 From: "Eugene V. Lyubimkin" Date: Mon, 2 Mar 2009 23:17:04 +0200 Subject: Imported Debian patch 0.8.1-4 --- debian/changelog | 18 +- .../600-openvz-veid-on-kernels-gt-2.6.18.patch | 43 +++++ debian/patches/610-rename-veid-to-ctid.patch | 114 ++++++++++++ debian/patches/700-ltrace-support.patch | 196 +++++++++++++++++++++ .../800-tree-view-without-userland-threads.patch | 15 ++ debian/patches/series | 4 + 6 files changed, 388 insertions(+), 2 deletions(-) create mode 100644 debian/patches/600-openvz-veid-on-kernels-gt-2.6.18.patch create mode 100644 debian/patches/610-rename-veid-to-ctid.patch create mode 100644 debian/patches/700-ltrace-support.patch create mode 100644 debian/patches/800-tree-view-without-userland-threads.patch diff --git a/debian/changelog b/debian/changelog index 2dcc529..e48512d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,23 @@ +htop (0.8.1-4) unstable; urgency=low + + * debian/patches: + - New 600-openvz-veid-on-kernels-gt-2.6.18.patch: fix determining veid on + openvz-enabled kernels greater than 2.6.18. Patch by + Thorsten Schifferdecker . (Closes: #516846) + - New 610-rename-veid-to-ctid.patch: openvz: renames 'veid' -> 'ctid' since + it's now a preferred term. Patch by + Thorsten Schifferdecker . (Closes: #516847) + - New 700-ltrace-support.patch: add ltrace(1) support in addition to strace + support. Patch by . + - New 800-tree-view-with-userland-threads.patch: patch to fix tree view when + userland threads are hidden, taken from Ubuntu. + + -- Eugene V. Lyubimkin Mon, 02 Mar 2009 23:17:04 +0200 + htop (0.8.1-3) unstable; urgency=low * debian/rules: - Don't ship empty directories in the package. - * debian/control: - - Allow DM uploads. -- Eugene V. Lyubimkin Sun, 15 Feb 2009 13:56:41 +0200 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 new file mode 100644 index 0000000..5826233 --- /dev/null +++ b/debian/patches/600-openvz-veid-on-kernels-gt-2.6.18.patch @@ -0,0 +1,43 @@ +diff -Naur htop-0.8.1.orig/ProcessList.c htop-0.8.1/ProcessList.c +--- htop-0.8.1.orig/ProcessList.c 2008-09-23 08:23:14.000000000 +0200 ++++ htop-0.8.1/ProcessList.c 2009-02-24 00:09:37.000000000 +0100 +@@ -625,20 +625,28 @@ + process->vpid = process->pid; + process->veid = 0; + } else { +- snprintf(statusfilename, MAX_NAME, "%s/%s/stat", dirname, name); ++ snprintf(statusfilename, MAX_NAME, "%s/%s/status", dirname, name); + status = ProcessList_fopen(this, statusfilename, "r"); + if (status == NULL) + goto errorReadingProcess; +- num = ProcessList_fread(this, status, +- "%*u %*s %*c %*u %*u %*u %*u %*u %*u %*u " +- "%*u %*u %*u %*u %*u %*u %*u %*u " +- "%*u %*u %*u %*u %*u %*u %*u %*u " +- "%*u %*u %*u %*u %*u %*u %*u %*u " +- "%*u %*u %*u %*u %*u %*u %*u %*u " +- "%*u %*u %*u %*u %*u %*u %*u " +- "%u %u", +- &process->vpid, &process->veid); +- fclose(status); ++ else { ++ char buffer[256]; ++ process->veid = 0; ++ while (!feof(status)) { ++ char* ok = fgets(buffer, 255, status); ++ if (!ok) ++ break; ++ ++ if (String_startsWith(buffer, "envID:")) { ++ int veid; ++ int ok = ProcessList_read(this, buffer, "envID:\t%d", &veid); ++ if (ok >= 1) { ++ process->veid = veid; ++ } ++ } ++ } ++ fclose(status); ++ } + } + #endif + diff --git a/debian/patches/610-rename-veid-to-ctid.patch b/debian/patches/610-rename-veid-to-ctid.patch new file mode 100644 index 0000000..f2e7d43 --- /dev/null +++ b/debian/patches/610-rename-veid-to-ctid.patch @@ -0,0 +1,114 @@ +diff -Naur htop-0.8.1.orig/Process.c htop-0.8.1/Process.c +--- htop-0.8.1.orig/Process.c 2008-09-23 05:43:34.000000000 +0200 ++++ htop-0.8.1/Process.c 2009-02-24 00:11:35.000000000 +0100 +@@ -47,7 +47,7 @@ + PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM, + USER, TIME, NLWP, TGID, + #ifdef HAVE_OPENVZ +- VEID, VPID, ++ CTID, VPID, + #endif + #ifdef HAVE_VSERVER + VXID, +@@ -124,7 +124,7 @@ + float percent_mem; + char* user; + #ifdef HAVE_OPENVZ +- unsigned int veid; ++ unsigned int ctid; + unsigned int vpid; + #endif + #ifdef HAVE_VSERVER +@@ -163,7 +163,7 @@ + "M_TRS", "M_DRS", "M_LRS", "M_DT", "ST_UID", "PERCENT_CPU", "PERCENT_MEM", + "USER", "TIME", "NLWP", "TGID", + #ifdef HAVE_OPENVZ +- "VEID", "VPID", ++ "CTID", "VPID", + #endif + #ifdef HAVE_VSERVER + "VXID", +@@ -185,7 +185,7 @@ + " CODE ", " DATA ", " LIB ", " DIRTY ", " UID ", "CPU% ", "MEM% ", + "USER ", " TIME+ ", "NLWP ", " TGID ", + #ifdef HAVE_OPENVZ +- " VEID ", " VPID ", ++ " CTID ", " VPID ", + #endif + #ifdef HAVE_VSERVER + " VXID ", +@@ -397,7 +397,7 @@ + break; + } + #ifdef HAVE_OPENVZ +- case VEID: snprintf(buffer, n, "%5u ", this->veid); break; ++ case CTID: snprintf(buffer, n, "%5u ", this->ctid); break; + case VPID: snprintf(buffer, n, "%5u ", this->vpid); break; + #endif + #ifdef HAVE_VSERVER +@@ -566,8 +566,8 @@ + case NLWP: + return (p1->nlwp - p2->nlwp); + #ifdef HAVE_OPENVZ +- case VEID: +- return (p1->veid - p2->veid); ++ case CTID: ++ return (p1->ctid - p2->ctid); + case VPID: + return (p1->vpid - p2->vpid); + #endif +diff -Naur htop-0.8.1.orig/Process.h htop-0.8.1/Process.h +--- htop-0.8.1.orig/Process.h 2008-09-23 05:43:34.000000000 +0200 ++++ htop-0.8.1/Process.h 2009-02-24 00:11:35.000000000 +0100 +@@ -49,7 +49,7 @@ + PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM, + USER, TIME, NLWP, TGID, + #ifdef HAVE_OPENVZ +- VEID, VPID, ++ CTID, VPID, + #endif + #ifdef HAVE_VSERVER + VXID, +@@ -126,7 +126,7 @@ + float percent_mem; + char* user; + #ifdef HAVE_OPENVZ +- unsigned int veid; ++ unsigned int ctid; + unsigned int vpid; + #endif + #ifdef HAVE_VSERVER +diff -Naur htop-0.8.1.orig/ProcessList.c htop-0.8.1/ProcessList.c +--- htop-0.8.1.orig/ProcessList.c 2009-02-24 00:09:37.000000000 +0100 ++++ htop-0.8.1/ProcessList.c 2009-02-24 00:11:35.000000000 +0100 +@@ -623,7 +623,7 @@ + #ifdef HAVE_OPENVZ + if (access("/proc/vz", R_OK) != 0) { + process->vpid = process->pid; +- process->veid = 0; ++ process->ctid = 0; + } else { + snprintf(statusfilename, MAX_NAME, "%s/%s/status", dirname, name); + status = ProcessList_fopen(this, statusfilename, "r"); +@@ -631,17 +631,17 @@ + goto errorReadingProcess; + else { + char buffer[256]; +- process->veid = 0; ++ process->ctid = 0; + while (!feof(status)) { + char* ok = fgets(buffer, 255, status); + if (!ok) + break; + + if (String_startsWith(buffer, "envID:")) { +- int veid; +- int ok = ProcessList_read(this, buffer, "envID:\t%d", &veid); ++ int ctid; ++ int ok = ProcessList_read(this, buffer, "envID:\t%d", &ctid); + if (ok >= 1) { +- process->veid = veid; ++ process->ctid = ctid; + } + } + } diff --git a/debian/patches/700-ltrace-support.patch b/debian/patches/700-ltrace-support.patch new file mode 100644 index 0000000..0a6212f --- /dev/null +++ b/debian/patches/700-ltrace-support.patch @@ -0,0 +1,196 @@ +diff --git a/TraceScreen.c b/TraceScreen.c +index 072c26d..087e6cc 100644 +--- a/TraceScreen.c ++++ b/TraceScreen.c +@@ -23,11 +23,17 @@ in the source distribution for its full text. + + /*{ + ++typedef enum TraceType_ { ++ STRACE, ++ LTRACE ++} TraceType; ++ + typedef struct TraceScreen_ { + Process* process; + Panel* display; + FunctionBar* bar; + bool tracing; ++ TraceType type; + } TraceScreen; + + }*/ +@@ -38,9 +44,10 @@ static char* tbKeys[3] = {"F4", "F5", "Esc"}; + + static int tbEvents[3] = {KEY_F(4), KEY_F(5), 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, LISTITEM_CLASS, true, ListItem_compare); + this->bar = FunctionBar_new(3, tbFunctions, tbKeys, tbEvents); + this->tracing = true; +@@ -56,7 +63,14 @@ void TraceScreen_delete(TraceScreen* this) { + static void TraceScreen_draw(TraceScreen* this) { + 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]); + FunctionBar_draw(this->bar, NULL); + } +@@ -73,15 +87,24 @@ void TraceScreen_run(TraceScreen* this) { + dup2(fdpair[1], STDERR_FILENO); + fcntl(fdpair[1], F_SETFL, O_NONBLOCK); + sprintf(buffer, "%d", this->process->pid); +- execlp("strace", "strace", "-p", buffer, NULL); +- const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH."; ++ const char* message; ++ switch(this->type) { ++ case STRACE: ++ execlp("strace", "strace", "-p", buffer, NULL); ++ message = "Could not execute 'strace'. Please make sure it is available in your $PATH."; ++ break; ++ case LTRACE: ++ execlp("ltrace", "ltrace", "-p", buffer, NULL); ++ message = "Could not execute 'ltrace'. Please make sure it is available in your $PATH."; ++ break; ++ } + 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); + TraceScreen_draw(this); + CRT_disableDelay(); + bool contLine = false; +@@ -90,13 +113,13 @@ void TraceScreen_run(TraceScreen* this) { + while (looping) { + fd_set fds; + FD_ZERO(&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) +- nread = fread(buffer, 1, 1000, strace); ++ nread = fread(buffer, 1, 1000, trace); + if (nread && this->tracing) { + char* line = buffer; + buffer[nread] = '\0'; +@@ -164,6 +187,6 @@ void TraceScreen_run(TraceScreen* this) { + } + kill(child, SIGTERM); + waitpid(child, NULL, 0); +- fclose(strace); ++ fclose(trace); + CRT_enableDelay(); + } +diff --git a/TraceScreen.h b/TraceScreen.h +index d2904a7..cad4450 100644 +--- a/TraceScreen.h ++++ b/TraceScreen.h +@@ -25,15 +25,21 @@ in the source distribution for its full text. + #include "FunctionBar.h" + + ++typedef enum TraceType_ { ++ STRACE, ++ LTRACE ++} TraceType; ++ + typedef struct TraceScreen_ { + Process* process; + Panel* display; + FunctionBar* bar; + bool tracing; ++ TraceType type; + } TraceScreen; + + +-TraceScreen* TraceScreen_new(Process* process); ++TraceScreen* TraceScreen_new(Process* process, TraceType type); + + void TraceScreen_delete(TraceScreen* this); + +diff --git a/htop.1 b/htop.1 +index 57c7012..27ae732 100644 +--- a/htop.1 ++++ b/htop.1 +@@ -35,6 +35,11 @@ Trace process system calls: if strace(1) is installed, pressing this key + will attach it to the currently selected process, presenting a live + update of system calls issued 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 + Help screen + .TP +diff --git a/htop.c b/htop.c +index c74b6b3..42d1aca 100644 +--- a/htop.c ++++ b/htop.c +@@ -117,6 +117,7 @@ static void showHelp(ProcessList* pl) { + mvaddstr(19, 0, " F2 S: setup F6 >: select sort column"); + mvaddstr(20, 0, " F1 h: show this help screen"); + mvaddstr(21, 0, " F10 q: quit s: trace syscalls with strace"); ++ mvaddstr(22, 0, " l: trace library calls with ltrace"); + + attrset(CRT_colors[HELP_BOLD]); + mvaddstr( 9, 0, " Arrows"); mvaddstr( 9,40, " F5 t"); +@@ -134,10 +135,11 @@ static void showHelp(ProcessList* pl) { + mvaddstr(19, 0, " F2 S"); mvaddstr(19,40, " F6 >"); + mvaddstr(20, 0, " F1 h"); + mvaddstr(21, 0, " F10 q"); mvaddstr(21,40, " s"); ++ mvaddstr(22,40, " l"); + attrset(CRT_colors[DEFAULT_COLOR]); + + attrset(CRT_colors[HELP_BOLD]); +- mvaddstr(23,0, "Press any key to return."); ++ mvaddstr(24,0, "Press any key to return."); + attrset(CRT_colors[DEFAULT_COLOR]); + refresh(); + CRT_readKey(); +@@ -542,9 +544,20 @@ int main(int argc, char** argv) { + Panel_onKey(panel, KEY_DOWN); + break; + } ++ case 'l': ++ { ++ TraceScreen* ts = TraceScreen_new((Process*) Panel_getSelected(panel), LTRACE); ++ TraceScreen_run(ts); ++ TraceScreen_delete(ts); ++ clear(); ++ FunctionBar_draw(defaultBar, NULL); ++ refreshTimeout = 0; ++ CRT_enableDelay(); ++ break; ++ } + case 's': + { +- TraceScreen* ts = TraceScreen_new((Process*) Panel_getSelected(panel)); ++ TraceScreen* ts = TraceScreen_new((Process*) Panel_getSelected(panel), STRACE); + TraceScreen_run(ts); + TraceScreen_delete(ts); + clear(); + + diff --git a/debian/patches/800-tree-view-without-userland-threads.patch b/debian/patches/800-tree-view-without-userland-threads.patch new file mode 100644 index 0000000..22c886d --- /dev/null +++ b/debian/patches/800-tree-view-without-userland-threads.patch @@ -0,0 +1,15 @@ +Index: htop/ProcessList.c +=================================================================== +--- htop.orig/ProcessList.c 2009-02-25 23:08:35.396191440 +0200 ++++ htop/ProcessList.c 2009-02-25 23:10:26.525680664 +0200 +@@ -563,9 +563,7 @@ + process->pid = pid; + } + } +- if (parent) { +- process->tgid = parent->pid; +- } ++ process->tgid = parent ? parent->pid : pid; + + if (showUserlandThreads && (!parent || pid != parent->pid)) { + char subdirname[MAX_NAME+1]; diff --git a/debian/patches/series b/debian/patches/series index 3f8b005..e0acef1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,6 @@ 010-make-desktop-file-valid.patch 200-filter-non-printable-characters.patch +600-openvz-veid-on-kernels-gt-2.6.18.patch -p1 +610-rename-veid-to-ctid.patch -p1 +700-ltrace-support.patch -p1 +800-tree-view-without-userland-threads.patch -- cgit v1.2.3