From 97cb08761ff267f139b013ca30e60d940758793e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A8=8A=E6=99=AF=E4=B9=90?= Date: Thu, 22 May 2025 15:11:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=80=E5=8C=96=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 樊景乐 --- common/appspawn_server.c | 6 +++--- modules/asan/asan_detector.c | 4 ++-- modules/common/appspawn_encaps.c | 2 +- modules/common/appspawn_silk.c | 8 ++++---- modules/sandbox/appspawn_sandbox.c | 2 +- modules/sandbox/sandbox_shared_mount.cpp | 10 +++++----- modules/sandbox/sandbox_utils.cpp | 22 +++++++++++----------- standard/BUILD.gn | 2 ++ standard/appspawn_kickdog.c | 4 ++-- standard/appspawn_msgmgr.c | 16 ++++++++-------- standard/appspawn_service.c | 16 ++++++++-------- util/include/appspawn_utils.h | 2 ++ 12 files changed, 49 insertions(+), 45 deletions(-) diff --git a/common/appspawn_server.c b/common/appspawn_server.c index 58c6248d..d773f87d 100644 --- a/common/appspawn_server.c +++ b/common/appspawn_server.c @@ -35,7 +35,7 @@ static void NotifyResToParent(struct AppSpawnContent *content, AppSpawnClient *client, int result) { - APPSPAWN_LOGI("NotifyResToParent: %{public}d", result); + APPSPAWN_DUMP("NotifyResToParent: %{public}d", result); if (content->notifyResToParent != NULL) { content->notifyResToParent(content, client, result); } @@ -43,7 +43,7 @@ static void NotifyResToParent(struct AppSpawnContent *content, AppSpawnClient *c void ProcessExit(int code) { - APPSPAWN_LOGI("ExitCode:%{public}d", code); + APPSPAWN_DUMP("ExitCode:%{public}d", code); #ifdef OHOS_LITE _exit(0x7f); // 0x7f user exit #else @@ -123,7 +123,7 @@ int AppSpawnChild(AppSpawnContent *content, AppSpawnClient *client) static int CloneAppSpawn(void *arg) { APPSPAWN_CHECK(arg != NULL, return -1, "Invalid content for appspawn"); - APPSPAWN_LOGI("CloneNwebSpawn done."); + APPSPAWN_DUMP("CloneNwebSpawn done"); #ifndef APPSPAWN_HELPER ffrt_child_init(); #endif diff --git a/modules/asan/asan_detector.c b/modules/asan/asan_detector.c index c0588a3d..73c5d1b0 100644 --- a/modules/asan/asan_detector.c +++ b/modules/asan/asan_detector.c @@ -101,8 +101,8 @@ static int CheckSupportColdStart(const char *bundleName) APPSPAWN_CHECK(len > 0 && (len < WRAP_VALUE_MAX_LENGTH), return -1, "Invalid to format wrapBundleNameKey"); int ret = GetParameter(wrapBundleNameKey, "", wrapBundleNameValue, WRAP_VALUE_MAX_LENGTH); - APPSPAWN_CHECK(ret > 0 && (!strcmp(wrapBundleNameValue, "asan_wrapper")), return -1, - "Not wrap %{public}s.", bundleName); + APPSPAWN_CHECK_ONLY_EXPER(ret > 0 && (!strcmp(wrapBundleNameValue, "asan_wrapper")), + APPSPAWN_DUMP("Not wrap %{public}s", bundleName); return -1); APPSPAWN_LOGI("Asan: GetParameter %{public}s the value is %{public}s.", wrapBundleNameKey, wrapBundleNameValue); return 0; } diff --git a/modules/common/appspawn_encaps.c b/modules/common/appspawn_encaps.c index 3236e976..62d2aa3a 100644 --- a/modules/common/appspawn_encaps.c +++ b/modules/common/appspawn_encaps.c @@ -360,7 +360,7 @@ APPSPAWN_STATIC int SpawnSetEncapsPermissions(AppSpawnMgr *content, AppSpawningC ret = SpawnBuildEncaps(content, property, &encapsInfoStr); if (ret != 0) { close(encapsFileFd); - APPSPAWN_LOGW("Build encaps object failed, ret: %{public}d", ret); + APPSPAWN_LOGW("Encaps failed %{public}d", ret); return 0; // Can't set permission encpas ability } diff --git a/modules/common/appspawn_silk.c b/modules/common/appspawn_silk.c index 37478b99..27750441 100644 --- a/modules/common/appspawn_silk.c +++ b/modules/common/appspawn_silk.c @@ -114,10 +114,10 @@ static void FreeAllSilkConfig(void) void LoadSilkLibrary(const char *packageName) { - APPSPAWN_CHECK(g_silkConfig.configItems != NULL, return, - "ConfigItems is NULL"); - APPSPAWN_CHECK(packageName != NULL, FreeAllSilkConfig(); return, - "PackageName is NULL"); + APPSPAWN_CHECK_ONLY_EXPER(g_silkConfig.configItems != NULL, + APPSPAWN_DUMP("ConfigItems is NULL"); return); + APPSPAWN_CHECK_ONLY_EXPER(packageName != NULL, + FreeAllSilkConfig(); APPSPAWN_DUMP("PackageName is NULL"); return); char **appName = NULL; void *handle = NULL; for (int i = 0; i < g_silkConfig.configCursor; i++) { diff --git a/modules/sandbox/appspawn_sandbox.c b/modules/sandbox/appspawn_sandbox.c index 610d3ee5..f86b5d82 100644 --- a/modules/sandbox/appspawn_sandbox.c +++ b/modules/sandbox/appspawn_sandbox.c @@ -346,7 +346,7 @@ static int32_t SandboxMountFusePath(const SandboxContext *context, const MountAr APPSPAWN_STATIC void CheckAndCreateSandboxFile(const char *file) { if (access(file, F_OK) == 0) { - APPSPAWN_LOGI("file %{public}s already exist", file); + APPSPAWN_DUMP("file %{public}s exist", file); return; } MakeDirRec(file, FILE_MODE, 0); diff --git a/modules/sandbox/sandbox_shared_mount.cpp b/modules/sandbox/sandbox_shared_mount.cpp index c752a28b..c9d8ea25 100644 --- a/modules/sandbox/sandbox_shared_mount.cpp +++ b/modules/sandbox/sandbox_shared_mount.cpp @@ -114,7 +114,7 @@ static bool IsUnlockStatus(uint32_t uid) std::string lockStatusParam = "startup.appspawn.lockstatus_" + std::to_string(uid); char userLockStatus[LOCK_STATUS_SIZE] = {0}; int ret = GetParameter(lockStatusParam.c_str(), "1", userLockStatus, sizeof(userLockStatus)); - APPSPAWN_LOGI("get param %{public}s %{public}s", lockStatusParam.c_str(), userLockStatus); + APPSPAWN_LOGI("lockStatus %{public}u %{public}s", uid, userLockStatus); if (ret > 0 && (strcmp(userLockStatus, "0") == 0)) { // 0:unlock status 1:lock status return true; } @@ -134,16 +134,16 @@ static int DoSharedMount(const SharedMountArgs *arg) int ret = mount(arg->srcPath, arg->destPath, arg->fsType, arg->mountFlags, arg->options); if (ret != 0) { - APPSPAWN_LOGE("mount %{public}s to %{public}s failed, errno %{public}d", + APPSPAWN_LOGE("mount %{public}s to %{public}s failed err %{public}d", arg->srcPath, arg->destPath, errno); return ret; } ret = mount(nullptr, arg->destPath, nullptr, arg->mountSharedFlag, nullptr); if (ret != 0) { - APPSPAWN_LOGE("mount path %{public}s to shared failed, errno %{public}d", arg->destPath, errno); + APPSPAWN_LOGE("mount path %{public}s failed err %{public}d", arg->destPath, errno); return ret; } - APPSPAWN_LOGI("mount path %{public}s to shared success", arg->destPath); + APPSPAWN_LOGI("mount path %{public}s success", arg->destPath); return 0; } @@ -151,7 +151,7 @@ static bool SetSandboxPathShared(const std::string &sandboxPath) { int ret = mount(nullptr, sandboxPath.c_str(), nullptr, MS_SHARED, nullptr); if (ret != 0) { - APPSPAWN_LOGW("Need to mount %{public}s to shared, errno %{public}d", sandboxPath.c_str(), errno); + APPSPAWN_LOGW("Need to mount %{public}s err %{public}d", sandboxPath.c_str(), errno); return false; } return true; diff --git a/modules/sandbox/sandbox_utils.cpp b/modules/sandbox/sandbox_utils.cpp index 777da7a5..8a30ff9b 100644 --- a/modules/sandbox/sandbox_utils.cpp +++ b/modules/sandbox/sandbox_utils.cpp @@ -220,7 +220,7 @@ static void MakeDirRecursive(const std::string &path, mode_t mode) std::string dir = path.substr(0, index); #ifndef APPSPAWN_TEST APPSPAWN_CHECK(!(access(dir.c_str(), F_OK) < 0 && mkdir(dir.c_str(), mode) < 0), - return, "errno is %{public}d, mkdir %{public}s failed", errno, dir.c_str()); + return, "err %{public}d mkdir %{public}s failed", errno, dir.c_str()); #endif } while (index < size); } @@ -242,7 +242,7 @@ static void MakeDirRecursiveWithClock(const std::string &path, mode_t mode) std::string dir = path.substr(0, index); #ifndef APPSPAWN_TEST APPSPAWN_CHECK(!(access(dir.c_str(), F_OK) < 0 && mkdir(dir.c_str(), mode) < 0), - return, "errno is %{public}d, mkdir %{public}s failed", errno, dir.c_str()); + return, "err %{public}d mkdir %{public}s failed", errno, dir.c_str()); #endif } while (index < size); @@ -353,7 +353,7 @@ int32_t SandboxUtils::DoAppSandboxMountOnce(const AppSpawningCtx *appProperty, c APPSPAWN_CHECK_ONLY_EXPER(diff < FUNC_REPORT_DURATION, ReportAbnormalDuration("MOUNT", diff)); #endif if (ret != 0) { - APPSPAWN_LOGI("errno is: %{public}d, bind mount %{public}s to %{public}s", errno, arg->srcPath, arg->destPath); + APPSPAWN_LOGI("err %{public}d BindMount %{public}s to %{public}s", errno, arg->srcPath, arg->destPath); if (errno == ENOENT && IsNeededCheckPathStatus(appProperty, arg->srcPath)) { CheckDirRecursive(arg->srcPath); } @@ -362,7 +362,7 @@ int32_t SandboxUtils::DoAppSandboxMountOnce(const AppSpawningCtx *appProperty, c ret = mount(nullptr, arg->destPath, nullptr, arg->mountSharedFlag, nullptr); if (ret != 0) { - APPSPAWN_LOGI("errno is: %{public}d, private mount to %{public}s '%{public}u' failed", + APPSPAWN_LOGI("err %{public}d private mount to %{public}s '%{public}u' failed", errno, arg->destPath, arg->mountSharedFlag); if (errno == EINVAL) { CheckMountStatus(arg->destPath); @@ -763,7 +763,7 @@ static int32_t DoDlpAppMountStrategy(const AppSpawningCtx *appProperty, umount2(sandboxPath.c_str(), MNT_DETACH); int fd = open("/dev/fuse", O_RDWR); - APPSPAWN_CHECK(fd != -1, return -EINVAL, "open /dev/fuse failed, errno is %{public}d", errno); + APPSPAWN_CHECK(fd != -1, return -EINVAL, "open /dev/fuse failed err %{public}d", errno); char options[OPTIONS_MAX_LEN]; (void)sprintf_s(options, sizeof(options), "fd=%d," @@ -786,7 +786,7 @@ static int32_t DoDlpAppMountStrategy(const AppSpawningCtx *appProperty, ret = mount(nullptr, sandboxPath.c_str(), nullptr, MS_SHARED, nullptr); APPSPAWN_CHECK(ret == 0, close(fd); - return ret, "errno is: %{public}d, private mount to %{public}s failed", errno, sandboxPath.c_str()); + return ret, "err %{public}d private mount to %{public}s failed", errno, sandboxPath.c_str()); #endif /* set DLP_FUSE_FD */ #ifdef WITH_DLP @@ -1021,7 +1021,7 @@ int SandboxUtils::DoAllSymlinkPointslink(const AppSpawningCtx *appProperty, nloh int ret = symlink(targetName.c_str(), linkName.c_str()); if (ret && errno != EEXIST) { - APPSPAWN_LOGE("errno is %{public}d, symlink failed, %{public}s", errno, linkName.c_str()); + APPSPAWN_LOGE("err %{public}d symlink failed %{public}s", errno, linkName.c_str()); std::string actionStatus = g_statusCheck; (void)JsonUtils::GetStringFromJson(symPoint, g_actionStatuc, actionStatus); @@ -1727,13 +1727,13 @@ int32_t SandboxUtils::ChangeCurrentDir(std::string &sandboxPackagePath, const st if (sandboxSharedStatus) { ret = chroot(sandboxPackagePath.c_str()); - APPSPAWN_CHECK(ret == 0, return ret, "chroot failed, path is %{public}s errno is %{public}d", + APPSPAWN_CHECK(ret == 0, return ret, "chroot failed path %{public}s err %{public}d", sandboxPackagePath.c_str(), errno); return ret; } ret = syscall(SYS_pivot_root, sandboxPackagePath.c_str(), sandboxPackagePath.c_str()); - APPSPAWN_CHECK(ret == 0, return ret, "errno is %{public}d, pivot root failed, packagename is %{public}s", + APPSPAWN_CHECK(ret == 0, return ret, "err %{public}d pivot root failed packagename %{public}s", errno, bundleName.c_str()); ret = umount2(".", MNT_DETACH); @@ -1912,13 +1912,13 @@ int32_t SandboxUtils::SetAppSandboxPropertyNweb(AppSpawningCtx *appProperty, uin if (sandboxSharedStatus) { rc = chroot(sandboxPackagePath.c_str()); - APPSPAWN_CHECK(rc == 0, return rc, "chroot failed, path is %{public}s errno is %{public}d", + APPSPAWN_CHECK(rc == 0, return rc, "chroot failed path %{public}s err %{public}d", sandboxPackagePath.c_str(), errno); return 0; } rc = syscall(SYS_pivot_root, sandboxPackagePath.c_str(), sandboxPackagePath.c_str()); - APPSPAWN_CHECK(rc == 0, return rc, "errno is %{public}d, pivot root failed, packagename is %{public}s", + APPSPAWN_CHECK(rc == 0, return rc, "err %{public}d pivot root failed packagename %{public}s", errno, bundleName.c_str()); rc = umount2(".", MNT_DETACH); diff --git a/standard/BUILD.gn b/standard/BUILD.gn index e9c5b1ec..f28b8337 100644 --- a/standard/BUILD.gn +++ b/standard/BUILD.gn @@ -139,6 +139,8 @@ ohos_shared_library("appspawn_helper") { "init:libbegetutil", ] + deps = ["${appspawn_path}/util:libappspawn_util"] + install_enable = true subsystem_name = "${subsystem_name}" part_name = "${part_name}" diff --git a/standard/appspawn_kickdog.c b/standard/appspawn_kickdog.c index 04a7db13..95059e55 100644 --- a/standard/appspawn_kickdog.c +++ b/standard/appspawn_kickdog.c @@ -73,9 +73,9 @@ static void DealSpawnWatchdog(AppSpawnContent *content, bool isOpen) if (isOpen) { content->wdgOpened = (result != -1); } - APPSPAWN_LOGI("%{public}s %{public}s %{public}s watchdog end,result:%{public}d", + APPSPAWN_DUMP("%{public}s %{public}s %{public}s dog end %{public}d", content->isLinux ? "Linux" : "Hm", (content->mode == MODE_FOR_NWEB_SPAWN) ? - "Nwebspawn" : "Appspawn", isOpen ? "enable" : "kick", result); + "Nweb" : "App", isOpen ? "enable" : "kick", result); } static void ProcessTimerHandle(const TimerHandle taskHandle, void *context) diff --git a/standard/appspawn_msgmgr.c b/standard/appspawn_msgmgr.c index 2e844d93..668f953d 100644 --- a/standard/appspawn_msgmgr.c +++ b/standard/appspawn_msgmgr.c @@ -39,7 +39,7 @@ void *GetAppSpawnMsgExtInfo(const AppSpawnMsgNode *message, const char *name, ui APPSPAWN_CHECK_ONLY_EXPER(message != NULL && message->buffer != NULL, return NULL); APPSPAWN_CHECK_ONLY_EXPER(message->tlvOffset != NULL, return NULL); - APPSPAWN_LOGV("GetAppSpawnMsgExtInfo tlvCount %{public}d name %{public}s", message->tlvCount, name); + APPSPAWN_LOGV("tlvCount %{public}d name %{public}s", message->tlvCount, name); for (uint32_t index = TLV_MAX; index < (TLV_MAX + message->tlvCount); index++) { if (message->tlvOffset[index] == INVALID_OFFSET) { return NULL; @@ -349,7 +349,7 @@ int GetAppSpawnMsgFromBuffer(const uint8_t *buffer, uint32_t bufferLen, static inline void DumpMsgFlags(const char *processName, const char *info, const AppSpawnMsgFlags *msgFlags) { for (uint32_t i = 0; i < msgFlags->count; i++) { - APPSPAWN_DUMP("processName: %{public}s %{public}d %{public}s flags: 0x%{public}x", + APPSPAWN_DUMP("%{public}s %{public}d %{public}s flags:0x%{public}x", processName, i, info, msgFlags->flags[i]); } } @@ -357,7 +357,7 @@ static inline void DumpMsgFlags(const char *processName, const char *info, const static inline void DumpMsgExtInfo(const AppSpawnTlv *tlv) { if (tlv->tlvType != TLV_MAX) { - APPSPAWN_DUMP("App tlv info: [%{public}d %{public}d]", tlv->tlvType, tlv->tlvLen); + APPSPAWN_DUMP("tlvinfo:[%{public}d %{public}d]", tlv->tlvType, tlv->tlvLen); return; } AppSpawnTlvExt *tlvExt = (AppSpawnTlvExt *)(tlv); @@ -365,25 +365,25 @@ static inline void DumpMsgExtInfo(const AppSpawnTlv *tlv) APPSPAWN_LOGV("App extend info name: %{public}s len: %{public}u value: '%{public}s'", tlvExt->tlvName, tlvExt->dataLen, (char *)(tlvExt + 1)); } else { - APPSPAWN_DUMP("AppExtendName:%{public}s len:%{public}u", tlvExt->tlvName, tlvExt->dataLen); + APPSPAWN_DUMP("tlvName:%{public}s len:%{public}u", tlvExt->tlvName, tlvExt->dataLen); } } void DumpAppSpawnMsg(const AppSpawnMsgNode *message) { APPSPAWN_CHECK_ONLY_EXPER(message != NULL, return); - APPSPAWN_DUMP("App spawn msg msgId: %{public}u msgLen: %{public}u tlvCount: %{public}u processName: %{public}s", + APPSPAWN_DUMP("msgId:%{public}u msgLen:%{public}u tlvCount:%{public}u processName:%{public}s", message->msgHeader.msgId, message->msgHeader.msgLen, message->tlvCount, message->msgHeader.processName); AppSpawnMsgFlags *msgFlags = (AppSpawnMsgFlags *)GetAppSpawnMsgInfo(message, TLV_MSG_FLAGS); APPSPAWN_ONLY_EXPER(msgFlags != NULL, DumpMsgFlags(message->msgHeader.processName, "App", msgFlags)); msgFlags = (AppSpawnMsgFlags *)GetAppSpawnMsgInfo(message, TLV_PERMISSION); APPSPAWN_ONLY_EXPER(msgFlags != NULL, - DumpMsgFlags(message->msgHeader.processName, "App permission bits", msgFlags)); + DumpMsgFlags(message->msgHeader.processName, "PermissionBits", msgFlags)); AppSpawnMsgDacInfo *dacInfo = (AppSpawnMsgDacInfo *)GetAppSpawnMsgInfo(message, TLV_DAC_INFO); if (dacInfo != NULL) { - APPSPAWN_DUMP("App dac info uid: %{public}d gid: %{public}d count: %{public}d", + APPSPAWN_DUMP("dac uid:%{public}d gid:%{public}d count:%{public}d", dacInfo->uid, dacInfo->gid, dacInfo->gidCount); for (uint32_t i = 0; i < dacInfo->gidCount; i++) { APPSPAWN_DUMP("gid group[%{public}d]: %{public}d", i, dacInfo->gidTable[i]); @@ -396,7 +396,7 @@ void DumpAppSpawnMsg(const AppSpawnMsgNode *message) AppSpawnMsgDomainInfo *domainInfo = (AppSpawnMsgDomainInfo *)GetAppSpawnMsgInfo(message, TLV_DOMAIN_INFO); APPSPAWN_ONLY_EXPER(domainInfo != NULL, - APPSPAWN_DUMP("App DomainHap:0x%{public}x apl:\"%{public}s\"", domainInfo->hapFlags, domainInfo->apl)); + APPSPAWN_DUMP("hapFlags:0x%{public}x apl:\"%{public}s\"", domainInfo->hapFlags, domainInfo->apl)); AppSpawnMgr *mgr = GetAppSpawnMgr(); if (mgr == NULL || ((mgr->flags & APP_DEVELOPER_MODE) != APP_DEVELOPER_MODE)) { diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index 001ddcbf..8ff7c86b 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -271,7 +271,7 @@ static void OnDisConnect(const TaskHandle taskHandle) { AppSpawnConnection *connection = (AppSpawnConnection *)LE_GetUserData(taskHandle); APPSPAWN_CHECK(connection != NULL, return, "Invalid connection"); - APPSPAWN_LOGI("OnDisConnect connectionId: %{public}u socket %{public}d", + APPSPAWN_LOGI("connectionId:%{public}u socket:%{public}d", connection->connectionId, LE_GetSocketFd(taskHandle)); OnClose(taskHandle); } @@ -289,7 +289,7 @@ static void SendMessageComplete(const TaskHandle taskHandle, BufferHandle handle if (appInfo == NULL) { return; } - APPSPAWN_LOGI("SendMessageComplete connectionId: %{public}u result %{public}d app %{public}s pid %{public}d", + APPSPAWN_LOGI("connectionId:%{public}u ret:%{public}d app:%{public}s pid:%{public}d", connection->connectionId, LE_GetSendResult(handle), appInfo->name, msg->result.pid); if (LE_GetSendResult(handle) != 0 && msg->result.pid > 0) { kill(msg->result.pid, SIGKILL); @@ -298,7 +298,7 @@ static void SendMessageComplete(const TaskHandle taskHandle, BufferHandle handle static int SendResponse(const AppSpawnConnection *connection, const AppSpawnMsg *msg, int result, pid_t pid) { - APPSPAWN_LOGV("SendResponse connectionId: %{public}u result: 0x%{public}x pid: %{public}d", + APPSPAWN_LOGV("connectionId:%{public}u ret:0x%{public}x pid:%{public}d", connection->connectionId, result, pid); uint32_t bufferSize = sizeof(AppSpawnResponseMsg); BufferHandle handle = LE_CreateBuffer(LE_GetDefaultLoop(), bufferSize); @@ -427,7 +427,7 @@ static int OnConnection(const LoopHandle loopHandle, const TaskHandle server) connection->receiverCtx.timer = NULL; connection->receiverCtx.msgRecvLen = 0; connection->receiverCtx.nextMsgId = 1; - APPSPAWN_LOGI("OnConnection connectionId: %{public}u fd %{public}d ", + APPSPAWN_LOGI("connectionId:%{public}u fd:%{public}d", connection->connectionId, LE_GetSocketFd(stream)); return 0; } @@ -446,7 +446,7 @@ APPSPAWN_STATIC bool MsgDevicedebugCheck(TaskHandle stream, AppSpawnMsgNode *mes AppSpawnMsg *msg = &message->msgHeader; if (msg->msgType != MSG_DEVICE_DEBUG) { - APPSPAWN_LOGE("appspawn devicedebug msg type is not devicedebug [%{public}d]", msg->msgType); + APPSPAWN_LOGE("type mismatch msgType [%{public}d]", msg->msgType); return false; } @@ -467,7 +467,7 @@ static void OnReceiveRequest(const TaskHandle taskHandle, const uint8_t *buffer, connection->receiverCtx.incompleteMsg = NULL; int ret = 0; do { - APPSPAWN_LOGI("OnReceiveRequest connectionId: %{public}u start: 0x%{public}x buffLen %{public}d", + APPSPAWN_LOGI("connectionId:%{public}u start:0x%{public}x buffLen:%{public}d", connection->connectionId, *(uint32_t *)(buffer + currLen), buffLen - currLen); ret = GetAppSpawnMsgFromBuffer(buffer + currLen, buffLen - currLen, @@ -565,7 +565,7 @@ APPSPAWN_STATIC int WriteMsgToChild(AppSpawningCtx *property, bool isNweb) static int InitForkContext(AppSpawningCtx *property) { if (pipe(property->forkCtx.fd) == -1) { - APPSPAWN_LOGE("create pipe fail, errno: %{public}d", errno); + APPSPAWN_LOGE("create pipe fail err:%{public}d", errno); return errno; } int option = fcntl(property->forkCtx.fd[0], F_GETFD); @@ -591,7 +591,7 @@ static void ProcessChildProcessFd(const WatcherHandle taskHandle, int fd, uint32 { APPSPAWN_CHECK_ONLY_EXPER(context != NULL, return); pid_t pid = *(pid_t *)context; - APPSPAWN_LOGI("Clear process group with pid %{public}d, pidFd %{public}d", pid, fd); + APPSPAWN_LOGI("pid:%{public}d pidFd:%{public}d", pid, fd); AppSpawnedProcess *appInfo = GetSpawnedProcess(pid); if (appInfo == NULL) { APPSPAWN_LOGW("Cannot get app info by bundle name: %{public}d", pid); diff --git a/util/include/appspawn_utils.h b/util/include/appspawn_utils.h index 2ab428c7..e654f76f 100644 --- a/util/include/appspawn_utils.h +++ b/util/include/appspawn_utils.h @@ -190,6 +190,8 @@ int EnableNewNetNamespace(void); #else +#define APPSPAWN_DUMP(fmt, ...) \ + HILOG_INFO(HILOG_MODULE_HIVIEW, fmt, ##__VA_ARGS__) #define APPSPAWN_LOGI(fmt, ...) \ HILOG_INFO(HILOG_MODULE_HIVIEW, "[%{public}s:%{public}d]" fmt, (APP_FILE_NAME), (__LINE__), ##__VA_ARGS__) #define APPSPAWN_LOGE(fmt, ...) \ -- Gitee