1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

Update to 1.0.3

PR:		194450
Submitted by:	Hung-Yi Chen <gaod at hychen.org> (maintainer)
This commit is contained in:
Guido Falsi 2014-10-28 22:14:42 +00:00
parent d386f79db2
commit e6c544f915
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=371652
6 changed files with 48 additions and 122 deletions

View File

@ -2,14 +2,15 @@
# $FreeBSD$
PORTNAME= htop
PORTVERSION= 1.0.2
PORTREVISION= 1
PORTVERSION= 1.0.3
CATEGORIES= sysutils
MASTER_SITES= SF
MASTER_SITES= http://hisham.hm/htop/releases/${PORTVERSION}/
MAINTAINER= gaod@hychen.org
COMMENT= Better top(1) - interactive process viewer
LICENSE= GPLv2
OPTIONS_DEFINE= LSOF
OPTIONS_DEFAULT=LSOF

View File

@ -1,2 +1,2 @@
SHA256 (htop-1.0.2.tar.gz) = ee60657b044ece0df096c053060df7abf3cce3a568ab34d260049e6a37ccd8a1
SIZE (htop-1.0.2.tar.gz) = 388499
SHA256 (htop-1.0.3.tar.gz) = 055c57927f75847fdc222b5258b079a9542811a9dcf5421c615c7e17f55d1829
SIZE (htop-1.0.3.tar.gz) = 399306

View File

@ -1,6 +1,6 @@
--- Process.h.orig 2013-04-21 03:34:39.000000000 +0800
+++ Process.h 2013-04-21 03:34:49.000000000 +0800
@@ -179,11 +179,11 @@
--- Process.h.orig 2014-10-19 02:06:35.000000000 +0800
+++ Process.h 2014-10-19 02:06:49.000000000 +0800
@@ -201,11 +201,11 @@
bool Process_setPriority(Process* this, int priority);
bool Process_changePriorityBy(Process* this, size_t delta);

View File

@ -1,84 +1,11 @@
--- ProcessList.c.orig 2013-04-21 03:39:12.000000000 +0800
+++ ProcessList.c 2013-04-21 03:41:41.000000000 +0800
@@ -25,6 +25,19 @@
#include <time.h>
#include <assert.h>
+#ifndef PAGE_SIZE
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#endif
+
+#ifdef __FreeBSD__
+#define KB 1024
+#define SYSCTLBYNAME(name, var, len) sysctlbyname(name, &(var), &(len), NULL, 0)
+#include <kvm.h>
+#include <paths.h>
+#include <fcntl.h>
+#include <sys/sysctl.h>
+#endif
+
/*{
#include "Vector.h"
#include "Hashtable.h"
@@ -685,7 +698,7 @@
--- ProcessList.c.orig 2014-10-19 02:09:17.000000000 +0800
+++ ProcessList.c 2014-10-19 02:11:07.000000000 +0800
@@ -804,8 +804,6 @@
unsigned long long int lasttimes = (process->utime + process->stime);
if (! ProcessList_readStatFile(process, dirname, name, command))
goto errorReadingProcess;
- Process_updateIOPriority(process);
+// Process_updateIOPriority(process);
- if (this->flags & PROCESS_FLAG_IOPRIO)
- Process_updateIOPriority(process);
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;
@@ -764,13 +777,15 @@
void ProcessList_scan(ProcessList* this) {
unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime, virtalltime;
- unsigned long long int swapFree = 0;
+ int cpus = this->cpuCount;
+ FILE* file = NULL;
- FILE* file = fopen(PROCMEMINFOFILE, "r");
+ #ifndef __FreeBSD__
+ unsigned long long int swapFree = 0;
+ file = fopen(PROCMEMINFOFILE, "r");
if (file == NULL) {
CRT_fatalError("Cannot open " PROCMEMINFOFILE);
}
- int cpus = this->cpuCount;
{
char buffer[128];
while (fgets(buffer, 128, file)) {
@@ -805,6 +820,33 @@
this->usedMem = this->totalMem - this->freeMem;
this->usedSwap = this->totalSwap - swapFree;
fclose(file);
+ #endif
+
+ #ifdef __FreeBSD__
+ kvm_t *kd = NULL;
+ struct kvm_swap kvmswapinfo[1];
+ size_t len = 0;
+
+ kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, NULL);
+ assert(kd != NULL);
+ kvm_getswapinfo(kd, kvmswapinfo, 1, 0);
+ this->totalSwap = kvmswapinfo[0].ksw_total * (PAGE_SIZE / KB);
+ this->usedSwap = kvmswapinfo[0].ksw_used * (PAGE_SIZE / KB);
+ kvm_close(kd);
+ len = sizeof(this->totalMem);
+ SYSCTLBYNAME("vm.stats.vm.v_page_count", this->totalMem, len);
+ this->totalMem *= PAGE_SIZE / KB;
+ len = sizeof(this->cachedMem);
+ SYSCTLBYNAME("vm.stats.vm.v_cache_count", this->cachedMem, len);
+ this->cachedMem *= PAGE_SIZE / KB;
+ len = sizeof(this->buffersMem);
+ SYSCTLBYNAME("vfs.bufspace", this->buffersMem, len);
+ this->buffersMem /= KB;
+ len = sizeof(this->usedMem);
+ SYSCTLBYNAME("vm.stats.vm.v_active_count", this->usedMem, len);
+ this->usedMem = this->usedMem * PAGE_SIZE / KB + this->cachedMem + this->buffersMem;
+ this->freeMem = this->totalMem - this->usedMem;
+ #endif
file = fopen(PROCSTATFILE, "r");
if (file == NULL) {

View File

@ -1,5 +1,5 @@
--- configure.ac.orig 2011-12-26 23:46:57.000000000 +0200
+++ configure.ac 2012-05-16 17:39:50.000000000 +0300
--- configure.ac.orig 2014-10-19 02:12:28.000000000 +0800
+++ configure.ac 2014-10-19 02:14:19.000000000 +0800
@@ -23,11 +23,12 @@
# Checks for libraries.
@ -9,8 +9,8 @@
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
-AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h],[:],[
+AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h curses.h kvm.h paths.h fcntl.h sys/sysctl.h],[:],[
-AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h],[:],[
+AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h kvm.h paths.h fcntl.h sys/sysctl.h],[:],[
missing_headers="$missing_headers $ac_header"
])
AC_CHECK_HEADERS([execinfo.h],[:],[:])

View File

@ -1,38 +1,36 @@
--- htop.c.orig 2012-10-05 07:55:31.000000000 +0800
+++ htop.c 2013-04-21 03:47:54.882373049 +0800
@@ -126,7 +126,7 @@
mvaddstr(13, 0, " Space: tag processes F: cursor follows process");
mvaddstr(14, 0, " U: untag all processes + -: expand/collapse tree");
mvaddstr(15, 0, " F9 k: kill process/tagged processes P M T: sort by CPU%, MEM% or TIME");
- mvaddstr(16, 0, " ] F7: higher priority (root only) i: set IO priority");
+ mvaddstr(16, 0, " ] F7: higher priority (root only)");
mvaddstr(17, 0, " [ F8: lower priority (+ nice) I: invert sort order");
--- htop.c.orig 2014-10-19 02:15:19.000000000 +0800
+++ htop.c 2014-10-19 02:17:10.000000000 +0800
@@ -96,7 +96,6 @@
#if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
if (pl->cpuCount > 1)
@@ -146,7 +146,7 @@
mvaddstr(13, 0, " Space"); mvaddstr(13,40, " F");
mvaddstr(14, 0, " U"); mvaddstr(14,40, " + -");
mvaddstr(15, 0, " F9 k"); mvaddstr(15,40, "P M T");
- mvaddstr(16, 0, " ] F7"); mvaddstr(16,40, " i");
+ mvaddstr(16, 0, " ] F7");
mvaddstr(17, 0, " [ F8"); mvaddstr(17,40, " I");
mvaddstr(18,40, " F6 >");
#if (HAVE_LIBHWLOC || HAVE_NATIVE_AFFINITY)
@@ -850,7 +850,7 @@
((Object*)sortPanel)->delete((Object*)sortPanel);
refreshTimeout = 0;
{ .key = " a: ", .info = "set CPU affinity" },
#endif
- { .key = " i: ", .info = "set IO prority" },
{ .key = " l: ", .info = "list open files with lsof" },
{ .key = " s: ", .info = "trace syscalls with strace" },
{ .key = " ", .info = "" },
@@ -856,25 +855,6 @@
}
break;
}
- case 'i':
- {
- Process* p = (Process*) Panel_getSelected(panel);
- if (!p) break;
- IOPriority ioprio = p->ioPriority;
- Panel* ioprioPanel = IOPriorityPanel_new(ioprio);
- const char* fuFunctions[] = {"Set ", "Cancel ", NULL};
- void* set = pickFromVector(panel, ioprioPanel, 21, headerHeight, fuFunctions, defaultBar, header);
- if (set) {
- IOPriority ioprio = IOPriorityPanel_getIOPriority(ioprioPanel);
- bool ok = foreachProcess(panel, (ForeachProcessFn) Process_setIOPriority, (size_t) ioprio, NULL);
- if (!ok)
- beep();
- }
- Panel_delete((Object*)ioprioPanel);
- ProcessList_printHeader(pl, Panel_getHeader(panel));
- refreshTimeout = 0;
- break;
- }
+ }/*
case 'i':
{
Process* p = (Process*) Panel_getSelected(panel);
@@ -869,7 +869,7 @@
ProcessList_printHeader(pl, Panel_getHeader(panel));
refreshTimeout = 0;
break;
- }
+ }*/
case 'I':
{
refreshTimeout = 0;