Fix breakage due to iperf.h depending on the autoconf config.h file but
not including it. To fix this required us to change config.h to iperf_config.h (to avoid potential filename collisions with this generic name). Then iperf.h could include this. Adjust the existing header file inclusions to track this, and also canonicalize their inclusion to be at the top of *.c files.
Этот коммит содержится в:
родитель
75ee0f4f26
Коммит
40050b7bee
2
.gitignore
поставляемый
2
.gitignore
поставляемый
@ -16,7 +16,7 @@ docs/_static
|
||||
src/.deps
|
||||
src/.libs
|
||||
src/Makefile
|
||||
src/config.h
|
||||
src/iperf_config.h
|
||||
src/stamp-h1
|
||||
src/iperf3
|
||||
src/iperf3_profile
|
||||
|
@ -9,7 +9,7 @@ AC_CONFIG_AUX_DIR(config)
|
||||
# Initialize the automake system
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
AM_CONFIG_HEADER(src/config.h)
|
||||
AM_CONFIG_HEADER(src/iperf_config.h)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#ifndef __IPERF_H
|
||||
#define __IPERF_H
|
||||
|
||||
#include "iperf_config.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
@ -10,6 +10,8 @@
|
||||
#define _GNU_SOURCE
|
||||
#define __USE_GNU
|
||||
|
||||
#include "iperf_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -40,7 +42,6 @@
|
||||
#include <sys/cpuset.h>
|
||||
#endif /* HAVE_CPUSET_SETAFFINITY */
|
||||
|
||||
#include "config.h"
|
||||
#include "net.h"
|
||||
#include "iperf.h"
|
||||
#include "iperf_api.h"
|
||||
@ -622,7 +623,8 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
test->json_output = 1;
|
||||
break;
|
||||
case 'v':
|
||||
printf("%s\n%s\n", version, get_system_info());
|
||||
printf("%s\n%s\n%s\n", version, get_system_info(),
|
||||
get_optional_features());
|
||||
exit(0);
|
||||
case 's':
|
||||
if (test->role == 'c') {
|
||||
@ -819,6 +821,10 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (test->debug) {
|
||||
printf("fubar\n");
|
||||
}
|
||||
|
||||
/* Set logging to a file if specified, otherwise use the default (stdout) */
|
||||
if (test->logfile) {
|
||||
test->outfile = fopen(test->logfile, "a+");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* src/config.h.in. Generated from configure.ac by autoheader. */
|
||||
/* src/iperf_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the `cpuset_setaffinity' function. */
|
||||
#undef HAVE_CPUSET_SETAFFINITY
|
||||
@ -70,6 +70,9 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 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>
|
||||
@ -20,8 +21,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_NETINET_SCTP_H
|
||||
#include <netinet/sctp.h>
|
||||
#endif /* HAVE_NETINET_SCTP_H */
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 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>
|
||||
@ -20,7 +21,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "iperf.h"
|
||||
#include "iperf_api.h"
|
||||
#include "iperf_tcp.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
* Iperf utility functions
|
||||
*
|
||||
*/
|
||||
#include "iperf_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -26,7 +27,6 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "cjson.h"
|
||||
|
||||
/* make_cookie
|
||||
@ -194,7 +194,7 @@ cpu_util(double pcpu[3])
|
||||
pcpu[2] = (systemdiff / timediff) * 100;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
get_system_info(void)
|
||||
{
|
||||
static char buf[1024];
|
||||
@ -210,6 +210,62 @@ get_system_info(void)
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
get_optional_features(void)
|
||||
{
|
||||
static char features[1024];
|
||||
unsigned int numfeatures = 0;
|
||||
|
||||
snprintf(features, sizeof(features), "Optional features available: ");
|
||||
|
||||
#if defined(HAVE_CPU_AFFINITY)
|
||||
if (numfeatures > 0) {
|
||||
strncat(features, ", ",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
}
|
||||
strncat(features, "CPU affinity setting",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
numfeatures++;
|
||||
#endif /* HAVE_CPU_AFFINITY */
|
||||
|
||||
#if defined(HAVE_FLOWLABEL)
|
||||
if (numfeatures > 0) {
|
||||
strncat(features, ", ",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
}
|
||||
strncat(features, "IPv6 flow label",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
numfeatures++;
|
||||
#endif /* HAVE_FLOWLABEL */
|
||||
|
||||
#if defined(HAVE_SCTP)
|
||||
if (numfeatures > 0) {
|
||||
strncat(features, ", ",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
}
|
||||
strncat(features, "SCTP",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
numfeatures++;
|
||||
#endif /* HAVE_SCTP */
|
||||
|
||||
#if defined(HAVE_TCP_CONGESTION)
|
||||
if (numfeatures > 0) {
|
||||
strncat(features, ", ",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
}
|
||||
strncat(features, "TCP congestion algorithm setting",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
numfeatures++;
|
||||
#endif /* HAVE_TCP_CONGESTION */
|
||||
|
||||
if (numfeatures == 0) {
|
||||
strncat(features, "None",
|
||||
sizeof(features) - strlen(features) - 1);
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
/* Helper routine for building cJSON objects in a printf-like manner.
|
||||
**
|
||||
** Sample call:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2011, The Regents of the University of California,
|
||||
* Copyright (c) 2009-2011, 2014, The Regents of the University of California,
|
||||
* through Lawrence Berkeley National Laboratory (subject to receipt of any
|
||||
* required approvals from the U.S. Dept. of Energy). All rights reserved.
|
||||
*
|
||||
@ -26,7 +26,9 @@ int delay(int64_t ns);
|
||||
|
||||
void cpu_util(double pcpu[3]);
|
||||
|
||||
char* get_system_info(void);
|
||||
const char* get_system_info(void);
|
||||
|
||||
const char* get_optional_features(void);
|
||||
|
||||
cJSON* iperf_json_printf(const char *format, ...);
|
||||
|
||||
|
@ -50,11 +50,10 @@
|
||||
* -------------------------------------------------------------------
|
||||
* Strings and other stuff that is locale specific.
|
||||
* ------------------------------------------------------------------- */
|
||||
#include "iperf_config.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 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>
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user