]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
Import patch iproute2-hz
authornet[shemminger]!shemminger <net[shemminger]!shemminger>
Mon, 14 Mar 2005 18:44:54 +0000 (18:44 +0000)
committernet[shemminger]!shemminger <net[shemminger]!shemminger>
Mon, 14 Mar 2005 18:44:54 +0000 (18:44 +0000)
(Logical change 1.159)

include/utils.h
ip/iproute.c
lib/utils.c
tc/tc_util.c

index 8466803f8e507cd9a8f54868571a2d348546c8d1..906e394140c76d8451fa592b9dd0f73472d947e3 100644 (file)
@@ -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__ */
index c144b740d146494bb1a58340014943cc83aa3ae4..b2ddb6edecc764f485e6a994e802c8df68611d36 100644 (file)
@@ -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");
 
index cd9567bfdd866e99b85d0d9fb539b7547c78a029..73ce865dfdb1f981a25c20a7d1e813c7226e4a8a 100644 (file)
@@ -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) {
index 889d16cc48816ba2a065baa9d75806b5b84da63b..9cde14416e7fbf89cbf2d8528ed9d9038dece963 100644 (file)
@@ -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)