diff options
author | 2017-04-10 14:06:11 -0700 | |
---|---|---|
committer | 2017-04-11 13:13:01 +0000 | |
commit | 3206224672d0a86cdede609e83ccc985754fb6ec (patch) | |
tree | 343315e0f16421355f441bbb0392ba970453f644 | |
parent | c441fbfe434a6af60651eb112040ec58e5fedb64 (diff) |
binder: add getDriverName()
Ass ProcessState::getDriverName() to retrieve the /dev node that
libbinder is initialized with in this process. This can be used
elsewhere to add debug code that is enabled for only one binder domain
or another.
Test: sailfish
Change-Id: I3ea9f0dcc97204508791bdeb70f790980be278a5
Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r-- | include/binder/ProcessState.h | 3 | ||||
-rw-r--r-- | libs/binder/ProcessState.cpp | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/binder/ProcessState.h b/include/binder/ProcessState.h index 05e9d09ee8..1ef045d455 100644 --- a/include/binder/ProcessState.h +++ b/include/binder/ProcessState.h @@ -69,6 +69,8 @@ public: status_t setThreadPoolMaxThreadCount(size_t maxThreads); void giveThreadPoolName(); + String8 getDriverName(); + private: friend class IPCThreadState; @@ -86,6 +88,7 @@ private: handle_entry* lookupHandleLocked(int32_t handle); + String8 mDriverName; int mDriverFD; void* mVMStart; diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 5c4cfe2156..9ccf07ca2a 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -317,6 +317,10 @@ void ProcessState::giveThreadPoolName() { androidSetThreadName( makeBinderThreadName().string() ); } +String8 ProcessState::getDriverName() { + return mDriverName; +} + static int open_driver(const char *driver) { int fd = open(driver, O_RDWR | O_CLOEXEC); @@ -346,7 +350,8 @@ static int open_driver(const char *driver) } ProcessState::ProcessState(const char *driver) - : mDriverFD(open_driver(driver)) + : mDriverName(String8(driver)) + , mDriverFD(open_driver(driver)) , mVMStart(MAP_FAILED) , mThreadCountLock(PTHREAD_MUTEX_INITIALIZER) , mThreadCountDecrement(PTHREAD_COND_INITIALIZER) @@ -367,6 +372,7 @@ ProcessState::ProcessState(const char *driver) ALOGE("Using /dev/binder failed: unable to mmap transaction memory.\n"); close(mDriverFD); mDriverFD = -1; + mDriverName.clear(); } } |