diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2024-01-21 09:19:19 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2024-01-21 09:19:19 -0800 |
commit | 3062aaf77027c69d1ab34c3483522f195c8856ad (patch) | |
tree | 38875bb9fa8df6a1e77bf9c3ba35d188368ab39a | |
parent | 91cca2aee76bb00ad81ce94da4d7e60670512fa3 (diff) | |
download | iproute2-3062aaf77027c69d1ab34c3483522f195c8856ad.tar.gz |
tc: better clockid handling
All clockid values not available on some older glibc versions.
Also, add some comments.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r-- | tc/tc_util.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tc/tc_util.c b/tc/tc_util.c index a799a6299..aa7cf60fa 100644 --- a/tc/tc_util.c +++ b/tc/tc_util.c @@ -596,14 +596,27 @@ char *sprint_linklayer(unsigned int linklayer, char *buf) return buf; } +/* + * Limited list of clockid's + * Since these are the ones the kernel qdisc can use + * because they are available via ktim_get + */ static const struct clockid_table { const char *name; clockid_t clockid; } clockt_map[] = { - { "REALTIME", CLOCK_REALTIME }, - { "TAI", CLOCK_TAI }, +#ifdef CLOCK_BOOTTIME { "BOOTTIME", CLOCK_BOOTTIME }, +#endif +#ifdef CLOCK_MONOTONIC { "MONOTONIC", CLOCK_MONOTONIC }, +#endif +#ifdef CLOCK_REALTIME + { "REALTIME", CLOCK_REALTIME }, +#endif +#ifdef CLOCK_TAI + { "TAI", CLOCK_TAI }, +#endif { NULL } }; @@ -611,6 +624,7 @@ int get_clockid(__s32 *val, const char *arg) { const struct clockid_table *c; + /* skip prefix if present */ if (strcasestr(arg, "CLOCK_") != NULL) arg += sizeof("CLOCK_") - 1; |