summaryrefslogtreecommitdiff
path: root/networking/libiproute/iproute.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-12-31 18:58:32 +0000
committerDenis Vlasenko2006-12-31 18:58:32 +0000
commit13463af29f1fd904cc0ea5e0bd0acdabd8431e53 (patch)
tree9ec9a96df5df0ee33bb5e31f89f9407d8cf48396 /networking/libiproute/iproute.c
parent98ee06d3d46aa7f89c204681c7075b53300a6a6e (diff)
downloadbusybox-13463af29f1fd904cc0ea5e0bd0acdabd8431e53.zip
busybox-13463af29f1fd904cc0ea5e0bd0acdabd8431e53.tar.gz
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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index bf6f95f..acb5169 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -57,6 +57,28 @@ static int flush_update(void)
return 0;
}
+static int get_hz(void)
+{
+ static int hz_internal;
+ FILE *fp;
+
+ if (hz_internal)
+ return hz_internal;
+
+ fp = fopen("/proc/net/psched", "r");
+ if (fp) {
+ unsigned nom, denom;
+
+ if (fscanf(fp, "%*08x%*08x%08x%08x", &nom, &denom) == 2)
+ if (nom == 1000000)
+ hz_internal = denom;
+ fclose(fp);
+ }
+ if (!hz_internal)
+ hz_internal = sysconf(_SC_CLK_TCK);
+ return hz_internal;
+}
+
static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
struct nlmsghdr *n, void *arg)
{