diff options
author | 2021-11-12 22:54:53 +0000 | |
---|---|---|
committer | 2022-07-01 05:50:52 +0000 | |
commit | 32150288f88b2a1a6e7268b24cd8b2646b1af5d6 (patch) | |
tree | 4dab826b41b4fec3fb19ed9d4aa2be1364d300f0 /libs/binder/RpcState.cpp | |
parent | ffa3aaac5513bc2ef6c7d3f88db9976f86275f88 (diff) |
libbinder: build option to disable the kernel IPC, part 1/2
Add a new BINDER_WITH_KERNEL_IPC macro to enable all code that
uses IPCThreadState or ProcessState. This macro is defined for
Android libbinder but left out for non-Android builds.
Bug: 224644083
Test: m
Change-Id: I622757fcc0f9885dbf271c0ffa84c54938d50774
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r-- | libs/binder/RpcState.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index 01311b505f..bde3d90d90 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -36,7 +36,6 @@ namespace android { -using base::ScopeGuard; using base::StringPrintf; #if RPC_FLAKE_PRONE @@ -733,6 +732,7 @@ status_t RpcState::processCommand( const sp<RpcSession::RpcConnection>& connection, const sp<RpcSession>& session, const RpcWireHeader& command, CommandType type, std::vector<std::variant<base::unique_fd, base::borrowed_fd>>&& ancillaryFds) { +#ifdef BINDER_WITH_KERNEL_IPC IPCThreadState* kernelBinderState = IPCThreadState::selfOrNull(); IPCThreadState::SpGuard spGuard{ .address = __builtin_frame_address(0), @@ -742,11 +742,13 @@ status_t RpcState::processCommand( if (kernelBinderState != nullptr) { origGuard = kernelBinderState->pushGetCallingSpGuard(&spGuard); } - ScopeGuard guardUnguard = [&]() { + + base::ScopeGuard guardUnguard = [&]() { if (kernelBinderState != nullptr) { kernelBinderState->restoreGetCallingSpGuard(origGuard); } }; +#endif // BINDER_WITH_KERNEL_IPC switch (command.command) { case RPC_COMMAND_TRANSACT: |