diff --git a/adapter/uhdf2/hdi/src/hdi_smq_syncer.cpp b/adapter/uhdf2/hdi/src/hdi_smq_syncer.cpp index ddf827e3d2df025ee694e52c6a42b2c363c84e43..59e854d5aa428d5f6834a772273a834437d77dda 100644 --- a/adapter/uhdf2/hdi/src/hdi_smq_syncer.cpp +++ b/adapter/uhdf2/hdi/src/hdi_smq_syncer.cpp @@ -76,7 +76,7 @@ int SharedMemQueueSyncer::FutexWait(uint32_t bitset, int64_t timeoutNanoSec) } status = -errno; if (status != ETIMEDOUT) { - HDF_LOGE("failed to wait smq futex, %{publich}d", status); + HDF_LOGE("failed to wait smq futex, status: %{public}d, errno desc: %{public}s", status, strerror(errno)); } return status; } @@ -91,7 +91,7 @@ int SharedMemQueueSyncer::Wake(uint32_t bitset) int ret = syscall(__NR_futex, syncAddr_, FUTEX_WAKE_BITSET, INT_MAX, 0, 0, bitset); if (ret < 0) { - HDF_LOGE("failed to wakeup smq futex, %{public}d", errno); + HDF_LOGE("failed to wakeup smq futex, errno: %{public}d, errno desc: %{public}s", errno, strerror(errno)); return -errno; } diff --git a/adapter/uhdf2/host/devhost.c b/adapter/uhdf2/host/devhost.c index d81e3fb23cdcb3e199b18b5de9bab5a903a87d6f..8a1513196b451a7cd9df640c53433ef4ea3b93c8 100644 --- a/adapter/uhdf2/host/devhost.c +++ b/adapter/uhdf2/host/devhost.c @@ -104,13 +104,13 @@ static void HdfSetProcPriority(char **argv) } if (setpriority(PRIO_PROCESS, 0, procPriority) != 0) { - HDF_LOGE("host setpriority failed: %{public}d", errno); + HDF_LOGE("host setpriority failed: errno: %{public}d, errno desc: %{public}s", errno, strerror(errno)); } struct sched_param param = {0}; param.sched_priority = schedPriority; if (sched_setscheduler(0, SCHED_FIFO, ¶m) != 0) { - HDF_LOGE("host sched_setscheduler failed: %{public}d", errno); + HDF_LOGE("host sched_setscheduler failed: errno: %{public}d, errno desc: %{public}s", errno, strerror(errno)); } else { HDF_LOGI("host sched_setscheduler succeed:%{public}d %{public}d", procPriority, schedPriority); } diff --git a/adapter/uhdf2/host/src/driver_loader_full.c b/adapter/uhdf2/host/src/driver_loader_full.c index 6632c4bb2c58d9fdc376558269eaa9b4611a7767..9c851edae6231bb2aad1b36d4263adaef0b0b906 100644 --- a/adapter/uhdf2/host/src/driver_loader_full.c +++ b/adapter/uhdf2/host/src/driver_loader_full.c @@ -52,7 +52,7 @@ struct HdfDriver *HdfDriverLoaderGetDriver(const char *moduleName) } if (realpath(driverPath, realPath) == NULL) { - HDF_LOGE("%{public}s no valid, errno:%{public}d", driverPath, errno); + HDF_LOGE("%{public}s no valid, errno: %{public}d, errno desc: %{public}s", driverPath, errno, strerror(errno)); return NULL; } diff --git a/adapter/uhdf2/manager/src/devmgr_uevent.c b/adapter/uhdf2/manager/src/devmgr_uevent.c index 461dbcf4526867e2f46cafcd8adc4a9a665eb740..c4e223e15581a0d256cf16b938b6a13a8ecb1223 100644 --- a/adapter/uhdf2/manager/src/devmgr_uevent.c +++ b/adapter/uhdf2/manager/src/devmgr_uevent.c @@ -301,7 +301,8 @@ static int32_t DevMgrUeventParseConfig(void) char resolvedPath[PATH_MAX] = {0}; if (realpath(path, resolvedPath) == NULL) { - HDF_LOGE("realpath file: %{public}s failed, errno:%{public}d", path, errno); + HDF_LOGE("realpath file: %{public}s failed, errno: %{public}d, errno desc: %{public}s", + path, errno, strerror(errno)); return HDF_FAILURE; } if (strncmp(resolvedPath, HDF_CONFIG_DIR, strlen(HDF_CONFIG_DIR)) != 0) { @@ -310,7 +311,8 @@ static int32_t DevMgrUeventParseConfig(void) } FILE *file = fopen(resolvedPath, "r"); if (file == NULL) { - HDF_LOGE("%{public}s fopen %{public}s failed:%{public}d", __func__, resolvedPath, errno); + HDF_LOGE("%{public}s fopen %{public}s failed: errno: %{public}d, errno desc: %{public}s", + __func__, resolvedPath, errno, strerror(errno)); return HDF_FAILURE; } @@ -337,26 +339,26 @@ static int32_t DevMgrUeventSocketInit(void) int32_t sockfd = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); if (sockfd < 0) { - HDF_LOGE("create socket failed, err = %{public}d", errno); + HDF_LOGE("create socket failed, err = %{public}d, desc = %{public}s", errno, strerror(errno)); return HDF_FAILURE; } int32_t buffSize = UEVENT_SOCKET_BUFF_SIZE; if (setsockopt(sockfd, SOL_SOCKET, SO_RCVBUF, &buffSize, sizeof(buffSize)) != 0) { - HDF_LOGE("setsockopt: SO_RCVBUF failed err = %{public}d", errno); + HDF_LOGE("setsockopt: SO_RCVBUF failed err = %{public}d, desc = %{public}s", errno, strerror(errno)); close(sockfd); return HDF_FAILURE; } const int32_t on = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) != 0) { - HDF_LOGE("setsockopt: SO_PASSCRED failed, err = %{public}d", errno); + HDF_LOGE("setsockopt: SO_PASSCRED failed, err = %{public}d, desc = %{public}s", errno, strerror(errno)); close(sockfd); return HDF_FAILURE; } if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - HDF_LOGE("bind socket failed, err = %{public}d", errno); + HDF_LOGE("bind socket failed, err = %{public}d, desc = %{public}s", errno, strerror(errno)); close(sockfd); return HDF_FAILURE; } @@ -523,7 +525,7 @@ static int32_t DevMgrUeventThread(void *arg) fd.events = POLLIN | POLLERR; while (true) { if (poll(&fd, 1, -1) <= 0) { - HDF_LOGE("%{public}s poll fail %{public}d", __func__, errno); + HDF_LOGE("%{public}s poll fail %{public}d %{public}s", __func__, errno, strerror(errno)); OsalMSleep(DEVMGR_UEVENT_WAIT_TIME); continue; } diff --git a/adapter/uhdf2/security/src/hdf_security.c b/adapter/uhdf2/security/src/hdf_security.c index 4ed3e42343ea08df9c4cec32526dccace174dd20..d3b9966b534e04e66324feef2c1de20360994aef 100644 --- a/adapter/uhdf2/security/src/hdf_security.c +++ b/adapter/uhdf2/security/src/hdf_security.c @@ -158,7 +158,8 @@ static int32_t HdfUpdateSecurityId(const char *id, uint64_t perms, int32_t isSet } int32_t fd = open(path, O_WRONLY); if (fd < 0) { - HDF_LOGE("open %{public}s failed, errno is %{public}d", HDF_SECURE_PATH, errno); + HDF_LOGE("open %{public}s failed, errno is %{public}d, desc is %{public}s", + HDF_SECURE_PATH, errno, strerror(errno)); return HDF_FAILURE; } diff --git a/framework/core/adapter/syscall/src/hdf_syscall_adapter.c b/framework/core/adapter/syscall/src/hdf_syscall_adapter.c index beb84d8a2c45e34dd791227873720d52e45e7937..983a02ae012521914b5bd5d3c1bb79ac7bd54d80 100644 --- a/framework/core/adapter/syscall/src/hdf_syscall_adapter.c +++ b/framework/core/adapter/syscall/src/hdf_syscall_adapter.c @@ -172,7 +172,7 @@ static int32_t HdfDevEventReadAndDispatch(struct HdfDevListenerThread *thread, i if (ret == -HDF_DEV_ERR_NODATA) { ret = HDF_SUCCESS; } else { - HDF_LOGE("%s:ioctl failed, errno=%d", __func__, ret); + HDF_LOGE("%s:ioctl failed, errno=%d, desc=%s", __func__, ret, strerror(errno)); } goto FINISH; @@ -228,7 +228,7 @@ static void SetThreadName(void) if (ret > 0) { ret = prctl(PR_SET_NAME, newTitle); if (ret < 0) { - HDF_LOGE("%s: failed to set thread name, errno is %d", __func__, errno); + HDF_LOGE("%s: failed to set thread name, errno is %d, desc is %s", __func__, errno, strerror(errno)); } } @@ -694,7 +694,7 @@ static int32_t HdfSyscallAdapterDispatch( wrBuf.cmdCode = code; int32_t ret = ioctl(ioService->fd, HDF_WRITE_READ, &wrBuf); if (ret < 0) { - HDF_LOGE("Failed to dispatch serv call ioctl %{public}d", -errno); + HDF_LOGE("Failed to dispatch serv call ioctl %{public}d, %{public}s", -errno, strerror(errno)); ret = -errno; } if (reply != NULL) { diff --git a/framework/core/host/src/hdf_load_vdi.c b/framework/core/host/src/hdf_load_vdi.c index b5c9c79c02beb706a96566530e32d2c29e1ad7cc..44e9b65a3ae513af083d59707a7471e7b4023a1c 100644 --- a/framework/core/host/src/hdf_load_vdi.c +++ b/framework/core/host/src/hdf_load_vdi.c @@ -37,8 +37,8 @@ struct HdfVdiObject *HdfLoadVdi(const char *libName) } if (realpath(path, resolvedPath) == NULL || strncmp(resolvedPath, VDI_PATH, strlen(VDI_PATH)) != 0) { - HDF_LOGE("%{public}s %{public}s %{public}s realpath file name failed %{public}d", - __func__, path, resolvedPath, errno); + HDF_LOGE("%{public}s %{public}s %{public}s realpath file name failed %{public}d, %{public}s", + __func__, path, resolvedPath, errno, strerror(errno)); return NULL; } diff --git a/framework/tools/hc-gen/src/option.cpp b/framework/tools/hc-gen/src/option.cpp index c661d330176bb4fcf5d0d6754ba6010040bbc7c8..f94d91cc361989411841125f64e28f17f481953d 100644 --- a/framework/tools/hc-gen/src/option.cpp +++ b/framework/tools/hc-gen/src/option.cpp @@ -122,8 +122,8 @@ void Option::SetOptionData(char op) void Option::ShowUsage() { - Logger() << "Usage: hc-gen [Options] [File]\n" - << "options:"; + Logger() << "Usage: hc-gen [Options] [File]\n"; + Logger() << "options:"; ShowOption("-o ", "output file name, default same as input"); ShowOption("-a", "hcb align with four bytes"); ShowOption("-b", "output binary output, default enable"); diff --git a/framework/tools/hdi-gen/codegen/code_emitter.cpp b/framework/tools/hdi-gen/codegen/code_emitter.cpp index d5645eb2475f49a1833966c2d956f61af1fe49e7..657a0eeaebe39ab58ee6423b0f25f4c548b24ef3 100644 --- a/framework/tools/hdi-gen/codegen/code_emitter.cpp +++ b/framework/tools/hdi-gen/codegen/code_emitter.cpp @@ -142,7 +142,9 @@ std::string CodeEmitter::InterfaceToFilePath(const std::string &interfaceName) c { std::string fullName = interfaceName; if (StringHelper::EndWith(fullName, "]")) { - fullName = fullName.substr(0, fullName.find("[")); + if (interfaceName.find("[") != std::string::npos) { + fullName = interfaceName.substr(0, interfaceName.find("[")); + } } size_t index = fullName.rfind("."); std::string prefix = fullName.substr(0, index + 1); diff --git a/framework/tools/hdi-gen/codegen/java_client_proxy_code_emitter.cpp b/framework/tools/hdi-gen/codegen/java_client_proxy_code_emitter.cpp index 0108ec0f24ca33c4f8ed3df290f60c1bd9af5ff0..b215233268a90d700af4a2c2c078503da9dffdb1 100644 --- a/framework/tools/hdi-gen/codegen/java_client_proxy_code_emitter.cpp +++ b/framework/tools/hdi-gen/codegen/java_client_proxy_code_emitter.cpp @@ -114,7 +114,7 @@ void JavaClientProxyCodeEmitter::EmitProxyImpl(StringBuilder &sb) EmitProxyConstants(sb, TAB); sb.Append("\n"); sb.Append(TAB).AppendFormat( - "private static final HiLogLabel TAG = new HiLogLabel(HiLog.LOG_CORE, 0xD001510, \"%s\");\n", + "private static final HiLogLabel TAG = new HiLogLabel(HiLog.LOG_CORE, 0xD002500, \"%s\");\n", interfaceFullName_.c_str()); sb.Append(TAB).Append("private final IRemoteObject remote;\n"); sb.Append(TAB).Append("private static final int ERR_OK = 0;\n"); diff --git a/framework/tools/hdi-gen/util/file.cpp b/framework/tools/hdi-gen/util/file.cpp index 54929190fdb6c7440925578a9fb0c75174d363d0..d2ef19e8fd4e99996cdc8686a95e4bb0adebd714 100644 --- a/framework/tools/hdi-gen/util/file.cpp +++ b/framework/tools/hdi-gen/util/file.cpp @@ -303,7 +303,7 @@ std::set File::FindFiles(const std::string &rootDir) dirs.pop(); DIR *dir = opendir(dirPath.c_str()); if (dir == nullptr) { - Logger::E(TAG, "failed to open '%s', errno:%d", dirPath.c_str(), errno); + Logger::E(TAG, "failed to open '%s', errno:%d, desc:%s", dirPath.c_str(), errno, strerror(errno)); continue; }