diff options
author | Jun Kuriyama <kuriyama@FreeBSD.org> | 2003-08-16 08:53:52 +0000 |
---|---|---|
committer | Jun Kuriyama <kuriyama@FreeBSD.org> | 2003-08-16 08:53:52 +0000 |
commit | 0e4ce7990127ac2f6960175e2169ab8c22274ac5 (patch) | |
tree | 7309749832db8c64d98b6b6172e2006f63be9838 /net-mgmt/net-snmp53 | |
parent | 361fe2db06d63e12712b1866634dedfe89064840 (diff) | |
download | ports-0e4ce7990127ac2f6960175e2169ab8c22274ac5.tar.gz ports-0e4ce7990127ac2f6960175e2169ab8c22274ac5.zip |
Notes
Diffstat (limited to 'net-mgmt/net-snmp53')
-rw-r--r-- | net-mgmt/net-snmp53/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-freebsd5.h | 22 | ||||
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-hr_swrun.c | 32 | ||||
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-memory_freebsd2.c | 30 | ||||
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-tcpTable.c | 51 |
5 files changed, 118 insertions, 19 deletions
diff --git a/net-mgmt/net-snmp53/Makefile b/net-mgmt/net-snmp53/Makefile index b9570ee4d32c..45794a90c89f 100644 --- a/net-mgmt/net-snmp53/Makefile +++ b/net-mgmt/net-snmp53/Makefile @@ -7,7 +7,7 @@ PORTNAME= net-snmp PORTVERSION= 5.0.8 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= net-snmp diff --git a/net-mgmt/net-snmp53/files/patch-freebsd5.h b/net-mgmt/net-snmp53/files/patch-freebsd5.h new file mode 100644 index 000000000000..697589ec48b8 --- /dev/null +++ b/net-mgmt/net-snmp53/files/patch-freebsd5.h @@ -0,0 +1,22 @@ +--- /dev/null Sat Aug 16 16:33:01 2003 ++++ include/net-snmp/system/freebsd5.h Sat Aug 16 16:42:08 2003 +@@ -0,0 +1,19 @@ ++#include "freebsd.h" ++ ++/* ++ * freebsd4 is a superset of freebsd2 and freebsd3 ++ */ ++#define freebsd2 1 ++#define freebsd3 1 ++#define freebsd4 1 ++ ++#undef IFADDR_SYMBOL ++#define IFADDR_SYMBOL "in_ifaddrhead" ++ ++#undef PROC_SYMBOL ++#define PROC_SYMBOL "allproc" ++ ++#undef NPROC_SYMBOL ++#define NPROC_SYMBOL "nprocs" ++ ++#undef TOTAL_MEMORY_SYMBOL diff --git a/net-mgmt/net-snmp53/files/patch-hr_swrun.c b/net-mgmt/net-snmp53/files/patch-hr_swrun.c index a2afd1c61cf3..5ff95f18ca72 100644 --- a/net-mgmt/net-snmp53/files/patch-hr_swrun.c +++ b/net-mgmt/net-snmp53/files/patch-hr_swrun.c @@ -1,7 +1,7 @@ ---- agent/mibgroup/host/hr_swrun.c.orig Sat Apr 20 16:30:03 2002 -+++ agent/mibgroup/host/hr_swrun.c Wed Apr 24 01:43:15 2002 -@@ -557,7 +557,11 @@ - strcpy(string, proc_buf->p_user.u_comm); +--- agent/mibgroup/host/hr_swrun.c.orig Fri Dec 20 00:07:30 2002 ++++ agent/mibgroup/host/hr_swrun.c Sat Aug 16 17:10:54 2003 +@@ -561,7 +561,11 @@ + string[ sizeof(string)-1 ] = 0; #endif #elif HAVE_KVM_GETPROCS +#if defined(freebsd5) && __FreeBSD_version >= 500014 @@ -12,7 +12,7 @@ #elif defined(linux) sprintf(string, "/proc/%d/status", pid); if ((fp = fopen(string, "r")) == NULL) -@@ -662,7 +666,11 @@ +@@ -666,7 +670,11 @@ *cp1 = 0; #endif #elif HAVE_KVM_GETPROCS @@ -24,7 +24,7 @@ #elif defined(linux) sprintf(string, "/proc/%d/cmdline", pid); if ((fp = fopen(string, "r")) == NULL) -@@ -853,7 +861,11 @@ +@@ -857,7 +865,11 @@ } #else #if HAVE_KVM_GETPROCS @@ -36,7 +36,7 @@ #elif defined(dynix) switch (lowpsinfo.pr_state) { #elif defined(solaris2) -@@ -948,9 +960,17 @@ +@@ -952,9 +964,17 @@ long_return = proc_buf->p_utime * 100 + proc_buf->p_stime * 100; #endif #elif HAVE_KVM_GETPROCS @@ -54,21 +54,23 @@ #elif defined(linux) sprintf(string, "/proc/%d/stat", pid); if ((fp = fopen(string, "r")) == NULL) -@@ -1022,6 +1042,13 @@ - #if defined(freebsd3) && !defined(darwin) - long_return = - proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024; -+#elif defined(freebsd5) && __FreeBSD_version >= 500014 +@@ -1023,7 +1043,14 @@ + long_return = proc_buf->p_swrss; + #endif + #elif HAVE_KVM_GETPROCS +-#if defined(freebsd3) && !defined(darwin) ++#if defined(freebsd5) && __FreeBSD_version >= 500014 + /* XXX + long_return = proc_table[LowProcIndex].ki_vmspace->vm_tsize + + proc_table[LowProcIndex].ki_vmspace->vm_ssize + + proc_table[LowProcIndex].ki_vmspace->vm_dsize; + long_return = long_return * (getpagesize() / 1024); */ + long_return = 0; ++#elif defined(freebsd3) && !defined(darwin) + long_return = + proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024; #else - long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize + - proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize + -@@ -1299,8 +1326,13 @@ +@@ -1303,8 +1330,13 @@ #elif defined(solaris2) return proc_table[current_proc_entry++]; #elif HAVE_KVM_GETPROCS diff --git a/net-mgmt/net-snmp53/files/patch-memory_freebsd2.c b/net-mgmt/net-snmp53/files/patch-memory_freebsd2.c index 8ddf778aea0d..47f5da45ccc7 100644 --- a/net-mgmt/net-snmp53/files/patch-memory_freebsd2.c +++ b/net-mgmt/net-snmp53/files/patch-memory_freebsd2.c @@ -1,6 +1,30 @@ ---- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig Sat Apr 20 16:30:08 2002 -+++ agent/mibgroup/ucd-snmp/memory_freebsd2.c Wed Apr 24 01:49:01 2002 -@@ -274,7 +274,7 @@ +--- agent/mibgroup/ucd-snmp/memory_freebsd2.c.orig Sat Nov 9 23:59:53 2002 ++++ agent/mibgroup/ucd-snmp/memory_freebsd2.c Sat Aug 16 17:09:01 2003 +@@ -207,11 +207,13 @@ + auto_nlist(NSWDEV_SYMBOL, (char *) &nswdev, sizeof(nswdev)); + auto_nlist(DMMAX_SYMBOL, (char *) &dmmax, sizeof(dmmax)); + ++#if !defined(freebsd5) + sw = (struct swdevt *) malloc(nswdev * sizeof(*sw)); + if (sw == NULL) + return; + + auto_nlist(SWDEVT_SYMBOL, (char *) sw, nswdev * sizeof(*sw)); ++#endif + + n = kvm_getswapinfo(kd, kswap, sizeof(kswap) / sizeof(kswap[0]), 0); + +@@ -242,7 +244,9 @@ + swapUsed *= pagesize; + swapFree *= pagesize; + ++#if !defined(freebsd5) + free(sw); ++#endif + } + #endif + +@@ -274,7 +278,7 @@ size_t total_size = sizeof(total); int total_mib[] = { CTL_VM, VM_METER }; diff --git a/net-mgmt/net-snmp53/files/patch-tcpTable.c b/net-mgmt/net-snmp53/files/patch-tcpTable.c new file mode 100644 index 000000000000..19e1f60d7ca8 --- /dev/null +++ b/net-mgmt/net-snmp53/files/patch-tcpTable.c @@ -0,0 +1,51 @@ +--- agent/mibgroup/mibII/tcpTable.c.orig Sat Apr 20 16:30:05 2002 ++++ agent/mibgroup/mibII/tcpTable.c Sat Aug 16 17:38:05 2003 +@@ -462,6 +462,40 @@ + TCP_Count_Connections(void) + { + int Established; ++#if (defined(freebsd2) || defined(netbsd2) || defined(openbsd2)) ++ int mib[4], len; ++ char *p; ++ struct tcpcb *tpcb; ++ struct xtcpcb *tp; ++ struct xinpgen *next; ++ ++ mib[0]=CTL_NET; ++ mib[1]=PF_INET; ++ mib[2]=IPPROTO_TCP; ++ mib[3]=TCPCTL_PCBLIST; ++ ++ if (sysctl(mib, 4, NULL, &len, NULL, 0) != 0) { ++ snmp_log_perror("TCP_Count_Connections - sysctl"); ++ return 0; ++ } ++ if ((p=(char *)malloc(len)) == NULL) { ++ snmp_log_perror("TCP_Count_Connections - malloc"); ++ return 0; ++ } ++ if (sysctl(mib, 4, p, &len, NULL, 0) != 0) { ++ snmp_log_perror("TCP_Count_Connections - sysctl"); ++ free(p); ++ return 0; ++ } ++ Established=0; ++ next=(struct xinpgen *)p; ++ for (next=(struct xinpgen *)((char *)next + next->xig_len); next->xig_len > sizeof(struct xinpgen); next=(struct xinpgen *)((char *)next + next->xig_len)) { ++ tp=(struct xtcpcb *)next; ++ if (tp->xt_tp.t_state == TCPS_ESTABLISHED || tp->xt_tp.t_state == TCPS_CLOSE_WAIT) ++ Established++; ++ } ++ free(p); ++#else + struct inpcb cb; + register struct inpcb *next; + #if !(defined(freebsd2) || defined(netbsd2) || defined(openbsd2)) +@@ -525,6 +559,7 @@ + prev = next; + #endif /* !(defined(freebsd2) || defined(netbsd1) || defined(openbsd2)) */ + } ++#endif + return (Established); + } + #endif /* !linux && !hpux11 */ |