Date: Fri, 12 Feb 2016 20:39:57 +0000 (UTC) From: Cy Schubert <cy@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r408755 - in head/sysutils/htop: . files Message-ID: <201602122039.u1CKdvBl026299@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cy Date: Fri Feb 12 20:39:57 2016 New Revision: 408755 URL: https://svnweb.freebsd.org/changeset/ports/408755 Log: * Fix process memory calculation * Add FreeBSD battery support * Add SHEBANG_LANG & SHEBANG_FILES PR: 207133 Submitted by: Hung-Yi Chen <gaod@hychen.org> (maintainer) Added: head/sysutils/htop/files/ head/sysutils/htop/files/patch-freebsd__Battery.c (contents, props changed) head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c (contents, props changed) Modified: head/sysutils/htop/Makefile Modified: head/sysutils/htop/Makefile ============================================================================== --- head/sysutils/htop/Makefile Fri Feb 12 20:29:01 2016 (r408754) +++ head/sysutils/htop/Makefile Fri Feb 12 20:39:57 2016 (r408755) @@ -3,6 +3,7 @@ PORTNAME= htop PORTVERSION= 2.0.0 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= gaod@hychen.org @@ -18,6 +19,8 @@ LIBS+= -L${LOCALBASE}/lib -lexecinfo CONFIGURE_ARGS= --enable-unicode USES= autoreconf execinfo libtool ncurses python:2,build shebangfix +SHEBANG_LANG= python2 +SHEBANG_FILES= scripts/MakeHeader.py USE_GITHUB= yes GH_ACCOUNT= hishamhm Added: head/sysutils/htop/files/patch-freebsd__Battery.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/htop/files/patch-freebsd__Battery.c Fri Feb 12 20:39:57 2016 (r408755) @@ -0,0 +1,27 @@ +--- freebsd/Battery.c.orig 2016-02-13 00:30:03.804015000 +0800 ++++ freebsd/Battery.c 2016-02-13 00:31:05.662396000 +0800 +@@ -6,10 +6,21 @@ + */ + + #include "BatteryMeter.h" ++#include <sys/sysctl.h> + + void Battery_getData(double* level, ACPresence* isOnAC) { +- // TODO +- *level = -1; +- *isOnAC = AC_ERROR; ++ int life; ++ size_t life_len = sizeof(life); ++ if (sysctlbyname("hw.acpi.battery.life", &life, &life_len, NULL, 0) == -1) ++ *level = -1; ++ else ++ *level = life; ++ ++ int acline; ++ size_t acline_len = sizeof(acline); ++ if (sysctlbyname("hw.acpi.acline", &acline, &acline_len, NULL, 0) == -1) ++ *isOnAC = AC_ERROR; ++ else ++ *isOnAC = acline == 0 ? AC_ABSENT : AC_PRESENT; + } + Added: head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c Fri Feb 12 20:39:57 2016 (r408755) @@ -0,0 +1,13 @@ +--- freebsd/FreeBSDProcessList.c.orig 2016-02-13 00:37:56.160832000 +0800 ++++ freebsd/FreeBSDProcessList.c 2016-02-13 00:38:19.671290000 +0800 +@@ -477,8 +477,8 @@ + } + + // from FreeBSD source /src/usr.bin/top/machine.c +- proc->m_size = kproc->ki_size / 1024; +- proc->m_resident = kproc->ki_rssize * pageSizeKb; ++ proc->m_size = kproc->ki_size / 1024 / pageSizeKb; ++ proc->m_resident = kproc->ki_rssize; + proc->nlwp = kproc->ki_numthreads; + proc->time = (kproc->ki_runtime + 5000) / 10000; +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602122039.u1CKdvBl026299>