aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/libiproute/utils.c')
-rw-r--r--networking/libiproute/utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index d0fe30605..37b5311f0 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -13,6 +13,28 @@
13#include "utils.h" 13#include "utils.h"
14#include "inet_common.h" 14#include "inet_common.h"
15 15
16unsigned get_hz(void)
17{
18 static unsigned hz_internal;
19 FILE *fp;
20
21 if (hz_internal)
22 return hz_internal;
23
24 fp = fopen_for_read("/proc/net/psched");
25 if (fp) {
26 unsigned nom, denom;
27
28 if (fscanf(fp, "%*08x%*08x%08x%08x", &nom, &denom) == 2)
29 if (nom == 1000000)
30 hz_internal = denom;
31 fclose(fp);
32 }
33 if (!hz_internal)
34 hz_internal = bb_clk_tck();
35 return hz_internal;
36}
37
16unsigned get_unsigned(char *arg, const char *errmsg) 38unsigned get_unsigned(char *arg, const char *errmsg)
17{ 39{
18 unsigned long res; 40 unsigned long res;