aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-10-07 09:29:17 -0700
committerRob Landley <rob@landley.net>2018-10-07 16:31:02 -0500
commit742f553b18194b82c78f1a96b57cc34958b53ce7 (patch)
tree5dc442e16cae9c3502d3065a65eb12b111568e6f
parent2b789c342a8a1bc79eaf753b7f8aace247020f44 (diff)
downloadtoybox-742f553b18194b82c78f1a96b57cc34958b53ce7.tar.gz
libcutils isn't in the NDK.
Bug: https://github.com/landley/toybox/issues/43
-rw-r--r--lib/portability.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/portability.h b/lib/portability.h
index d20e4099..1f5fbf6f 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -244,7 +244,6 @@ pid_t xfork(void);
// 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 {
@@ -262,8 +261,6 @@ 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)
{
@@ -271,6 +268,15 @@ static inline int __system_property_set(const char *key, const char *value)
}
#endif
+#if defined(__BIONIC__)
+#if defined(__ANDROID_NDK__)
+static inline int get_sched_policy(int tid, void *policy) {return 0;}
+static inline char *get_sched_policy_name(int policy) {return "unknown";}
+#else
+#include <cutils/sched_policy.h>
+#endif
+#endif
+
#ifndef SYSLOG_NAMES
typedef struct {char *c_name; int c_val;} CODE;
extern CODE prioritynames[], facilitynames[];