Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to support VxWorks #1595

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/iperf.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,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 */
Expand Down
8 changes: 8 additions & 0 deletions src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions src/iperf_client_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/portable_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <endian.h>
#if BYTE_ORDER == BIG_ENDIAN
#define HTONLL(n) (n)
Expand Down