Commit b645b345 authored by Mike Hibler's avatar Mike Hibler
Browse files

changes to make it work better with Linux

parent 5cb2e92f
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group. # Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -104,7 +104,7 @@ frisbee-dist: Makefile.sa Makefile-linux.sa README.sa $(DISTFILES) ...@@ -104,7 +104,7 @@ frisbee-dist: Makefile.sa Makefile-linux.sa README.sa $(DISTFILES)
mv frisbee-dist/frisbee/Makefile.sa frisbee-dist/frisbee/Makefile mv frisbee-dist/frisbee/Makefile.sa frisbee-dist/frisbee/Makefile
mv frisbee-dist/frisbee/Makefile-linux.sa frisbee-dist/frisbee/Makefile-linux mv frisbee-dist/frisbee/Makefile-linux.sa frisbee-dist/frisbee/Makefile-linux
mv frisbee-dist/frisbee/README.sa frisbee-dist/README mv frisbee-dist/frisbee/README.sa frisbee-dist/README
cp $(TESTBED_SRCDIR)/COPYING frisbee-dist cp $(TESTBED_SRCDIR)/GPL-COPYING frisbee-dist/COPYING
cp $(TESTBED_SRCDIR)/doc/papers/frisbee-usenix03.pdf frisbee-dist/doc cp $(TESTBED_SRCDIR)/doc/papers/frisbee-usenix03.pdf frisbee-dist/doc
(cd frisbee-dist/frisbee; \ (cd frisbee-dist/frisbee; \
$(EXPANDCOPYRIGHT) Makefile Makefile-linux $(DISTFILES)) $(EXPANDCOPYRIGHT) Makefile Makefile-linux $(DISTFILES))
......
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group. # Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -18,7 +18,8 @@ SHAREDOBJS = log.o network.o trace.o utils.o ...@@ -18,7 +18,8 @@ SHAREDOBJS = log.o network.o trace.o utils.o
PTHREADCFLAGS = -D_THREAD_SAFE -pthread PTHREADCFLAGS = -D_THREAD_SAFE -pthread
# get 64-bit off_t and pread/pwrite protos # get 64-bit off_t and pread/pwrite protos
LINUXOPTS = -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE LINUXOPTS = -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \
-D_XOPEN_SOURCE=500 -D_BSD_SOURCE=1
CLIENTFLAGS = $(CFLAGS) CLIENTFLAGS = $(CFLAGS)
CLIENTLIBS = -lz $(PTHREADLIBS) CLIENTLIBS = -lz $(PTHREADLIBS)
...@@ -53,7 +54,7 @@ CFLAGS += -DCONDVARS_WORK ...@@ -53,7 +54,7 @@ CFLAGS += -DCONDVARS_WORK
#CLIENTLIBS += `elvin-config --libs vin4c` #CLIENTLIBS += `elvin-config --libs vin4c`
#EVENTFLAGS = $(CFLAGS) `elvin-config --cflags vin4c` -I$(TESTBED_SRCDIR) #EVENTFLAGS = $(CFLAGS) `elvin-config --cflags vin4c` -I$(TESTBED_SRCDIR)
all: frisbeed all: frisbee frisbeed
frisbee: $(CLIENTOBJS) frisbee: $(CLIENTOBJS)
$(CC) $(LDFLAGS) $(CLIENTFLAGS) $(CLIENTOBJS) $(CLIENTLIBS) -o frisbee $(CC) $(LDFLAGS) $(CLIENTFLAGS) $(CLIENTOBJS) $(CLIENTLIBS) -o frisbee
......
/* /*
* EMULAB-COPYRIGHT * EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group. * Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved. * All rights reserved.
*/ */
...@@ -1127,7 +1127,11 @@ PlayFrisbee(void) ...@@ -1127,7 +1127,11 @@ PlayFrisbee(void)
* sequence above, and its important that each client have a different * sequence above, and its important that each client have a different
* sequence! * sequence!
*/ */
#ifdef __FreeBSD__
srandomdev(); srandomdev();
#else
srandom(ClientNetID() ^ stamp.tv_sec ^ stamp.tv_usec ^ getpid());
#endif
/* /*
* A random number ID. I do not think this is really necessary, * A random number ID. I do not think this is really necessary,
......
/* /*
* EMULAB-COPYRIGHT * EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group. * Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved. * All rights reserved.
*/ */
...@@ -282,6 +282,7 @@ typedef struct { ...@@ -282,6 +282,7 @@ typedef struct {
*/ */
int ClientNetInit(void); int ClientNetInit(void);
int ServerNetInit(void); int ServerNetInit(void);
unsigned long ClientNetID(void);
int PacketReceive(Packet_t *p); int PacketReceive(Packet_t *p);
void PacketSend(Packet_t *p, int *resends); void PacketSend(Packet_t *p, int *resends);
void PacketReply(Packet_t *p); void PacketReply(Packet_t *p);
......
...@@ -170,6 +170,12 @@ ClientNetInit(void) ...@@ -170,6 +170,12 @@ ClientNetInit(void)
return 1; return 1;
} }
unsigned long
ClientNetID(void)
{
return ntohl(myipaddr.s_addr);
}
int int
ServerNetInit(void) ServerNetInit(void)
{ {
......
/* /*
* EMULAB-COPYRIGHT * EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group. * Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved. * All rights reserved.
*/ */
...@@ -1003,6 +1003,7 @@ mypread(int fd, void *buf, size_t nbytes, off_t offset) ...@@ -1003,6 +1003,7 @@ mypread(int fd, void *buf, size_t nbytes, off_t offset)
pfatal("read error: busted for too long"); pfatal("read error: busted for too long");
return -1; return -1;
again: again:
;
} }
return count; return count;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment