[openib-general] perftest-03: put C code in .c file

Bernhard Fischer blist at aon.at
Wed May 11 09:25:07 PDT 2005


On Wed, May 11, 2005 at 08:11:05AM -0700, Grant Grundler wrote:
>On Wed, May 11, 2005 at 03:00:04PM +0200, Bernhard Fischer wrote:
>> >-	gcc $(CFLAGS) -o rdma_lat rdma_lat.c -libverbs
>> 
>> please replace that gcc with $(CC)
>
>yes, good idea. Patch below (perftest-04) removes the line.
>Applies on top of perftest-03.

With the attached (let's call it perftest-05 as it's on top of -04) it
links again on i386 (get_clock vs. get_cycles),
furthermore some sparse warning about non-ANSI fn decls, and 0 vs. NULL.
Also make pp_client_exch_dest and pp_server_connect static.

Please consider.

Signed-off-by: Bernhard Fischer <rep.nop at aon.com>
>
>thanks,
>grant
-------------- next part --------------
diff -rup perftest-04.oorig/get_clock.h perftest/get_clock.h
--- perftest-04.oorig/get_clock.h	2005-05-11 16:05:48.000000000 +0000
+++ perftest/get_clock.h	2005-05-11 16:09:39.000000000 +0000
@@ -34,7 +34,7 @@
 
 #if defined (__x86_64__) || defined(__i386__)
 typedef unsigned long long cycles_t;
-static inline cycles_t get_clock()
+static inline cycles_t get_cycles(void)
 {
 	unsigned low, high;
 	unsigned long long val;
@@ -45,7 +45,7 @@ static inline cycles_t get_clock()
 }
 #elif defined(__PPC64__)
 typedef unsigned long long cycles_t;
-static inline cycles_t get_cycles()
+static inline cycles_t get_cycles(void)
 {
 	cycles_t ret;
 
@@ -54,7 +54,7 @@ static inline cycles_t get_cycles()
 }
 #elif defined(__ia64__)
 typedef unsigned long long cycles_t;
-static inline cycles_t get_cycles()
+static inline cycles_t get_cycles(void)
 {
 	cycles_t ret;
 
diff -rup perftest-04.oorig/rdma_lat.c perftest/rdma_lat.c
--- perftest-04.oorig/rdma_lat.c	2005-05-11 10:59:37.000000000 +0000
+++ perftest/rdma_lat.c	2005-05-11 16:10:42.000000000 +0000
@@ -163,7 +163,7 @@ static int pp_client_connect(const char 
 	return sockfd;
 }
 
-struct pingpong_dest * pp_client_exch_dest(int sockfd,
+static struct pingpong_dest * pp_client_exch_dest(int sockfd,
 					   const struct pingpong_dest *my_dest)
 {
 	struct pingpong_dest *rem_dest = NULL;
@@ -202,7 +202,7 @@ out:
 	return rem_dest;
 }
 
-int pp_server_connect(int port)
+static int pp_server_connect(int port)
 {
 	struct addrinfo *res, *t;
 	struct addrinfo hints = {
@@ -244,7 +244,7 @@ int pp_server_connect(int port)
 	}
 
 	listen(sockfd, 1);
-	connfd = accept(sockfd, NULL, 0);
+	connfd = accept(sockfd, NULL, NULL);
 	if (connfd < 0) {
 		perror("server accept");
 		fprintf(stderr, "accept() failed\n");


More information about the general mailing list