init: remove console_init_action
There's no fundamental reason to store this aside. That property can
only be written by init, so it's not likely that we're going to
corrupt it.
Test: boot and use serial console
Change-Id: I9248fbaf959ea913d09add829d4cb509af99d570
diff --git a/init/host_init_stubs.cpp b/init/host_init_stubs.cpp
index b85e54a..47d2633 100644
--- a/init/host_init_stubs.cpp
+++ b/init/host_init_stubs.cpp
@@ -26,9 +26,6 @@
namespace android {
namespace init {
-// init.h
-std::string default_console = "/dev/console";
-
// property_service.h
bool CanReadProperty(const std::string& source_context, const std::string& name) {
return true;
diff --git a/init/host_init_stubs.h b/init/host_init_stubs.h
index f6e9676..4fbd2e6 100644
--- a/init/host_init_stubs.h
+++ b/init/host_init_stubs.h
@@ -35,9 +35,6 @@
namespace android {
namespace init {
-// init.h
-extern std::string default_console;
-
// property_service.h
bool CanReadProperty(const std::string& source_context, const std::string& name);
extern uint32_t (*property_set)(const std::string& name, const std::string& value);
diff --git a/init/init.cpp b/init/init.cpp
index bb12a6e..2b94825 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -90,8 +90,6 @@
static char qemu[32];
-std::string default_console = "/dev/console";
-
static int signal_fd = -1;
static std::unique_ptr<Timer> waiting_for_prop(nullptr);
@@ -348,14 +346,6 @@
return {};
}
-static Result<void> console_init_action(const BuiltinArguments& args) {
- std::string console = GetProperty("ro.boot.console", "");
- if (!console.empty()) {
- default_console = "/dev/" + console;
- }
- return {};
-}
-
static Result<void> SetupCgroupsAction(const BuiltinArguments&) {
// Have to create <CGROUPS_RC_DIR> using make_dir function
// for appropriate sepolicy to be set for it
@@ -762,7 +752,6 @@
return {};
},
"KeychordInit");
- am.QueueBuiltinAction(console_init_action, "console_init");
// Trigger all the boot actions to get us started.
am.QueueEventTrigger("init");
diff --git a/init/init.h b/init/init.h
index 198ec2a..6ada6ab 100644
--- a/init/init.h
+++ b/init/init.h
@@ -34,7 +34,6 @@
// Note: These globals are *only* valid in init, so they should not be used in ueventd
// or any files that may be included in ueventd, such as devices.cpp and util.cpp.
// TODO: Have an Init class and remove all globals.
-extern std::string default_console;
extern std::vector<std::string> late_import_paths;
Parser CreateParser(ActionManager& action_manager, ServiceList& service_list);
diff --git a/init/service.cpp b/init/service.cpp
index 4cd1889..cd08f3d 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -40,7 +40,6 @@
#if defined(__ANDROID__)
#include <ApexProperties.sysprop.h>
-#include "init.h"
#include "mount_namespace.h"
#include "property_service.h"
#else
@@ -359,7 +358,7 @@
bool needs_console = (flags_ & SVC_CONSOLE);
if (needs_console) {
if (proc_attr_.console.empty()) {
- proc_attr_.console = default_console;
+ proc_attr_.console = "/dev/" + GetProperty("ro.boot.console", "console");
}
// Make sure that open call succeeds to ensure a console driver is