Move art::Runtime::InitZygote logic from art into frameworks/base.
Test: m test-art
Test: m
Test: aosp_angler-eng boots
Change-Id: I119cdd74e5909137365ce723fca1a003ef3c5f95
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 97911d4..f144b98 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -639,11 +639,7 @@
system_class_loader_ = CreateSystemClassLoader(this);
- if (is_zygote_) {
- if (!InitZygote()) {
- return false;
- }
- } else {
+ if (!is_zygote_) {
if (is_native_bridge_loaded_) {
PreInitializeNativeBridge(".");
}
@@ -688,45 +684,6 @@
}
}
-// Do zygote-mode-only initialization.
-bool Runtime::InitZygote() {
-#ifdef __linux__
- // zygote goes into its own process group
- setpgid(0, 0);
-
- // See storage config details at http://source.android.com/tech/storage/
- // Create private mount namespace shared by all children
- if (unshare(CLONE_NEWNS) == -1) {
- PLOG(ERROR) << "Failed to unshare()";
- return false;
- }
-
- // Mark rootfs as being a slave so that changes from default
- // namespace only flow into our children.
- if (mount("rootfs", "/", nullptr, (MS_SLAVE | MS_REC), nullptr) == -1) {
- PLOG(ERROR) << "Failed to mount() rootfs as MS_SLAVE";
- return false;
- }
-
- // Create a staging tmpfs that is shared by our children; they will
- // bind mount storage into their respective private namespaces, which
- // are isolated from each other.
- const char* target_base = getenv("EMULATED_STORAGE_TARGET");
- if (target_base != nullptr) {
- if (mount("tmpfs", target_base, "tmpfs", MS_NOSUID | MS_NODEV,
- "uid=0,gid=1028,mode=0751") == -1) {
- PLOG(ERROR) << "Failed to mount tmpfs to " << target_base;
- return false;
- }
- }
-
- return true;
-#else
- UNIMPLEMENTED(FATAL);
- return false;
-#endif
-}
-
void Runtime::InitNonZygoteOrPostFork(
JNIEnv* env, bool is_system_server, NativeBridgeAction action, const char* isa) {
is_zygote_ = false;