A fork[1] of htop has appeared, with blessings[2] from the original developer. Downsides are that it uses GitHub archives, so GH_* stuff is addded. I took the time to modify the patches to work on this release, but since there were some substantial rewrites[3] I wonder if we should drop them altogether.
[1] https://github.com/htop-dev/htop [2] https://github.com/hishamhm/htop/issues/992#issuecomment-683286672 [3] The shortlog: b92f62f Remove trailing whitespaces dd33444 Clean up existing whitespace 909bb86 Show N/A on unsupported platforms instead of 0KHz 27fe307 Remove a few unnecessary #includes 9197adf Fix CPU usage on OpenBSD c34be41 Widen ST_UID (UID) column to 5 chars to allow UIDs > 9999 without breaking alignment Issue Github #841, Debian bug #910492 ca1cce4 OpenBSD: make the STARTTIME column display correctly (#815) c1fb585 OpenBSD: add environment reading support (#819) 060aa2b remove wrongfix 3d79c72 Update OpenBSD maximum PID c005ffc Fix zero-index array bounds issue 48b807b Fix CPU meters -- Stephen Gregoratto Index: Makefile =================================================================== RCS file: /cvs/ports/sysutils/htop/Makefile,v retrieving revision 1.21 diff -u -p -r1.21 Makefile --- Makefile 17 Jul 2020 08:36:04 -0000 1.21 +++ Makefile 1 Sep 2020 04:17:08 -0000 @@ -2,13 +2,13 @@ COMMENT = interactive process viewer -V = 2.2.0 -DISTNAME = htop-${V} -REVISION = 15 +GH_ACCOUNT = htop-dev +GH_PROJECT = htop +GH_TAGNAME = 3.0.0 CATEGORIES = sysutils -HOMEPAGE = https://hisham.hm/htop/index.php +HOMEPAGE = https://htop.dev MAINTAINER = Ian Sutton <i...@ce.gl> @@ -17,19 +17,20 @@ PERMIT_PACKAGE = Yes WANTLIB = c curses kvm m -MASTER_SITES = https://hisham.hm/htop/releases/${V}/ - MODULES = lang/python RUN_DEPENDS = devel/desktop-file-utils NO_TEST = Yes -CONFIGURE_STYLE = gnu +CONFIGURE_STYLE = autoreconf +AUTOCONF_VERSION = 2.69 +AUTOMAKE_VERSION = 1.16 +AUTORECONF = ./autogen.sh CONFIGURE_ARGS += --disable-unicode \ --disable-taskstats MODPY_RUNDEP = No -MODPY_ADJ_FILES = scripts/MakeHeader.py +MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3} # htop has some bugs which take hours or days to reach. # Keep the symbols to give a chance to the user to get an useful coredump. Index: distinfo =================================================================== RCS file: /cvs/ports/sysutils/htop/distinfo,v retrieving revision 1.3 diff -u -p -r1.3 distinfo --- distinfo 4 Jul 2018 03:50:16 -0000 1.3 +++ distinfo 1 Sep 2020 04:17:08 -0000 @@ -1,2 +1,2 @@ -SHA256 (htop-2.2.0.tar.gz) = 2daCbxDOOIeVDXCbU+4djBhJpw+jjpHViWrYy8a6PFc= -SIZE (htop-2.2.0.tar.gz) = 308109 +SHA256 (htop-3.0.0.tar.gz) = HAZh8K5fTih02iULYM1RXkrEwEFYMiGt/pXxDhjRpOY= +SIZE (htop-3.0.0.tar.gz) = 179371 Index: patches/patch-htop_c =================================================================== RCS file: patches/patch-htop_c diff -N patches/patch-htop_c --- patches/patch-htop_c 19 Apr 2020 12:43:43 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -$OpenBSD: patch-htop_c,v 1.1 2020/04/19 12:43:43 robert Exp $ - -Index: htop.c ---- htop.c.orig -+++ htop.c -@@ -93,7 +93,7 @@ static CommandLineSettings parseArguments(int argc, ch - - int opt, opti=0; - /* Parse arguments */ -- while ((opt = getopt_long(argc, argv, "hvCst::d:u:p:i", long_opts, &opti))) { -+ while ((opt = getopt_long(argc, argv, "hvCs:t::d:u:p:i", long_opts, &opti))) { - if (opt == EOF) break; - switch (opt) { - case 'h': Index: patches/patch-openbsd_OpenBSDProcessList_c =================================================================== RCS file: /cvs/ports/sysutils/htop/patches/patch-openbsd_OpenBSDProcessList_c,v retrieving revision 1.1 diff -u -p -r1.1 patch-openbsd_OpenBSDProcessList_c --- patches/patch-openbsd_OpenBSDProcessList_c 10 May 2019 02:17:46 -0000 1.1 +++ patches/patch-openbsd_OpenBSDProcessList_c 1 Sep 2020 04:17:08 -0000 @@ -3,15 +3,7 @@ $OpenBSD: patch-openbsd_OpenBSDProcessLi Index: openbsd/OpenBSDProcessList.c --- openbsd/OpenBSDProcessList.c.orig +++ openbsd/OpenBSDProcessList.c -@@ -20,6 +20,7 @@ in the source distribution for its full text. - #include <sys/sysctl.h> - #include <sys/types.h> - #include <sys/user.h> -+#include <sys/sched.h> - #include <limits.h> - #include <stdlib.h> - #include <string.h> -@@ -62,24 +63,37 @@ typedef struct OpenBSDProcessList_ { +@@ -79,24 +79,36 @@ typedef struct OpenBSDProcessList_ { static long fscale; ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) { @@ -35,7 +27,6 @@ Index: openbsd/OpenBSDProcessList.c + size_ncpu = sizeof(int); + size_cpustats = sizeof(cpu_stats); + cpu_index_c = 0; -+ ProcessList_init(pl, Class(OpenBSDProcess), usersTable, pidWhiteList, userId); e = sysctl(mib, 2, &pl->cpuCount, &size, NULL, 0); @@ -47,12 +38,12 @@ Index: openbsd/OpenBSDProcessList.c + ncpu = pl->cpuCount; + } + - opl->cpus = xRealloc(opl->cpus, pl->cpuCount * sizeof(CPUData)); + opl->cpus = xCalloc(pl->cpuCount + 1, sizeof(CPUData)); + opl->cpuIndex = xRealloc(opl->cpuIndex, pl->cpuCount * sizeof(int)); size = sizeof(fscale); if (sysctl(fmib, 2, &fscale, &size, NULL, 0) < 0) { -@@ -94,6 +108,19 @@ ProcessList* ProcessList_new(UsersTable* usersTable, H +@@ -112,6 +124,19 @@ ProcessList* ProcessList_new(UsersTable* usersTable, H opl->kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf); if (opl->kd == NULL) { errx(1, "kvm_open: %s", errbuf); Index: patches/patch-openbsd_Platform_c =================================================================== RCS file: /cvs/ports/sysutils/htop/patches/patch-openbsd_Platform_c,v retrieving revision 1.7 diff -u -p -r1.7 patch-openbsd_Platform_c --- patches/patch-openbsd_Platform_c 10 May 2019 23:38:58 -0000 1.7 +++ patches/patch-openbsd_Platform_c 1 Sep 2020 04:17:08 -0000 @@ -1,48 +1,9 @@ $OpenBSD: patch-openbsd_Platform_c,v 1.7 2019/05/10 23:38:58 ians Exp $ -Use sched.h macros instead of hardcoding, the former broke when we introduced -CP_SPIN cpu state. - -https://github.com/hishamhm/htop/pull/817 - Index: openbsd/Platform.c --- openbsd/Platform.c.orig +++ openbsd/Platform.c -@@ -46,7 +46,7 @@ extern ProcessFieldData Process_fields[]; - - #define MAXCPU 256 - // XXX: probably should be a struct member --static int64_t old_v[MAXCPU][5]; -+static int64_t old_v[MAXCPU][CPUSTATES]; - - /* - * Copyright (c) 1984, 1989, William LeFebvre, Rice University -@@ -209,13 +209,13 @@ double Platform_setCPUValues(Meter* this, int cpu) { - int64_t new_v[CPUSTATES], diff_v[CPUSTATES], scratch_v[CPUSTATES]; - double *v = this->values; - size_t size = sizeof(double) * CPUSTATES; -- int mib[] = { CTL_KERN, KERN_CPTIME2, cpu-1 }; -+ int mib[] = { CTL_KERN, KERN_CPTIME2, pl->cpuIndex[cpu-1] }; - if (sysctl(mib, 3, new_v, &size, NULL, 0) == -1) { - return 0.; - } - - // XXX: why? -- cpuData->totalPeriod = 1; -+ //cpuData->totalPeriod = 1; - - percentages(CPUSTATES, diff_v, new_v, - (int64_t *)old_v[cpu-1], scratch_v); -@@ -225,7 +225,7 @@ double Platform_setCPUValues(Meter* this, int cpu) { - v[i] = diff_v[i] / 10.; - } - -- Meter_setItems(this, 4); -+ Meter_setItems(this, CP_IDLE); - - perc = v[0] + v[1] + v[2] + v[3]; - -@@ -286,7 +286,7 @@ void Platform_setSwapValues(Meter* this) { +@@ -235,7 +235,7 @@ void Platform_setSwapValues(Meter* this) { this->total = pl->totalSwap = total; this->values[0] = pl->usedSwap = used;