Skip to content

Commit ecf8dd5

Browse files
authored
Merge pull request #1595 from RayWindRiver/iperf_vxworks
update to support VxWorks
2 parents 402b48d + 913f8df commit ecf8dd5

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/iperf.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ typedef uint_fast64_t iperf_size_t;
9494
typedef atomic_uint_fast64_t atomic_iperf_size_t;
9595
#endif // __IPERF_API_H
9696

97+
#if (defined(__vxworks)) || (defined(__VXWORKS__))
98+
typedef unsigned int uint
99+
#endif // __vxworks or __VXWORKS__
100+
97101
struct iperf_interval_results
98102
{
99103
atomic_iperf_size_t bytes_transferred; /* bytes transferred in this interval */

src/iperf_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4710,7 +4710,15 @@ iperf_create_pidfile(struct iperf_test *test)
47104710
if (pid > 0) {
47114711

47124712
/* See if the process exists. */
4713+
#if (defined(__vxworks)) || (defined(__VXWORKS__))
4714+
#if (defined(_WRS_KERNEL)) && (defined(_WRS_CONFIG_LP64))
4715+
if (kill((_Vx_TASK_ID)pid, 0) == 0) {
4716+
#else
4717+
if (kill(pid, 0) == 0) {
4718+
#endif // _WRS_KERNEL and _WRS_CONFIG_LP64
4719+
#else
47134720
if (kill(pid, 0) == 0) {
4721+
#endif // __vxworks or __VXWORKS__
47144722
/*
47154723
* Make sure not to try to delete existing PID file by
47164724
* scribbling over the pathname we'd use to refer to it.

src/iperf_client_api.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,19 @@ iperf_run_client(struct iperf_test * test)
614614
timeout = &used_timeout;
615615
}
616616

617+
#if (defined(__vxworks)) || (defined(__VXWORKS__))
618+
if (timeout != NULL && timeout->tv_sec == 0 && timeout->tv_usec == 0) {
619+
taskDelay (1);
620+
}
621+
622+
result = select(test->max_fd + 1,
623+
&read_set,
624+
(test->state == TEST_RUNNING && !test->reverse) ? &write_set : NULL,
625+
NULL,
626+
timeout);
627+
#else
617628
result = select(test->max_fd + 1, &read_set, &write_set, NULL, timeout);
629+
#endif // __vxworks or __VXWORKS__
618630
if (result < 0 && errno != EINTR) {
619631
i_errno = IESELECT;
620632
goto cleanup_and_fail;

src/portable_endian.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@
131131
// the truth because we use the homebrew htonll, et al. implementations
132132
// that were originally the sole implementation of this functionality
133133
// in iperf 3.0.
134+
#if (!defined(__vxworks)) && (!defined(__VXWORKS__))
134135
# warning platform not supported
136+
#endif
135137
# include <endian.h>
136138
#if BYTE_ORDER == BIG_ENDIAN
137139
#define HTONLL(n) (n)

0 commit comments

Comments
 (0)