Loading init/init.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -280,13 +280,13 @@ static const std::map<std::string, ControlMessageFunction>& get_control_message_ return control_message_functions; return control_message_functions; } } void HandleControlMessage(const std::string& msg, const std::string& name, pid_t pid) { bool HandleControlMessage(const std::string& msg, const std::string& name, pid_t pid) { const auto& map = get_control_message_map(); const auto& map = get_control_message_map(); const auto it = map.find(msg); const auto it = map.find(msg); if (it == map.end()) { if (it == map.end()) { LOG(ERROR) << "Unknown control msg '" << msg << "'"; LOG(ERROR) << "Unknown control msg '" << msg << "'"; return; return false; } } std::string cmdline_path = StringPrintf("proc/%d/cmdline", pid); std::string cmdline_path = StringPrintf("proc/%d/cmdline", pid); Loading Loading @@ -315,17 +315,19 @@ void HandleControlMessage(const std::string& msg, const std::string& name, pid_t default: default: LOG(ERROR) << "Invalid function target from static map key '" << msg << "': " LOG(ERROR) << "Invalid function target from static map key '" << msg << "': " << static_cast<std::underlying_type<ControlTarget>::type>(function.target); << static_cast<std::underlying_type<ControlTarget>::type>(function.target); return; return false; } } if (svc == nullptr) { if (svc == nullptr) { LOG(ERROR) << "Could not find '" << name << "' for ctl." << msg; LOG(ERROR) << "Could not find '" << name << "' for ctl." << msg; return; return false; } } if (auto result = function.action(svc); !result) { if (auto result = function.action(svc); !result) { LOG(ERROR) << "Could not ctl." << msg << " for '" << name << "': " << result.error(); LOG(ERROR) << "Could not ctl." << msg << " for '" << name << "': " << result.error(); return false; } } return true; } } static Result<Success> wait_for_coldboot_done_action(const BuiltinArguments& args) { static Result<Success> wait_for_coldboot_done_action(const BuiltinArguments& args) { Loading init/init.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,7 @@ extern std::vector<std::string> late_import_paths; Parser CreateParser(ActionManager& action_manager, ServiceList& service_list); Parser CreateParser(ActionManager& action_manager, ServiceList& service_list); Parser CreateServiceOnlyParser(ServiceList& service_list); Parser CreateServiceOnlyParser(ServiceList& service_list); void HandleControlMessage(const std::string& msg, const std::string& arg, pid_t pid); bool HandleControlMessage(const std::string& msg, const std::string& arg, pid_t pid); void property_changed(const std::string& name, const std::string& value); void property_changed(const std::string& name, const std::string& value); Loading init/property_service.cpp +3 −2 Original line number Original line Diff line number Diff line Loading @@ -473,8 +473,9 @@ uint32_t HandlePropertySet(const std::string& name, const std::string& value, } } if (StartsWith(name, "ctl.")) { if (StartsWith(name, "ctl.")) { HandleControlMessage(name.c_str() + 4, value, cr.pid); return HandleControlMessage(name.c_str() + 4, value, cr.pid) return PROP_SUCCESS; ? PROP_SUCCESS : PROP_ERROR_HANDLE_CONTROL_MESSAGE; } } // sys.powerctl is a special property that is used to make the device reboot. We want to log // sys.powerctl is a special property that is used to make the device reboot. We want to log Loading Loading
init/init.cpp +6 −4 Original line number Original line Diff line number Diff line Loading @@ -280,13 +280,13 @@ static const std::map<std::string, ControlMessageFunction>& get_control_message_ return control_message_functions; return control_message_functions; } } void HandleControlMessage(const std::string& msg, const std::string& name, pid_t pid) { bool HandleControlMessage(const std::string& msg, const std::string& name, pid_t pid) { const auto& map = get_control_message_map(); const auto& map = get_control_message_map(); const auto it = map.find(msg); const auto it = map.find(msg); if (it == map.end()) { if (it == map.end()) { LOG(ERROR) << "Unknown control msg '" << msg << "'"; LOG(ERROR) << "Unknown control msg '" << msg << "'"; return; return false; } } std::string cmdline_path = StringPrintf("proc/%d/cmdline", pid); std::string cmdline_path = StringPrintf("proc/%d/cmdline", pid); Loading Loading @@ -315,17 +315,19 @@ void HandleControlMessage(const std::string& msg, const std::string& name, pid_t default: default: LOG(ERROR) << "Invalid function target from static map key '" << msg << "': " LOG(ERROR) << "Invalid function target from static map key '" << msg << "': " << static_cast<std::underlying_type<ControlTarget>::type>(function.target); << static_cast<std::underlying_type<ControlTarget>::type>(function.target); return; return false; } } if (svc == nullptr) { if (svc == nullptr) { LOG(ERROR) << "Could not find '" << name << "' for ctl." << msg; LOG(ERROR) << "Could not find '" << name << "' for ctl." << msg; return; return false; } } if (auto result = function.action(svc); !result) { if (auto result = function.action(svc); !result) { LOG(ERROR) << "Could not ctl." << msg << " for '" << name << "': " << result.error(); LOG(ERROR) << "Could not ctl." << msg << " for '" << name << "': " << result.error(); return false; } } return true; } } static Result<Success> wait_for_coldboot_done_action(const BuiltinArguments& args) { static Result<Success> wait_for_coldboot_done_action(const BuiltinArguments& args) { Loading
init/init.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -40,7 +40,7 @@ extern std::vector<std::string> late_import_paths; Parser CreateParser(ActionManager& action_manager, ServiceList& service_list); Parser CreateParser(ActionManager& action_manager, ServiceList& service_list); Parser CreateServiceOnlyParser(ServiceList& service_list); Parser CreateServiceOnlyParser(ServiceList& service_list); void HandleControlMessage(const std::string& msg, const std::string& arg, pid_t pid); bool HandleControlMessage(const std::string& msg, const std::string& arg, pid_t pid); void property_changed(const std::string& name, const std::string& value); void property_changed(const std::string& name, const std::string& value); Loading
init/property_service.cpp +3 −2 Original line number Original line Diff line number Diff line Loading @@ -473,8 +473,9 @@ uint32_t HandlePropertySet(const std::string& name, const std::string& value, } } if (StartsWith(name, "ctl.")) { if (StartsWith(name, "ctl.")) { HandleControlMessage(name.c_str() + 4, value, cr.pid); return HandleControlMessage(name.c_str() + 4, value, cr.pid) return PROP_SUCCESS; ? PROP_SUCCESS : PROP_ERROR_HANDLE_CONTROL_MESSAGE; } } // sys.powerctl is a special property that is used to make the device reboot. We want to log // sys.powerctl is a special property that is used to make the device reboot. We want to log Loading