MFH: r503234 sysutils/asmem: Remove BROKEN (fix build) for FreeBSD 12/13

PR:		238273
Submitted by:	lealxe <lealxe yandex ru>
Approved by:	portmgr (unmaintained port)

Approved by:	ports-secteam (blanket: build fix)
This commit is contained in:
Kubilay Kocak 2019-07-01 06:21:52 +00:00
parent 6433b76567
commit bea3cbe0f4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2019Q2/; revision=505540
3 changed files with 65 additions and 18 deletions

View File

@ -5,17 +5,16 @@ PORTNAME= asmem
PORTVERSION= 1.12
PORTREVISION= 1
CATEGORIES= sysutils afterstep
MASTER_SITES= http://tigr.net/afterstep/download/asmem/
MASTER_SITES= https://tigr.net/afterstep/download/asmem/
MAINTAINER= ports@FreeBSD.org
COMMENT= AfterStep look-n-feel memory utilization monitor
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/LICENSE
BROKEN_FreeBSD_12= fails to compile: read_mem.c: invalid use of undefined type 'struct vmmeter'
BROKEN_FreeBSD_13= fails to compile: read_mem.c: invalid use of undefined type 'struct vmmeter'
USE_XORG= x11 ice sm x11 xext xpm
USE_XORG= xpm
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-xpm \
--with-xpm-includes=${LOCALBASE}/include \
@ -25,9 +24,7 @@ post-build:
@${LN} -sf asmem.man ${WRKSRC}/asmem.1
do-install:
(cd ${WRKSRC} && ${INSTALL_PROGRAM} asmem \
${STAGEDIR}${PREFIX}/bin)
(cd ${WRKSRC} && ${INSTALL_MAN} asmem.1 \
${STAGEDIR}${MANPREFIX}/man/man1)
${INSTALL_PROGRAM} ${WRKSRC}/asmem ${STAGEDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/asmem.1 ${STAGEDIR}${MANPREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -0,0 +1,60 @@
--- read_mem.c.orig 2007-04-12 20:38:40 UTC
+++ read_mem.c
@@ -56,6 +56,8 @@ char buf[BUFFER_LENGTH];
// Machine dependent headers
// FreeBSD
#if defined(__FreeBSD__)
+#define _WANT_VMMETER
+#include <sys/param.h>
#include <sys/conf.h>
#include <osreldate.h>
#include <kvm.h>
@@ -336,6 +338,14 @@ void error_handle( int place, const char * message )
int read_meminfo() {
int pagesize, pageshift;
#if __FreeBSD_version > 400000
+
+ /* setup pageshift */
+ pagesize = getpagesize();
+ pageshift = 0;
+ while (pagesize > 1) {
+ pageshift++;
+ pagesize >>= 1;
+ }
struct kvm_swap kswap[SWAP_DEVICES];
int i, swaps;
@@ -347,10 +357,6 @@ int read_meminfo() {
time_t current_time;
#define GETSWAP_DELAY 60 /* 1 min */
- /* get the info */
- if (kvm_read(kd, cnt_offset, (int *)(&sum), sizeof(sum)) != sizeof(sum))
- return (-1);
-
/* we obtain swap info every GETSWAP_DELAY seconds because of
* kvm_getswapinfo CPU load
*/
@@ -406,9 +412,19 @@ int read_meminfo() {
#endif /* if __FreeBSD_version > 400000 */
- state.fresh.total = pagetok(sum.v_page_count);
- state.fresh.used = pagetok(sum.v_page_count-sum.v_free_count);
- state.fresh.free = pagetok(sum.v_free_count);
+ unsigned long physmem, freemem, inacmem;
+ size_t sz = sizeof(unsigned long);
+
+ physmem = 0;
+ freemem = 0;
+ inacmem = 0;
+ sysctlbyname("hw.physmem", &physmem, &sz, NULL, 0);
+ sysctlbyname("vm.stats.vm.v_free_count", &freemem, &sz, NULL, 0);
+ sysctlbyname("vm.stats.vm.v_inactive_count", &inacmem, &sz, NULL, 0);
+
+ state.fresh.total = physmem;
+ state.fresh.free = pagetok(freemem + inacmem);
+ state.fresh.used = physmem - pagetok(freemem + inacmem);
state.fresh.shared = 0; /* dont know how to get these */
state.fresh.buffers = 0;

View File

@ -1,10 +0,0 @@
--- read_mem.c.dist Fri Sep 19 01:06:01 2003
+++ read_mem.c Tue Nov 30 18:52:06 2004
@@ -56,6 +56,7 @@
// Machine dependent headers
// FreeBSD
#if defined(__FreeBSD__)
+#include <sys/param.h>
#include <sys/conf.h>
#include <osreldate.h>
#include <kvm.h>