[Pkg-net-snmp-commits] [pkg-net-snmp] 06/27: _kfreebsd

Hideki Yamane henrich at moszumanska.debian.org
Sun Aug 28 02:19:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch patch-queue/master
in repository pkg-net-snmp.

commit e73b56b556ad0fdabf9c6206dcdcf8a8d0ebf606
Author: Net-SNMP Packaging Team <pkg-net-snmp-devel at lists.alioth.debian.org>
Date:   Thu Jun 18 06:12:05 2015 +0900

    _kfreebsd
    
    Preliminary support for kfreebsd.
    
    Gbp-Pq: Name 26_kfreebsd.patch
---
 agent/mibgroup/hardware/cpu/cpu_sysctl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/agent/mibgroup/hardware/cpu/cpu_sysctl.c b/agent/mibgroup/hardware/cpu/cpu_sysctl.c
index 5ecb68e..f0899c2 100644
--- a/agent/mibgroup/hardware/cpu/cpu_sysctl.c
+++ b/agent/mibgroup/hardware/cpu/cpu_sysctl.c
@@ -12,7 +12,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include <sys/resource.h>
 #if !defined(CPUSTATES)
 #include <sys/dkstat.h>
@@ -89,7 +89,7 @@ void init_cpu_sysctl( void ) {
 #elif defined(KERN_CPTIME)                /* OpenBSD */
 #define NETSNMP_KERN_CPU  KERN_CPTIME
 
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #define NETSNMP_KERN_MCPU 1    /* Enable support for multi-cpu stats. Valid for FreeBSD >=6.4, >=7.1, >=8.0 and beyond */
 #define NETSNMP_KERN_MCPU_TYPE NETSNMP_CPU_STATS
 
@@ -129,7 +129,7 @@ void init_cpu_sysctl( void ) {
 #define NETSNMP_VM_STATS_TYPE  struct uvmexp
 #endif  /* VM_UVMEXP2 || VM_UVMEXP */
 
-#elif defined(__FreeBSD__)                /* FreeBSD */
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) /* FreeBSD */
 #define NETSNMP_VM_STATS       VM_METER
 #define NETSNMP_VM_STATS_TYPE  struct vmmeter
     #define NS_VM_INTR		v_intr
@@ -169,10 +169,10 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
      */
     NETSNMP_CPU_STATS cpu_stats[CPUSTATES];
     size_t         cpu_size  = sizeof(cpu_stats);
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+#if !defined(__FreeBSD__) || defined(__FreeBSD_kernel__) && !defined(__NetBSD__)
     int            cpu_mib[] = { CTL_KERN, NETSNMP_KERN_CPU };
 #endif
-#ifdef __FreeBSD__
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__))
     static int     cp_times = -1;
 #endif
 #ifdef KERN_CPTIME2
@@ -189,7 +189,7 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
     size_t         mem_size  = sizeof(NETSNMP_VM_STATS_TYPE);
     netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
 
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
     sysctlbyname("kern.cp_time", cpu_stats, &cpu_size, NULL, 0);
 #else
     sysctl(cpu_mib, 2,  cpu_stats, &cpu_size, NULL, 0);
@@ -226,7 +226,7 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
     mcpu_size  = cpu_num*sizeof(cpu_stats);
     mcpu_stats = malloc(mcpu_size);
     sysctlbyname("kern.cp_time", mcpu_stats, &mcpu_size, NULL, 0);
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
     if (cp_times == -1) {
 	int ret = sysctlbyname("kern.cp_times", NULL, &mcpu_size, NULL, 0);
 	cp_times = ret == -1 ? 0 : 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-net-snmp/pkg-net-snmp.git



More information about the Pkg-net-snmp-commits mailing list