aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-09-27 16:34:49 -0700
committerRob Landley <rob@landley.net>2018-10-04 12:53:59 -0500
commitb33d37d6f735f008c15a4acf86a66e0e9a6dbef6 (patch)
treec3eb677ce34041e910d94f03ac91b59d2518aa88 /lib
parente29880dee2be718e5c1d1e175708f922962dbed2 (diff)
downloadtoybox-b33d37d6f735f008c15a4acf86a66e0e9a6dbef6.tar.gz
Make it possible to build the AOSP .config against glibc.
It's possible that we should just pull setprop back out of toybox to live with getprop in system/core/, but this lets us build the same toybox configuration for device and host in AOSP. (Longer term we'd like to use host bionic, but if we enable this we can start experimenting on the tobyox side before the bionic side is finished.)
Diffstat (limited to 'lib')
-rw-r--r--lib/portability.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/portability.h b/lib/portability.h
index 8e1049f9..d20e4099 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -240,11 +240,35 @@ pid_t xfork(void);
//#define strncpy(...) @@strncpyisbadmmkay@@
//#define strncat(...) @@strncatisbadmmkay@@
-#if CFG_TOYBOX_ANDROID_SCHEDPOLICY
+// Support building the Android tools on glibc, so hermetic AOSP builds can
+// use toybox before they're ready to switch to host bionic.
+#ifdef __BIONIC__
+#include <android/log.h>
#include <cutils/sched_policy.h>
+#include <sys/system_properties.h>
#else
+typedef enum android_LogPriority {
+ ANDROID_LOG_UNKNOWN = 0,
+ ANDROID_LOG_DEFAULT,
+ ANDROID_LOG_VERBOSE,
+ ANDROID_LOG_DEBUG,
+ ANDROID_LOG_INFO,
+ ANDROID_LOG_WARN,
+ ANDROID_LOG_ERROR,
+ ANDROID_LOG_FATAL,
+ ANDROID_LOG_SILENT,
+} android_LogPriority;
+static inline int __android_log_write(int pri, const char *tag, const char *msg)
+{
+ return -1;
+}
static inline int get_sched_policy(int tid, void *policy) {return 0;}
static inline char *get_sched_policy_name(int policy) {return "unknown";}
+#define PROP_VALUE_MAX 92
+static inline int __system_property_set(const char *key, const char *value)
+{
+ return -1;
+}
#endif
#ifndef SYSLOG_NAMES