pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/net-snmp/patches make net-snmp build on darwin 8.2...
details: https://anonhg.NetBSD.org/pkgsrc/rev/bf0aef38ab59
branches: trunk
changeset: 497585:bf0aef38ab59
user: rtr <rtr%pkgsrc.org@localhost>
date: Sun Jul 31 02:30:18 2005 +0000
description:
make net-snmp build on darwin 8.2.0 patches from darwin sources
diffstat:
net/net-snmp/patches/patch-ak | 21 ++++++
net/net-snmp/patches/patch-al | 44 +++++++++++++
net/net-snmp/patches/patch-am | 11 +++
net/net-snmp/patches/patch-an | 133 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 209 insertions(+), 0 deletions(-)
diffs (225 lines):
diff -r 932f91c52581 -r bf0aef38ab59 net/net-snmp/patches/patch-ak
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/net-snmp/patches/patch-ak Sun Jul 31 02:30:18 2005 +0000
@@ -0,0 +1,21 @@
+--- agent/mibgroup/ucd-snmp/disk.c.orig 2005-07-30 18:48:29.000000000 +1000
++++ agent/mibgroup/ucd-snmp/disk.c 2005-07-30 18:49:20.000000000 +1000
+@@ -73,15 +73,17 @@
+ #if HAVE_SYS_VFS_H
+ #include <sys/vfs.h>
+ #endif
+-#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
++#ifdef HAVE_STATFS
+ #if HAVE_SYS_MOUNT_H
+ #include <sys/mount.h>
+ #endif
+ #if HAVE_SYS_SYSCTL_H
+ #include <sys/sysctl.h>
+ #endif
++#ifndef HAVE_STATVFS
+ #define statvfs statfs
+ #endif
++#endif
+ #if HAVE_VM_VM_H
+ #include <vm/vm.h>
+ #endif
diff -r 932f91c52581 -r bf0aef38ab59 net/net-snmp/patches/patch-al
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/net-snmp/patches/patch-al Sun Jul 31 02:30:18 2005 +0000
@@ -0,0 +1,44 @@
+--- agent/mibgroup/host/hr_network.c.orig 2005-07-30 19:20:48.000000000 +1000
++++ agent/mibgroup/host/hr_network.c 2005-07-30 19:21:25.000000000 +1000
+@@ -189,6 +189,10 @@
+ static char HRN_name[MAX_PHYSADDR_LEN];
+ static nmapi_phystat HRN_ifnet;
+ #define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c)
++#elif defined darwin
++static char HRN_name[IFNAMSIZ];
++static struct if_msghdr HRN_ifnet;
++#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c, d)
+ #else /* hpux11 */
+ static char HRN_name[16];
+ static struct ifnet HRN_ifnet;
+@@ -207,7 +211,7 @@
+ void
+ Init_HR_Network(void)
+ {
+-#ifndef solaris2
++#ifndef solaris2 &&
+ Interface_Scan_Init();
+ #endif
+ }
+@@ -215,7 +219,7 @@
+ int
+ Get_Next_HR_Network(void)
+ {
+-#ifndef solaris2
++#if !(defined solaris2 && defined darwin)
+ if (M_Interface_Scan_Next(&HRN_index, HRN_name, &HRN_ifnet, NULL))
+ return (HRDEV_NETWORK << HRDEV_TYPE_SHIFT) + HRN_index;
+ else
+@@ -231,7 +235,11 @@
+ HRN_savedFlags = HRN_ifnet.if_entry.ifOper;
+ HRN_savedErrors = HRN_ifnet.if_entry.ifInErrors +
+ HRN_ifnet.if_entry.ifOutErrors;
+-#else /* hpux11 */
++#elif defined(__APPLE__)
++ HRN_savedFlags = HRN_ifnet.ifm_flags;
++ HRN_savedFlags = HRN_ifnet.ifm_data.ifi_ierrors +
++ HRN_ifnet.ifm_data.ifi_oerrors;
++#else
+ HRN_savedFlags = HRN_ifnet.if_flags;
+ HRN_savedErrors = HRN_ifnet.if_ierrors + HRN_ifnet.if_oerrors;
+ #endif /* hpux11 */
diff -r 932f91c52581 -r bf0aef38ab59 net/net-snmp/patches/patch-am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/net-snmp/patches/patch-am Sun Jul 31 02:30:18 2005 +0000
@@ -0,0 +1,11 @@
+--- agent/mibgroup/host/hr_swrun.c.orig 2005-07-30 21:47:42.000000000 +1000
++++ agent/mibgroup/host/hr_swrun.c 2005-07-30 21:47:46.000000000 +1000
+@@ -1070,6 +1070,8 @@
+ #else
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
+ #endif
++#elif defined darwin
++ long_return = -1;
+ #else
+ long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
diff -r 932f91c52581 -r bf0aef38ab59 net/net-snmp/patches/patch-an
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/net-snmp/patches/patch-an Sun Jul 31 02:30:18 2005 +0000
@@ -0,0 +1,133 @@
+--- agent/mibgroup/mibII/route_write.c.orig 2005-07-30 22:18:06.000000000 +1000
++++ agent/mibgroup/mibII/route_write.c 2005-07-30 22:18:28.000000000 +1000
+@@ -102,7 +102,7 @@
+ int
+ addRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+ {
+-#ifndef dynix
++#if !(defined dynix || defined darwin)
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+ int s, rc;
+@@ -141,6 +141,55 @@
+ return rc;
+ #endif
+
++#elif defined darwin
++ size_t sa_in_size = sizeof(struct sockaddr_in);
++ int s, rc;
++ struct sockaddr_in dst;
++ struct sockaddr_in gateway;
++ struct {
++ struct rt_msghdr hdr;
++ char space[512];
++ } rtmsg;
++
++ s = socket(PF_ROUTE, SOCK_RAW, 0);
++ if (s < 0) {
++ snmp_log_perror("socket");
++ return -1;
++ }
++
++ shutdown(s, SHUT_RD);
++ /* possible panic otherwise */
++ flags |= (RTF_UP | RTF_GATEWAY);
++
++ bzero((char *)&dst, sa_in_size);
++ dst.sin_len = sa_in_size;
++ dst.sin_family = AF_INET;
++ dst.sin_addr.s_addr = htonl(dstip);
++
++ bzero((char *)&gateway, sa_in_size);
++ gateway.sin_len = sa_in_size;
++ gateway.sin_family = AF_INET;
++ gateway.sin_addr.s_addr = htonl(gwip);
++
++ bzero((char *)&rtmsg, sizeof(rtmsg));
++ rtmsg.hdr.rtm_type = RTM_ADD;
++ rtmsg.hdr.rtm_version = RTM_VERSION;
++ rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
++ rtmsg.hdr.rtm_flags = RTF_GATEWAY;
++
++ bcopy((char *)&dst, rtmsg.space, sa_in_size);
++ bcopy((char *)&gateway, (rtmsg.space+sa_in_size), sa_in_size);
++
++ rc = sizeof(struct rt_msghdr) + sa_in_size + sa_in_size;
++ rtmsg.hdr.rtm_msglen = rc;
++
++ if ((rc = write(s, (char *)&rtmsg, rc)) < 0) {
++ snmp_log_perror("writing to routing socket");
++ return -1;
++ }
++
++ return (rc);
++
+ #else /* dynix */
+ /*
+ * Throws up the following errors:
+@@ -166,7 +215,7 @@
+ int
+ delRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+ {
+-#ifndef dynix
++#if !(defined dynix || defined darwin)
+
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+@@ -205,6 +254,56 @@
+ return rc;
+ #endif
+
++#elif defined darwin
++ size_t sa_in_size = sizeof(struct sockaddr_in);
++ int s, rc;
++ struct sockaddr_in dst;
++ struct sockaddr_in gateway;
++ struct {
++ struct rt_msghdr hdr;
++ char space[512];
++ } rtmsg;
++
++ s = socket(PF_ROUTE, SOCK_RAW, 0);
++
++ if (s < 0) {
++ snmp_log_perror("socket");
++ return -1;
++ }
++
++ shutdown(s, SHUT_RD);
++ /* possible panic otherwise */
++ flags |= (RTF_UP | RTF_GATEWAY);
++
++ bzero((char *)&dst, sa_in_size);
++ dst.sin_len = sa_in_size;
++ dst.sin_family = AF_INET;
++ dst.sin_addr.s_addr = htonl(dstip);
++
++ bzero((char *)&gateway, sa_in_size);
++ gateway.sin_len = sa_in_size;
++ gateway.sin_family = AF_INET;
++ gateway.sin_addr.s_addr = htonl(gwip);
++
++ bzero((char *)&rtmsg, sizeof(rtmsg));
++ rtmsg.hdr.rtm_type = RTM_DELETE;
++ rtmsg.hdr.rtm_version = RTM_VERSION;
++ rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY;
++ rtmsg.hdr.rtm_flags = RTF_GATEWAY;
++
++ bcopy((char *)&dst, rtmsg.space, sa_in_size);
++ bcopy((char *)&gateway, (rtmsg.space+sa_in_size), sa_in_size);
++
++ rc = sizeof(struct rt_msghdr) + sa_in_size + sa_in_size;
++ rtmsg.hdr.rtm_msglen = rc;
++
++ if ((rc = write(s, (char *)&rtmsg, rc)) < 0) {
++ snmp_log_perror("writing to routing socket");
++ return -1;
++ }
++
++ return rc;
++
+ #else /* dynix */
+ /*
+ * See 'addRoute' for the list of errors.
Home |
Main Index |
Thread Index |
Old Index