<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">	Roll in some patches from NetBSD's hbench package:
		- minor modernizations and fixes
		- recognize DragonFlyBSD

	Fix for mhz, from Chris Gilbert of NetBSD:

	   Fiz mhz calculation for arm.  It seems gcc has become
	   intelligent enough to optimize away the loop used for
	   timing.  Do something in the loop for arm that can't be
	   optimized away, and will also meet the 1,000 instructions
	   in the loop requirement.

	   This allows mhz to calculate sensible Mhz on a StrongArm
	   (228Mhz rather than 56Mhz)

	   Other hardware probably also need fixing, as gcc probably
	   applies the same optimizations on them.

	I have enabled this logic as the default for all processors,
	not just arm. I also had to add volatile to the loop counter
	to keep gcc from optimizing away the loop. Now I at least
	get the right order of magnitude result on my amd64 machine
	rather than 4 terahertz.

	Do some hacking to get something like a clean compile with
	gcc -Wall. This includes:
	   - declare all args present in K&amp;R function definitions
	   - make sure all function definitions have a return type
	   - declare functions before calling them
	   - fix some signed/unsigned comparison problems
	   - fix some printf formats to match their argument types
	   - fix some printf calls that were missing arguments
	   - use long instead of int in some cases for 64-bit cleanliness
	   - call execlp correctly in lat_proc.c
	   - move a few decls of things used within ifdefs into ifdefs
	   - delete a few unused variables
	   - add missing standard headers
	   - use socklen_t where needed
	   - add &lt;rpc/rpc.h&gt; where needed

	Fix some macros that were trying to stringize with double quotes.

	I have not moved the code to C89, because I know the original
	motivation for writing it K&amp;R-style and keeping it that way
	was so it would build and run on ancient Buggix-type platforms
	with equally ancient compilers. This is probably still true,
	even though the number of such platforms has dwindled.

	Note: for such platforms the build will fail on socklen_t. For
	all such platforms I know of it's safe to add -Dsocklen_t=int
	to CFLAGS. If that doesn't work, try unsigned long.

	In gen_iterations, bail out if we exceed the maximum number of
	iterations that the iteration variable can count, instead of
	going into an infinite loop. While this *shouldn't* happen, it
	*can* happen if some compiler optimizes away the test loop.

	- dholland 20110912

diff -r 0a2df15eaa54 -r 407fec8af34b scripts/interactive-setup
--- a/scripts/interactive-setup	Mon Sep 12 03:41:35 2011 -0400
+++ b/scripts/interactive-setup	Mon Sep 12 06:25:57 2011 -0400
@@ -44,8 +44,8 @@
 TESTFILE=full.test
 NRUNS=10
 RAWDISK=none
-SCRATCHFILE=/usr/tmp/XXX
-SCRATCHDIR=/usr/tmp
+SCRATCHFILE=/var/tmp/XXX
+SCRATCHDIR=/var/tmp
 REMOTE=""
 NETWORKS=""
 PLAINBINDIR=
diff -r 0a2df15eaa54 -r 407fec8af34b src/Makefile
--- a/src/Makefile	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/Makefile	Mon Sep 12 06:25:57 2011 -0400
@@ -114,7 +114,7 @@
 #####################################
 
 # The following don't need special handling.
-freebsd netbsd openbsd sunos linux:
+dragonfly freebsd netbsd netbsdelf openbsd sunos linux:
 	@$(MAKE) binaries
 
 bsdi:
diff -r 0a2df15eaa54 -r 407fec8af34b src/bench.h
--- a/src/bench.h	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bench.h	Mon Sep 12 06:25:57 2011 -0400
@@ -66,6 +66,8 @@
 void	ptime();
 void	tvsub();
 
+void	timeit();
+
 /*
  * Generated from msg.x which is included here:
 
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_bzero.c
--- a/src/bw_bzero.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_bzero.c	Mon Sep 12 06:25:57 2011 -0400
@@ -53,6 +53,7 @@
 
 int
 main(ac, av)
+	int ac;
         char  **av;
 {
 	unsigned int	niter;
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_file_rd.c
--- a/src/bw_file_rd.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_file_rd.c	Mon Sep 12 06:25:57 2011 -0400
@@ -42,6 +42,7 @@
 
 #include &lt;unistd.h&gt;
 #include &lt;stdlib.h&gt;
+#include &lt;fcntl.h&gt;
 
 #define	CHK(x)		if ((int)(x) == -1) { perror("x"); exit(1); }
 #define	MIN(a, b)	((a) &lt; (b) ? (a) : (b))
@@ -154,7 +155,7 @@
 	start();		/* start the clocks */
 	while (size &gt; 0) {
 		CHK(n = read(fd, buf, bufsize));
-		if (n &lt; bufsize) {
+		if ((unsigned)n &lt; bufsize) {
 			break;
 		}
 		for (p=(unsigned int*)buf, j=bufsize/1024; j &gt; 0; j--) {
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_mem_cp.c
--- a/src/bw_mem_cp.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_mem_cp.c	Mon Sep 12 06:25:57 2011 -0400
@@ -73,7 +73,9 @@
 
 void	unrolled();
 
+int
 main(ac, av)
+	int ac;
         char  **av;
 {
 	unsigned int	niter;
@@ -112,7 +114,7 @@
 		xferred = (16*SIZE) * (bytes / (16 * SIZE));
 	if (xferred == 0) {
 		fprintf(stderr, "error: buffer size too small: must be at "
-			"least %d bytes.\n",16*SIZE);
+			"least %lu bytes.\n",16*SIZE);
 		printf("&lt;error&gt;\n");
 		exit(1);
 	}
@@ -235,7 +237,7 @@
 	 * read/write bandwidths are measured, so we get
 	 * consistant/comparable numbers by using array-indexing.
 	 */
-	while (numbytes &gt;= 16 * SIZE) {
+	while (numbytes &gt;= (int)(16 * SIZE)) {
 		dst[0] = src[0];
 		dst[1] = src[1];
 		dst[2] = src[2];
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_mem_rd.c
--- a/src/bw_mem_rd.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_mem_rd.c	Mon Sep 12 06:25:57 2011 -0400
@@ -62,6 +62,7 @@
 
 int
 main(ac, av)
+	int ac;
         char  **av;
 {
 	unsigned int	niter;
@@ -89,7 +90,7 @@
 	xferred = (200*SIZE)*((((bytes/SIZE)-200)+199)/200);
 	if (xferred == 0) {
 		fprintf(stderr, "error: buffer size too small: must be at "
-			"least %d bytes.\n",201*SIZE);
+			"least %lu bytes.\n",201*SIZE);
 		printf("&lt;error&gt;\n");
 		exit(1);
 	}
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_mem_wr.c
--- a/src/bw_mem_wr.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_mem_wr.c	Mon Sep 12 06:25:57 2011 -0400
@@ -63,6 +63,7 @@
 
 int
 main(ac, av)
+	int ac;
         char  **av;
 {
 	unsigned int	niter;
@@ -90,7 +91,7 @@
 	xferred = (200*SIZE)*((((bytes/SIZE)-200)+199)/200);
 	if (xferred == 0) {
 		fprintf(stderr, "error: buffer size too small: must be at "
-			"least %d bytes.\n",201*SIZE);
+			"least %lu bytes.\n",201*SIZE);
 		printf("&lt;error&gt;\n");
 		exit(1);
 	}
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_mmap_rd.c
--- a/src/bw_mmap_rd.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_mmap_rd.c	Mon Sep 12 06:25:57 2011 -0400
@@ -50,6 +50,7 @@
 
 #include &lt;sys/mman.h&gt;
 #include &lt;sys/stat.h&gt;
+#include &lt;fcntl.h&gt;
 
 /*
  * Use unsigned int: supposedly the "optimal" transfer size for a given 
@@ -62,7 +63,13 @@
 #define	SIZE	sizeof(TYPE)
 #endif
 
+#ifdef __STDC__
 #define	CHK(x)		if ((int)(x) == -1) { perror("x"); exit(1); }
+#define	CHKP(x)		if ((long)(x) == -1) { perror("x"); exit(1); }
+#else
+#define	CHK(x)		if ((int)(x) == -1) { perror(#x); exit(1); }
+#define	CHKP(x)		if ((long)(x) == -1) { perror(#x); exit(1); }
+#endif
 
 /* 
  * The worker function. We don't really need it here; it is just to make 
@@ -79,6 +86,7 @@
 unsigned int 	bytes;		/* the number of bytes to be read */
 int		fd;		/* file descriptor of open file */
 
+int
 main(ac, av)
 	int ac;
 	char **av;
@@ -105,7 +113,7 @@
 	CHK(fstat(fd, &amp;sbuf));
 	if (bytes &gt; sbuf.st_size) {
 		fprintf(stderr, "%s: is too small; %d bytes requested but only"
-			" %d available\n", av[3], bytes, sbuf.st_size);
+			" %ld available\n", av[3], bytes, (long)sbuf.st_size);
 		exit(1);
 	}
 
@@ -116,7 +124,7 @@
 	xferred = (200*SIZE)*((((bytes/SIZE)-200)+199)/200);
 	if (xferred == 0) {
 		fprintf(stderr, "error: buffer size too small: must be at "
-			"least %d bytes.\n",201*SIZE);
+			"least %lu bytes.\n",201*SIZE);
 		printf("&lt;error&gt;\n");
 		exit(1);
 	}
@@ -173,10 +181,10 @@
 
 	/* Try to map in the file */
 #ifdef MAP_FILE
-	CHK(where = (TYPE *)mmap(0, bytes, PROT_READ, MAP_FILE|MAP_SHARED, 
+	CHKP(where = (TYPE *)mmap(0, bytes, PROT_READ, MAP_FILE|MAP_SHARED, 
 				 fd, 0));
 #else
-	CHK(where = (TYPE *)mmap(0, bytes, PROT_READ, MAP_SHARED, fd, 0));
+	CHKP(where = (TYPE *)mmap(0, bytes, PROT_READ, MAP_SHARED, fd, 0));
 #endif
 	p = where;
 	
@@ -193,10 +201,10 @@
 	for (i = num_iter; i &gt; 0; i--) {
 		munmap((char *)where, bytes);
 #ifdef MAP_FILE
-		CHK(where = (TYPE *)mmap(0, bytes, PROT_READ, 
+		CHKP(where = (TYPE *)mmap(0, bytes, PROT_READ, 
 					 MAP_FILE|MAP_SHARED, fd, 0));
 #else
-		CHK(where = (TYPE *)mmap(0, bytes, PROT_READ, MAP_SHARED, 
+		CHKP(where = (TYPE *)mmap(0, bytes, PROT_READ, MAP_SHARED, 
 					 fd, 0));
 #endif
 		start();
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_pipe.c
--- a/src/bw_pipe.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_pipe.c	Mon Sep 12 06:25:57 2011 -0400
@@ -38,6 +38,8 @@
 
 #include "common.c"
 
+#include &lt;sys/wait.h&gt;
+
 extern	void	exit();		/* for lint on SunOS 4.x */
 void		writer(), reader();
 
diff -r 0a2df15eaa54 -r 407fec8af34b src/bw_tcp.c
--- a/src/bw_tcp.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/bw_tcp.c	Mon Sep 12 06:25:57 2011 -0400
@@ -49,6 +49,8 @@
 #include "common.c"
 #include "lib_tcp.c"
 
+#include &lt;sys/wait.h&gt;
+
 /* 
  * General philosophy for getting reproducible numbers: we transfer
  * data in multiples of the user-supplied buffer size until the data
@@ -63,6 +65,9 @@
 /* The worker function */
 int 	do_client(int num_iter, clk_t *time);
 
+void	server_main();
+void	absorb();
+
 /*
  * Global variables: these are the parameters required by the worker routine.
  * We make them global to avoid portability problems with variable argument
@@ -78,7 +83,6 @@
 {
 	unsigned int	niter;
 	clk_t		totaltime;
-	unsigned int	xferred;
 
 	/* print out RCS ID to stderr*/
 	fprintf(stderr, "%s", id);
@@ -167,11 +171,12 @@
 	 * unsigned int bufsize;
 	 * char		*rhostname;
 	 */
-	char    *buf, *obuf;
+	char    *buf;
 	int     data, control;
 	int     c;
 	int     bytes;
 #ifdef EVENT_COUNTERS
+	char	*obuf;
 	eventcounter_t c0, c1;
 #endif
 
@@ -193,7 +198,7 @@
 	control = tcp_connect(rhostname, TCP_CONTROL, SOCKOPT_NONE);
 	data = tcp_connect(rhostname, TCP_DATA, SOCKOPT_WRITE);
 	(void)sprintf(buf, "%d", bytes);
-	if (write(control, buf, strlen(buf)) != strlen(buf)) {
+	if (write(control, buf, strlen(buf)) != (ssize_t)strlen(buf)) {
 		perror("control write");
 		exit(1);
 	}
@@ -262,6 +267,7 @@
 	signal(SIGCHLD, child);
 }
 
+void
 server_main()
 {
 	int	data, control, newdata, newcontrol;
@@ -295,7 +301,9 @@
  * Read that many bytes on the data socket.
  * Write the performance results on the control socket.
  */
+void
 absorb(control, data)
+	int control, data;
 {
 	int	nread, save, nbytes;
 	char	*buf = valloc(bufsize);
diff -r 0a2df15eaa54 -r 407fec8af34b src/hello.c
--- a/src/hello.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/hello.c	Mon Sep 12 06:25:57 2011 -0400
@@ -1,4 +1,8 @@
+#include &lt;stdio.h&gt;
+
+int
 main()
 {
 	printf("Hello world.\n");
+	return 0;
 }
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_connect.c
--- a/src/lat_connect.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_connect.c	Mon Sep 12 06:25:57 2011 -0400
@@ -47,6 +47,8 @@
 /* Worker function */
 int do_client();
 
+void server_main();
+
 /*
  * Global variables: these are the parameters required by the worker routine.
  * We make them global to avoid portability problems with variable argument
@@ -61,7 +63,6 @@
 {
 	clk_t		totaltime;
 	unsigned int	niter;
-	int i;
 
 	/* print out RCS ID to stderr*/
 	fprintf(stderr, "%s", id);
@@ -156,8 +157,7 @@
 	 * char		*server;
 	 */
 	int     sock;
-	int	i, tmp;
-	char	c = 65;
+	int	i;
 
 	start();		/* start the clocks */
 	for (i = num_iter; i &gt; 0; i--) {
@@ -169,7 +169,9 @@
 	return (0);
 }
 
+void
 server_main(ac, av)
+	int ac;
 	char  **av;
 {
 	int     newsock, sock;
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_ctx.c
--- a/src/lat_ctx.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_ctx.c	Mon Sep 12 06:25:57 2011 -0400
@@ -39,6 +39,7 @@
 
 #include "common.c"
 #include &lt;sys/mman.h&gt;
+#include &lt;sys/wait.h&gt;
 #include &lt;fcntl.h&gt;
 
 #define MAX_PROCS		128
@@ -90,7 +91,7 @@
 	
 	if (nprocs &gt; MAX_PROCS) {
 		fprintf(stderr, "%s: maximum number of processes (%d) "
-			"exceeded\n",MAX_PROCS);
+			"exceeded\n", av[0], MAX_PROCS);
 		exit(1);
 	}
 
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_ctx2.c
--- a/src/lat_ctx2.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_ctx2.c	Mon Sep 12 06:25:57 2011 -0400
@@ -39,6 +39,7 @@
 
 #include "common.c"
 #include &lt;sys/mman.h&gt;
+#include &lt;sys/wait.h&gt;
 #include &lt;fcntl.h&gt;
 
 #define MAX_PROCS		128
@@ -90,7 +91,7 @@
 	
 	if (nprocs &gt; MAX_PROCS) {
 		fprintf(stderr, "%s: maximum number of processes (%d) "
-			"exceeded\n",MAX_PROCS);
+			"exceeded\n", av[0], MAX_PROCS);
 		exit(1);
 	}
 
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_fs.c
--- a/src/lat_fs.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_fs.c	Mon Sep 12 06:25:57 2011 -0400
@@ -42,6 +42,7 @@
 
 #include "common.c"
 #include &lt;stdlib.h&gt;
+#include &lt;fcntl.h&gt;
 #include &lt;sys/time.h&gt;
 
 /* Worker function */
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_fslayer.c
--- a/src/lat_fslayer.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_fslayer.c	Mon Sep 12 06:25:57 2011 -0400
@@ -39,6 +39,7 @@
 char	*id = "$Id: lat_fslayer.c,v 1.1.1.1 2003/02/28 17:19:52 fedorova Exp $\n";
 
 #include "common.c"
+#include &lt;fcntl.h&gt;
 
 /* Worker function */
 int do_syscall();
@@ -50,6 +51,7 @@
  */
 int	fd;			/* file descriptor of /dev/null */
 
+int
 main(ac, av)
 	int ac;
 	char  **av;
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_mem_rd.c
--- a/src/lat_mem_rd.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_mem_rd.c	Mon Sep 12 06:25:57 2011 -0400
@@ -44,6 +44,7 @@
 #include	&lt;fcntl.h&gt;
 
 int 	do_loads();
+int	step();
 
 #if !defined(FILENAME_MAX) || FILENAME_MAX &lt; 255
 #undef FILENAME_MAX
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_mmap.c
--- a/src/lat_mmap.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_mmap.c	Mon Sep 12 06:25:57 2011 -0400
@@ -43,8 +43,13 @@
 
 #include &lt;sys/stat.h&gt;
 #include &lt;sys/mman.h&gt;
+#include &lt;fcntl.h&gt;
 
+#ifdef __STDC__
+#define	CHK(x)		if ((int)(x) == -1) { perror(#x); exit(1); }
+#else
 #define	CHK(x)		if ((int)(x) == -1) { perror("x"); exit(1); }
+#endif
 
 /* Worker function */
 int do_mmap();
@@ -139,7 +144,7 @@
 #else
 		where = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
 #endif
-		if ((int)where == -1) {
+		if (where == (char *)-1) {
 			perror("mmap");
 			exit(1);
 		}
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_pagefault.c
--- a/src/lat_pagefault.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_pagefault.c	Mon Sep 12 06:25:57 2011 -0400
@@ -16,9 +16,15 @@
 #include &lt;sys/stat.h&gt;
 #include &lt;sys/mman.h&gt;
 
+#ifdef __STDC__
+#define	CHK(x)	if ((x) == -1) { perror(#x); exit(1); }
+#else
 #define	CHK(x)	if ((x) == -1) { perror("x"); exit(1); }
+#endif
 
+int
 main(ac, av)
+	int ac;
 	char **av;
 {
 #ifdef	MS_INVALIDATE
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_proc.c
--- a/src/lat_proc.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_proc.c	Mon Sep 12 06:25:57 2011 -0400
@@ -38,6 +38,8 @@
 
 #include	"common.c"
 
+#include &lt;sys/wait.h&gt;
+
 #define	PROG_S "/tmp/hello-s"
 #define	PROG "/tmp/hello"
 
@@ -216,7 +218,7 @@
 		    case 0:	/* child */
 			close(1);
 		    	execlp("/bin/sh", "sh", "-c", 
-			       (dynamic ? PROG : PROG_S), 0);
+			       (dynamic ? PROG : PROG_S), (void *)NULL);
 			exit(1);
 
 		    default:
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_rpc.c
--- a/src/lat_rpc.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_rpc.c	Mon Sep 12 06:25:57 2011 -0400
@@ -48,6 +48,8 @@
 /* Worker functions */
 int do_client();
 
+void server_main();
+
 /*
  * Global variables: these are the parameters required by the worker routine.
  * We make them global to avoid portability problems with variable argument
@@ -150,7 +152,7 @@
 	char	c;
 	char	*resp;
 	struct	timeval tv;
-	char	*server;
+	char	*server = "???"; /* XXX this is never set */
 	char 	*proto;
 
 	proto = (protocol == NULL ? "udp" : protocol);
@@ -220,6 +222,7 @@
 
 static void xact_prog_1();
 
+void
 server_main()
 {
 	register SVCXPRT *transp;
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_syscall.c
--- a/src/lat_syscall.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_syscall.c	Mon Sep 12 06:25:57 2011 -0400
@@ -43,6 +43,7 @@
 #include &lt;sys/resource.h&gt;
 #include &lt;string.h&gt;
 #include &lt;stdlib.h&gt;
+#include &lt;fcntl.h&gt;
 
 /* Worker functions */
 int do_sigaction();
@@ -61,6 +62,7 @@
  */
 int	fd;			/* file descriptor of /dev/null */
 
+int
 main(ac, av)
 	int ac;
 	char  **av;
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_tcp.c
--- a/src/lat_tcp.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_tcp.c	Mon Sep 12 06:25:57 2011 -0400
@@ -42,8 +42,12 @@
 #include "common.c"
 #include "lib_tcp.c"
 
+#include &lt;sys/wait.h&gt;
+
 /* Worker functions */
 int do_client();
+void server_main();
+void doserver();
 
 /*
  * Global variables: these are the parameters required by the worker routine.
@@ -169,11 +173,13 @@
 
 void
 child(unused)
+	int unused;
 {
 	wait(0);
 	signal(SIGCHLD, child);
 }
 
+void
 server_main()
 {
 	int     newsock, sock;
@@ -198,7 +204,9 @@
 	/* NOTREACHED */
 }
 
+void
 doserver(sock)
+	int sock;
 {
 	char    c;
 	int	n = 0;
diff -r 0a2df15eaa54 -r 407fec8af34b src/lat_udp.c
--- a/src/lat_udp.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lat_udp.c	Mon Sep 12 06:25:57 2011 -0400
@@ -41,8 +41,10 @@
 
 #include "common.c"
 #include "lib_udp.c"
+
 /* Worker functions */
 int do_client();
+void server_main();
 
 /*
  * Global variables: these are the parameters required by the worker routine.
@@ -183,10 +185,12 @@
 	return (0);
 }
 
+void
 server_main()
 {
-	int     sock, sent, namelen, seq = 0;
+	int     sock, sent, seq = 0;
 	struct sockaddr it;
+	socklen_t namelen;
 
 	GO_AWAY;
 
diff -r 0a2df15eaa54 -r 407fec8af34b src/lib_tcp.c
--- a/src/lib_tcp.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lib_tcp.c	Mon Sep 12 06:25:57 2011 -0400
@@ -9,10 +9,14 @@
 #include	&lt;netinet/in.h&gt;
 #include	&lt;netdb.h&gt;
 #include	&lt;arpa/inet.h&gt;
+#include	&lt;rpc/rpc.h&gt;
 
-/* #define	LIBTCP_VERBOSE	/**/
+#if 0
+#define	LIBTCP_VERBOSE	/**/
+#endif
 
 u_short	pmap_getport();
+void sock_optimize();
 
 /*
  * Get a TCP socket, bind it, figure out the port,
@@ -25,8 +29,9 @@
 	u_long	prog;
 	int	rdwr;
 {
-	int	sock, namelen;
+	int	sock;
 	struct	sockaddr_in s;
+	socklen_t namelen;
 
 	if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) &lt; 0) {
 		perror("socket");
@@ -68,6 +73,7 @@
 /*
  * Unadvertise the socket
  */
+int
 tcp_done(prog)
 	u_long	prog;
 {
@@ -80,11 +86,13 @@
 /*
  * Accept a connection and return it
  */
+int
 tcp_accept(sock, rdwr)
 	int	sock, rdwr;
 {
 	struct	sockaddr_in s;
-	int	newsock, namelen;
+	int	newsock;
+	socklen_t namelen;
 
 	namelen = sizeof(s);
 	bzero((char*)&amp;s, namelen);
@@ -116,6 +124,7 @@
  * about 4000 usecs in loopback lat_connect calls.  I suppose we
  * should time gethostbyname() &amp; pmap_getprot(), huh?
  */
+int
 tcp_connect(host, prog, rdwr)
 	char	*host;
 	u_long	prog;
@@ -126,7 +135,10 @@
 	static	u_short	save_port;
 	static	u_long save_prog;
 	static	char *save_host;
-	int	sock, namelen;
+	int	sock;
+#ifdef	LIBTCP_VERBOSE
+	socklen_t namelen;
+#endif
 
 	if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) &lt; 0) {
 		perror("socket");
@@ -183,7 +195,9 @@
 /*
  * This is identical in lib_tcp.c and lib_udp.c
  */
+void
 sock_optimize(sock, rdwr)
+	int sock, rdwr;
 {
 	if (rdwr == SOCKOPT_READ || rdwr == SOCKOPT_RDWR) {
 		int	sockbuf = SOCKBUF;
diff -r 0a2df15eaa54 -r 407fec8af34b src/lib_udp.c
--- a/src/lib_udp.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/lib_udp.c	Mon Sep 12 06:25:57 2011 -0400
@@ -11,6 +11,9 @@
 #include	&lt;netinet/in.h&gt;
 #include	&lt;netdb.h&gt;
 #include	&lt;arpa/inet.h&gt;
+#include	&lt;rpc/rpc.h&gt;
+
+void sock_optimize();
 
 /*
  * Get a UDP socket, bind it, figure out the port,
@@ -18,11 +21,14 @@
  *
  * XXX - it would be nice if you could advertise ascii strings.
  */
+int
 udp_server(prog, rdwr)
 	u_long	prog;
+	int rdwr;
 {
-	int	sock, namelen;
+	int	sock;
 	struct	sockaddr_in s;
+	socklen_t namelen;
 
 	if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) &lt; 0) {
 		perror("socket");
@@ -57,7 +63,9 @@
 /*
  * Unadvertise the socket
  */
+void
 udp_done(prog)
+	u_long prog;
 {
 	(void)pmap_unset((u_long)prog, (u_long)1);
 }
@@ -66,9 +74,11 @@
  * "Connect" to the UCP socket advertised as "prog" on "host" and
  * return the connected socket.
  */
+int
 udp_connect(host, prog, rdwr)
 	char	*host;
 	u_long	prog;
+	int rdwr;
 {
 	struct hostent *h;
 	struct sockaddr_in sin;
@@ -108,7 +118,9 @@
 /*
  * This is identical in lib_tcp.c and lib_udp.c
  */
+void
 sock_optimize(sock, rdwr)
+	int sock, rdwr;
 {
 	if (rdwr == SOCKOPT_READ || rdwr == SOCKOPT_RDWR) {
 		int	sockbuf = SOCKBUF;
diff -r 0a2df15eaa54 -r 407fec8af34b src/memsize.c
--- a/src/memsize.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/memsize.c	Mon Sep 12 06:25:57 2011 -0400
@@ -38,13 +38,21 @@
 
 #include "common.c"
 
+#ifdef __STDC__
+#define	CHK(x)	if ((x) == -1) { perror(#x); exit(1); }
+#else
 #define	CHK(x)	if ((x) == -1) { perror("x"); exit(1); }
+#endif
 
 #ifndef	TOO_LONG
 #define	TOO_LONG	10	/* usecs */
 #endif
 
+void touch();
+
+int
 main(ac, av)
+	int ac;
 	char **av;
 {
 	char	*where;
@@ -91,13 +99,15 @@
 	exit(0);
 }
 
+void
 timeit(where, size)
 	char	*where;
+	size_t size;
 {
 	clk_t	lat = (clk_t) 0;
 	int	n;
 	char	*end = where + size;
-	int	range;
+	size_t	range;
 
 	if (size &lt; 1024*1024 - 16*1024) {
 		fprintf(stderr, "Bad size\n");
@@ -113,16 +123,17 @@
 		n = range / 4096;
 		if ((lat / n) &gt; (clk_t)((float)TOO_LONG / clock_multiplier)) {
 			fprintf(stderr, "\n");
-			printf("%d\n", (range&gt;&gt;20) - 1);
+			printf("%lu\n", (range&gt;&gt;20) - 1);
 			exit(0);
 		}
-		fprintf(stderr, "%dMB OK\r", range/(1024*1024));
+		fprintf(stderr, "%luMB OK\r", range/(1024*1024));
 	}
 	fprintf(stderr, "\n");
-	printf("%d\n", (size&gt;&gt;20));
+	printf("%lu\n", (size&gt;&gt;20));
 }
 
-touch(char *p, char *end, int range)
+void
+touch(char *p, char *end, ssize_t range)
 {
 	char	*tmp = p;
 
diff -r 0a2df15eaa54 -r 407fec8af34b src/mhz.c
--- a/src/mhz.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/mhz.c	Mon Sep 12 06:25:57 2011 -0400
@@ -122,7 +122,7 @@
 #	ifdef _AIX	/* really for the rs6000 only */
 #		define	FOUR	a++; a++;
 #	else
-#		define	FOUR	a++; a++; a++; a++;
+#		define	FOUR	a++; a &gt;&gt;= 1; a++; a &gt;&gt;= 1;
 #	endif
 #endif
 #define TWENTY	FOUR FOUR FOUR FOUR FOUR
@@ -136,7 +136,8 @@
 	int num_iter;
 	clk_t *t;
 {
-	register a, i;
+	register int a;
+	register volatile int i;
 
 	a = 1024;
 	
@@ -161,7 +162,8 @@
 	int num_iter;
 	clk_t *t;
 {
-	register a, i;
+	register int a;
+	register volatile int i;
 
 	a = 1024;
 	
diff -r 0a2df15eaa54 -r 407fec8af34b src/timing.c
--- a/src/timing.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/timing.c	Mon Sep 12 06:25:57 2011 -0400
@@ -250,7 +250,7 @@
 	if ((*workfn)(1, &amp;rtntime) != 0)
 		return (1);
 #ifdef DEBUG
-	printf("&gt;&gt; %d iteration gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
+	printf("&gt;&gt; %u iteration gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
 #endif
 	while ((time = ((float)rtntime)*clkmul) &lt; 1000000.) {
 		/* while less than one second */
@@ -263,11 +263,16 @@
 			break;
 		}
 #ifdef DEBUG
-		printf("&gt;&gt; %d iterations gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
+		printf("&gt;&gt; %u iterations gives %f seconds\n",num,((float)rtntime)*clkmul/1000000.);
 #endif
+		if (num == 0) {
+			/* overflowed */
+			fprintf(stderr, "gen_iterations: too many iterations\n");
+			exit(1);
+		}
 	}
 #ifdef DEBUG
-	printf("&gt;&gt; Choosing %d iterations\n",num);
+	printf("&gt;&gt; Choosing %u iterations\n", num);
 #endif
 	return (num);
 }
diff -r 0a2df15eaa54 -r 407fec8af34b src/utils.c
--- a/src/utils.c	Mon Sep 12 03:41:35 2011 -0400
+++ b/src/utils.c	Mon Sep 12 06:25:57 2011 -0400
@@ -155,7 +155,7 @@
 #else
 	sprintf(buf, "%.4f\n", ns_per_iter);
 #endif
-	if (write(fd, buf, strlen(buf)) != strlen(buf)) {
+	if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) {
 		perror("file write");
 		exit(1);
 	}
</pre></body></html>