Date: Thu, 12 Feb 2015 19:50:35 +0000 (UTC) From: Ryan Steinmetz <zi@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r378886 - in head/net-mgmt/net-snmp: . files Message-ID: <201502121950.t1CJoZSA066079@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zi Date: Thu Feb 12 19:50:34 2015 New Revision: 378886 URL: https://svnweb.freebsd.org/changeset/ports/378886 QAT: https://qat.redports.org/buildarchive/r378886/ Log: - Fix hrSystemProcesses regression - Bump PORTREVISION PR: 197124 Submitted by: Lukasz Wasikowski <lukasz@wasikowski.net> Obtained from: upstream: https://sourceforge.net/p/net-snmp/bugs/2595/ Added: head/net-mgmt/net-snmp/files/patch-kthreads (contents, props changed) Modified: head/net-mgmt/net-snmp/Makefile Modified: head/net-mgmt/net-snmp/Makefile ============================================================================== --- head/net-mgmt/net-snmp/Makefile Thu Feb 12 18:53:29 2015 (r378885) +++ head/net-mgmt/net-snmp/Makefile Thu Feb 12 19:50:34 2015 (r378886) @@ -3,7 +3,7 @@ PORTNAME= snmp PORTVERSION= 5.7.3 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net-mgmt ipv6 MASTER_SITES= SF/net-${PORTNAME}/net-${PORTNAME}/${PORTVERSION} PKGNAMEPREFIX= net- Added: head/net-mgmt/net-snmp/files/patch-kthreads ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net-mgmt/net-snmp/files/patch-kthreads Thu Feb 12 19:50:34 2015 (r378886) @@ -0,0 +1,96 @@ +diff --git a/agent/mibgroup/host/data_access/swrun.c b/agent/mibgroup/host/data_access/swrun.c +index d18ea5f..60ad5b4 100644 +--- agent/mibgroup/host/data_access/swrun.c ++++ agent/mibgroup/host/data_access/swrun.c +@@ -75,10 +75,27 @@ shutdown_swrun(void) + } + + int +-swrun_count_processes( void ) ++swrun_count_processes(int include_kthreads) + { ++ netsnmp_swrun_entry *entry; ++ netsnmp_iterator *it; ++ int i = 0; ++ + netsnmp_cache_check_and_reload(swrun_cache); +- return ( swrun_container ? CONTAINER_SIZE(swrun_container) : 0 ); ++ if ( !swrun_container ) ++ return 0; /* or -1 */ ++ ++ if (include_kthreads) ++ return ( swrun_container ? CONTAINER_SIZE(swrun_container) : 0 ); ++ ++ it = CONTAINER_ITERATOR( swrun_container ); ++ while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) { ++ if (4 == entry->hrSWRunType) ++ i++; ++ } ++ ITERATOR_RELEASE( it ); ++ ++ return i; + } + + #ifndef NETSNMP_FEATURE_REMOVE_SWRUN_MAX_PROCESSES +diff --git a/agent/mibgroup/host/hr_system.c b/agent/mibgroup/host/hr_system.c +index d99cc7d..e853779 100644 +--- agent/mibgroup/host/hr_system.c ++++ agent/mibgroup/host/hr_system.c +@@ -24,6 +24,7 @@ + + #include <net-snmp/net-snmp-includes.h> + #include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/data_access/swrun.h> + + #include "host.h" + #include "host_res.h" +@@ -114,7 +115,14 @@ static long get_max_solaris_processes(void); + static int get_load_dev(void); + static int count_users(void); + extern int count_processes(void); +-extern int swrun_count_processes(void); ++#if USING_HOST_DATA_ACCESS_SWRUN_MODULE ++static int count_kthreads = 1; ++ ++static void parse_count_kthreads(const char *token, const char *line) ++{ ++ count_kthreads = atoi(line); ++} ++#endif + + /********************* + * +@@ -194,6 +202,11 @@ init_hr_system(void) + #ifdef NPROC_SYMBOL + auto_nlist(NPROC_SYMBOL, 0, 0); + #endif ++#if USING_HOST_DATA_ACCESS_SWRUN_MODULE ++ snmpd_register_const_config_handler("count_kthreads", ++ parse_count_kthreads, NULL, ++ "0|1 0 to exclude kernel threads from hrSystemProcesses.0"); ++#endif + + REGISTER_MIB("host/hr_system", hrsystem_variables, variable2, + hrsystem_variables_oid); +@@ -317,7 +330,7 @@ var_hrsys(struct variable * vp, + return (u_char *) & long_return; + case HRSYS_PROCS: + #if USING_HOST_DATA_ACCESS_SWRUN_MODULE +- long_return = swrun_count_processes(); ++ long_return = swrun_count_processes(1); + #elif USING_HOST_HR_SWRUN_MODULE + long_return = count_processes(); + #else +diff --git a/include/net-snmp/data_access/swrun.h b/include/net-snmp/data_access/swrun.h +index 3e15c41..4f768ac 100644 +--- include/net-snmp/data_access/swrun.h ++++ include/net-snmp/data_access/swrun.h +@@ -85,7 +85,7 @@ extern "C" { + + void netsnmp_swrun_entry_free(netsnmp_swrun_entry *entry); + +- int swrun_count_processes( void ); ++ int swrun_count_processes( int include_kthreads ); + int swrun_max_processes( void ); + int swrun_count_processes_by_name( char *name ); +
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502121950.t1CJoZSA066079>