Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 2017 22:54:35 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r438996 - head/devel/sigar/files
Message-ID:  <201704202254.v3KMsZ8g042750@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius (src committer)
Date: Thu Apr 20 22:54:35 2017
New Revision: 438996
URL: https://svnweb.freebsd.org/changeset/ports/438996

Log:
  Fix build after src r317061. Declare our own vmmeter on all FreeBSD versions.

Modified:
  head/devel/sigar/files/patch-src_os_darwin_darwin__sigar.c

Modified: head/devel/sigar/files/patch-src_os_darwin_darwin__sigar.c
==============================================================================
--- head/devel/sigar/files/patch-src_os_darwin_darwin__sigar.c	Thu Apr 20 22:16:00 2017	(r438995)
+++ head/devel/sigar/files/patch-src_os_darwin_darwin__sigar.c	Thu Apr 20 22:54:35 2017	(r438996)
@@ -1,6 +1,110 @@
 --- src/os/darwin/darwin_sigar.c.orig	2014-11-17 13:46:20.000000000 -0800
-+++ src/os/darwin/darwin_sigar.c	2017-03-20 23:32:31.935016000 -0700
-@@ -399,9 +399,13 @@
++++ src/os/darwin/darwin_sigar.c	2017-04-20 15:52:24.386676000 -0700
+@@ -123,6 +123,69 @@
+ #endif
+ 
+ #if defined(SIGAR_FREEBSD5)
++#if __FreeBSD_version >= 1200028
++#define	VMMETER_TYPE	uint64_t
++#else
++#define	VMMETER_TYPE	u_int
++#endif
++struct __vmmeter {
++	VMMETER_TYPE v_vm_faults;
++	VMMETER_TYPE v_io_faults;
++	VMMETER_TYPE v_cow_faults;
++	VMMETER_TYPE v_cow_optim;
++	VMMETER_TYPE v_zfod;
++	VMMETER_TYPE v_ozfod;
++	VMMETER_TYPE v_swapin;
++	VMMETER_TYPE v_swapout;
++	VMMETER_TYPE v_swappgsin;
++	VMMETER_TYPE v_swappgsout;
++	VMMETER_TYPE v_vnodein;
++	VMMETER_TYPE v_vnodeout;
++	VMMETER_TYPE v_vnodepgsin;
++	VMMETER_TYPE v_vnodepgsout;
++	VMMETER_TYPE v_intrans;
++	VMMETER_TYPE v_reactivated;
++	VMMETER_TYPE v_pdwakeups;
++	VMMETER_TYPE v_pdpages;
++	VMMETER_TYPE v_pdshortfalls;
++	VMMETER_TYPE v_dfree;
++	VMMETER_TYPE v_pfree;
++	VMMETER_TYPE v_tfree;
++	VMMETER_TYPE v_forks;
++	VMMETER_TYPE v_vforks;
++	VMMETER_TYPE v_rforks;
++	VMMETER_TYPE v_kthreads;
++	VMMETER_TYPE v_forkpages;
++	VMMETER_TYPE v_vforkpages;
++	VMMETER_TYPE v_rforkpages;
++	VMMETER_TYPE v_kthreadpages;
++	VMMETER_TYPE v_swtch;
++	VMMETER_TYPE v_syscall;
++	VMMETER_TYPE v_trap;
++	VMMETER_TYPE v_intr;
++	VMMETER_TYPE v_soft;
++	u_int v_page_size;
++	u_int v_page_count;
++	u_int v_free_reserved;
++	u_int v_free_target;
++	u_int v_free_min;
++	u_int v_free_count;
++	u_int v_wire_count;
++	u_int v_active_count;
++	u_int v_inactive_target;
++	u_int v_inactive_count;
++	u_int v_laundry_count;
++	u_int v_pageout_free_min;
++	u_int v_interrupt_free_min;
++	u_int v_free_severe;
++#if (__FreeBSD_version < 1200016)
++	u_int v_cache_count;
++#endif
++#if (__FreeBSD_version < 1100079)
++	u_int v_cache_min;
++	u_int v_cache_max;
++#endif
++};
+ 
+ #define KI_FD   ki_fd
+ #define KI_PID  ki_pid
+@@ -342,24 +405,21 @@
+     }
+ }
+ #elif defined(__FreeBSD__)
+-static int sigar_vmstat(sigar_t *sigar, struct vmmeter *vmstat)
++static int sigar_vmstat(sigar_t *sigar, struct __vmmeter *vmstat)
+ {
+-    int status;
+-    size_t size = sizeof(unsigned int);
+-
+-    status = kread(sigar, vmstat, sizeof(*vmstat),
+-                   sigar->koffsets[KOFFSET_VMMETER]);
+-
+-    if (status == SIGAR_OK) {
+-        return SIGAR_OK;
+-    }
++    size_t size;
+ 
+     SIGAR_ZERO(vmstat);
+ 
+     /* derived from src/usr.bin/vmstat/vmstat.c */
+     /* only collect the ones we actually use */
+-#define GET_VM_STATS(cat, name, used) \
+-    if (used) sysctlbyname("vm.stats." #cat "." #name, &vmstat->name, &size, NULL, 0)
++#define GET_VM_STATS(cat, name, used)	do {				\
++	if (used) {							\
++		size = sizeof(vmstat->name);				\
++		sysctlbyname("vm.stats." #cat "." #name, &vmstat->name,	\
++		    &size, NULL, 0);					\
++	}								\
++} while (0)
+ 
+     /* sys */
+     GET_VM_STATS(sys, v_swtch, 0);
+@@ -399,9 +459,13 @@
      GET_VM_STATS(vm, v_active_count, 0);
      GET_VM_STATS(vm, v_inactive_target, 0);
      GET_VM_STATS(vm, v_inactive_count, 1);
@@ -14,7 +118,16 @@
      GET_VM_STATS(vm, v_pageout_free_min, 0);
      GET_VM_STATS(vm, v_interrupt_free_min, 0);
      GET_VM_STATS(vm, v_forks, 0);
-@@ -479,7 +483,11 @@
+@@ -440,7 +504,7 @@
+     unsigned long mem_total;
+ #endif
+ #if defined(__FreeBSD__)
+-    struct vmmeter vmstat;
++    struct __vmmeter vmstat;
+ #elif defined(__OpenBSD__) || defined(__NetBSD__)
+     struct uvmexp vmstat;
+ #endif
+@@ -479,7 +543,11 @@
      kern *= sigar->pagesize;
  #elif defined(__FreeBSD__)
      if ((status = sigar_vmstat(sigar, &vmstat)) == SIGAR_OK) {
@@ -26,7 +139,16 @@
          kern *= sigar->pagesize;
          mem->free = vmstat.v_free_count;
          mem->free *= sigar->pagesize;
-@@ -3055,8 +3063,13 @@
+@@ -689,7 +757,7 @@
+     swap->page_out = vmstat.pageouts;
+ #elif defined(__FreeBSD__)
+     struct kvm_swap kswap[1];
+-    struct vmmeter vmstat;
++    struct __vmmeter vmstat;
+ 
+     if (getswapinfo_sysctl(kswap, 1) != SIGAR_OK) {
+         if (!sigar->kmem) {
+@@ -3055,8 +3123,13 @@
      int type, istcp = 0;
      char *buf;
      const char *mibvar;
@@ -40,7 +162,7 @@
      struct xinpgen *xig, *oxig;
      struct xsocket *so;
      size_t len;
-@@ -3094,6 +3107,15 @@
+@@ -3094,6 +3167,15 @@
           xig->xig_len > sizeof(struct xinpgen);
           xig = (struct xinpgen *)((char *)xig + xig->xig_len))
      {
@@ -56,7 +178,7 @@
          if (istcp) {
              struct xtcpcb *cb = (struct xtcpcb *)xig;
              tp = &cb->xt_tp;
-@@ -3105,6 +3127,7 @@
+@@ -3105,6 +3187,7 @@
              inp = &cb->xi_inp;
              so = &cb->xi_socket;
          }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704202254.v3KMsZ8g042750>