pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/wmpload net/pload: Add FreeBSD and DragonFly support



details:   https://anonhg.NetBSD.org/pkgsrc/rev/53866131b158
branches:  trunk
changeset: 607419:53866131b158
user:      marino <marino%pkgsrc.org@localhost>
date:      Sat Aug 11 17:22:18 2012 +0000

description:
net/pload: Add FreeBSD and DragonFly support

Patch differentials came from FreeBSD ports.

diffstat:

 net/wmpload/distinfo                |   5 +-
 net/wmpload/patches/patch-aa        |  93 +++++++++++++++++++++++++++++++++---
 net/wmpload/patches/patch-configure |  14 +++++
 3 files changed, 102 insertions(+), 10 deletions(-)

diffs (152 lines):

diff -r bc47820e08bb -r 53866131b158 net/wmpload/distinfo
--- a/net/wmpload/distinfo      Sat Aug 11 17:21:03 2012 +0000
+++ b/net/wmpload/distinfo      Sat Aug 11 17:22:18 2012 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.6 2005/02/24 12:14:07 agc Exp $
+$NetBSD: distinfo,v 1.7 2012/08/11 17:22:18 marino Exp $
 
 SHA1 (wmpload-0.9.5.tar.gz) = 8627bb43d789f4639ecbca67b198f371c9487e65
 RMD160 (wmpload-0.9.5.tar.gz) = d0bf961b4593797caab667b160ef97f4c6d4d16c
 Size (wmpload-0.9.5.tar.gz) = 25373 bytes
-SHA1 (patch-aa) = e9ab516214c664e930b4156531c3515dd3e6f8df
+SHA1 (patch-aa) = 57521e37e6a0d1c7d26ce52f2e01b12a3ce8206f
 SHA1 (patch-ab) = dfc510295d8c59908fe4a619b3ec22af90021271
+SHA1 (patch-configure) = 0780b9f9b8245ec2f2d4c657b5fafa6e898112fc
diff -r bc47820e08bb -r 53866131b158 net/wmpload/patches/patch-aa
--- a/net/wmpload/patches/patch-aa      Sat Aug 11 17:21:03 2012 +0000
+++ b/net/wmpload/patches/patch-aa      Sat Aug 11 17:22:18 2012 +0000
@@ -1,23 +1,100 @@
-$NetBSD: patch-aa,v 1.4 2004/11/27 00:15:30 abs Exp $
+$NetBSD: patch-aa,v 1.5 2012/08/11 17:22:18 marino Exp $
 
 --- ioctl_stat.c.orig  2000-02-01 07:49:01.000000000 +0000
 +++ ioctl_stat.c
-@@ -62,6 +62,10 @@ void ioctl_stat(if_data *ifd)
+@@ -30,6 +30,15 @@
+ #include <fcntl.h>            /* open */
+ #include <sys/ioctl.h>                /* ioctl */
+ #include <errno.h>
++#if defined(__FreeBSD__) || defined(__DragonFly__)
++#define __FreeFly__   1
++#endif
++#if __FreeFly__
++#include <sys/sysctl.h>
++#include <sys/socket.h>
++#include <net/if.h>
++#include <net/if_mib.h>
++#endif
+ 
+ #ifndef STREAMS                               /* Linux, FreeBSD, NetBSD, Ultrix */
+ #     include <sys/socket.h>          /* socket */
+@@ -39,8 +48,10 @@
+ #             include <linux/if_ppp.h>
+ #     else                            /* most everything else */
+ #             include <net/if.h>
++#     ifndef __FreeFly__
+ #             include <net/ppp_defs.h>
+ #             include <net/if_ppp.h>
++#     endif   /* FreeBSD | DragonFly */
+ #     endif   /* linux && __GLIBC__ < 2 */
+ #else /* STREAMS */                   /* Solaris, SunOS, OSF/1, SVR4 */
+ #     include <net/ppp_defs.h>
+@@ -61,7 +72,21 @@ void getsocket(if_data *ifd)
+ void ioctl_stat(if_data *ifd)
  {
        struct ifreq ifr;
-       struct ifpppstatsreq req;
-+#ifdef SIOCGIFDATA     /* Supported on at least NetBSD */
++#if __FreeFly__
++      static int              if_ix = -1;
++      struct ifmibdata        ifmd;
++      size_t                  ifmd_sz = sizeof(ifmd);
++      int                     nr_ifs;
++      size_t                  nr_ifs_sz = sizeof(nr_ifs);
++      int                     name[6];
++      int                     i;
++#else
++#ifdef SIOCGIFDATA
 +      struct ifdatareq ifdr;
-+      struct if_data * const ifi = &ifdr.ifdr_data;
++      struct if_data * const ifi = &ifdr.ifdr_data;
 +#endif
+       struct ifpppstatsreq req;
++#endif /* FreeBSD | DragonFly */
        
        if (!ifd->s) getsocket(ifd);
        
-@@ -84,6 +88,19 @@ void ioctl_stat(if_data *ifd)
+@@ -76,7 +101,9 @@ void ioctl_stat(if_data *ifd)
+               return;
+       }
+       
++#ifndef __FreeFly__
+       memset(&req, 0, sizeof(req));
++#endif
+ 
+ #ifdef linux
+       req.stats_ptr = (caddr_t) &req.stats;
+@@ -84,6 +111,48 @@ void ioctl_stat(if_data *ifd)
  #define ifr_name ifr__name
  #endif        
  
-+#if defined(SIOCGIFDATA)
++#if __FreeFly__
++      name[0] = CTL_NET;
++      name[1] = PF_LINK;
++      name[2] = NETLINK_GENERIC;
++      name[3] = IFMIB_IFDATA;
++      name[5] = IFDATA_GENERAL;
++
++      if (if_ix < 0) {
++              if (sysctlbyname("net.link.generic.system.ifcount", (void *) &nr_ifs, &nr_ifs_sz, (void *) 0, 0) < 0) {
++                      return;
++              }
++              for (i = 1; i <= nr_ifs; i++) {
++                      name[4] = i; /* row of the ifmib table */
++
++                      if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) < 0) {
++                              continue;
++                      }
++                      if (strncmp(ifmd.ifmd_name, ifr.ifr_name, strlen(ifr.ifr_name)) == 0) {
++                              if_ix = i;
++                              break;
++                      }
++              }
++      }
++
++      name[4] = if_ix;
++      if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) >= 0) {
++              ifd->in_bytes = ifmd.ifmd_data.ifi_ibytes;
++              ifd->out_bytes = ifmd.ifmd_data.ifi_obytes;
++      }
++#elif defined(SIOCGIFDATA)
 +      /* prefer generic interface statistics over PPP specific ones */
 +      strncpy(ifdr.ifdr_name, ifd->device, sizeof(ifdr.ifdr_name));
 +      if (ioctl(ifd->s, SIOCGIFDATA, &ifdr) == -1)
@@ -33,7 +110,7 @@
        strncpy(req.ifr_name, ifd->device, sizeof(req.ifr_name));
        if (ioctl(ifd->s, SIOCGPPPSTATS, &req) != 0)
        {
-@@ -95,6 +112,7 @@ void ioctl_stat(if_data *ifd)
+@@ -95,6 +164,7 @@ void ioctl_stat(if_data *ifd)
        
        ifd->in_bytes = (unsigned long)req.stats.p.ppp_ibytes;
        ifd->out_bytes = (unsigned long)req.stats.p.ppp_obytes;
diff -r bc47820e08bb -r 53866131b158 net/wmpload/patches/patch-configure
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/wmpload/patches/patch-configure       Sat Aug 11 17:22:18 2012 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-configure,v 1.1 2012/08/11 17:22:18 marino Exp $
+
+--- configure.orig     2000-02-01 07:49:01.000000000 +0000
++++ configure
+@@ -17,6 +17,9 @@ case $system in
+                       echo "enabling proc stats reading";
+               fi      
+               ;;
++      DragonFly)
++              os="dragonfly";
++              ;;
+       FreeBSD)
+               os="freebsd";
+               ;;



Home | Main Index | Thread Index | Old Index