1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
$NetBSD: patch-du,v 1.3 2013/03/17 00:15:29 gdt Exp $
--- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2012-10-09 22:28:58.000000000 +0000
+++ agent/mibgroup/hardware/memory/memory_freebsd.c
@@ -36,6 +36,12 @@ int netsnmp_mem_arch_load( netsnmp_cache
long pagesize;
int nswap;
+#ifdef dragonfly
+ struct vmstats vms;
+ size_t vms_size = sizeof(vms);
+ size_t vmem_size = sizeof(struct vmmeter);
+#endif
+
struct vmtotal total;
size_t total_size = sizeof(total);
int total_mib[] = { CTL_VM, VM_METER };
@@ -65,11 +71,17 @@ int netsnmp_mem_arch_load( netsnmp_cache
sysctlbyname("vm.stats.vm.v_inactive_count", &inact_count, &inact_size, NULL, 0);
sysctlbyname("vfs.bufspace", &bufspace, &buf_size, NULL, 0);
sysctlbyname("vfs.maxbufspace", &maxbufspace, &buf_size, NULL, 0);
+#ifdef dragonfly
+ pagesize = getpagesize();
+ sysctlbyname("vm.vmstats", &vms, &vms_size, NULL, 0);
+ sysctlbyname("vm.vmmeter", &vmem, &vmem_size, NULL, 0);
+#else
#ifndef freebsd4
pagesize = 1024;
#else
pagesize = getpagesize();
#endif
+#endif
/*
* ... and save this in a standard form.
@@ -80,9 +92,15 @@ int netsnmp_mem_arch_load( netsnmp_cache
} else {
if (!mem->descr)
mem->descr = strdup("Physical memory");
+#ifdef dragonfly
+ mem->units = vms.v_page_size;
+ mem->size = vms.v_cache_max;
+ mem->free = vms.v_cache_max - vms.v_cache_count;
+#else
mem->units = pagesize;
mem->size = phys_mem/pagesize;
mem->free = total.t_free;
+#endif
}
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
|