vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 0192bda68b2d637ae9b6998b956720b959b63e83
parent f355b3ad7a021ebcf86258d7b3e2b1fc957aee66
Author: npe@jmk <none@none>
Date:   Wed, 27 Oct 2010 17:20:03 -0700

Got 9vx to compile on OSX and added preliminary tap support for Darwin. -npe

Diffstat:
Msrc/9vx/ethertap.c | 19+++++++++++++++++++
Msrc/Makefrag | 4++--
2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/9vx/ethertap.c b/src/9vx/ethertap.c @@ -16,6 +16,7 @@ #include "etherif.h" #include "vether.h" +#include <sys/socket.h> #include <net/if.h> #include <sys/ioctl.h> @@ -67,6 +68,24 @@ opentap(char *dev) return -1; return fd; } +#elif defined(__DARWIN_UNIX03) +static int +opentap(char *dev) +{ + int fd; + struct stat s; + + iprint("tundev: %s\n", dev); + if((fd = open("/dev/tap0", O_RDWR)) < 0) + return -1; + /* + * miserable hack to get the interface up, + * feel free to add the ioctls if you're feeling energetic. + */ + system("ifconfig tap0 0.0.0.0 up"); + + return fd; +} #endif static int diff --git a/src/Makefrag b/src/Makefrag @@ -5,8 +5,8 @@ COMMON_CFLAGS = -g -O2 -MD -std=gnu99 -I. -fno-stack-protector $(CFLAGS) COMMON_LDFLAGS = -g -L. $(LDFLAGS) # Host environment compiler options -HOST_CC := $(CC) -fno-inline -HOST_LD := $(LD) +HOST_CC := $(CC) -fno-inline -D_XOPEN_SOURCE -arch i386 -m32 +HOST_LD := $(LD) -arch i386 HOST_AR := $(AR) HOST_LDFLAGS := $(COMMON_LDFLAGS) HOST_CFLAGS := $(COMMON_CFLAGS)