aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorcy <cy@FreeBSD.org>2016-02-13 04:39:57 +0800
committercy <cy@FreeBSD.org>2016-02-13 04:39:57 +0800
commitaf07f71e6f22941486a88148b7740b1c703e5c47 (patch)
treed43d40843213bae15f3fbbe7d55f6ce99b2d1fb2 /sysutils
parentcc703a8bd6b3d7868ec788ed92c75a4c78112348 (diff)
downloadfreebsd-ports-gnome-af07f71e6f22941486a88148b7740b1c703e5c47.tar.gz
freebsd-ports-gnome-af07f71e6f22941486a88148b7740b1c703e5c47.tar.zst
freebsd-ports-gnome-af07f71e6f22941486a88148b7740b1c703e5c47.zip
* Fix process memory calculation
* Add FreeBSD battery support * Add SHEBANG_LANG & SHEBANG_FILES PR: 207133 Submitted by: Hung-Yi Chen <gaod@hychen.org> (maintainer)
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/htop/Makefile3
-rw-r--r--sysutils/htop/files/patch-freebsd__Battery.c27
-rw-r--r--sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c13
3 files changed, 43 insertions, 0 deletions
diff --git a/sysutils/htop/Makefile b/sysutils/htop/Makefile
index 3e8e9ea679e0..1e6b0334d360 100644
--- a/sysutils/htop/Makefile
+++ b/sysutils/htop/Makefile
@@ -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
diff --git a/sysutils/htop/files/patch-freebsd__Battery.c b/sysutils/htop/files/patch-freebsd__Battery.c
new file mode 100644
index 000000000000..3113e7341c55
--- /dev/null
+++ b/sysutils/htop/files/patch-freebsd__Battery.c
@@ -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;
+ }
+
diff --git a/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c b/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c
new file mode 100644
index 000000000000..27f7165ab4b1
--- /dev/null
+++ b/sysutils/htop/files/patch-freebsd__FreeBSDProcessList.c
@@ -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;
+