[netperf-talk] [PATCH] netperf compile fixes

Rick Jones rick.jones2 at hp.com
Fri Mar 14 17:10:29 PDT 2008


Brandeburg, Jesse wrote:
> 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.

I think the former may not be necessary with top-of-trunk netperf2.  The 
latter, so long as there is a pid in the name at the end of it all I'll 
be happy to take-in.

So, could you respin against top of trunk?

http://www.netperf.org/svn/netperf2/trunk/

happy benchmarking,

rick jones

> 
> 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)
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> netperf-talk mailing list
> netperf-talk at netperf.org
> http://www.netperf.org/cgi-bin/mailman/listinfo/netperf-talk



More information about the netperf-talk mailing list