d872659bfa
snmplib:
- [PATCH 1921861]: Avoid endless loop after truncating 64bit int
- Better handling of CONTAINER_INSERT failures with multiple indices
snmpd:
- [PATCH 2023633
]: add SCTP-MIB implementation (Linux only)
- suppress annoying "registration != duplicate" warning for root oids
build:
- [BUG 2023803]: Compilation problems on HP-UX 11.31
- Update to libtool 1.5.26
AIX:
- Add support for AIX 6.x.
70 lines
1.9 KiB
Text
70 lines
1.9 KiB
Text
$NetBSD: patch-dn,v 1.2 2008/09/08 12:58:09 adam Exp $
|
|
|
|
--- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig 2008-02-12 18:40:48.000000000 +0100
|
|
+++ agent/mibgroup/ucd-snmp/memory_freebsd2.c
|
|
@@ -10,8 +10,12 @@
|
|
*/
|
|
#include <sys/param.h>
|
|
#include <sys/time.h>
|
|
+#ifdef dragonfly
|
|
+#include <sys/user.h>
|
|
+#else
|
|
#include <sys/proc.h>
|
|
#include <sys/dkstat.h>
|
|
+#endif
|
|
#ifdef freebsd5
|
|
#include <sys/bio.h>
|
|
#endif
|
|
@@ -251,6 +255,10 @@ var_extensible_mem(struct variable *vp,
|
|
|
|
static struct vmmeter mem;
|
|
static struct vmtotal total;
|
|
+#ifdef dragonfly
|
|
+ static struct vmstats vmstats;
|
|
+ size_t vmstats_size = sizeof(vmstats);
|
|
+#endif
|
|
size_t total_size = sizeof(total);
|
|
int total_mib[] = { CTL_VM, VM_METER };
|
|
|
|
@@ -284,6 +292,8 @@ var_extensible_mem(struct variable *vp,
|
|
*/
|
|
sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
|
|
|
|
+ sysctlbyname("vm.vmstats", &vmstats, &vmstats_size, NULL, 0);
|
|
+
|
|
#ifdef BUFSPACE_SYMBOL
|
|
/*
|
|
* Buffer space
|
|
@@ -296,7 +306,11 @@ var_extensible_mem(struct variable *vp,
|
|
/*
|
|
* Page-to-kb macro
|
|
*/
|
|
+#ifdef dragonfly
|
|
+#define ptok(p) ((p) * (vmstats.v_page_size >> 10))
|
|
+#else
|
|
#define ptok(p) ((p) * (mem.v_page_size >> 10))
|
|
+#endif
|
|
|
|
switch (vp->magic) {
|
|
case MIBINDEX:
|
|
@@ -316,7 +330,11 @@ var_extensible_mem(struct variable *vp,
|
|
long_ret = phys_mem >> 10;
|
|
return ((u_char *) (&long_ret));
|
|
case MEMAVAILREAL: /* FREE real memory */
|
|
+#ifdef dragonfly
|
|
+ long_ret = ptok(vmstats.v_free_count);
|
|
+#else
|
|
long_ret = ptok(mem.v_free_count);
|
|
+#endif
|
|
return ((u_char *) (&long_ret));
|
|
|
|
/*
|
|
@@ -351,6 +369,8 @@ var_extensible_mem(struct variable *vp,
|
|
case MEMCACHED:
|
|
#ifdef darwin
|
|
long_ret = ptok(mem.v_lookups);
|
|
+#elif defined(dragonfly)
|
|
+ long_ret = ptok(vmstats.v_cache_count);
|
|
#else
|
|
long_ret = ptok(mem.v_cache_count) + ptok(mem.v_inactive_count);
|
|
#endif
|