From: Yifan Hong Date: Thu, 25 May 2017 02:45:02 +0000 (-0700) Subject: Add pids for processes that dlopens implementations X-Git-Tag: android-x86-9.0-r1~245^2~1^2^2~5^2~15^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f2d557b619394d201cdf4571a20fa92480c9f7fd;p=android-x86%2Fframeworks-native.git Add pids for processes that dlopens implementations Test: lshal -itrpc Test: lshal Test: lshal --init-vintf Test: lshal_test Bug: 37639822 Change-Id: Ia415e5f8dbcd10f24e9a5cfdd591eb829a1da89e --- diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp index 38b406ce86..34012fea6d 100644 --- a/cmds/lshal/ListCommand.cpp +++ b/cmds/lshal/ListCommand.cpp @@ -415,7 +415,8 @@ Status ListCommand::fetchAllLibraries(const sp &manager) { using namespace ::android::hardware; using namespace ::android::hidl::manager::V1_0; using namespace ::android::hidl::base::V1_0; - auto ret = timeoutIPC(manager, &IServiceManager::debugDump, [&] (const auto &infos) { + using std::literals::chrono_literals::operator""s; + auto ret = timeoutIPC(2s, manager, &IServiceManager::debugDump, [&] (const auto &infos) { std::map entries; for (const auto &info : infos) { std::string interfaceName = std::string{info.interfaceName.c_str()} + "/" + @@ -425,7 +426,7 @@ Status ListCommand::fetchAllLibraries(const sp &manager) { .transport = "passthrough", .serverPid = NO_PID, .serverObjectAddress = NO_PTR, - .clientPids = {}, + .clientPids = info.clientPids, .arch = ARCH_UNKNOWN }).first->second.arch |= fromBaseArchitecture(info.arch); } diff --git a/cmds/lshal/Timeout.h b/cmds/lshal/Timeout.h index ca477bf615..c940404200 100644 --- a/cmds/lshal/Timeout.h +++ b/cmds/lshal/Timeout.h @@ -77,14 +77,15 @@ bool timeout(std::chrono::duration delay, std::function &&func return success; } -template +template typename std::result_of::type -timeoutIPC(const sp &interfaceObject, Function &&func, Args &&... args) { +timeoutIPC(std::chrono::duration wait, const sp &interfaceObject, Function &&func, + Args &&... args) { using ::android::hardware::Status; typename std::result_of::type ret{Status::ok()}; auto boundFunc = std::bind(std::forward(func), interfaceObject.get(), std::forward(args)...); - bool success = timeout(IPC_CALL_WAIT, [&ret, &boundFunc] { + bool success = timeout(wait, [&ret, &boundFunc] { ret = std::move(boundFunc()); }); if (!success) { @@ -93,5 +94,12 @@ timeoutIPC(const sp &interfaceObject, Function &&func, Args &&... args) { return ret; } +template +typename std::result_of::type +timeoutIPC(const sp &interfaceObject, Function &&func, Args &&... args) { + return timeoutIPC(IPC_CALL_WAIT, interfaceObject, func, args...); +} + + } // namespace lshal } // namespace android