修改appspawn子进程退出

Signed-off-by: laiguizhong <laiguizhong@huawei.com>
This commit is contained in:
laiguizhong
2022-05-19 21:13:12 +08:00
parent 858b35c1cd
commit ac0a29e6ea
2 changed files with 18 additions and 3 deletions
+14 -2
View File
@@ -15,6 +15,7 @@
#include "appspawn_server.h"
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
@@ -30,6 +31,18 @@ static int NotifyResToParent(struct AppSpawnContent_ *content, AppSpawnClient *c
return 0;
}
static void ProcessExit(void)
{
APPSPAWN_LOGI("App exit %d.", getpid());
#ifdef OHOS_LITE
_exit(0x7f); // 0x7f user exit
#else
#ifndef APPSPAWN_TEST
quick_exit(0);
#endif
#endif
}
int DoStartApp(struct AppSpawnContent_ *content, AppSpawnClient *client, char *longProcName, uint32_t longProcNameLen)
{
APPSPAWN_LOGI("DoStartApp id %d longProcNameLen %u", client->id, longProcNameLen);
@@ -117,8 +130,7 @@ int AppSpawnProcessMsg(struct AppSpawnContent_ *content, AppSpawnClient *client,
if (ret == 0 && content->runChildProcessor != NULL) {
content->runChildProcessor(content, client);
}
APPSPAWN_LOGI("App exit %d.", getpid());
_exit(0x7f); // 0x7f user exit
ProcessExit();
}
*childPid = pid;
return 0;
+4 -1
View File
@@ -38,7 +38,10 @@ executable("appspawn") {
"-Wno-format-extra-args",
]
defines = [ "_GNU_SOURCE" ]
defines = [
"_GNU_SOURCE",
"OHOS_LITE",
]
include_dirs = [
".",