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

(-)/usr/ports/sysutils/htop/Makefile (-2 / +1 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	htop
8
PORTNAME=	htop
9
PORTVERSION=	0.9
9
PORTVERSION=	1.0.1
10
PORTREVISION=	1
11
CATEGORIES=	sysutils
10
CATEGORIES=	sysutils
12
MASTER_SITES=	SF
11
MASTER_SITES=	SF
13
12
(-)/usr/ports/sysutils/htop/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (htop-0.9.tar.gz) = 4de65c38e1886bccd30ed692b30eb9bf195240680781bfe1eaf5faf84ee6fbfd
1
SHA256 (htop-1.0.1.tar.gz) = 07db2cbe02835f9e186b9610ecc3beca330a5c9beadb3b6069dd0a10561506f2
2
SIZE (htop-0.9.tar.gz) = 418767
2
SIZE (htop-1.0.1.tar.gz) = 384683
(-)/usr/ports/sysutils/htop/files/patch-FunctionBar.c (-19 lines)
Lines 1-19 Link Here
1
--- FunctionBar.c.orig	2010-01-26 03:50:57.000000000 +0800
2
+++ FunctionBar.c	2010-01-26 03:51:50.000000000 +0800
3
@@ -52,14 +52,12 @@
4
       this->functions = malloc(sizeof(char*) * 15);
5
       this->keys = malloc(sizeof(char*) * 15);
6
       this->events = malloc(sizeof(int) * 15);
7
-      int i = 0;
8
-      while (i < 15 && functions[i]) {
9
+      for (int i = 0; i < 15 && functions[i]; i++) {
10
          this->functions[i] = String_copy(functions[i]);
11
          this->keys[i] = String_copy(keys[i]);
12
          this->events[i] = events[i];
13
-         i++;
14
+         this->size = i;
15
       }
16
-      this->size = i;
17
    } else {
18
       this->staticData = true;
19
       this->functions = functions ? functions : FunctionBar_FLabels;
(-)/usr/ports/sysutils/htop/files/patch-ProcessList.c (-87 lines)
Lines 1-87 Link Here
1
--- ./ProcessList.c.orig	2010-11-26 18:50:25.000000000 +0200
2
+++ ./ProcessList.c	2011-08-11 13:07:08.000000000 +0300
3
@@ -32,6 +32,19 @@
4
 #include "debug.h"
5
 #include <assert.h>
6
 
7
+#ifndef PAGE_SIZE
8
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
9
+#endif
10
+
11
+#ifdef __FreeBSD__
12
+#define KB 1024
13
+#define SYSCTLBYNAME(name, var, len) sysctlbyname(name, &(var), &(len), NULL, 0)
14
+#include <kvm.h>
15
+#include <paths.h>
16
+#include <fcntl.h>
17
+#include <sys/sysctl.h>
18
+#endif
19
+
20
 /*{
21
 
22
 #ifndef PROCDIR
23
@@ -665,15 +678,24 @@
24
 
25
 void ProcessList_scan(ProcessList* this) {
26
    unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime, virtalltime;
27
+   #ifndef __FreeBSD__
28
    unsigned long long int swapFree = 0;
29
+   #endif
30
+   int cpus = this->cpuCount;
31
+   FILE* file = NULL;
32
 
33
-   FILE* file = fopen(PROCMEMINFOFILE, "r");
34
+   #ifdef __FreeBSD__
35
+   kvm_t *kd = NULL;
36
+   struct kvm_swap kvmswapinfo[1];
37
+   size_t len = 0;
38
+   #endif
39
+
40
+   #ifndef __FreeBSD__
41
+   file = fopen(PROCMEMINFOFILE, "r");
42
    assert(file != NULL);
43
-   int cpus = this->cpuCount;
44
    {
45
       char buffer[128];
46
       while (fgets(buffer, 128, file)) {
47
-   
48
          switch (buffer[0]) {
49
          case 'M':
50
             if (String_startsWith(buffer, "MemTotal:"))
51
@@ -700,10 +722,35 @@
52
          }
53
       }
54
    }
55
+   fclose(file);
56
+   #endif
57
 
58
+   #ifdef __FreeBSD__
59
+   len = sizeof(this->totalMem);
60
+   SYSCTLBYNAME("vm.stats.vm.v_page_count", this->totalMem, len);
61
+   this->totalMem *= PAGE_SIZE / KB;
62
+   len = sizeof(this->cachedMem);
63
+   SYSCTLBYNAME("vm.stats.vm.v_cache_count", this->cachedMem, len);
64
+   this->cachedMem *= PAGE_SIZE / KB;
65
+   len = sizeof(this->buffersMem);
66
+   SYSCTLBYNAME("vfs.bufspace", this->buffersMem, len);
67
+   this->buffersMem /= KB;
68
+   len = sizeof(this->usedMem);
69
+   SYSCTLBYNAME("vm.stats.vm.v_active_count", this->usedMem, len);
70
+   this->usedMem = this->usedMem * PAGE_SIZE / KB + this->cachedMem + this->buffersMem;
71
+   this->freeMem = this->totalMem - this->usedMem;
72
+   kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
73
+   assert(kd != NULL);
74
+   kvm_getswapinfo(kd, kvmswapinfo, 1, 0);
75
+   this->totalSwap = kvmswapinfo[0].ksw_total * PAGE_SIZE / KB;
76
+   this->usedSwap = kvmswapinfo[0].ksw_used * PAGE_SIZE / KB;
77
+   kvm_close(kd);
78
+   #endif
79
+
80
+   #ifndef __FreeBSD__
81
    this->usedMem = this->totalMem - this->freeMem;
82
    this->usedSwap = this->totalSwap - swapFree;
83
-   fclose(file);
84
+   #endif
85
 
86
    file = fopen(PROCSTATFILE, "r");
87
    assert(file != NULL);
(-)/usr/ports/sysutils/htop/files/patch-RichString.c (-14 lines)
Lines 1-14 Link Here
1
--- RichString.c.orig
2
+++ RichString.c
3
@@ -13,7 +13,11 @@
4
 #include "debug.h"
5
 #include <assert.h>
6
 #ifdef HAVE_LIBNCURSESW
7
+#    ifdef HAVE_NCURSESW_CURSES_H
8
 #include <ncursesw/curses.h>
9
+#    else
10
+#include <curses.h>
11
+#    endif
12
 #else
13
 #include <curses.h>
14
 #endif
(-)/usr/ports/sysutils/htop/files/patch-RichString.h (-14 lines)
Lines 1-14 Link Here
1
--- RichString.h.orig
2
+++ RichString.h
3
@@ -16,7 +16,11 @@
4
 #include "debug.h"
5
 #include <assert.h>
6
 #ifdef HAVE_LIBNCURSESW
7
+#    ifdef HAVE_NCURSESW_CURSES_H
8
 #include <ncursesw/curses.h>
9
+#    else
10
+#include <curses.h>
11
+#    endif
12
 #else
13
 #include <curses.h>
14
 #endif
(-)/usr/ports/sysutils/htop/files/patch-configure.ac (-19 lines)
Lines 1-19 Link Here
1
--- ./configure.ac.orig	2010-11-23 17:56:32.000000000 +0200
2
+++ ./configure.ac	2011-08-11 12:50:44.000000000 +0300
3
@@ -18,6 +18,7 @@
4
 
5
 # Checks for libraries.
6
 AC_CHECK_LIB([m], [ceil], [], [missing_libraries="$missing_libraries libm"])
7
+AC_CHECK_LIB([kvm], [kvm_open], [], [missing_libraries="$missing_libraries libkvm"])
8
 
9
 # Checks for header files.
10
 AC_HEADER_DIRENT
11
@@ -86,7 +87,7 @@
12
 AC_ARG_ENABLE(unicode, [AC_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="no")
13
 if test "x$enable_unicode" = xyes; then
14
    AC_CHECK_LIB([ncursesw], [refresh], [], [missing_libraries="$missing_libraries libncursesw"])
15
-   AC_CHECK_HEADERS([ncursesw/curses.h],[:],[missing_headers="$missing_headers $ac_header"])
16
+   AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
17
 else
18
    AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"])
19
    AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
(-)/usr/ports/sysutils/htop/pkg-message (-1 / +1 lines)
Lines 1-6 Link Here
1
***********************************************************
1
***********************************************************
2
htop(1) requires linprocfs(5) to be mounted. If you don't
2
htop(1) requires linprocfs(5) to be mounted. If you don't
3
have it mounted already, please add this line to /etc/fstab
3
have it mounted already, please add this line to /etc/fstab
4
and run `mount linproc`:
4
and run `mkdir -p /usr/compat/linux/proc; ln -s /usr/compat /compat; mount linproc`:
5
linproc /compat/linux/proc linprocfs rw 0 0
5
linproc /compat/linux/proc linprocfs rw 0 0
6
***********************************************************
6
***********************************************************

Return to bug 165661