diff options
author | San Mehat <san@google.com> | 2010-04-07 09:44:54 -0700 |
---|---|---|
committer | San Mehat <san@google.com> | 2010-04-07 09:56:00 -0700 |
commit | f1cbadf4caabd2f5fb30b1e4f3728e1493d40bb7 (patch) | |
tree | 474f3205e87a8350a4dc87a27e9507a6e93a94a4 | |
parent | dcfb7a77f8709125e97c313cb8ab6ec4d87468f4 (diff) | |
download | platform_external_iproute2-f1cbadf4caabd2f5fb30b1e4f3728e1493d40bb7.tar.gz platform_external_iproute2-f1cbadf4caabd2f5fb30b1e4f3728e1493d40bb7.tar.bz2 platform_external_iproute2-f1cbadf4caabd2f5fb30b1e4f3728e1493d40bb7.zip |
iproute2: Build tc and netlink/util libs
For http://b/issue?id=2576057
Change-Id: Ic0a5edbdf6496a1a267634147c3c3eea3b3604ac
Signed-off-by: San Mehat <san@google.com>
-rw-r--r-- | Android.mk | 3 | ||||
-rw-r--r-- | lib/Android.mk | 63 | ||||
-rw-r--r-- | lib/utils.c | 6 | ||||
-rw-r--r-- | tc/Android.mk | 20 | ||||
-rw-r--r-- | tc/tc.c | 14 | ||||
-rw-r--r-- | tc/tc_util.h | 4 |
6 files changed, 108 insertions, 2 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 00000000..ba187a6d --- /dev/null +++ b/Android.mk @@ -0,0 +1,3 @@ +ifneq ($(TARGET_SIMULATOR),true) +include $(call all-subdir-makefiles) +endif diff --git a/lib/Android.mk b/lib/Android.mk new file mode 100644 index 00000000..daca9cd8 --- /dev/null +++ b/lib/Android.mk @@ -0,0 +1,63 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_SRC_FILES := utils.c rt_names.c ll_types.c ll_proto.c ll_addr.c inet_proto.c +LOCAL_MODULE := libiprouteutil +LOCAL_SYSTEM_SHARED_LIBRARIES := libc +LOCAL_C_INCLUDES := $(KERNEL_HEADERS) external/iproute2/include +LOCAL_CFLAGS := -O2 -g -W -Wall \ + -DHAVE_UNISTD_H \ + -DHAVE_ERRNO_H \ + -DHAVE_NETINET_IN_H \ + -DHAVE_SYS_IOCTL_H \ + -DHAVE_SYS_MMAN_H \ + -DHAVE_SYS_MOUNT_H \ + -DHAVE_SYS_PRCTL_H \ + -DHAVE_SYS_RESOURCE_H \ + -DHAVE_SYS_SELECT_H \ + -DHAVE_SYS_STAT_H \ + -DHAVE_SYS_TYPES_H \ + -DHAVE_STDLIB_H \ + -DHAVE_STRDUP \ + -DHAVE_MMAP \ + -DHAVE_UTIME_H \ + -DHAVE_GETPAGESIZE \ + -DHAVE_LSEEK64 \ + -DHAVE_LSEEK64_PROTOTYPE \ + -DHAVE_EXT2_IOCTLS \ + -DHAVE_LINUX_FD_H \ + -DHAVE_TYPE_SSIZE_T +LOCAL_PRELINK_MODULE := false +include $(BUILD_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_SRC_FILES := ll_map.c libnetlink.c +LOCAL_MODULE := libnetlink +LOCAL_SYSTEM_SHARED_LIBRARIES := libc +LOCAL_C_INCLUDES := $(KERNEL_HEADERS) external/iproute2/include +LOCAL_CFLAGS := -O2 -g -W -Wall \ + -DHAVE_UNISTD_H \ + -DHAVE_ERRNO_H \ + -DHAVE_NETINET_IN_H \ + -DHAVE_SYS_IOCTL_H \ + -DHAVE_SYS_MMAN_H \ + -DHAVE_SYS_MOUNT_H \ + -DHAVE_SYS_PRCTL_H \ + -DHAVE_SYS_RESOURCE_H \ + -DHAVE_SYS_SELECT_H \ + -DHAVE_SYS_STAT_H \ + -DHAVE_SYS_TYPES_H \ + -DHAVE_STDLIB_H \ + -DHAVE_STRDUP \ + -DHAVE_MMAP \ + -DHAVE_UTIME_H \ + -DHAVE_GETPAGESIZE \ + -DHAVE_LSEEK64 \ + -DHAVE_LSEEK64_PROTOTYPE \ + -DHAVE_EXT2_IOCTLS \ + -DHAVE_LINUX_FD_H \ + -DHAVE_TYPE_SSIZE_T + +LOCAL_PRELINK_MODULE := false + +include $(BUILD_SHARED_LIBRARY) diff --git a/lib/utils.c b/lib/utils.c index a60d884e..89717513 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -297,6 +297,7 @@ int get_addr_1(inet_prefix *addr, const char *name, int family) return 0; } +#ifndef ANDROID if (family == AF_DECnet) { struct dn_naddr dna; addr->family = AF_DECnet; @@ -307,6 +308,7 @@ int get_addr_1(inet_prefix *addr, const char *name, int family) addr->bitlen = -1; return 0; } +#endif addr->family = AF_INET; if (family != AF_UNSPEC && family != AF_INET) @@ -519,6 +521,7 @@ const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen case AF_INET: case AF_INET6: return inet_ntop(af, addr, buf, buflen); +#ifndef ANDROID case AF_IPX: return ipx_ntop(af, addr, buf, buflen); case AF_DECnet: @@ -527,6 +530,7 @@ const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen memcpy(dna.a_addr, addr, 2); return dnet_ntop(af, &dna, buf, buflen); } +#endif default: return "???"; } @@ -697,6 +701,7 @@ int print_timestamp(FILE *fp) int cmdlineno; +#ifndef ANDROID /* Like glibc getline but handle continuation lines and comments */ ssize_t getcmdline(char **linep, size_t *lenp, FILE *in) { @@ -741,6 +746,7 @@ ssize_t getcmdline(char **linep, size_t *lenp, FILE *in) } return cc; } +#endif /* split command line into argument vector */ int makeargs(char *line, char *argv[], int maxargs) diff --git a/tc/Android.mk b/tc/Android.mk new file mode 100644 index 00000000..da2b3583 --- /dev/null +++ b/tc/Android.mk @@ -0,0 +1,20 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_SRC_FILES := tc.c tc_qdisc.c q_cbq.c tc_util.c tc_class.c tc_core.c m_action.c \ + m_estimator.c tc_filter.c tc_monitor.c tc_stab.c tc_cbq.c \ + tc_estimator.c + +LOCAL_MODULE := tc + +LOCAL_SYSTEM_SHARED_LIBRARIES := \ + libc libm + +LOCAL_SHARED_LIBRARIES += libiprouteutil libnetlink + +LOCAL_C_INCLUDES := $(KERNEL_HEADERS) external/iproute2/include + +LOCAL_CFLAGS := -O2 -g -W -Wall + +include $(BUILD_EXECUTABLE) + @@ -182,7 +182,11 @@ noexist: static void usage(void) { fprintf(stderr, "Usage: tc [ OPTIONS ] OBJECT { COMMAND | help }\n" +#ifdef ANDROID + " tc [-force]\n" +#else " tc [-force] -batch filename\n" +#endif "where OBJECT := { qdisc | class | filter | action | monitor }\n" " OPTIONS := { -s[tatistics] | -d[etails] | -r[aw] | -p[retty] | -b[atch] [filename] }\n"); } @@ -214,6 +218,7 @@ static int do_cmd(int argc, char **argv) return -1; } +#ifndef ANDROID static int batch(const char *name) { char *line = NULL; @@ -257,13 +262,15 @@ static int batch(const char *name) rtnl_close(&rth); return ret; } - +#endif int main(int argc, char **argv) { int ret; +#ifndef ANDROID int do_batching = 0; char *batchfile = NULL; +#endif while (argc > 1) { if (argv[1][0] != '-') @@ -287,20 +294,23 @@ int main(int argc, char **argv) return 0; } else if (matches(argv[1], "-force") == 0) { ++force; +#ifndef ANDROID } else if (matches(argv[1], "-batch") == 0) { do_batching = 1; if (argc > 2) batchfile = argv[2]; argc--; argv++; +#endif } else { fprintf(stderr, "Option \"%s\" is unknown, try \"tc -help\".\n", argv[1]); return -1; } argc--; argv++; } - +#ifndef ANDROID if (do_batching) return batch(batchfile); +#endif if (argc <= 1) { usage(); diff --git a/tc/tc_util.h b/tc/tc_util.h index d84b09a8..8f6b82d6 100644 --- a/tc/tc_util.h +++ b/tc/tc_util.h @@ -7,6 +7,10 @@ #include <linux/gen_stats.h> #include "tc_core.h" +#ifndef MIN +#define MIN(x,y) ((x)<(y)?(x):(y)) +#endif + /* This is the deprecated multiqueue interface */ #ifndef TCA_PRIO_MAX enum |