diff --git a/src/iperf.h b/src/iperf.h index 7b270bd0f..707ca2229 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -67,6 +67,7 @@ #include "queue.h" #include "cjson.h" #include "iperf_time.h" +#include "portable_endian.h" #if defined(HAVE_SSL) #include @@ -93,6 +94,10 @@ typedef uint_fast64_t iperf_size_t; typedef atomic_uint_fast64_t atomic_iperf_size_t; #endif // __IPERF_API_H +#if (defined(__vxworks)) || (defined(__VXWORKS__)) +typedef unsigned int uint +#endif // __vxworks or __VXWORKS__ + struct iperf_interval_results { atomic_iperf_size_t bytes_transferred; /* bytes transferred in this interval */ @@ -453,9 +458,15 @@ struct iperf_test extern int gerror; /* error value from getaddrinfo(3), for use in internal error handling */ /* UDP "connect" message and reply (textual value for Wireshark, etc. readability - legacy was numeric) */ +#if BYTE_ORDER == BIG_ENDIAN +#define UDP_CONNECT_MSG 0x39383736 +#define UDP_CONNECT_REPLY 0x36373839 +#define LEGACY_UDP_CONNECT_REPLY 0xb168de3a +#else #define UDP_CONNECT_MSG 0x36373839 // "6789" - legacy value was 123456789 #define UDP_CONNECT_REPLY 0x39383736 // "9876" - legacy value was 987654321 #define LEGACY_UDP_CONNECT_REPLY 987654321 // Old servers may still reply with the legacy value +#endif /* In Reverse mode, maximum number of packets to wait for "accept" response - to handle out of order packets */ #define MAX_REVERSE_OUT_OF_ORDER_PACKETS 2 diff --git a/src/iperf_api.c b/src/iperf_api.c index eb234030c..105be3564 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -4710,7 +4710,15 @@ iperf_create_pidfile(struct iperf_test *test) if (pid > 0) { /* See if the process exists. */ +#if (defined(__vxworks)) || (defined(__VXWORKS__)) +#if (defined(_WRS_KERNEL)) && (defined(_WRS_CONFIG_LP64)) + if (kill((_Vx_TASK_ID)pid, 0) == 0) { +#else + if (kill(pid, 0) == 0) { +#endif // _WRS_KERNEL and _WRS_CONFIG_LP64 +#else if (kill(pid, 0) == 0) { +#endif // __vxworks or __VXWORKS__ /* * Make sure not to try to delete existing PID file by * scribbling over the pathname we'd use to refer to it. diff --git a/src/iperf_client_api.c b/src/iperf_client_api.c index 5b333694b..7ad4c939b 100644 --- a/src/iperf_client_api.c +++ b/src/iperf_client_api.c @@ -614,7 +614,19 @@ iperf_run_client(struct iperf_test * test) timeout = &used_timeout; } +#if (defined(__vxworks)) || (defined(__VXWORKS__)) + if (timeout != NULL && timeout->tv_sec == 0 && timeout->tv_usec == 0) { + taskDelay (1); + } + + result = select(test->max_fd + 1, + &read_set, + (test->state == TEST_RUNNING && !test->reverse) ? &write_set : NULL, + NULL, + timeout); +#else result = select(test->max_fd + 1, &read_set, &write_set, NULL, timeout); +#endif // __vxworks or __VXWORKS__ if (result < 0 && errno != EINTR) { i_errno = IESELECT; goto cleanup_and_fail; diff --git a/src/iperf_udp.c b/src/iperf_udp.c index b7aa1ebdf..5f69ee366 100644 --- a/src/iperf_udp.c +++ b/src/iperf_udp.c @@ -47,7 +47,6 @@ #include "timer.h" #include "net.h" #include "cjson.h" -#include "portable_endian.h" #if defined(HAVE_INTTYPES_H) # include diff --git a/src/portable_endian.h b/src/portable_endian.h index c3c73ffd7..dbb678992 100644 --- a/src/portable_endian.h +++ b/src/portable_endian.h @@ -131,7 +131,9 @@ // the truth because we use the homebrew htonll, et al. implementations // that were originally the sole implementation of this functionality // in iperf 3.0. +#if (!defined(__vxworks)) && (!defined(__VXWORKS__)) # warning platform not supported +#endif # include #if BYTE_ORDER == BIG_ENDIAN #define HTONLL(n) (n)