|
RTE OSAdapter POSIX 0.1.0 build 41b3eb3
POSIX/Linux OAL OSAdapter for Platform_RTE
|
Private helpers: millisecond waits for poll()'s int timeout argument. More...
#include <limits.h>#include <stdint.h>#include <time.h>Go to the source code of this file.
Functions | |
| static int | posix_poll_timeout_ms (uint32_t timeout_ms) |
| Converts an unsigned millisecond timeout to poll()'s int argument. | |
| static int | posix_remaining_ms (const struct timespec *deadline) |
| Milliseconds left until a CLOCK_MONOTONIC deadline, for poll()'s int argument. | |
Private helpers: millisecond waits for poll()'s int timeout argument.
A plain (int) cast turns a value above INT_MAX into a negative one. poll() reads a negative timeout as "wait forever" - an unbounded wait the OSA rules forbid (every wait has a timeout) - and the IPC and netlink callers of the time left read it as "no time left", so a timeout above INT_MAX ms ended at once instead of waiting. Both helpers cap at INT_MAX instead (about 24.8 days per poll() call).
Not installed: an internal header of this product. A source file including it defines _POSIX_C_SOURCE (or _GNU_SOURCE) before its first include (glibc declares clock_gettime() only under a POSIX feature-test macro).
Definition in file rte_posix_osadapter_poll.h.
|
inlinestatic |
Converts an unsigned millisecond timeout to poll()'s int argument.
| timeout_ms | Timeout in milliseconds. |
Definition at line 25 of file rte_posix_osadapter_poll.h.
|
inlinestatic |
Milliseconds left until a CLOCK_MONOTONIC deadline, for poll()'s int argument.
The difference is (deadline.tv_sec - now.tv_sec) * 1000 plus (deadline.tv_nsec - now.tv_nsec) / 1000000, the nanosecond part truncated toward zero (the rounding of the two local remaining_ms() copies this replaces).
| deadline | Absolute CLOCK_MONOTONIC deadline. |
Definition at line 40 of file rte_posix_osadapter_poll.h.