summaryrefslogtreecommitdiff
path: root/libs/binder/ProcessState.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2019-01-02 17:54:16 -0800
committer Steven Moreland <smoreland@google.com> 2019-01-11 10:40:04 -0800
commit7732a091e496da763142d45cea78cad432369e5d (patch)
tree470dfc68bd4abc1a7b68cc5d6fcc196cabf9ca54 /libs/binder/ProcessState.cpp
parenta7fa269ddaf4ee156bbe4796f0e77541d1283f98 (diff)
Allow error/abort for non-oneway calls.
Low-level processes like init might not want to make blocking calls. This provides the mechanism to programmatically enforce that. Test: enable ERROR_BLOCKING on process and look at callstacks Bug: 36424585 Change-Id: I6dad33271108768f8bfc4723bf3eeddbf9720395 (cherry picked from commit b7412b0d15e5e5625c63cc2aacba72a692594837)
Diffstat (limited to 'libs/binder/ProcessState.cpp')
-rw-r--r--libs/binder/ProcessState.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 53f8dddfe1..3798b61ab9 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -234,6 +234,12 @@ ssize_t ProcessState::getKernelReferences(size_t buf_count, uintptr_t* buf)
return count;
}
+void ProcessState::setCallRestriction(CallRestriction restriction) {
+ LOG_ALWAYS_FATAL_IF(IPCThreadState::selfOrNull(), "Call restrictions must be set before the threadpool is started.");
+
+ mCallRestriction = restriction;
+}
+
ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle)
{
const size_t N=mHandleToObject.size();
@@ -426,6 +432,7 @@ ProcessState::ProcessState(const char *driver)
, mBinderContextUserData(nullptr)
, mThreadPoolStarted(false)
, mThreadPoolSeq(1)
+ , mCallRestriction(CallRestriction::NONE)
{
if (mDriverFD >= 0) {
// mmap the binder, providing a chunk of virtual address space to receive transactions.