aboutsummaryrefslogtreecommitdiff
path: root/sysutils/htop
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/htop')
-rw-r--r--sysutils/htop/Makefile1
-rw-r--r--sysutils/htop/files/patch-FunctionBar.c19
-rw-r--r--sysutils/htop/files/patch-OpenFilesScreen.c56
-rw-r--r--sysutils/htop/files/patch-OpenFilesScreen.h11
-rw-r--r--sysutils/htop/files/patch-ProcessList.c20
-rw-r--r--sysutils/htop/files/patch-UptimeMeter.c11
6 files changed, 118 insertions, 0 deletions
diff --git a/sysutils/htop/Makefile b/sysutils/htop/Makefile
index 23a8214885ec..45fe9fd68a5b 100644
--- a/sysutils/htop/Makefile
+++ b/sysutils/htop/Makefile
@@ -7,6 +7,7 @@
PORTNAME= htop
PORTVERSION= 0.8.3
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= SF
diff --git a/sysutils/htop/files/patch-FunctionBar.c b/sysutils/htop/files/patch-FunctionBar.c
new file mode 100644
index 000000000000..1a6c3ecc825a
--- /dev/null
+++ b/sysutils/htop/files/patch-FunctionBar.c
@@ -0,0 +1,19 @@
+--- FunctionBar.c.orig 2010-01-26 03:50:57.000000000 +0800
++++ FunctionBar.c 2010-01-26 03:51:50.000000000 +0800
+@@ -52,14 +52,12 @@
+ this->functions = malloc(sizeof(char*) * 15);
+ this->keys = malloc(sizeof(char*) * 15);
+ this->events = malloc(sizeof(int) * 15);
+- int i = 0;
+- while (i < 15 && functions[i]) {
++ for (int i = 0; i < 15 && functions[i]; i++) {
+ this->functions[i] = String_copy(functions[i]);
+ this->keys[i] = String_copy(keys[i]);
+ this->events[i] = events[i];
+- i++;
++ this->size = i;
+ }
+- this->size = i;
+ } else {
+ this->staticData = true;
+ this->functions = functions ? functions : FunctionBar_FLabels;
diff --git a/sysutils/htop/files/patch-OpenFilesScreen.c b/sysutils/htop/files/patch-OpenFilesScreen.c
new file mode 100644
index 000000000000..36ea28b7b905
--- /dev/null
+++ b/sysutils/htop/files/patch-OpenFilesScreen.c
@@ -0,0 +1,56 @@
+--- OpenFilesScreen.c.orig 2010-01-26 03:53:04.000000000 +0800
++++ OpenFilesScreen.c 2010-01-26 03:56:23.000000000 +0800
+@@ -26,7 +26,7 @@
+ typedef struct OpenFiles_ProcessData_ {
+ char* data[256];
+ struct OpenFiles_FileData_* files;
+- bool failed;
++ int error;
+ } OpenFiles_ProcessData;
+
+ typedef struct OpenFiles_FileData_ {
+@@ -80,16 +80,18 @@
+ OpenFiles_ProcessData* process = calloc(sizeof(OpenFiles_ProcessData), 1);
+ OpenFiles_FileData* file = NULL;
+ OpenFiles_ProcessData* item = process;
+- process->failed = true;
+ bool anyRead = false;
++
++ if (!fd) {
++ process->error = 127;
++ return process;
++ }
++
+ while (!feof(fd)) {
+ int cmd = fgetc(fd);
+- if (cmd == EOF && !anyRead) {
+- process->failed = true;
++ if (cmd == EOF && !anyRead)
+ break;
+- }
+ anyRead = true;
+- process->failed = false;
+ char* entry = malloc(1024);
+ if (!fgets(entry, 1024, fd)) break;
+ char* newline = strrchr(entry, '\n');
+@@ -106,7 +108,7 @@
+ }
+ item->data[cmd] = entry;
+ }
+- pclose(fd);
++ process->error = pclose(fd);
+ return process;
+ }
+
+@@ -115,8 +117,10 @@
+ int index = MAX(Panel_getSelectedIndex(panel), 0);
+ Panel_prune(panel);
+ OpenFiles_ProcessData* process = OpenFilesScreen_getProcessData(this->process->pid);
+- if (process->failed) {
++ if (process->error == 127) {
+ Panel_add(panel, (Object*) ListItem_new("Could not execute 'lsof'. Please make sure it is available in your $PATH.", 0));
++ } else if (process->error == 1) {
++ Panel_add(panel, (Object*) ListItem_new("Failed listing open files.", 0));
+ } else {
+ OpenFiles_FileData* file = process->files;
+ while (file) {
diff --git a/sysutils/htop/files/patch-OpenFilesScreen.h b/sysutils/htop/files/patch-OpenFilesScreen.h
new file mode 100644
index 000000000000..0a3a8d35e1b9
--- /dev/null
+++ b/sysutils/htop/files/patch-OpenFilesScreen.h
@@ -0,0 +1,11 @@
+--- OpenFilesScreen.h.orig 2010-01-26 03:57:03.000000000 +0800
++++ OpenFilesScreen.h 2010-01-26 03:57:19.000000000 +0800
+@@ -28,7 +28,7 @@
+ typedef struct OpenFiles_ProcessData_ {
+ char* data[256];
+ struct OpenFiles_FileData_* files;
+- bool failed;
++ int error;
+ } OpenFiles_ProcessData;
+
+ typedef struct OpenFiles_FileData_ {
diff --git a/sysutils/htop/files/patch-ProcessList.c b/sysutils/htop/files/patch-ProcessList.c
new file mode 100644
index 000000000000..cecb029a7371
--- /dev/null
+++ b/sysutils/htop/files/patch-ProcessList.c
@@ -0,0 +1,20 @@
+--- ProcessList.c.orig 2010-01-26 03:58:10.000000000 +0800
++++ ProcessList.c 2010-01-26 04:22:58.000000000 +0800
+@@ -313,7 +313,7 @@
+ unsigned int pid = p->pid;
+ int index = Vector_indexOf(this->processes, p, Process_pidCompare);
+ assert(index != -1);
+- Vector_remove(this->processes, index);
++ if (index >= 0) Vector_remove(this->processes, index);
+ assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
+ assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
+ }
+@@ -730,7 +730,7 @@
+
+ void ProcessList_scan(ProcessList* this) {
+ unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
+- unsigned long long int swapFree;
++ unsigned long long int swapFree = 0;
+
+ FILE* status;
+ char buffer[128];
diff --git a/sysutils/htop/files/patch-UptimeMeter.c b/sysutils/htop/files/patch-UptimeMeter.c
new file mode 100644
index 000000000000..4790908e0f9b
--- /dev/null
+++ b/sysutils/htop/files/patch-UptimeMeter.c
@@ -0,0 +1,11 @@
+--- UptimeMeter.c.orig 2010-01-26 04:26:23.000000000 +0800
++++ UptimeMeter.c 2010-01-26 04:27:01.000000000 +0800
+@@ -19,7 +19,7 @@
+ };
+
+ static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
+- double uptime;
++ double uptime = 0;
+ FILE* fd = fopen(PROCDIR "/uptime", "r");
+ fscanf(fd, "%lf", &uptime);
+ fclose(fd);