From owner-svn-ports-head@freebsd.org Tue Jan 8 15:30:15 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58FEF148100B; Tue, 8 Jan 2019 15:30:15 +0000 (UTC) (envelope-from tobik@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1E378F688; Tue, 8 Jan 2019 15:30:14 +0000 (UTC) (envelope-from tobik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4921191F; Tue, 8 Jan 2019 15:30:14 +0000 (UTC) (envelope-from tobik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x08FUEJ2047838; Tue, 8 Jan 2019 15:30:14 GMT (envelope-from tobik@FreeBSD.org) Received: (from tobik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x08FUEEO047836; Tue, 8 Jan 2019 15:30:14 GMT (envelope-from tobik@FreeBSD.org) Message-Id: <201901081530.x08FUEEO047836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tobik set sender to tobik@FreeBSD.org using -f From: Tobias Kortkamp Date: Tue, 8 Jan 2019 15:30:14 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r489709 - in head/sysutils/htop: . files X-SVN-Group: ports-head X-SVN-Commit-Author: tobik X-SVN-Commit-Paths: in head/sysutils/htop: . files X-SVN-Commit-Revision: 489709 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F1E378F688 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jan 2019 15:30:15 -0000 Author: tobik Date: Tue Jan 8 15:30:14 2019 New Revision: 489709 URL: https://svnweb.freebsd.org/changeset/ports/489709 Log: sysutils/htop: Fix memory display in the header On amd64 it works correctly, but it breaks on powerpc, due to using types with the wrong size when requesting various sysctls. PR: 234357 Submitted by: tobik Approved by: Hung-Yi Chen (maintainer timeout, 2 weeks) Added: head/sysutils/htop/files/ 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 Tue Jan 8 15:25:16 2019 (r489708) +++ head/sysutils/htop/Makefile Tue Jan 8 15:30:14 2019 (r489709) @@ -3,6 +3,7 @@ PORTNAME= htop DISTVERSION= 2.2.0 +PORTREVISION= 1 CATEGORIES= sysutils MAINTAINER= gaod@hychen.org 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 Tue Jan 8 15:30:14 2019 (r489709) @@ -0,0 +1,67 @@ +Fix memory display in the header on FreeBSD/powerpc + +https://github.com/hishamhm/htop/pull/871 + +--- freebsd/FreeBSDProcessList.c.orig 2018-04-10 13:42:59 UTC ++++ freebsd/FreeBSDProcessList.c +@@ -296,31 +296,46 @@ static inline void FreeBSDProcessList_scanMemoryInfo(P + // + // htop_used = active + (wired - arc) + // htop_cache = buffers + cache + arc +- size_t len = sizeof(pl->totalMem); ++ u_long totalMem; ++ u_int memActive, memWire, cachedMem; ++ long buffersMem; ++ uint64_t memZfsArc; ++ size_t len; + + //disabled for now, as it is always smaller than phycal amount of memory... + //...to avoid "where is my memory?" questions + //sysctl(MIB_vm_stats_vm_v_page_count, 4, &(pl->totalMem), &len, NULL, 0); + //pl->totalMem *= pageSizeKb; +- sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0); +- pl->totalMem /= 1024; ++ len = sizeof(totalMem); ++ sysctl(MIB_hw_physmem, 2, &(totalMem), &len, NULL, 0); ++ totalMem /= 1024; ++ pl->totalMem = totalMem; + +- sysctl(MIB_vm_stats_vm_v_active_count, 4, &(fpl->memActive), &len, NULL, 0); +- fpl->memActive *= pageSizeKb; ++ len = sizeof(memActive); ++ sysctl(MIB_vm_stats_vm_v_active_count, 4, &(memActive), &len, NULL, 0); ++ memActive *= pageSizeKb; ++ fpl->memActive = memActive; + +- sysctl(MIB_vm_stats_vm_v_wire_count, 4, &(fpl->memWire), &len, NULL, 0); +- fpl->memWire *= pageSizeKb; ++ len = sizeof(memWire); ++ sysctl(MIB_vm_stats_vm_v_wire_count, 4, &(memWire), &len, NULL, 0); ++ memWire *= pageSizeKb; ++ fpl->memWire = memWire; + +- sysctl(MIB_vfs_bufspace, 2, &(pl->buffersMem), &len, NULL, 0); +- pl->buffersMem /= 1024; ++ len = sizeof(buffersMem); ++ sysctl(MIB_vfs_bufspace, 2, &(buffersMem), &len, NULL, 0); ++ buffersMem /= 1024; ++ pl->buffersMem = buffersMem; + +- sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(pl->cachedMem), &len, NULL, 0); +- pl->cachedMem *= pageSizeKb; ++ len = sizeof(cachedMem); ++ sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(cachedMem), &len, NULL, 0); ++ cachedMem *= pageSizeKb; ++ pl->cachedMem = cachedMem; + + if (fpl->zfsArcEnabled) { +- len = sizeof(fpl->memZfsArc); +- sysctl(MIB_kstat_zfs_misc_arcstats_size, 5, &(fpl->memZfsArc), &len , NULL, 0); +- fpl->memZfsArc /= 1024; ++ len = sizeof(memZfsArc); ++ sysctl(MIB_kstat_zfs_misc_arcstats_size, 5, &(memZfsArc), &len , NULL, 0); ++ memZfsArc /= 1024; ++ fpl->memZfsArc = memZfsArc; + fpl->memWire -= fpl->memZfsArc; + pl->cachedMem += fpl->memZfsArc; + // maybe when we learn how to make custom memory meter