mirror of
https://github.com/openharmony/distributed_hardware_fwk.git
synced 2026-07-01 20:24:00 -04:00
!113 添加动态库操作出错信息log, codex问题修改
Merge pull request !113 from dengliang/master
This commit is contained in:
@@ -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<GetMgrFunc>(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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<std::shared_mutex> lock(onlineDevMutex_);
|
||||
auto iter = std::find_if(onlineDeviceMap_.begin(), onlineDeviceMap_.end(),
|
||||
[networkId](const auto &item) {return networkId.compare(item.second) == 0; });
|
||||
|
||||
Reference in New Issue
Block a user