[netperf-talk] [PATCH] netperf compile fixes

Brandeburg, Jesse jesse.brandeburg at intel.com
Fri Mar 14 16:57:59 PDT 2008


in order for netperf-2.4.4 to build on fedora 8, I made these changes I
thought they might be valuable, attached and whitespace damaged inline.

in particular, the __USE_GNU makes the sched.h header work right with
CPU_SET and CPU_ZERO

and the mkstemp thing stops a warning being generated at build.

Jesse

diff -rup netperf-2.4.4/src/netlib.c netperf-2.4.4mod/src/netlib.c
--- netperf-2.4.4/src/netlib.c	2007-10-17 14:16:02.000000000 -0700
+++ netperf-2.4.4mod/src/netlib.c	2008-02-15 10:56:11.000000000 -0800
@@ -1531,7 +1531,7 @@ alloc_sendfile_buf_ring(int width,
      file. 08/2000 */
   if (strcmp(fill_file,"") == 0) {
     /* use an temp file for the fill file */
-    char *temp_file;
+    char temp_file[] = {"netperfXXXXXX\0"};
     int *temp_buffer;
     
     /* make sure we have at least an ints worth, even if the user is
@@ -1542,8 +1542,8 @@ alloc_sendfile_buf_ring(int width,
     if (temp_buffer) {
       /* ok, we have the buffer we are going to write, lets get a
 	 temporary filename */
-      temp_file = tmpnam(NULL);
-      if (NULL != temp_file) {
+      int mkstemp_return = mkstemp(temp_file);
+      if (!mkstemp_return) {
 	fildes = open(temp_file,O_RDWR | O_EXCL | O_CREAT,0600);
 	if (-1 != fildes) {
 	  int count;
@@ -1980,6 +1980,7 @@ bind_to_specific_processor(int processor
      value will not tell you if you are bound vs unbound. */
   bindprocessor(BINDPROCESS,getpid(),(cpu_t)mapped_affinity);
 #elif HAVE_SCHED_SETAFFINITY
+#define __USE_GNU
 #include <sched.h>
   /* in theory this should cover systems with more CPUs than bits in a
      long, without having to specify __USE_GNU.  we "cheat" by taking
@@ -1990,8 +1991,8 @@ bind_to_specific_processor(int processor
 
 #if defined(__CPU_SETSIZE)
 #define NETPERF_CPU_SETSIZE __CPU_SETSIZE
-#define NETPERF_CPU_SET(cpu, cpusetp)  __CPU_SET(cpu, cpusetp)
-#define NETPERF_CPU_ZERO(cpusetp)      __CPU_ZERO (cpusetp)
+#define NETPERF_CPU_SET(cpu, cpusetp)  CPU_SET(cpu, cpusetp)
+#define NETPERF_CPU_ZERO(cpusetp)      CPU_ZERO(cpusetp)
   typedef cpu_set_t netperf_cpu_set_t;
 #else
 #define NETPERF_CPU_SETSIZE sizeof(unsigned long)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: netperf244_compile.patch
Type: application/octet-stream
Size: 1823 bytes
Desc: not available
Url : http://www.netperf.org/pipermail/netperf-talk/attachments/20080314/26255896/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6703 bytes
Desc: not available
Url : http://www.netperf.org/pipermail/netperf-talk/attachments/20080314/26255896/attachment.bin 


More information about the netperf-talk mailing list