!1634 revert processname

Merge pull request !1634 from 杨浩/1021processnnaem
This commit is contained in:
openharmony_ci 2024-10-30 09:31:00 +00:00 committed by Gitee
commit 6d07dadcfe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -54,7 +54,6 @@
#define FD_PATH_SIZE 128 #define FD_PATH_SIZE 128
#define MAX_MEM_SIZE (4 * 1024) #define MAX_MEM_SIZE (4 * 1024)
#define APPSPAWN_MSG_USER_CHECK_COUNT 3 #define APPSPAWN_MSG_USER_CHECK_COUNT 3
#define PREFORK_PROCESS "apppool"
#ifndef PIDFD_NONBLOCK #ifndef PIDFD_NONBLOCK
#define PIDFD_NONBLOCK O_NONBLOCK #define PIDFD_NONBLOCK O_NONBLOCK
#endif #endif
@ -735,28 +734,6 @@ static void ClearMMAP(int clientId)
} }
} }
static int SetPreforkProcessName(AppSpawnContent *content)
{
int ret = prctl(PR_SET_NAME, PREFORK_PROCESS);
if (ret == -1) {
return errno;
}
ret = memset_s(content->longProcName,
(size_t)content->longProcNameLen, 0, (size_t)content->longProcNameLen);
if (ret != EOK) {
return EINVAL;
}
ret = strncpy_s(content->longProcName, content->longProcNameLen,
PREFORK_PROCESS, strlen(PREFORK_PROCESS));
if (ret != EOK) {
return EINVAL;
}
return 0;
}
static void ProcessPreFork(AppSpawnContent *content, AppSpawningCtx *property) static void ProcessPreFork(AppSpawnContent *content, AppSpawningCtx *property)
{ {
APPSPAWN_CHECK(pipe(content->preforkFd) == 0, return, "prefork with prefork pipe failed %{public}d", errno); APPSPAWN_CHECK(pipe(content->preforkFd) == 0, return, "prefork with prefork pipe failed %{public}d", errno);
@ -773,7 +750,7 @@ static void ProcessPreFork(AppSpawnContent *content, AppSpawningCtx *property)
if (content->reservedPid == 0) { if (content->reservedPid == 0) {
(void)close(property->forkCtx.fd[0]); (void)close(property->forkCtx.fd[0]);
(void)close(property->forkCtx.fd[1]); (void)close(property->forkCtx.fd[1]);
int isRet = SetPreforkProcessName(content); int isRet = prctl(PR_SET_NAME, "apppool");
APPSPAWN_LOGI("prefork process start wait read msg with set processname %{public}d", isRet); APPSPAWN_LOGI("prefork process start wait read msg with set processname %{public}d", isRet);
AppSpawnClient client = {0, 0}; AppSpawnClient client = {0, 0};
int infoSize = read(content->parentToChildFd[0], &client, sizeof(AppSpawnClient)); int infoSize = read(content->parentToChildFd[0], &client, sizeof(AppSpawnClient));