summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2022-06-13 22:52:45 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-06-13 22:52:45 +0000
commitd5a68b47029d33b80f297329c0be9e9a09071c1a (patch)
tree05d01d801be190607e5e5934f5c6bb584a891583
parent2619591d79278a25ee012e83d350af060095b0e9 (diff)
parent0292d80f469a4a2b0d8057af125392b73baae375 (diff)
downloadnative-temp_sam_236045730.tar.gz
Merge "libbinder: compile some Linux code conditionally" am: 0292d80f46temp_sam_236045730
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2081787 Change-Id: Id06010e4a12be1139ac8883c782e882265dce7cd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/binder/Binder.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 6a12e65fc0..e2db1a389c 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -32,9 +32,12 @@
#include <utils/misc.h>
#include <inttypes.h>
-#include <linux/sched.h>
#include <stdio.h>
+#ifdef __linux__
+#include <linux/sched.h>
+#endif
+
#include "RpcState.h"
namespace android {
@@ -234,11 +237,13 @@ class BBinder::Extras
{
public:
// unlocked objects
- bool mRequestingSid = false;
- bool mInheritRt = false;
sp<IBinder> mExtension;
+#ifdef __linux__
int mPolicy = SCHED_NORMAL;
int mPriority = 0;
+#endif
+ bool mRequestingSid = false;
+ bool mInheritRt = false;
// for below objects
Mutex mLock;
@@ -407,6 +412,7 @@ sp<IBinder> BBinder::getExtension() {
return e->mExtension;
}
+#ifdef __linux__
void BBinder::setMinSchedulerPolicy(int policy, int priority) {
LOG_ALWAYS_FATAL_IF(mParceled,
"setMinSchedulerPolicy() should not be called after a binder object "
@@ -451,6 +457,7 @@ int BBinder::getMinSchedulerPriority() {
if (e == nullptr) return 0;
return e->mPriority;
}
+#endif // __linux__
bool BBinder::isInheritRt() {
Extras* e = mExtras.load(std::memory_order_acquire);
@@ -478,7 +485,12 @@ void BBinder::setInheritRt(bool inheritRt) {
}
pid_t BBinder::getDebugPid() {
+#ifdef __linux__
return getpid();
+#else
+ // TODO: handle other OSes
+ return 0;
+#endif // __linux__
}
void BBinder::setExtension(const sp<IBinder>& extension) {