diff options
Diffstat (limited to 'networking/libiproute/iproute.c')
-rw-r--r-- | networking/libiproute/iproute.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index bf6f95f61..acb5169a4 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -57,6 +57,28 @@ static int flush_update(void) | |||
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | static int get_hz(void) | ||
61 | { | ||
62 | static int hz_internal; | ||
63 | FILE *fp; | ||
64 | |||
65 | if (hz_internal) | ||
66 | return hz_internal; | ||
67 | |||
68 | fp = fopen("/proc/net/psched", "r"); | ||
69 | if (fp) { | ||
70 | unsigned nom, denom; | ||
71 | |||
72 | if (fscanf(fp, "%*08x%*08x%08x%08x", &nom, &denom) == 2) | ||
73 | if (nom == 1000000) | ||
74 | hz_internal = denom; | ||
75 | fclose(fp); | ||
76 | } | ||
77 | if (!hz_internal) | ||
78 | hz_internal = sysconf(_SC_CLK_TCK); | ||
79 | return hz_internal; | ||
80 | } | ||
81 | |||
60 | static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED, | 82 | static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED, |
61 | struct nlmsghdr *n, void *arg) | 83 | struct nlmsghdr *n, void *arg) |
62 | { | 84 | { |