mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2026-02-01 18:18:34 +00:00
Import patch iproute2-hz
(Logical change 1.159)
This commit is contained in:
parent
d27d73ab55
commit
5e8bc6316b
@ -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__ */
|
||||
|
||||
@ -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<<i))
|
||||
fprintf(fp, " lock");
|
||||
|
||||
|
||||
@ -384,6 +384,13 @@ int __get_hz(void)
|
||||
return HZ;
|
||||
}
|
||||
|
||||
int __iproute2_user_hz_internal;
|
||||
|
||||
int __get_user_hz(void)
|
||||
{
|
||||
return sysconf(_SC_CLK_TCK);
|
||||
}
|
||||
|
||||
const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen)
|
||||
{
|
||||
switch (af) {
|
||||
|
||||
@ -421,7 +421,7 @@ int action_a2n(char *arg, int *result)
|
||||
|
||||
void print_tm(FILE * f, const struct tcf_t *tm)
|
||||
{
|
||||
int hz = get_hz();
|
||||
int hz = get_user_hz();
|
||||
if (tm->install != 0)
|
||||
fprintf(f, " installed %u sec", (unsigned)(tm->install/hz));
|
||||
if (tm->lastuse != 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user