ethertap in darwin - vx32 - Local 9vx git repository for patches.
 (HTM) git clone git://r-36.net/vx32
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 95fa2229beeaca4fbad9a3870a8f397dcd674489
 (DIR) parent 5b9a5aabc3cbe6a784a75eaeedb6e2419a702802
 (HTM) Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
       Date:   Mon, 13 Sep 2010 00:02:47 +0200
       
       ethertap in darwin
       
       Diffstat:
         M src/9vx/Makefrag                    |       4 ++--
         M src/9vx/ethertap.c                  |      18 ++++++++++++++++++
       
       2 files changed, 20 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/9vx/Makefrag b/src/9vx/Makefrag
       @@ -3,7 +3,7 @@ PLAN9VX=1
        PLAN9GUI=x11
        PLAN9AUDIO=unix
        PLAN9PCAP=nopcap
       -PLAN9TAP=notap
       +PLAN9TAP=ethertap
        endif
        
        ifeq ($(OS),darwin)
       @@ -11,7 +11,7 @@ PLAN9VX=1
        PLAN9GUI=osx
        PLAN9AUDIO=none
        PLAN9PCAP=nopcap
       -PLAN9TAP=notap
       +PLAN9TAP=ethertap
        endif
        
        ifeq ($(OS),freebsd)
 (DIR) diff --git a/src/9vx/ethertap.c b/src/9vx/ethertap.c
       @@ -16,6 +16,9 @@
        #include "etherif.h"
        #include "vether.h"
        
       +#if defined(__APPLE__)
       +#include <sys/socket.h>
       +#endif
        #include <net/if.h>
        #include <sys/ioctl.h>
        
       @@ -67,6 +70,21 @@ opentap(char *dev)
                        return -1;
                return fd;
        }
       +#elif defined(__APPLE__)
       +static int
       +opentap(char *dev)
       +{
       +        int fd;
       +        char *tap0 = "/dev/tap0";
       +
       +        if(dev == nil)
       +                dev = tap0;
       +        if((fd = open(dev, O_RDWR)) < 0) {
       +                iprint("tap: open failed with: %d\n", errno);
       +                return -1;
       +        }
       +        return fd;
       +}
        #endif
        
        static int