summaryrefslogtreecommitdiff
path: root/net/net-snmp
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-02-05 19:18:37 +0000
committerjoerg <joerg@pkgsrc.org>2007-02-05 19:18:37 +0000
commitc39b7c9ccabe690f767e9e336f028af2c4381590 (patch)
treea663f99cfeb318436dca684fdf2e77a43d72c3d9 /net/net-snmp
parent6f82968b44304100378b00224057cd6d71798a77 (diff)
downloadpkgsrc-c39b7c9ccabe690f767e9e336f028af2c4381590.tar.gz
Fix DragonFly build changes. I have no clue to add an optional file
into the build system, so override cpu_nlist on DragonFly.
Diffstat (limited to 'net/net-snmp')
-rw-r--r--net/net-snmp/Makefile5
-rw-r--r--net/net-snmp/distinfo5
-rw-r--r--net/net-snmp/files/cpu_dragonfly.c68
-rw-r--r--net/net-snmp/patches/patch-de6
4 files changed, 78 insertions, 6 deletions
diff --git a/net/net-snmp/Makefile b/net/net-snmp/Makefile
index 29a87eff74e..1c623d4115b 100644
--- a/net/net-snmp/Makefile
+++ b/net/net-snmp/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.56 2007/02/05 12:06:16 adam Exp $
+# $NetBSD: Makefile,v 1.57 2007/02/05 19:18:37 joerg Exp $
DISTNAME= net-snmp-5.4
CATEGORIES= net
@@ -111,6 +111,9 @@ INSTALLATION_DIRS+= share/examples/net-snmp
post-extract:
cp ${FILESDIR}/dragonfly.h ${WRKSRC}/include/net-snmp/system
+.if ${OPSYS} == "DragonFly"
+ cp ${FILESDIR}/cpu_dragonfly.c ${WRKSRC}/agent/mibgroup/hardware/cpu/cpu_nlist.c
+.endif
post-wrapper:
.if !empty(MACHINE_PLATFORM:MNetBSD-1.5.[123]*-i386)
diff --git a/net/net-snmp/distinfo b/net/net-snmp/distinfo
index b1ceab0d375..41d21c36a6e 100644
--- a/net/net-snmp/distinfo
+++ b/net/net-snmp/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.36 2007/02/05 12:06:16 adam Exp $
+$NetBSD: distinfo,v 1.37 2007/02/05 19:18:37 joerg Exp $
SHA1 (net-snmp-5.4.tar.gz) = 8edb17509eba9f8c9cfb015fe35a1024048129eb
RMD160 (net-snmp-5.4.tar.gz) = 8ad1f9a3def8022eea48d9b74ae71d8efb59ca61
@@ -16,7 +16,7 @@ SHA1 (patch-da) = 7466445c8388492344acdee236b153cb5f5b45e1
SHA1 (patch-db) = bec0bee1860ee42ba64b4c07df2280e206eaf582
SHA1 (patch-dc) = f24a352a09bf6d9e1abb5077176ce3301ac07de7
SHA1 (patch-dd) = 08da0d1da485959549ac461e5cbb7030f800e643
-SHA1 (patch-de) = 0c09ab5d8dae46b127cd969cbc1d168b307ffbc9
+SHA1 (patch-de) = 62052d13a54d28a98e6383d705b3928c17209768
SHA1 (patch-dg) = 6e6e396add0613dd76e3b8618008a7ebf8103c7c
SHA1 (patch-dh) = c9a776d6574df008adae52a2f08930e0662f70b3
SHA1 (patch-di) = e0e1039c1adbf10ae56c50998ff74b39193e7348
@@ -31,6 +31,7 @@ SHA1 (patch-dq) = 619d94d9937098b684ee8d0f1a3a92dfdff2155c
SHA1 (patch-dr) = ab75e5cf3448d9c0520b6e7d2c68adfbf3ab639b
SHA1 (patch-ds) = 4d59f016eca12660f94dcba89f94e395323ab7b4
SHA1 (patch-dt) = a8d173926161e4fce26ee5fbf3aeee05802f2598
+SHA1 (patch-du) = a07160ee1197d8aefa3ccaf7fb255be48311e8bc
SHA1 (patch-ea) = fb13d164075c804617fc73f4cfb51ed5fb25600c
SHA1 (patch-ee) = ec2a41ba9489bf71412169c0f8367eac214e3738
SHA1 (patch-eg) = 421ccf1c810a2b03d7ff10fe38e8a3eea62d9836
diff --git a/net/net-snmp/files/cpu_dragonfly.c b/net/net-snmp/files/cpu_dragonfly.c
new file mode 100644
index 00000000000..9d0ce4c0bf8
--- /dev/null
+++ b/net/net-snmp/files/cpu_dragonfly.c
@@ -0,0 +1,68 @@
+/*
+ * DragonFly kinfo interface
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <sys/types.h>
+#include <sys/vmmeter.h>
+#include <kinfo.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void _cpu_copy_stats( netsnmp_cpu_info *cpu );
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_nlist( void ) {
+ netsnmp_cpu_info *cpu;
+ int i;
+ size_t len;
+ char descr[ SNMP_MAXBUF ];
+
+ kinfo_get_cpus(&cpu_num);
+ len = sizeof(descr);
+ sysctlbyname("hw.model", descr, &len, NULL, 0);
+ for ( i = 0; i < cpu_num; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+ sprintf(cpu->name, "cpu%d", i);
+ sprintf(cpu->descr, "%s", descr);
+ }
+}
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ struct vmmeter vmm;
+ size_t len;
+ struct kinfo_cputime cp_time;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+
+ kinfo_get_sched_cputime(&cp_time);
+ len = sizeof(vmm);
+ sysctlbyname("vm.vmmeter", &vmm, &len, NULL, 0);
+
+ cpu->user_ticks = cp_time.cp_user;
+ cpu->nice_ticks = cp_time.cp_nice;
+ cpu->sys2_ticks = cp_time.cp_sys + cp_time.cp_intr;
+ cpu->idle_ticks = cp_time.cp_idle;
+ cpu->kern_ticks = cp_time.cp_sys;
+ cpu->intrpt_ticks = cp_time.cp_intr;
+
+ cpu->swapIn = vmm.v_swappgsin + vmm.v_vnodepgsin;
+ cpu->swapOut = vmm.v_swappgsout + vmm.v_vnodepgsout;
+ cpu->nInterrupts = vmm.v_intr;
+ cpu->nCtxSwitches = vmm.v_swtch;
+
+ /* Copy "overall" figures to cpu0 entry */
+ _cpu_copy_stats( cpu );
+
+ return 0;
+}
diff --git a/net/net-snmp/patches/patch-de b/net/net-snmp/patches/patch-de
index b889c17e100..e1e8cea928b 100644
--- a/net/net-snmp/patches/patch-de
+++ b/net/net-snmp/patches/patch-de
@@ -1,6 +1,6 @@
-$NetBSD: patch-de,v 1.2 2007/02/05 12:06:16 adam Exp $
+$NetBSD: patch-de,v 1.3 2007/02/05 19:18:37 joerg Exp $
---- agent/mibgroup/mibII/ipv6.c.orig 2006-11-07 00:43:27.000000000 +0100
+--- agent/mibgroup/mibII/ipv6.c.orig 2006-11-06 23:43:27.000000000 +0000
+++ agent/mibgroup/mibII/ipv6.c
@@ -11,7 +11,7 @@
#include <sys/types.h>
@@ -298,7 +298,7 @@ $NetBSD: patch-de,v 1.2 2007/02/05 12:06:16 adam Exp $
if (in6pcb.in6p_af != AF_INET6)
goto skip;
-#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
-+#elif (defined(freebsd3) || defined(darwin)
++#elif defined(freebsd3) || defined(darwin)
if (0 == (in6pcb.inp_vflag & INP_IPV6))
goto skip;
#endif