summaryrefslogtreecommitdiff
path: root/benchmarks/ttcp/patches/patch-ab
blob: 51d657c088fdf7dc284f3baf9c58ffc72a60814c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
$NetBSD: patch-ab,v 1.4 2003/03/19 13:12:23 tron Exp $

--- ttcp.c.orig	1997-02-27 22:30:23.000000000 +0100
+++ ttcp.c	2003-03-19 14:09:08.000000000 +0100
@@ -55,6 +55,7 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <sys/time.h>		/* struct timeval */
+#include <stdlib.h>
 
 #if defined(SYSV)
 #include <sys/times.h>
@@ -151,7 +152,7 @@
 int argc;
 char **argv;
 {
-	unsigned long addr_tmp;
+	in_addr_t addr_tmp;
 	int c;
 
 	if (argc < 2) goto usage;
@@ -263,7 +264,7 @@
 	if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL)
 		err("malloc");
 	if (bufalign != 0)
-		buf +=(bufalign - ((int)buf % bufalign) + bufoffset) % bufalign;
+		buf +=(bufalign - ((u_long)buf % bufalign) + bufoffset) % bufalign;
 
 	if (trans) {
 	    fprintf(stdout,
@@ -285,7 +286,8 @@
 		err("socket");
 	mes("socket");
 
-	if (bind(fd, &sinme, sizeof(sinme)) < 0)
+	sinme.sin_family = AF_INET;
+	if (bind(fd, (struct sockaddr *)&sinme, sizeof(sinme)) < 0)
 		err("bind");
 
 #if defined(SO_SNDBUF) || defined(SO_RCVBUF)
@@ -326,7 +328,7 @@
 			mes("nodelay");
 		}
 #endif
-		if(connect(fd, &sinhim, sizeof(sinhim) ) < 0)
+		if(connect(fd, (struct sockaddr *)&sinhim, sizeof(sinhim) ) < 0)
 			err("connect");
 		mes("connect");
 	    } else {
@@ -348,11 +350,11 @@
 		}
 		fromlen = sizeof(frominet);
 		domain = AF_INET;
-		if((fd=accept(fd, &frominet, &fromlen) ) < 0)
+		if((fd=accept(fd, (struct sockaddr *)&frominet, &fromlen) ) < 0)
 			err("accept");
 		{ struct sockaddr_in peer;
 		  int peerlen = sizeof(peer);
-		  if (getpeername(fd, (struct sockaddr_in *) &peer, 
+		  if (getpeername(fd, (struct sockaddr *) &peer, 
 				&peerlen) < 0) {
 			err("getpeername");
 		  }
@@ -752,7 +754,7 @@
 	int len = sizeof(from);
 	register int cnt;
 	if( udp )  {
-		cnt = recvfrom( fd, buf, count, 0, &from, &len );
+		cnt = recvfrom( fd, buf, count, 0, (struct sockaddr *)&from, &len );
 		numCalls++;
 	} else {
 		if( b_flag )
@@ -782,7 +784,7 @@
 	register int cnt;
 	if( udp )  {
 again:
-		cnt = sendto( fd, buf, count, 0, &sinhim, sizeof(sinhim) );
+		cnt = sendto( fd, buf, count, 0, (struct sockaddr *)&sinhim, sizeof(sinhim) );
 		numCalls++;
 		if( cnt<0 && errno == ENOBUFS )  {
 			delay(18000);
@@ -803,7 +805,7 @@
 
 	tv.tv_sec = 0;
 	tv.tv_usec = us;
-	(void)select( 1, (char *)0, (char *)0, (char *)0, &tv );
+	(void)select( 1, (void *)0, (void *)0, (void *)0, &tv );
 }
 
 /*