[netperf-talk] [PATCH] netperf compile fixes
Brandeburg, Jesse
jesse.brandeburg at intel.com
Mon Mar 17 18:01:25 PDT 2008
Rick Jones wrote:
> 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/
here is the patch against trunk from today, I can't test it besides that
it compiles (since it is only used from nettest_bsd.c), with no warnings
or errors on Fedora 8. mkstemp creates and opens the file according to
the libc docs. (attached version is probably not whitespace damaged)
Index: src/netlib.c
===================================================================
--- src/netlib.c (revision 262)
+++ src/netlib.c (working copy)
@@ -1597,7 +1597,7 @@
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
@@ -1608,9 +1608,8 @@
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) {
- fildes = open(temp_file,O_RDWR | O_EXCL | O_CREAT,0600);
+ fildes = mkstemp(temp_file);
+ /* no need to call open because mkstemp did it */
if (-1 != fildes) {
int count;
int *int_ptr;
@@ -1640,14 +1639,9 @@
exit(-1);
}
}
- }
- else {
- perror("allocate_sendfile_buf_ring: could not open tempfile");
- exit(-1);
- }
}
else {
- perror("allocate_sendfile_buf_ring: could not allocate temp
name");
+ perror("alloc_sendfile_buf_ring: could not allocate temp name");
exit(-1);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: netperf_trunk_mkstemp.patch
Type: application/octet-stream
Size: 1196 bytes
Desc: netperf_trunk_mkstemp.patch
Url : http://www.netperf.org/pipermail/netperf-talk/attachments/20080317/271a0efa/attachment.obj
More information about the netperf-talk
mailing list