mirror of
https://gitee.com/openharmony/startup_appspawn
synced 2024-11-27 01:00:38 +00:00
add
Signed-off-by: yh <yanghao236@huawei.com> Change-Id: I37a8f15341d3bc81259d2c8a076277f7e4b4c7f0
This commit is contained in:
parent
6d07dadcfe
commit
1e8ff79481
@ -24,7 +24,8 @@
|
||||
"appspawn_support_native",
|
||||
"appspawn_use_encaps",
|
||||
"appspawn_mount_tmpshm",
|
||||
"appspawn_seccomp_privilege"
|
||||
"appspawn_seccomp_privilege",
|
||||
"appspawn_support_prefork"
|
||||
],
|
||||
"rom": "296KB",
|
||||
"ram": "13125KB",
|
||||
|
@ -54,6 +54,7 @@
|
||||
#define FD_PATH_SIZE 128
|
||||
#define MAX_MEM_SIZE (4 * 1024)
|
||||
#define APPSPAWN_MSG_USER_CHECK_COUNT 3
|
||||
#define PREFORK_PROCESS "apppool"
|
||||
#ifndef PIDFD_NONBLOCK
|
||||
#define PIDFD_NONBLOCK O_NONBLOCK
|
||||
#endif
|
||||
@ -734,6 +735,28 @@ 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)
|
||||
{
|
||||
APPSPAWN_CHECK(pipe(content->preforkFd) == 0, return, "prefork with prefork pipe failed %{public}d", errno);
|
||||
@ -750,7 +773,7 @@ static void ProcessPreFork(AppSpawnContent *content, AppSpawningCtx *property)
|
||||
if (content->reservedPid == 0) {
|
||||
(void)close(property->forkCtx.fd[0]);
|
||||
(void)close(property->forkCtx.fd[1]);
|
||||
int isRet = prctl(PR_SET_NAME, "apppool");
|
||||
int isRet = SetPreforkProcessName(content);
|
||||
APPSPAWN_LOGI("prefork process start wait read msg with set processname %{public}d", isRet);
|
||||
AppSpawnClient client = {0, 0};
|
||||
int infoSize = read(content->parentToChildFd[0], &client, sizeof(AppSpawnClient));
|
||||
|
Loading…
Reference in New Issue
Block a user