View | Details | Raw Unified | Return to bug 153529
Collapse All | Expand All

(-)/usr/ports/sysutils/htop/Makefile (-3 / +11 lines)
Lines 6-17 Link Here
6
#
6
#
7
7
8
PORTNAME=	htop
8
PORTNAME=	htop
9
PORTVERSION=	0.8.3
9
PORTVERSION=	0.9
10
PORTREVISION=	2
11
CATEGORIES=	sysutils
10
CATEGORIES=	sysutils
12
MASTER_SITES=	SF
11
MASTER_SITES=	SF
13
12
14
MAINTAINER=	yzlin@FreeBSD.org
13
MAINTAINER=	gaod@hychen.org
15
COMMENT=	A better top(1) - interactive process viewer
14
COMMENT=	A better top(1) - interactive process viewer
16
15
17
OPTIONS=	LSOF "Enable lsof support" On
16
OPTIONS=	LSOF "Enable lsof support" On
Lines 19-24 Link Here
19
NOT_FOR_ARCHS=	sparc64
18
NOT_FOR_ARCHS=	sparc64
20
19
21
GNU_CONFIGURE=	yes
20
GNU_CONFIGURE=	yes
21
CFLAGS+=	-I${LOCALBASE}/include
22
CPPFLAGS+=	-I${LOCALBASE}/include
23
LDFLAGS+=	-L${LOCALBASE}/lib
24
CONFIGURE_ENV=	CFLAGS="${CFLAGS}" \
25
		CPPFLAGS="${CPPFLAGS}" \
26
		LDFLAGS="${LDFLAGS}" \
27
		LIBS="-lexecinfo"
28
22
CONFIGURE_ARGS=	--with-proc=/compat/linux/proc --enable-unicode
29
CONFIGURE_ARGS=	--with-proc=/compat/linux/proc --enable-unicode
23
USE_AUTOTOOLS=	autoconf aclocal automake libtool
30
USE_AUTOTOOLS=	autoconf aclocal automake libtool
24
ACLOCAL_ARGS=	-I ${ACLOCAL_DIR}
31
ACLOCAL_ARGS=	-I ${ACLOCAL_DIR}
Lines 29-34 Link Here
29
36
30
.include <bsd.port.pre.mk>
37
.include <bsd.port.pre.mk>
31
38
39
LIB_DEPENDS=	execinfo.1:${PORTSDIR}/devel/libexecinfo
32
.if ${OSVERSION} < 602107 || (${OSVERSION} > 700000 && ${OSVERSION} < 700033)
40
.if ${OSVERSION} < 602107 || (${OSVERSION} > 700000 && ${OSVERSION} < 700033)
33
LIB_DEPENDS+=	ncursesw.5:${PORTSDIR}/devel/ncurses
41
LIB_DEPENDS+=	ncursesw.5:${PORTSDIR}/devel/ncurses
34
.endif
42
.endif
(-)/usr/ports/sysutils/htop/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (htop-0.8.3.tar.gz) = 5c9f093f9eaddf6e77aa6d54c2116d0c
1
MD5 (htop-0.9.tar.gz) = 7c5507f35f363f3f40183a2ba3c561f8
2
SHA256 (htop-0.8.3.tar.gz) = f03bac8999c57c399cbf4332831bcce905d0393d0f97f7e32a1407b48890dd9d
2
SHA256 (htop-0.9.tar.gz) = 4de65c38e1886bccd30ed692b30eb9bf195240680781bfe1eaf5faf84ee6fbfd
3
SIZE (htop-0.8.3.tar.gz) = 428061
3
SIZE (htop-0.9.tar.gz) = 418767
(-)/usr/ports/sysutils/htop/files/patch-OpenFilesScreen.c (-56 lines)
Lines 1-56 Link Here
1
--- OpenFilesScreen.c.orig	2010-01-26 03:53:04.000000000 +0800
2
+++ OpenFilesScreen.c	2010-01-26 03:56:23.000000000 +0800
3
@@ -26,7 +26,7 @@
4
 typedef struct OpenFiles_ProcessData_ {
5
    char* data[256];
6
    struct OpenFiles_FileData_* files;
7
-   bool failed;
8
+   int error;
9
 } OpenFiles_ProcessData;
10
 
11
 typedef struct OpenFiles_FileData_ {
12
@@ -80,16 +80,18 @@
13
    OpenFiles_ProcessData* process = calloc(sizeof(OpenFiles_ProcessData), 1);
14
    OpenFiles_FileData* file = NULL;
15
    OpenFiles_ProcessData* item = process;
16
-   process->failed = true;
17
    bool anyRead = false;
18
+
19
+   if (!fd) {
20
+      process->error = 127;
21
+      return process;
22
+   }
23
+
24
    while (!feof(fd)) {
25
       int cmd = fgetc(fd);
26
-      if (cmd == EOF && !anyRead) {
27
-         process->failed = true;
28
+      if (cmd == EOF && !anyRead)
29
          break;
30
-      }
31
       anyRead = true;
32
-      process->failed = false;
33
       char* entry = malloc(1024);
34
       if (!fgets(entry, 1024, fd)) break;
35
       char* newline = strrchr(entry, '\n');
36
@@ -106,7 +108,7 @@
37
       }
38
       item->data[cmd] = entry;
39
    }
40
-   pclose(fd);
41
+   process->error = pclose(fd);
42
    return process;
43
 }
44
 
45
@@ -115,8 +117,10 @@
46
    int index = MAX(Panel_getSelectedIndex(panel), 0);
47
    Panel_prune(panel);
48
    OpenFiles_ProcessData* process = OpenFilesScreen_getProcessData(this->process->pid);
49
-   if (process->failed) {
50
+   if (process->error == 127) {
51
       Panel_add(panel, (Object*) ListItem_new("Could not execute 'lsof'. Please make sure it is available in your $PATH.", 0));
52
+   } else if (process->error == 1) {
53
+      Panel_add(panel, (Object*) ListItem_new("Failed listing open files.", 0));
54
    } else {
55
       OpenFiles_FileData* file = process->files;
56
       while (file) {
(-)/usr/ports/sysutils/htop/files/patch-OpenFilesScreen.h (-11 lines)
Lines 1-11 Link Here
1
--- OpenFilesScreen.h.orig	2010-01-26 03:57:03.000000000 +0800
2
+++ OpenFilesScreen.h	2010-01-26 03:57:19.000000000 +0800
3
@@ -28,7 +28,7 @@
4
 typedef struct OpenFiles_ProcessData_ {
5
    char* data[256];
6
    struct OpenFiles_FileData_* files;
7
-   bool failed;
8
+   int error;
9
 } OpenFiles_ProcessData;
10
 
11
 typedef struct OpenFiles_FileData_ {
(-)/usr/ports/sysutils/htop/files/patch-ProcessList.c (-20 lines)
Lines 1-20 Link Here
1
--- ProcessList.c.orig	2010-01-26 03:58:10.000000000 +0800
2
+++ ProcessList.c	2010-01-26 04:22:58.000000000 +0800
3
@@ -313,7 +313,7 @@
4
    unsigned int pid = p->pid;
5
    int index = Vector_indexOf(this->processes, p, Process_pidCompare);
6
    assert(index != -1);
7
-   Vector_remove(this->processes, index);
8
+   if (index >= 0) Vector_remove(this->processes, index);
9
    assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
10
    assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
11
 }
12
@@ -730,7 +730,7 @@
13
 
14
 void ProcessList_scan(ProcessList* this) {
15
    unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
16
-   unsigned long long int swapFree;
17
+   unsigned long long int swapFree = 0;
18
 
19
    FILE* status;
20
    char buffer[128];
(-)/usr/ports/sysutils/htop/files/patch-UptimeMeter.c (-11 lines)
Lines 1-11 Link Here
1
--- UptimeMeter.c.orig	2010-01-26 04:26:23.000000000 +0800
2
+++ UptimeMeter.c	2010-01-26 04:27:01.000000000 +0800
3
@@ -19,7 +19,7 @@
4
 };
5
 
6
 static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
7
-   double uptime;
8
+   double uptime = 0;
9
    FILE* fd = fopen(PROCDIR "/uptime", "r");
10
    fscanf(fd, "%lf", &uptime);
11
    fclose(fd);
(-)/usr/ports/sysutils/htop/files/patch-configure.ac (+11 lines)
Line 0 Link Here
1
--- configure.ac.orig	2010-12-30 03:13:16.000000000 +0800
2
+++ configure.ac	2010-12-30 03:13:23.000000000 +0800
3
@@ -86,7 +86,7 @@
4
 AC_ARG_ENABLE(unicode, [AC_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="no")
5
 if test "x$enable_unicode" = xyes; then
6
    AC_CHECK_LIB([ncursesw], [refresh], [], [missing_libraries="$missing_libraries libncursesw"])
7
-   AC_CHECK_HEADERS([ncursesw/curses.h],[:],[missing_headers="$missing_headers $ac_header"])
8
+   AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
9
 else
10
    AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"])
11
    AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])

Return to bug 153529