From cfa8a1cd74bc765682c6b77811df6241cbb159ee Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Fri, 12 Sep 2025 11:54:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BC=98=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: fan-jingle --- common/appspawn_server.c | 6 +++--- interfaces/innerkits/client/appspawn_client.c | 4 ++-- standard/appspawn_appmgr.c | 2 +- standard/appspawn_service.c | 16 ++++++++-------- util/include/appspawn_utils.h | 4 ++++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/common/appspawn_server.c b/common/appspawn_server.c index c33efde7..0891831a 100644 --- a/common/appspawn_server.c +++ b/common/appspawn_server.c @@ -36,7 +36,7 @@ static void NotifyResToParent(struct AppSpawnContent *content, AppSpawnClient *client, int result) { StartAppspawnTrace("NotifyResToParent"); - APPSPAWN_LOGI("NotifyResToParent: %{public}d", result); + APPSPAWN_DUMPI("NotifyResToParent:%{public}d", result); APPSPAWN_CHECK(content != NULL && content->notifyResToParent != NULL, FinishAppspawnTrace(); return, "invalid param"); content->notifyResToParent(content, client, result); @@ -126,7 +126,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_DUMPI("CloneNwebSpawn done"); #ifndef APPSPAWN_HELPER ffrt_child_init(); #endif @@ -186,7 +186,7 @@ int AppSpawnProcessMsg(AppSpawnContent *content, AppSpawnClient *client, pid_t * { APPSPAWN_CHECK(content != NULL, return -1, "Invalid content for appspawn"); APPSPAWN_CHECK(client != NULL && childPid != NULL, return -1, "Invalid client for appspawn"); - APPSPAWN_LOGI("AppSpawnProcessMsg id: %{public}d mode: %{public}d sandboxNsFlags: 0x%{public}x", + APPSPAWN_DUMPI("AppSpawnProcessMsg id:%{public}d mode:%{public}d sandboxNsFlags:0x%{public}x", client->id, content->mode, content->sandboxNsFlags); pid_t pid = 0; diff --git a/interfaces/innerkits/client/appspawn_client.c b/interfaces/innerkits/client/appspawn_client.c index 5699112c..8d143518 100644 --- a/interfaces/innerkits/client/appspawn_client.c +++ b/interfaces/innerkits/client/appspawn_client.c @@ -432,7 +432,7 @@ int AppSpawnClientSendMsg(AppSpawnClientHandle handle, AppSpawnReqMsgHandle reqH APPSPAWN_CHECK(reqNode != NULL && reqNode->msg != NULL, AppSpawnReqMsgFree(reqHandle); return APPSPAWN_ARG_INVALID, "Invalid msgReq"); - APPSPAWN_LOGI("AppSpawnClientSendMsg reqId: %{public}u msgLen: %{public}u fd: %{public}d %{public}s", + APPSPAWN_DUMPI("AppSpawnClientSendMsg reqId:%{public}u msgLen:%{public}u fd:%{public}d %{public}s", reqNode->reqId, reqNode->msg->msgLen, reqMgr->socketId, reqNode->msg->processName); pthread_mutex_lock(&reqMgr->mutex); int ret = ClientSendMsg(reqMgr, reqNode, result); @@ -440,7 +440,7 @@ int AppSpawnClientSendMsg(AppSpawnClientHandle handle, AppSpawnReqMsgHandle reqH result->result = ret; } pthread_mutex_unlock(&reqMgr->mutex); - APPSPAWN_LOGI("AppSpawnClientSendMsg reqId: %{public}u fd: %{public}d end result: 0x%{public}x pid: %{public}d", + APPSPAWN_DUMPI("AppSpawnClientSendMsg reqId:%{public}u fd:%{public}d end result:0x%{public}x pid:%{public}d", reqNode->reqId, reqMgr->socketId, result->result, result->pid); AppSpawnReqMsgFree(reqHandle); return ret; diff --git a/standard/appspawn_appmgr.c b/standard/appspawn_appmgr.c index b864d494..08a9b5b2 100644 --- a/standard/appspawn_appmgr.c +++ b/standard/appspawn_appmgr.c @@ -166,7 +166,7 @@ AppSpawnedProcess *AddSpawnedProcess(pid_t pid, const char *processName, uint32_ return NULL, "Failed to strcpy process name"); OH_ListInit(&node->node); - APPSPAWN_LOGI("Add %{public}s, pid=%{public}d success", processName, pid); + APPSPAWN_DUMPI("Add %{public}s,pid=%{public}d success", processName, pid); OH_ListAddWithOrder(&g_appSpawnMgr->appQueue, &node->node, AppInfoCompareProc); return node; } diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index 179c5a59..eb25e14b 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -115,11 +115,11 @@ static inline void DumpStatus(const char *appName, pid_t pid, int status, int *s { if (WIFSIGNALED(status)) { *signal = WTERMSIG(status); - APPSPAWN_LOGW("%{public}s with pid %{public}d exit with signal:%{public}d", appName, pid, *signal); + APPSPAWN_DUMPW("%{public}s with pid %{public}d exit with signal:%{public}d", appName, pid, *signal); } if (WIFEXITED(status)) { *signal = WEXITSTATUS(status); - APPSPAWN_LOGW("%{public}s with pid %{public}d exit with code:%{public}d", appName, pid, *signal); + APPSPAWN_DUMPW("%{public}s with pid %{public}d exit with code:%{public}d", appName, pid, *signal); } } @@ -181,7 +181,7 @@ static void HandleDiedPid(pid_t pid, uid_t uid, int status) APPSPAWN_STATIC void ProcessSignal(const struct signalfd_siginfo *siginfo) { - APPSPAWN_LOGI("ProcessSignal signum %{public}d %{public}d", siginfo->ssi_signo, siginfo->ssi_pid); + APPSPAWN_DUMPI("ProcessSignal signum %{public}d %{public}d", siginfo->ssi_signo, siginfo->ssi_pid); switch (siginfo->ssi_signo) { case SIGCHLD: { // delete pid from app map pid_t pid; @@ -262,7 +262,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_DUMPI("SendMessageComplete connectionId:%{public}u result:%{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); @@ -563,7 +563,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_DUMPI("Clear process group with 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); @@ -599,7 +599,7 @@ static void WatchChildProcessFd(AppSpawningCtx *property) GetBundleName(property), errno); return; } - APPSPAWN_LOGI("watch app process pid %{public}d, pidFd %{public}d", property->pid, fd); + APPSPAWN_DUMPI("watch app process pid %{public}d,pidFd %{public}d", property->pid, fd); LE_WatchInfo watchInfo = {}; watchInfo.fd = fd; watchInfo.flags = WATCHER_ONCE; @@ -1049,7 +1049,7 @@ static int ProcessChildFdCheck(int fd, AppSpawningCtx *property) { int result = 0; (void)read(fd, &result, sizeof(result)); - APPSPAWN_LOGI("Child process %{public}s success pid %{public}d appId: %{public}d result: %{public}d", + APPSPAWN_DUMPI("Child process %{public}s success pid %{public}d appId:%{public}d result:%{public}d", GetProcessName(property), property->pid, property->client.id, result); APPSPAWN_CHECK(property->message != NULL, return -1, "Invalid message in ctx %{public}d", property->client.id); @@ -1659,7 +1659,7 @@ APPSPAWN_STATIC void ProcessObserveProcessSignalMsg(AppSpawnConnection *connecti static void ProcessRecvMsg(AppSpawnConnection *connection, AppSpawnMsgNode *message) { AppSpawnMsg *msg = &message->msgHeader; - APPSPAWN_LOGI("Recv message header magic 0x%{public}x type %{public}u id %{public}u len %{public}u %{public}s", + APPSPAWN_DUMPI("Recv msgHeader magic 0x%{public}x type %{public}u id %{public}u len %{public}u %{public}s", msg->magic, msg->msgType, msg->msgId, msg->msgLen, msg->processName); APPSPAWN_CHECK_ONLY_LOG(connection->receiverCtx.nextMsgId == msg->msgId, "Invalid msg id %{public}u %{public}u", connection->receiverCtx.nextMsgId, msg->msgId); diff --git a/util/include/appspawn_utils.h b/util/include/appspawn_utils.h index 32bf7fcf..517afa50 100644 --- a/util/include/appspawn_utils.h +++ b/util/include/appspawn_utils.h @@ -184,6 +184,8 @@ int EnableNewNetNamespace(void); HILOG_FATAL(LOG_CORE, "[%{public}s:%{public}d]" fmt, (APP_FILE_NAME), (__LINE__), ##__VA_ARGS__) #define APPSPAWN_DUMPI(fmt, ...) \ HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__) +#define APPSPAWN_DUMPW(fmt, ...) \ + HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__) #define APPSPAWN_DUMP(fmt, ...) \ do { \ HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__); \ @@ -204,6 +206,8 @@ int EnableNewNetNamespace(void); HILOG_FATAL(HILOG_MODULE_HIVIEW, "[%{public}s:%{public}d]" fmt, (APP_FILE_NAME), (__LINE__), ##__VA_ARGS__) #define APPSPAWN_DUMPI(fmt, ...) \ HILOG_INFO(HILOG_MODULE_HIVIEW, fmt, ##__VA_ARGS__) +#define APPSPAWN_DUMPW(fmt, ...) \ + HILOG_FATAL(HILOG_MODULE_HIVIEW, fmt, ##__VA_ARGS__) #define APPSPAWN_KLOGI(fmt, ...) \ HILOG_INFO(HILOG_MODULE_HIVIEW, "[%{public}s:%{public}d]" fmt, (APP_FILE_NAME), (__LINE__), ##__VA_ARGS__) #endif -- Gitee