aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/net-snmp-devel
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2008-05-14 08:37:38 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2008-05-14 08:37:38 +0000
commit6498cb6bd65b449d0a90bfacc121e9d9139929d8 (patch)
tree04a2e8b73b86fe97dd1f5ed83b6b8a296cec43cc /net-mgmt/net-snmp-devel
parent81fcb47638e37e3d5de8776c2f71bbf3f7088ed0 (diff)
downloadports-6498cb6bd65b449d0a90bfacc121e9d9139929d8.tar.gz
ports-6498cb6bd65b449d0a90bfacc121e9d9139929d8.zip
Notes
Diffstat (limited to 'net-mgmt/net-snmp-devel')
-rw-r--r--net-mgmt/net-snmp-devel/Makefile2
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu.h18
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c94
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-ucd_snmp.h16
-rw-r--r--net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c22
5 files changed, 113 insertions, 39 deletions
diff --git a/net-mgmt/net-snmp-devel/Makefile b/net-mgmt/net-snmp-devel/Makefile
index 1d784c20d766..36df177ccd4c 100644
--- a/net-mgmt/net-snmp-devel/Makefile
+++ b/net-mgmt/net-snmp-devel/Makefile
@@ -7,7 +7,7 @@
PORTNAME= snmp
PORTVERSION= 5.4.1
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= net-mgmt ipv6
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= net-snmp
diff --git a/net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu.h b/net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu.h
new file mode 100644
index 000000000000..143133291f9e
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu.h
@@ -0,0 +1,18 @@
+
+$FreeBSD$
+
+--- agent/mibgroup/hardware/cpu.h
++++ agent/mibgroup/hardware/cpu.h
+@@ -12,10 +12,10 @@
+ #elif defined(irix6)
+ config_require(hardware/cpu/cpu_sysinfo)
+
+-#elif (defined(netbsd) || defined(netbsd1) || defined(netbsdelf) || defined(netbsdelf2)|| defined(netbsdelf3) || defined(openbsd2)|| defined(openbsd3) || defined(openbsd4))
++#elif (defined(netbsd) || defined(netbsd1) || defined(netbsdelf) || defined(netbsdelf2)|| defined(netbsdelf3) || defined(openbsd2)|| defined(openbsd3) || defined(openbsd4) || defined(freebsd4) || defined(freebsd5)|| defined(freebsd6))
+ config_require(hardware/cpu/cpu_sysctl)
+
+-#elif (defined(freebsd2) || defined(freebsd3) || defined(freebsd4) || defined(freebsd5)|| defined(freebsd6))
++#elif (defined(freebsd2) || defined(freebsd3))
+ config_require(hardware/cpu/cpu_nlist)
+
+ #elif (defined(aix4) || defined(aix5))
diff --git a/net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c b/net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c
new file mode 100644
index 000000000000..68d058961161
--- /dev/null
+++ b/net-mgmt/net-snmp-devel/files/patch-agent_mibgroup_hardware_cpu_cpu__sysctl.c
@@ -0,0 +1,94 @@
+
+$FreeBSD$
+
+--- agent/mibgroup/hardware/cpu/cpu_sysctl.c.orig
++++ agent/mibgroup/hardware/cpu/cpu_sysctl.c
+@@ -11,7 +11,14 @@
+ #include <unistd.h>
+ #include <sys/types.h>
+
++#if defined(__FreeBSD__)
++#include <sys/resource.h>
++#if !defined(CPUSTATES)
++#include <sys/dkstat.h>
++#endif
++#else
+ #include <sys/sched.h>
++#endif
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+ #include <sys/vmmeter.h>
+@@ -37,11 +44,11 @@
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ i = sizeof(n);
+- sysctl(ncpu_mib, 2, &n, &i, NULL, 0);
++ sysctl(ncpu_mib, 2, &n, (void *)&i, NULL, 0);
+ if ( n <= 0 )
+ n = 1; /* Single CPU system */
+ i = sizeof(descr);
+- sysctl(model_mib, 2, descr, &i, NULL, 0);
++ sysctl(model_mib, 2, descr, (void *)&i, NULL, 0);
+ for ( i = 0; i < n; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+@@ -64,6 +71,8 @@
+ #undef NETSNMP_CPU_STATS
+ #define NETSNMP_CPU_STATS uint64_t
+ #endif
++#elif defined(__FreeBSD__)
++#define NETSNMP_KERN_CPU 0 /* FreeBSD - dummy value, sysctlnametomib(2) should be used */
+ #else
+ #error "No CPU statistics sysctl token"
+ #endif
+@@ -95,7 +104,7 @@
+ #define NETSNMP_VM_STATS_TYPE struct uvmexp
+ #endif /* VM_UVMEXP2 || VM_UVMEXP */
+
+-#elif defined(VM_METER) /* OpenBSD, NetBSD, FreeBSD */
++#elif defined(VM_METER) && !defined(__FreeBSD__) /* OpenBSD, NetBSD */
+ #define NETSNMP_VM_STATS VM_METER
+ #define NETSNMP_VM_STATS_TYPE struct vmtotal
+
+@@ -108,6 +117,15 @@
+ #undef NS_VM_PAGEOUT
+ #define NS_VM_SWAPIN v_swpin
+ #define NS_VM_SWAPOUT v_swpout
++#elif defined(__FreeBSD__) /* FreeBSD */
++#define NETSNMP_VM_STATS VM_METER
++#define NETSNMP_VM_STATS_TYPE struct vmmeter
++ #define NS_VM_INTR v_intr
++ #define NS_VM_SWTCH v_swtch
++ #define NS_VM_PAGEIN v_swappgsin
++ #define NS_VM_PAGEOUT v_swappgsout
++ #define NS_VM_SWAPIN v_swapin
++ #define NS_VM_SWAPOUT v_swapout
+ #endif
+
+
+@@ -126,7 +144,7 @@
+ */
+ NETSNMP_CPU_STATS cpu_stats[CPUSTATES];
+ int cpu_mib[] = { CTL_KERN, NETSNMP_KERN_CPU };
+- int cpu_size = sizeof(cpu_stats);
++ size_t cpu_size = sizeof(cpu_stats);
+ #ifdef NETSNMP_KERN_MCPU
+ NETSNMP_KERN_MCPU_TYPE *mcpu_stats;
+ int mcpu_mib[] = { CTL_KERN, NETSNMP_KERN_MCPU };
+@@ -134,10 +152,13 @@
+ #endif
+ NETSNMP_VM_STATS_TYPE mem_stats;
+ int mem_mib[] = { CTL_VM, NETSNMP_VM_STATS };
+- int mem_size = sizeof(NETSNMP_VM_STATS_TYPE);
++ size_t mem_size = sizeof(NETSNMP_VM_STATS_TYPE);
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+-
+- sysctl(cpu_mib, 2, cpu_stats, &cpu_size, NULL, 0);
++#if defined(__FreeBSD__)
++ sysctlbyname("kern.cp_time", cpu_stats, &cpu_size, NULL, 0);
++#else
++ sysctl(cpu_time, 2, cpu_stats, &cpu_size, NULL, 0);
++#endif
+ cpu->user_ticks = (unsigned long)cpu_stats[CP_USER];
+ cpu->nice_ticks = (unsigned long)cpu_stats[CP_NICE];
+ cpu->sys2_ticks = (unsigned long)cpu_stats[CP_SYS]+cpu_stats[CP_INTR];
diff --git a/net-mgmt/net-snmp-devel/files/patch-ucd_snmp.h b/net-mgmt/net-snmp-devel/files/patch-ucd_snmp.h
deleted file mode 100644
index 476951ce818c..000000000000
--- a/net-mgmt/net-snmp-devel/files/patch-ucd_snmp.h
+++ /dev/null
@@ -1,16 +0,0 @@
-
-$FreeBSD$
-
---- agent/mibgroup/ucd_snmp.h.orig
-+++ agent/mibgroup/ucd_snmp.h
-@@ -13,5 +13,10 @@
- config_require(ucd-snmp/logmatch)
- config_require(ucd-snmp/memory)
- config_require(ucd-snmp/vmstat)
-+config_arch_require(freebsd4, ucd-snmp/vmstat_freebsd2)
-+config_arch_require(freebsd5, ucd-snmp/vmstat_freebsd2)
-+config_arch_require(freebsd6, ucd-snmp/vmstat_freebsd2)
-+config_arch_require(freebsd7, ucd-snmp/vmstat_freebsd2)
-+config_arch_require(freebsd8, ucd-snmp/vmstat_freebsd2)
- config_add_mib(UCD-SNMP-MIB)
- config_add_mib(UCD-DEMO-MIB)
diff --git a/net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c b/net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c
deleted file mode 100644
index 310c0bbf5320..000000000000
--- a/net-mgmt/net-snmp-devel/files/patch-vmstat_freebsd2.c
+++ /dev/null
@@ -1,22 +0,0 @@
---- agent/mibgroup/ucd-snmp/vmstat_freebsd2.c.orig 2008-04-25 16:28:53.000000000 +0300
-+++ agent/mibgroup/ucd-snmp/vmstat_freebsd2.c 2008-04-25 16:29:01.000000000 +0300
-@@ -174,6 +174,7 @@
- static long cpu_total;
- long cpu_sum;
- double cpu_prc;
-+ int mib[2], mib_len, cpu_new_len;
-
- static struct vmmeter mem_old, mem_new;
-
-@@ -195,7 +196,10 @@
- /*
- * CPU usage
- */
-- auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
-+ mib_len = 2;
-+ sysctlnametomib("kern.cp_time", mib, &mib_len);
-+ cpu_new_len = sizeof(cpu_new);
-+ sysctl(mib, mib_len, cpu_new, &cpu_new_len, NULL, 0);
-
- cpu_total = 0;
-