diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-31 18:58:32 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-31 18:58:32 +0000 |
commit | 13463af29f1fd904cc0ea5e0bd0acdabd8431e53 (patch) | |
tree | 9ec9a96df5df0ee33bb5e31f89f9407d8cf48396 /networking/libiproute/iproute.c | |
parent | 98ee06d3d46aa7f89c204681c7075b53300a6a6e (diff) | |
download | busybox-w32-13463af29f1fd904cc0ea5e0bd0acdabd8431e53.tar.gz busybox-w32-13463af29f1fd904cc0ea5e0bd0acdabd8431e53.tar.bz2 busybox-w32-13463af29f1fd904cc0ea5e0bd0acdabd8431e53.zip |
remove commented out #includes etc
move get_hz to the only caller
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 | { |