From 5e8bc6316b1a6c56598cdb29a737d1d670d74e69 Mon Sep 17 00:00:00 2001 From: "net[shemminger]!shemminger" Date: Mon, 14 Mar 2005 18:44:54 +0000 Subject: [PATCH] Import patch iproute2-hz (Logical change 1.159) --- include/utils.h | 10 ++++++++++ ip/iproute.c | 6 +++--- lib/utils.c | 7 +++++++ tc/tc_util.c | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/utils.h b/include/utils.h index 8466803f..906e3941 100644 --- a/include/utils.h +++ b/include/utils.h @@ -113,4 +113,14 @@ static __inline__ int get_hz(void) return __iproute2_hz_internal; } +extern int __iproute2_user_hz_internal; +extern int __get_user_hz(void); + +static __inline__ int get_user_hz(void) +{ + if (__iproute2_user_hz_internal == 0) + __iproute2_user_hz_internal = __get_user_hz(); + return __iproute2_user_hz_internal; +} + #endif /* __UTILS_H__ */ diff --git a/ip/iproute.c b/ip/iproute.c index c144b740..b2ddb6ed 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -410,7 +410,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) struct rta_cacheinfo *ci = RTA_DATA(tb[RTA_CACHEINFO]); static int hz; if (!hz) - hz = get_hz(); + hz = get_user_hz(); if (ci->rta_expires != 0) fprintf(fp, " expires %dsec", ci->rta_expires/hz); if (ci->rta_error != 0) @@ -437,7 +437,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) if ((r->rtm_flags & RTM_F_CLONED) || (ci && ci->rta_expires)) { static int hz; if (!hz) - hz = get_hz(); + hz = get_user_hz(); if (r->rtm_flags & RTM_F_CLONED) fprintf(fp, "%s cache ", _SL_); if (ci->rta_expires) @@ -487,7 +487,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) if (i-2 < sizeof(mx_names)/sizeof(char*)) fprintf(fp, " %s", mx_names[i-2]); else - fprintf(fp, " metric%d", i); + fprintf(fp, " metric %d", i); if (mxlock & (1<install != 0) fprintf(f, " installed %u sec", (unsigned)(tm->install/hz)); if (tm->lastuse != 0) -- 2.39.5