add prefork feature

Signed-off-by: yh <yanghao236@huawei.com>
Change-Id: I899eb4e89cbe54eb8bda8b7f4a203e6ae1dfdd7f
This commit is contained in:
yh 2024-10-22 11:06:42 +08:00
parent 9fca56deb8
commit 38a8d8fbde
3 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@ declare_args() {
appspawn_unittest_coverage = false appspawn_unittest_coverage = false
appspawn_mount_tmpshm = false appspawn_mount_tmpshm = false
appspawn_seccomp_privilege = false appspawn_seccomp_privilege = false
appspawn_support_prefork = true
} }
if (!defined(global_parts_info) || if (!defined(global_parts_info) ||

View File

@ -67,6 +67,9 @@ ohos_executable("appspawn") {
if (is_debug || build_variant == "root") { if (is_debug || build_variant == "root") {
defines += [ "DEBUG_BEGETCTL_BOOT" ] defines += [ "DEBUG_BEGETCTL_BOOT" ]
} }
if (appspawn_support_prefork) {
defines += [ "APPSPAWN_SUPPORT_PREFORK" ]
}
external_deps = [ external_deps = [
"c_utils:utils", "c_utils:utils",

View File

@ -770,6 +770,7 @@ static int AppSpawnProcessMsgForPrefork(AppSpawnContent *content, AppSpawnClient
static bool IsSupportPrefork(AppSpawnContent *content, AppSpawnClient *client) static bool IsSupportPrefork(AppSpawnContent *content, AppSpawnClient *client)
{ {
#ifdef APPSPAWN_SUPPORT_PREFORK
if (client == NULL || content == NULL) { if (client == NULL || content == NULL) {
return false; return false;
} }
@ -782,6 +783,7 @@ static bool IsSupportPrefork(AppSpawnContent *content, AppSpawnClient *client)
&& !CheckAppMsgFlagsSet(property, APP_FLAGS_CHILDPROCESS)) { && !CheckAppMsgFlagsSet(property, APP_FLAGS_CHILDPROCESS)) {
return true; return true;
} }
#endif
return false; return false;
} }