From 3f6090df259d925bb5aae2a0a8aa363f9a7a036b Mon Sep 17 00:00:00 2001 From: wanderer-dl122 Date: Fri, 17 Jun 2022 16:00:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?codex=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanderer-dl122 --- .../distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp b/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp index 13744cba..8f48c199 100644 --- a/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/utils/dh_context.cpp @@ -90,7 +90,8 @@ std::string DHContext::GetNetworkIdByUUID(const std::string &uuid) return onlineDeviceMap_[uuid]; } -std::string DHContext::GetUUIDByNetworkId(const std::string &networkId) { +std::string DHContext::GetUUIDByNetworkId(const std::string &networkId) +{ std::unique_lock lock(onlineDevMutex_); auto iter = std::find_if(onlineDeviceMap_.begin(), onlineDeviceMap_.end(), [networkId](const auto &item) {return networkId.compare(item.second) == 0; }); -- Gitee From 70625af137bf5a13f2f8d3f7fa93bf702c0b0675 Mon Sep 17 00:00:00 2001 From: wanderer-dl122 Date: Fri, 17 Jun 2022 16:09:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?codex=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanderer-dl122 --- .../src/distributed_hardware_manager_factory.cpp | 4 ++-- .../src/componentloader/component_loader.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp index 5afa2b0f..c3442a10 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_manager_factory.cpp @@ -174,13 +174,13 @@ int32_t DistributedHardwareManagerFactory::LoadLibrary() handler_ = dlopen(LIB_NAME, RTLD_NOW | RTLD_NODELETE); if (handler_ == nullptr) { - DHLOGE("open %s failed.", LIB_NAME); + DHLOGE("open %s failed, fail reason : %s", LIB_NAME, dlerror()); return ERR_DH_FWK_HARDWARE_MANAGER_LIB_IMPL_OPEN_FAILED; } auto getManager = reinterpret_cast(dlsym(handler_, FUNC_GET_INSTANCE.c_str())); if (getManager == nullptr) { - DHLOGE("can not find %s.", FUNC_GET_INSTANCE.c_str()); + DHLOGE("can not find %s, failed reason : %s", FUNC_GET_INSTANCE.c_str(), dlerror()); CloseLibrary(); return ERR_DH_FWK_HARDWARE_MANAGER_LIB_IMPL_GET_INSTANCE_FAILED; } diff --git a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp index 8b37b3c8..41a16eca 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp @@ -150,7 +150,7 @@ void *ComponentLoader::GetHandler(const std::string &soName) } void *pHandler = dlopen(path, RTLD_LAZY | RTLD_NODELETE); if (pHandler == nullptr) { - DHLOGE("%s handler load failed.", path); + DHLOGE("%s handler load failed, failed reason : %s", path, dlerror()); HiSysEventWriteMsg(DHFWK_INIT_FAIL, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, "dhfwk so open failed, soname : " + soName); return nullptr; @@ -180,7 +180,7 @@ int32_t ComponentLoader::GetHardwareHandler(const DHType dhType, IHardwareHandle GetHardwareClass getHardwareClassHandler = (GetHardwareClass)dlsym(compHandlerMap_[dhType].hardwareHandler, COMPONENT_LOADER_GET_HARDWARE_HANDLER.c_str()); if (getHardwareClassHandler == nullptr) { - DHLOGE("get getHardwareClassHandler is null."); + DHLOGE("get getHardwareClassHandler is null, failed reason : %s", dlerror()); dlclose(compHandlerMap_[dhType].hardwareHandler); compHandlerMap_[dhType].hardwareHandler = nullptr; return ERR_DH_FWK_LOADER_HANDLER_IS_NULL; @@ -199,7 +199,7 @@ int32_t ComponentLoader::GetSource(const DHType dhType, IDistributedHardwareSour GetSourceHardwareClass getSourceHardClassHandler = (GetSourceHardwareClass)dlsym( compHandlerMap_[dhType].sourceHandler, COMPONENT_LOADER_GET_SOURCE_HANDLER.c_str()); if (getSourceHardClassHandler == nullptr) { - DHLOGE("get getSourceHardClassHandler is null."); + DHLOGE("get getSourceHardClassHandler is null, failed reason : %s", dlerror()); dlclose(compHandlerMap_[dhType].sourceHandler); compHandlerMap_[dhType].sourceHandler = nullptr; return ERR_DH_FWK_LOADER_HANDLER_IS_NULL; @@ -218,7 +218,7 @@ int32_t ComponentLoader::GetSink(const DHType dhType, IDistributedHardwareSink * GetSinkHardwareClass getSinkHardwareClassHandler = (GetSinkHardwareClass)dlsym(compHandlerMap_[dhType].sinkHandler, COMPONENT_LOADER_GET_SINK_HANDLER.c_str()); if (getSinkHardwareClassHandler == nullptr) { - DHLOGE("get getSinkHardwareClassHandler is null."); + DHLOGE("get getSinkHardwareClassHandler is null, failed reason : %s", dlerror()); dlclose(compHandlerMap_[dhType].sinkHandler); compHandlerMap_[dhType].sinkHandler = nullptr; return ERR_DH_FWK_LOADER_HANDLER_IS_NULL; -- Gitee