From b2267032bd852c5566462057135967b24fdfe076 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 13 Sep 2016 19:12:57 -0400 Subject: [PATCH] Move art::Runtime::InitZygote logic from art into frameworks/base. Test: m test-art Test: m Test: aosp_angler-eng boots Change-Id: I119cdd74e5909137365ce723fca1a003ef3c5f95 --- runtime/runtime.cc | 45 +-------------------------------------------- runtime/runtime.h | 1 - 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 97911d4e2..f144b981d 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -639,11 +639,7 @@ bool Runtime::Start() { 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 @@ void Runtime::EndThreadBirth() REQUIRES(Locks::runtime_shutdown_lock_) { } } -// 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; diff --git a/runtime/runtime.h b/runtime/runtime.h index 58068ebbf..9e63564d5 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -455,7 +455,6 @@ class Runtime { bool UseJitCompilation() const; void PreZygoteFork(); - bool InitZygote(); void InitNonZygoteOrPostFork( JNIEnv* env, bool is_system_server, NativeBridgeAction action, const char* isa); -- 2.11.0