On 10/04/14(Thu) 15:24, Martin Pieuchot wrote: > Thanks to naddy, here's the list of ports that will break when > <uvm/uvm_extern.h> will stop to include <sys/vmmeter.h>. I'd > appreciate if the maintainers of the ports below could have a > look and fix their ports. > > If the application is only using the VM_METER sysctl(3) to get > memory statics, then it should be converted to the VM_UVMEXP > one. See the attached diff for examples. > > If the application also uses the process stats from the "struct > vmtotal", then you should also include <sys/vmmeter.h>. You can > have a look at usr.sbin/vmstat/vmstat.c if you want an example. > > Attached are three diffs for the following ports, I'm looking > for reviews/oks. > > databases/pg_top > x11/xfce4/xfce4-taskmanager
These two have been committed. > sysutils/libstatgrab This one is below, ok? > These are the remaining ports to fix: > > lang/erlang > sysutils/monit > sysutils/symon > sysutils/toprump > sysutils/wmmon > sysutils/xstatbar > telephony/asterisk > www/chromium > x11/kde/base3 > x11/kde4/workspace I didn't see any activity for these, I sent this mail a month ago, should I commit the header change? Martin Index: Makefile =================================================================== RCS file: /home/ncvs/ports/sysutils/libstatgrab/Makefile,v retrieving revision 1.9 diff -u -p -r1.9 Makefile --- Makefile 21 Mar 2013 08:48:54 -0000 1.9 +++ Makefile 10 Apr 2014 12:44:14 -0000 @@ -4,6 +4,7 @@ COMMENT= system statistics gathering lib DISTNAME= libstatgrab-0.17 CATEGORIES= sysutils +REVISION= 0 HOMEPAGE= http://www.i-scream.org/libstatgrab/ Index: patches/patch-src_libstatgrab_memory_stats_c =================================================================== RCS file: /home/ncvs/ports/sysutils/libstatgrab/patches/patch-src_libstatgrab_memory_stats_c,v retrieving revision 1.1 diff -u -p -r1.1 patch-src_libstatgrab_memory_stats_c --- patches/patch-src_libstatgrab_memory_stats_c 6 Jul 2011 12:45:04 -0000 1.1 +++ patches/patch-src_libstatgrab_memory_stats_c 10 Apr 2014 12:44:14 -0000 @@ -1,15 +1,82 @@ $OpenBSD: patch-src_libstatgrab_memory_stats_c,v 1.1 2011/07/06 12:45:04 jasper Exp $ -Fix implicit declarations of sysconf() and bzero(). +Prefer the UVM way to the vmmeter one to get memory stats. ---- src/libstatgrab/memory_stats.c.orig Wed Jul 6 14:37:07 2011 -+++ src/libstatgrab/memory_stats.c Wed Jul 6 14:38:26 2011 -@@ -50,6 +50,8 @@ - #include <sys/types.h> - #include <sys/sysctl.h> - #include <sys/unistd.h> -+#include <unistd.h> -+#include <string.h> +--- src/libstatgrab/memory_stats.c.orig Sun Feb 21 11:04:26 2010 ++++ src/libstatgrab/memory_stats.c Thu Apr 10 14:43:24 2014 +@@ -91,15 +91,9 @@ sg_mem_stats *sg_get_mem_stats(){ + u_long inactive_count; + int pagesize; #endif - #ifdef HPUX - #include <sys/param.h> +-#if defined(NETBSD) ++#if defined(NETBSD) || defined(OPENBSD) + struct uvmexp *uvm; + #endif +-#if defined(OPENBSD) +- int mib[2]; +- struct vmtotal vmtotal; +- size_t size; +- int pagesize, page_multiplier; +-#endif + #ifdef WIN32 + MEMORYSTATUSEX memstats; + #endif +@@ -240,53 +234,15 @@ sg_mem_stats *sg_get_mem_stats(){ + mem_stat.free = uvm->pagesize * (uvm->free + uvm->inactive); + mem_stat.used = mem_stat.total - mem_stat.free; + #endif +- + #if defined(OPENBSD) +- /* The code in this section is based on the code in the OpenBSD +- * top utility, located at src/usr.bin/top/machine.c in the +- * OpenBSD source tree. +- * +- * For fun, and like OpenBSD top, we will do the multiplication +- * converting the memory stats in pages to bytes in base 2. +- */ +- +- /* All memory stats in OpenBSD are returned as the number of pages. +- * To convert this into the number of bytes we need to know the +- * page size on this system. +- */ +- pagesize = sysconf(_SC_PAGESIZE); +- +- /* The pagesize gives us the base 10 multiplier, so we need to work +- * out what the base 2 multiplier is. This means dividing +- * pagesize by 2 until we reach unity, and counting the number of +- * divisions required. +- */ +- page_multiplier = 0; +- +- while (pagesize > 1) { +- page_multiplier++; +- pagesize >>= 1; +- } +- +- /* We can now ret the the raw VM stats (in pages) using the +- * sysctl interface. +- */ +- mib[0] = CTL_VM; +- mib[1] = VM_METER; +- size = sizeof(vmtotal); +- +- if (sysctl(mib, 2, &vmtotal, &size, NULL, 0) < 0) { +- bzero(&vmtotal, sizeof(vmtotal)); +- sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_VM.VM_METER"); ++ if ((uvm = sg_get_uvmexp()) == NULL) { + return NULL; + } + +- /* Convert the raw stats to bytes, and return these to the caller +- */ +- mem_stat.used = (vmtotal.t_rm << page_multiplier); /* total real mem in use */ +- mem_stat.cache = 0; /* no cache stats */ +- mem_stat.free = (vmtotal.t_free << page_multiplier); /* free memory pages */ +- mem_stat.total = (mem_stat.used + mem_stat.free); ++ mem_stat.total = uvm->pagesize * uvm->npages; ++ mem_stat.cache = 0; ++ mem_stat.free = uvm->pagesize * (uvm->free + uvm->inactive); ++ mem_stat.used = mem_stat.total - mem_stat.free; + #endif + + #ifdef WIN32