This patch fixes several WebStone-1.1 portability problems and other deficiencies: - rcp no longer takes the non-portable option -v - port number is passed (from testbed) to webmaster - default host target is now SUNOS (not a bug) - gettimeofday now calls my_gettimeofday which maps to one or two argument gettimeofday's - webclient is placed in /tmp rather than /usr/local/bin - rexec is replaced with rsh (which is assumed to run without prompting for a password) Changes by John Heidemann , September 1997, for USC CSci 558. ---------------------------------------------------------------------- diff -ru WebStone-1.1-pure/bin/distribute WebStone-1.1/bin/distribute --- WebStone-1.1-pure/bin/distribute Thu Nov 9 17:57:50 1995 +++ WebStone-1.1/bin/distribute Tue Sep 30 17:22:44 1997 @@ -4,5 +4,7 @@ for i in $CLIENTHOSTS do - rcp -v webclient $i:/usr/local/bin + echo $i rcp webclient $i:/tmp + rsh $i rm -f /tmp/webclient + rcp webclient $i:/tmp done diff -ru WebStone-1.1-pure/bin/genfiles WebStone-1.1/bin/genfiles --- WebStone-1.1-pure/bin/genfiles Thu Nov 9 17:57:50 1995 +++ WebStone-1.1/bin/genfiles Fri Sep 26 11:27:04 1997 @@ -34,7 +34,7 @@ files=`cat $WEBSTONEROOT/conf/fileset | cut -f2 -d' '` for f in $files do - rcp -v $f $SERVER:$WEBDOCDIR + rcp $f $SERVER:$WEBDOCDIR rm -f $f done diff -ru WebStone-1.1-pure/bin/runbench WebStone-1.1/bin/runbench --- WebStone-1.1-pure/bin/runbench Thu Nov 9 17:57:51 1995 +++ WebStone-1.1/bin/runbench Fri Sep 26 18:11:50 1997 @@ -120,7 +120,7 @@ # Run benchmark # date - CMD="$WEBSTONEROOT/bin/webmaster $DEBUG -w $SERVER -u $TMPDIR/filelist -f $TMPDIR/config -t $TIMEPERRUN " + CMD="$WEBSTONEROOT/bin/webmaster $DEBUG -w $SERVER -u $TMPDIR/filelist -f $TMPDIR/config -t $TIMEPERRUN -p $PORTNO " echo $CMD $CMD | tee $LOGDIR/run diff -ru WebStone-1.1-pure/conf/testbed WebStone-1.1/conf/testbed --- WebStone-1.1-pure/conf/testbed Thu Nov 9 17:57:59 1995 +++ WebStone-1.1/conf/testbed Fri Sep 26 17:37:11 1997 @@ -1,23 +1,23 @@ ### BENCHMARK PARAMETERS -- EDIT THESE AS REQUIRED -ITERATIONS="3" +ITERATIONS="2" MINCLIENTS="8" -MAXCLIENTS="128" +MAXCLIENTS="48" CLIENTINCR="8" -TIMEPERRUN="30" +TIMEPERRUN="10" ### SERVER PARAMETERS -- EDIT AS REQUIRED -SERVER="www" -PORTNO=80 +SERVER="mug" +PORTNO=8080 SERVERINFO=hinv -OSTUNINGFILES="/var/sysgen/master.d/bsd" -WEBSERVERDIR="/usr/ns-home" -WEBDOCDIR="$WEBSERVERDIR/docs" -WEBSERVERTUNINGFILES="$WEBSERVERDIR/httpd-80/config/magnus.conf $WEBSERVERDIR/httpd-80/config/obj.conf" +OSTUNINGFILES="/usr/bin/true" +WEBSERVERDIR="/nfs/u3/johnh/USC/CS558_FALL97/HTTP_LAB/apache_1.2.4" +WEBDOCDIR="$WEBSERVERDIR/htdocs" +WEBSERVERTUNINGFILES="/usr/bin/true" # WE NEED AN ACCOUNT WITH A FIXED PASSWORD, SO WE CAN REXEC # THE WEBSTONE CLIENTS -CLIENTS="webstone1 webstone2 webstone3 webstone4 webstone5" -CLIENTACCOUNT=guest +CLIENTS="keg ale" +CLIENTACCOUNT=johnh CLIENTPASSWORD=guest CLIENTINFO=hinv TMPDIR=/tmp diff -ru WebStone-1.1-pure/src/Makefile WebStone-1.1/src/Makefile --- WebStone-1.1-pure/src/Makefile Thu Nov 9 17:58:02 1995 +++ WebStone-1.1/src/Makefile Fri Sep 26 18:04:31 1997 @@ -9,7 +9,7 @@ # SOLARIS Solaris 2.x, aka SunOS 5.x # AIX IBM AIX # -OS = IRIX +OS = SUNOS DYNAMICDEFS = -DMCC_HTTPD -DXP_UNIX @@ -17,7 +17,7 @@ LD_SHAREDCMD = ld -shared -CC = cc +CC = gcc BINDIR = ../bin @@ -38,7 +38,7 @@ #For Solaris 2.x, remove the comment from the following line #LIBS = -lm -lnsl -lsocket -OPTIMIZATION = -O +OPTIMIZATION = -g CFLAGS = $(OPTIMIZATION) -ansi -D$(OS) $(DYNAMICDEFS) $(INCLUDEDIRS) MASTEROBJS = webmaster.o $(MASTERSRCS:.c=.o) diff -ru WebStone-1.1-pure/src/get.c WebStone-1.1/src/get.c --- WebStone-1.1-pure/src/get.c Thu Nov 9 17:58:03 1995 +++ WebStone-1.1/src/get.c Fri Sep 26 17:54:02 1997 @@ -67,7 +67,7 @@ char readbuffer[READBUFSIZ]; char outputfilename[MAXPATHLEN]; - if(gettimeofday(&timer->entertime) != 0) + if(my_gettimeofday(&timer->entertime) != 0) { return(returnerr("Error retrieving entertime\n")); } @@ -77,8 +77,9 @@ sprintf(getcommand, "%s%s%s%s", "GET ", url, " HTTP/1.0\r\n", ACCEPT_COMMAND); - if(gettimeofday(&timer->beforeconnect) != 0) + if(my_gettimeofday(&timer->beforeconnect) != 0) { + perror(""); return(returnerr("Error retrieving beforeconnect\n")); } @@ -92,7 +93,7 @@ strerror(errno))); } - if(gettimeofday(&timer->afterconnect) != 0) + if(my_gettimeofday(&timer->afterconnect) != 0) { return(returnerr("Error retrieving afterconnect\n")); } @@ -113,7 +114,7 @@ * WE HAVE NOW SENT THE REQUEST SUCCESSFULLY. * WAIT FOR THE REPLY AND FIND THE HEADER */ - if(gettimeofday(&timer->beforeheader) != 0) + if(my_gettimeofday(&timer->beforeheader) != 0) { return(returnerr("Error retrieving beforeheader\n")); } @@ -210,7 +211,7 @@ } /*while(index < numbytesread)*/ } - if(gettimeofday(&timer->afterheader) != 0) + if(my_gettimeofday(&timer->afterheader) != 0) { return(returnerr("Error retrieving afterheader\n")); } @@ -267,7 +268,7 @@ bodylength = totalbytesread - index; /* done with the body */ - if(gettimeofday(&timer->afterbody) != 0) + if(my_gettimeofday(&timer->afterbody) != 0) { return(returnerr("Error retrieving afterbody\n")); } @@ -281,7 +282,7 @@ D_PRINTF "Read %d bytes, %d of that being body\n", totalbytesread, bodylength D_FLUSH; - if(gettimeofday(&timer->exittime) != 0) + if(my_gettimeofday(&timer->exittime) != 0) { D_PRINTF "Error retrieving exit time: %s\n", strerror(errno) D_FLUSH; return(returnerr("Error retrieving exit time\n")); diff -ru WebStone-1.1-pure/src/sysdep.c WebStone-1.1/src/sysdep.c --- WebStone-1.1-pure/src/sysdep.c Thu Nov 9 17:58:07 1995 +++ WebStone-1.1/src/sysdep.c Fri Sep 26 17:55:03 1997 @@ -12,6 +12,8 @@ /* Sun OS */ #ifdef SUNOS +#include + extern int sys_nerr; extern char *sys_errlist[]; extern int errno; @@ -26,3 +28,24 @@ } #endif /* SunOS */ + + +#ifdef SGI +#include +#include + +int +my_gettimeofday(struct timeval *tv) +{ + return gettimeofday(tv); +} +#else +#include +#include + +int +my_gettimeofday(struct timeval *tv) +{ + return gettimeofday(tv, NULL); +} +#endif diff -ru WebStone-1.1-pure/src/webclient.c WebStone-1.1/src/webclient.c --- WebStone-1.1-pure/src/webclient.c Thu Nov 9 17:58:04 1995 +++ WebStone-1.1/src/webclient.c Fri Sep 26 17:54:12 1997 @@ -736,7 +736,7 @@ /* GET START TIME, ZERO LOOP COUNTER */ loopcnt = 0; - gettimeofday(&(timestat.starttime)); + my_gettimeofday(&(timestat.starttime)); /* LOOP UNTIL WE HIT numloops, OR WE RUN OUT OF TIME */ while((loopcnt < numloops) && !(timeexpired)) @@ -801,7 +801,7 @@ } /* END if TIME'S UP */ } /* END while loopcnt */ - gettimeofday(&(timestat.endtime)); + my_gettimeofday(&(timestat.endtime)); D_PRINTF "Time's up\n" D_FLUSH; signal(SIGALRM, NULL); diff -ru WebStone-1.1-pure/src/webmaster.c WebStone-1.1/src/webmaster.c --- WebStone-1.1-pure/src/webmaster.c Thu Nov 9 17:58:05 1995 +++ WebStone-1.1/src/webmaster.c Fri Sep 26 18:16:11 1997 @@ -30,7 +30,7 @@ #include "debug.h" #include "sysdep.h" -#define PROGPATH "/usr/local/bin/webclient" +#define PROGPATH "/tmp/webclient" #define NCCARGS 4096 #define MAXCLIENTS 256 #define MAXUSERNAME 9 @@ -186,6 +186,26 @@ return(0); } +int +my_rexec(char **hostname_p, int port, char *login, char *password, + char *cmdline, int *fd2p) +{ + char cmd[2048]; + FILE *rsh_f; + int e; + + sprintf(cmd, "rsh -n -l %s %s %s", login, *hostname_p, cmdline); + /* printf ("my_rexec: %s\n", cmd); */ + rsh_f = popen(cmd, "r"); + if (!rsh_f) { + fprintf(stderr, "my_rexec: rsh failed.\n"); + return -1; + } else { + /* printf ("\tfileno=%d\n", fileno(rsh_f)); */ + return fileno(rsh_f); + }; +} + void main(const int argc, char *argv[]) { @@ -514,7 +534,7 @@ D_PRINTF "%s rexec %s\n",tmphostname,tmpcommandline D_FLUSH; - if((tmpfd = rexec(&tmphostname,inetport->s_port,login,password, + if((tmpfd = my_rexec(&tmphostname,inetport->s_port,login,password, tmpcommandline,0)) < 0) { errexit("Could not rexec: rexec to client %s, cmdline %s failed\n",