diff options
author | Sylvio Cesar Teixeira <sylvio@FreeBSD.org> | 2011-02-03 19:34:40 +0000 |
---|---|---|
committer | Sylvio Cesar Teixeira <sylvio@FreeBSD.org> | 2011-02-03 19:34:40 +0000 |
commit | f66207d45b4afdf8ece18513b82df23af1b939b2 (patch) | |
tree | 53fb47bf4d4f9d881461db76cd1f03e062e4933b /net-mgmt | |
parent | d7c9884e4c3e19e0994e60127e6c93464e7f0882 (diff) | |
download | ports-f66207d45b4afdf8ece18513b82df23af1b939b2.tar.gz ports-f66207d45b4afdf8ece18513b82df23af1b939b2.zip |
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/net-snmp/files/patch-memory_freebsd.c | 71 |
1 files changed, 62 insertions, 9 deletions
diff --git a/net-mgmt/net-snmp/files/patch-memory_freebsd.c b/net-mgmt/net-snmp/files/patch-memory_freebsd.c index 3dc734a29435..2db2d6e2c144 100644 --- a/net-mgmt/net-snmp/files/patch-memory_freebsd.c +++ b/net-mgmt/net-snmp/files/patch-memory_freebsd.c @@ -1,6 +1,6 @@ ---- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2010-06-29 12:34:48.000000000 +0200 -+++ agent/mibgroup/hardware/memory/memory_freebsd.c 2010-07-01 13:32:34.000000000 +0200 -@@ -43,10 +43,15 @@ +--- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2008-05-28 14:48:46.000000000 +0300 ++++ agent/mibgroup/hardware/memory/memory_freebsd.c 2010-12-15 14:56:48.000000000 +0200 +@@ -43,10 +43,17 @@ u_long phys_mem; u_long user_mem; @@ -9,36 +9,85 @@ unsigned int bufspace; unsigned int maxbufspace; + unsigned int inact_count; ++ unsigned int page_count; size_t mem_size = sizeof(phys_mem); + size_t cache_size = sizeof(cache_count); size_t buf_size = sizeof(bufspace); + size_t inact_size = sizeof(inact_count); ++ size_t page_size = sizeof(page_count); int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM }; int user_mem_mib[] = { CTL_HW, HW_USERMEM }; -@@ -56,9 +61,11 @@ +@@ -56,15 +63,20 @@ sysctl(total_mib, 2, &total, &total_size, NULL, 0); sysctl(phys_mem_mib, 2, &phys_mem, &mem_size, NULL, 0); sysctl(user_mem_mib, 2, &user_mem, &mem_size, NULL, 0); + sysctlbyname("vm.stats.vm.v_cache_count", &cache_count, &cache_size, NULL, 0); + sysctlbyname("vm.stats.vm.v_cache_max", &cache_max, &cache_size, NULL, 0); + sysctlbyname("vm.stats.vm.v_inactive_count", &inact_count, &inact_size, NULL, 0); ++ sysctlbyname("vm.stats.vm.v_page_count", &page_count, &page_size, NULL, 0); sysctlbyname("vfs.bufspace", &bufspace, &buf_size, NULL, 0); sysctlbyname("vfs.maxbufspace", &maxbufspace, &buf_size, NULL, 0); - auto_nlist(SUM_SYMBOL, (char *) &vmem, sizeof(vmem)); #ifndef freebsd4 pagesize = 1024; #else -@@ -75,7 +82,7 @@ + pagesize = getpagesize(); + #endif + ++ nswap = swapmode(pagesize); ++ + /* + * ... and save this in a standard form. + */ +@@ -75,7 +87,7 @@ if (!mem->descr) mem->descr = strdup("Physical memory"); mem->units = pagesize; - mem->size = user_mem/pagesize; -+ mem->size = phys_mem/pagesize; ++ mem->size = page_count; mem->free = total.t_free; } -@@ -129,9 +136,9 @@ +@@ -87,7 +99,7 @@ + mem->descr = strdup("Real memory"); + mem->units = pagesize; + mem->size = total.t_rm; +- mem->free = total.t_arm; ++ mem->free = total.t_rm - total.t_arm; + } + + mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 ); +@@ -97,8 +109,8 @@ + if (!mem->descr) + mem->descr = strdup("Virtual memory"); + mem->units = pagesize; +- mem->size = total.t_vm; +- mem->free = total.t_avm; ++ mem->size = page_count + swapTotal; ++ mem->free = total.t_free + swapFree; + } + + mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 1 ); +@@ -109,7 +121,7 @@ + mem->descr = strdup("Shared virtual memory"); + mem->units = pagesize; + mem->size = total.t_vmshr; +- mem->free = total.t_avmshr; ++ mem->free = total.t_vmshr - total.t_avmshr; + } + + mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED2, 1 ); +@@ -120,7 +132,7 @@ + mem->descr = strdup("Shared real memory"); + mem->units = pagesize; + mem->size = total.t_rmshr; +- mem->free = total.t_armshr; ++ mem->free = total.t_rmshr - total.t_armshr; + } + + mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_CACHED, 1 ); +@@ -129,12 +141,11 @@ } else { if (!mem->descr) mem->descr = strdup("Cached memory"); @@ -46,8 +95,12 @@ - mem->size = vmem.v_cache_max; - mem->free = vmem.v_cache_max - vmem.v_cache_count; + mem->units = pagesize; -+ mem->size = cache_max + inact_count; ++ mem->size = cache_count + inact_count; + mem->free = cache_max - cache_count; } - nswap = swapmode(pagesize); +- nswap = swapmode(pagesize); + mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 ); + if (!mem) { + snmp_log_perror("No Swap info entry"); + |