diff options
Diffstat (limited to 'src/android_stubs.h')
-rw-r--r-- | src/android_stubs.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/android_stubs.h b/src/android_stubs.h new file mode 100644 index 0000000..60b1e29 --- /dev/null +++ b/src/android_stubs.h @@ -0,0 +1,47 @@ +#include <linux/ethtool.h> +#include <sys/socket.h> + +/* Android doesn't provide locale support int its C and C++ + * runtime. Handled at higher level in application stack. + * So define stubs for gettext funtions used. + */ +#define PACKAGE 0 +#define LOCALEDIR 0 +#define bindtextdomain(x, y) +#define textdomain(x) +#define gettext(x) (x) + +/* Android C++ new operator does not throw exception on failure */ +#define set_new_handler(x) + +/* define stubs for C++ exception handling */ +#define try if (true) +#define catch(x) if (false) + +/* Define __NR_perf_event_open if not already defined */ +#if __arm__ +#ifndef __NR_perf_event_open +#define __NR_perf_event_open 364 +#endif +#endif + +/* Implement missing functions */ +static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, + __u32 speed) +{ + + ep->speed = (__u16)speed; + ep->speed_hi = (__u16)(speed >> 16); +} + +static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep) +{ + return (ep->speed_hi << 16) | ep->speed; +} + +static inline char *strchrnul(const char *s, int c) +{ + while (*s && (*s != c)) + s++; + return (char *)s; +} |