!1503 add prefork default mode

Merge pull request !1503 from 杨浩/0928prefork
This commit is contained in:
openharmony_ci 2024-09-29 14:22:37 +00:00 committed by Gitee
commit e25b585f91
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -148,6 +148,11 @@ static inline void DumpStatus(const char *appName, pid_t pid, int status)
static void HandleDiedPid(pid_t pid, uid_t uid, int status)
{
AppSpawnContent *content = GetAppSpawnContent();
if (pid == content->reservedPid) {
APPSPAWN_LOGW("HandleDiedPid with reservedPid %{public}d", pid);
content->reservedPid = 0;
}
AppSpawnedProcess *appInfo = GetSpawnedProcess(pid);
if (appInfo == NULL) { // If an exception occurs during app spawning, kill pid, return failed
WaitChildDied(pid);
@ -1169,8 +1174,9 @@ APPSPAWN_STATIC int AppSpawnClearEnv(AppSpawnMgr *content, AppSpawningCtx *prope
static int IsEnablePerfork()
{
char buffer[32] = {0};
int ret = GetParameter("persist.sys.prefork.enable", "false", buffer, sizeof(buffer));
return (ret > 0 && strcmp(buffer, "true") == 0);
int ret = GetParameter("persist.sys.prefork.enable", "true", buffer, sizeof(buffer));
APPSPAWN_LOGV("IsEnablePerfork result %{public}d, %{public}s", ret, buffer);
return strcmp(buffer, "true") == 0;
}
AppSpawnContent *AppSpawnCreateContent(const char *socketName, char *longProcName, uint32_t nameLen, int mode)