as an upstream submission.
-commit b63d41b25f49a76d0be66edfb61bd4cb68921d55
-Author: Philip Prindeville <philipp@redfish-solutions.com>
-Date: Tue Oct 31 13:41:08 2017 -0600
-
- Fix warnings about _GNU_SOURCE being redefined.
-
- Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
-
-diff --git a/src/iperf.h b/src/iperf.h
-index bb951dc..b656784 100755
---- a/src/iperf.h
-+++ b/src/iperf.h
-@@ -36,7 +36,9 @@
- #endif
- #include <sys/select.h>
- #include <sys/socket.h>
--#define _GNU_SOURCE
-+#ifndef _GNU_SOURCE
-+# define _GNU_SOURCE
-+#endif
- #include <netinet/tcp.h>
-
- #if defined(HAVE_CPUSET_SETAFFINITY)
-diff --git a/src/iperf_api.c b/src/iperf_api.c
-index ab30b93..9e41238 100755
---- a/src/iperf_api.c
-+++ b/src/iperf_api.c
-@@ -24,7 +24,9 @@
- * This code is distributed under a BSD style license, see the LICENSE file
- * for complete information.
- */
--#define _GNU_SOURCE
-+#ifndef _GNU_SOURCE
-+# define _GNU_SOURCE
-+#endif
- #define __USE_GNU
-
- #include "iperf_config.h"
-
-commit 315254cfc5f5682627f4a46ade3100bc3c64cfcc
-Author: Philip Prindeville <philipp@redfish-solutions.com>
-Date: Tue Oct 31 13:42:58 2017 -0600
-
- Fix warnings of format-specified mismatching type
-
- Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
-
-diff --git a/src/iperf_tcp.c b/src/iperf_tcp.c
-index 91cf032..6f86d5d 100644
---- a/src/iperf_tcp.c
-+++ b/src/iperf_tcp.c
-@@ -24,8 +24,6 @@
- * This code is distributed under a BSD style license, see the LICENSE
- * file for complete information.
- */
--#include "iperf_config.h"
--
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -44,6 +42,12 @@
- #include "net.h"
- #include "cjson.h"
-
-+#if defined(HAVE_INTTYPES_H)
-+# include <inttypes.h>
-+#else
-+# define PRIu64 "llu"
-+#endif
-+
- #if defined(HAVE_FLOWLABEL)
- #include "flowlabel.h"
- #endif /* HAVE_FLOWLABEL */
-@@ -90,7 +94,7 @@ iperf_tcp_send(struct iperf_stream *sp)
- sp->result->bytes_sent_this_interval += r;
-
- if (sp->test->debug)
-- printf("sent %d bytes of %d, total %llu\n", r, sp->settings->blksize, sp->result->bytes_sent);
-+ printf("sent %d bytes of %d, total %" PRIu64 "\n", r, sp->settings->blksize, sp->result->bytes_sent);
-
- return r;
- }
-diff --git a/src/iperf_udp.c b/src/iperf_udp.c
-index a2ea6d0..d04ae44 100644
---- a/src/iperf_udp.c
-+++ b/src/iperf_udp.c
-@@ -48,6 +48,12 @@
- #include "cjson.h"
- #include "portable_endian.h"
-
-+#if defined(HAVE_INTTYPES_H)
-+# include <inttypes.h>
-+#else
-+# define PRIu64 "llu"
-+#endif
-+
- /* iperf_udp_recv
- *
- * receives the data for UDP
-@@ -98,7 +104,7 @@ iperf_udp_recv(struct iperf_stream *sp)
- }
-
- if (sp->test->debug)
-- fprintf(stderr, "pcount %llu packet_count %d\n", pcount, sp->packet_count);
-+ fprintf(stderr, "pcount %" PRIu64 " packet_count %d\n", pcount, sp->packet_count);
-
- /*
- * Try to handle out of order packets. The way we do this
-@@ -141,7 +147,7 @@ iperf_udp_recv(struct iperf_stream *sp)
-
- /* Log the out-of-order packet */
- if (sp->test->debug)
-- fprintf(stderr, "OUT OF ORDER - incoming packet sequence %llu but expected sequence %d on stream %d", pcount, sp->packet_count, sp->socket);
-+ fprintf(stderr, "OUT OF ORDER - incoming packet sequence %" PRIu64 " but expected sequence %d on stream %d", pcount, sp->packet_count, sp->socket);
- }
-
- /*
-@@ -220,7 +226,7 @@ iperf_udp_send(struct iperf_stream *sp)
- sp->result->bytes_sent_this_interval += r;
-
- if (sp->test->debug)
-- printf("sent %d bytes of %d, total %llu\n", r, sp->settings->blksize, sp->result->bytes_sent);
-+ printf("sent %d bytes of %d, total %" PRIu64 "\n", r, sp->settings->blksize, sp->result->bytes_sent);
-
- return r;
- }
-
commit 9a66b3b0349e0a158bb4940b668a5cbc7c245762
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Tue Oct 31 13:44:34 2017 -0600
index f57e83f..cfb42ac 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -101,6 +101,14 @@ AC_CHECK_HEADERS([netinet/sctp.h],
+@@ -103,6 +103,14 @@ AC_CHECK_HEADERS([netinet/sctp.h],
#endif
])
index bd03935..a9e51ec 100644
--- a/src/iperf_config.h.in
+++ b/src/iperf_config.h.in
-@@ -9,6 +9,9 @@
+@@ -15,6 +15,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Have IPv6 flowlabel support. */
#undef HAVE_FLOWLABEL
-@@ -54,6 +57,9 @@
+@@ -69,6 +69,9 @@
/* Define to 1 if the system has the type `struct sctp_assoc_value'. */
#undef HAVE_STRUCT_SCTP_ASSOC_VALUE
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
-diff --git a/src/portable_endian.h b/src/portable_endian.h
-index b86d37a..5dbc6e5 100644
---- a/src/portable_endian.h
-+++ b/src/portable_endian.h
-@@ -10,14 +10,33 @@
-
- #endif
-
--// GLIBC / Linux with endian(3) support, which was added in glibc 2.9.
--// Intended to support CentOS 6 and newer.
--#if defined(__linux__) && \
-- ((__GLIBC__ > 3) || \
-- (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9))
--
-+#if defined(HAVE_ENDIAN_H)
- # include <endian.h>
-
-+#elif defined(HAVE_SYS_ENDIAN_H)
-+# include <sys/endian.h>
-+
-+# if defined(__OpenBSD__)
-+
-+# define be16toh(x) betoh16(x)
-+# define le16toh(x) letoh16(x)
-+
-+# define be32toh(x) betoh32(x)
-+# define le32toh(x) letoh32(x)
-+
-+# define be64toh(x) betoh64(x)
-+# define le64toh(x) letoh64(x)
-+
-+# elif defined(__sgi)
-+
-+# include <netinet/in.h>
-+# include <inttypes.h>
-+
-+# define be64toh(x) (x)
-+# define htobe64(x) (x)
-+
-+# endif
-+
- #elif defined(__CYGWIN__)
-
- # include <endian.h>
-@@ -46,32 +65,6 @@
- # define __LITTLE_ENDIAN LITTLE_ENDIAN
- # define __PDP_ENDIAN PDP_ENDIAN
-
--#elif defined(__OpenBSD__)
--
--# include <sys/endian.h>
--
--# define be16toh(x) betoh16(x)
--# define le16toh(x) letoh16(x)
--
--# define be32toh(x) betoh32(x)
--# define le32toh(x) letoh32(x)
--
--# define be64toh(x) betoh64(x)
--# define le64toh(x) letoh64(x)
--
--#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
--
--# include <sys/endian.h>
--
--#elif defined(__sgi)
--
--# include <sys/endian.h>
--# include <netinet/in.h>
--# include <inttypes.h>
--
--# define be64toh(x) (x)
--# define htobe64(x) (x)
--
- #elif defined(__sun) && defined(__SVR4)
-
- # include <sys/types.h>
-
-commit 7e7285d0daf92ef7beda8f78a6f63cc647a77f38
-Author: Philip Prindeville <philipp@redfish-solutions.com>
-Date: Tue Oct 31 13:48:06 2017 -0600
-
- Sys headers should not be included directly
-
- There's usually a top-level header which then includes the sys/
- descendent.
-
- Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
-
-diff --git a/src/net.c b/src/net.c
-index af456cb..afd0022 100644
---- a/src/net.c
-+++ b/src/net.c
-@@ -31,13 +31,12 @@
- #include <errno.h>
- #include <sys/socket.h>
- #include <sys/types.h>
--#include <sys/errno.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>
- #include <assert.h>
- #include <netdb.h>
- #include <string.h>
--#include <sys/fcntl.h>
-+#include <fcntl.h>
-
- #ifdef HAVE_SENDFILE
- #ifdef linux