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/Debug.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/Debug.cpp')
-rw-r--r-- | libs/binder/Debug.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/binder/Debug.cpp b/libs/binder/Debug.cpp index e4ac4b49a4..c6e4fb378d 100644 --- a/libs/binder/Debug.cpp +++ b/libs/binder/Debug.cpp @@ -15,6 +15,7 @@ */ #include "Debug.h" +#include "BuildFlags.h" #include <binder/ProcessState.h> @@ -301,6 +302,11 @@ void printHexData(int32_t indent, const void *buf, size_t length, } ssize_t getBinderKernelReferences(size_t count, uintptr_t* buf) { + if constexpr (!kEnableKernelIpc) { + LOG_ALWAYS_FATAL("Binder kernel driver disabled at build time"); + return 0; + } + sp<ProcessState> proc = ProcessState::selfOrNull(); if (proc.get() == nullptr) { return 0; |