From f068486d4c9d50fdde1f6c9b229760ce550b67b8 Mon Sep 17 00:00:00 2001 From: Sylvio Cesar Teixeira Date: Mon, 28 Jun 2010 14:51:46 +0000 Subject: [PATCH] - Fix problem with memCached incorrect. [2] - BUMP PORTREVISION PR: ports/147468 Submitted by: Helmut Schneider Y.A. [2] Feature safe: yes --- net-mgmt/net-snmp/Makefile | 2 +- .../net-snmp/files/patch-memory_freebsd.c | 54 +++++++++++-------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile index 061e20862031..9d0d180169f9 100644 --- a/net-mgmt/net-snmp/Makefile +++ b/net-mgmt/net-snmp/Makefile @@ -7,7 +7,7 @@ PORTNAME= snmp PORTVERSION= 5.5 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net-mgmt ipv6 MASTER_SITES= SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} PKGNAMEPREFIX= net- diff --git a/net-mgmt/net-snmp/files/patch-memory_freebsd.c b/net-mgmt/net-snmp/files/patch-memory_freebsd.c index ccdc537e629a..907d1249740c 100644 --- a/net-mgmt/net-snmp/files/patch-memory_freebsd.c +++ b/net-mgmt/net-snmp/files/patch-memory_freebsd.c @@ -1,14 +1,31 @@ ---- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2008-05-28 20:48:46.000000000 +0900 -+++ agent/mibgroup/hardware/memory/memory_freebsd.c 2008-11-14 16:56:48.000000000 +0900 -@@ -59,6 +59,7 @@ +--- agent/mibgroup/hardware/memory/memory_freebsd.c.orig 2008-05-28 14:48:46.000000000 +0300 ++++ agent/mibgroup/hardware/memory/memory_freebsd.c 2010-06-27 15:19:27.000000000 +0300 +@@ -43,9 +43,12 @@ + + u_long phys_mem; + u_long user_mem; ++ unsigned int cache_count; ++ unsigned int cache_max; + unsigned int bufspace; + unsigned int maxbufspace; + size_t mem_size = sizeof(phys_mem); ++ size_t cache_size = sizeof(cache_count); + size_t buf_size = sizeof(bufspace); + int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM }; + int user_mem_mib[] = { CTL_HW, HW_USERMEM }; +@@ -56,9 +59,10 @@ + 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("vfs.bufspace", &bufspace, &buf_size, NULL, 0); sysctlbyname("vfs.maxbufspace", &maxbufspace, &buf_size, NULL, 0); - auto_nlist(SUM_SYMBOL, (char *) &vmem, sizeof(vmem)); -+ auto_nlist(BUFSPACE_SYMBOL, (char *) &bufspace, sizeof(bufspace)); +- auto_nlist(SUM_SYMBOL, (char *) &vmem, sizeof(vmem)); #ifndef freebsd4 pagesize = 1024; #else -@@ -75,7 +76,7 @@ +@@ -75,7 +79,7 @@ if (!mem->descr) mem->descr = strdup("Physical memory"); mem->units = pagesize; @@ -17,21 +34,16 @@ mem->free = total.t_free; } -@@ -134,6 +135,17 @@ - mem->free = vmem.v_cache_max - vmem.v_cache_count; +@@ -129,9 +133,9 @@ + } else { + if (!mem->descr) + mem->descr = strdup("Cached memory"); +- mem->units = vmem.v_page_size; +- mem->size = vmem.v_cache_max; +- mem->free = vmem.v_cache_max - vmem.v_cache_count; ++ mem->units = pagesize; ++ mem->size = cache_max; ++ mem->free = cache_max - cache_count; } -+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 1 ); -+ if (!mem) { -+ snmp_log_perror("No Memory Buffer info entry"); -+ } else { -+ if (!mem->descr) -+ mem->descr = strdup("Memory Buffer"); -+ mem->units = pagesize; -+ mem->size = bufspace/pagesize; -+ mem->free = -1; -+ } -+ nswap = swapmode(pagesize); - mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 ); - if (!mem) {