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 | |
parent | 98ee06d3d46aa7f89c204681c7075b53300a6a6e (diff) | |
download | busybox-13463af29f1fd904cc0ea5e0bd0acdabd8431e53.tar.gz |
remove commented out #includes etc
move get_hz to the only caller
Diffstat (limited to 'networking/libiproute')
-rw-r--r-- | networking/libiproute/iproute.c | 22 | ||||
-rw-r--r-- | networking/libiproute/libnetlink.h | 1 | ||||
-rw-r--r-- | networking/libiproute/linux/pkt_sched.h | 2 | ||||
-rw-r--r-- | networking/libiproute/utils.c | 20 | ||||
-rw-r--r-- | networking/libiproute/utils.h | 12 |
5 files changed, 22 insertions, 35 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) 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) { diff --git a/networking/libiproute/libnetlink.h b/networking/libiproute/libnetlink.h index bd1913618..6dd242d03 100644 --- a/networking/libiproute/libnetlink.h +++ b/networking/libiproute/libnetlink.h @@ -2,7 +2,6 @@ #ifndef __LIBNETLINK_H__ #define __LIBNETLINK_H__ 1 -//#include <asm/types.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> diff --git a/networking/libiproute/linux/pkt_sched.h b/networking/libiproute/linux/pkt_sched.h index 36c0a46e3..012bb5766 100644 --- a/networking/libiproute/linux/pkt_sched.h +++ b/networking/libiproute/linux/pkt_sched.h @@ -15,8 +15,6 @@ filler or even bulk. */ -//#include <asm/types.h> - #define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 #define TC_PRIO_BULK 2 diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index aa60ffd01..7e74e1c4b 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c @@ -294,26 +294,6 @@ int inet_addr_match(inet_prefix * a, inet_prefix * b, int bits) return 0; } -int __iproute2_hz_internal; - -int __get_hz(void) -{ - int hz = 0; - FILE *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 = denom; - fclose(fp); - } - if (hz) - return hz; - return sysconf(_SC_CLK_TCK); -} - const char *rt_addr_n2a(int af, int ATTRIBUTE_UNUSED len, void *addr, char *buf, int buflen) { diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h index 3ecbb3abd..c8ac63197 100644 --- a/networking/libiproute/utils.h +++ b/networking/libiproute/utils.h @@ -3,8 +3,6 @@ #define __UTILS_H__ 1 #include "libbb.h" -//#include <asm/types.h> -//#include <resolv.h> #include "libnetlink.h" #include "ll_map.h" @@ -90,14 +88,4 @@ int dnet_pton(int af, const char *src, void *addr); const char *ipx_ntop(int af, const void *addr, char *str, size_t len); int ipx_pton(int af, const char *src, void *addr); -extern int __iproute2_hz_internal; -extern int __get_hz(void); - -static inline int get_hz(void) -{ - if (__iproute2_hz_internal == 0) - __iproute2_hz_internal = __get_hz(); - return __iproute2_hz_internal; -} - #endif /* __UTILS_H__ */ |