Bug: https://github.com/landley/toybox/issues/43
---
 lib/portability.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
From 253004e1fcea162f053ecb10853ce8813589dc7c Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Sun, 7 Oct 2018 09:29:17 -0700
Subject: [PATCH] libcutils isn't in the NDK.

Bug: https://github.com/landley/toybox/issues/43
---
 lib/portability.h | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/portability.h b/lib/portability.h
index d20e409..1f5fbf6 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[];
-- 
2.19.0.605.g01d371f741-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to