From: Davin McCall Date: Fri, 15 Jun 2018 09:16:08 +0000 (+0100) Subject: Refactor: rename onstart_flags_t to service_flags_t. X-Git-Tag: v0.3.0~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9f55275623287cab572c344269010c62a26b03de;p=oweals%2Fdinit.git Refactor: rename onstart_flags_t to service_flags_t. --- diff --git a/src/includes/service.h b/src/includes/service.h index 09000c5..246a249 100644 --- a/src/includes/service.h +++ b/src/includes/service.h @@ -110,7 +110,7 @@ * transition stage, at the latest. */ -struct onstart_flags_t { +struct service_flags_t { // on-start flags: bool rw_ready : 1; // file system should be writable once this service starts bool log_ready : 1; // syslog should be available once this service starts @@ -123,7 +123,7 @@ struct onstart_flags_t { bool start_interruptible : 1; // the startup of this service process is ok to interrupt with SIGINT bool skippable : 1; // if interrupted the service is skipped (scripted services) - onstart_flags_t() noexcept : rw_ready(false), log_ready(false), + service_flags_t() noexcept : rw_ready(false), log_ready(false), no_sigterm(false), runs_on_console(false), starts_on_console(false), pass_cs_fd(false), start_interruptible(false), skippable(false) { @@ -266,7 +266,7 @@ class service_record protected: string pid_file; - onstart_flags_t onstart_flags; + service_flags_t onstart_flags; string logfile; // log file name, empty string specifies /dev/null @@ -527,7 +527,7 @@ class service_record } // Set "on start" flags (commands) - void set_flags(onstart_flags_t flags) noexcept + void set_flags(service_flags_t flags) noexcept { this->onstart_flags = flags; } diff --git a/src/load-service.cc b/src/load-service.cc index ffc5564..c0c9eff 100644 --- a/src/load-service.cc +++ b/src/load-service.cc @@ -446,7 +446,7 @@ service_record * dirload_service_set::load_service(const char * name) service_type_t service_type = service_type_t::PROCESS; std::list depends; string logfile; - onstart_flags_t onstart_flags; + service_flags_t onstart_flags; int term_signal = -1; // additional termination signal bool auto_restart = false; bool smooth_recovery = false; diff --git a/src/tests/proctests.cc b/src/tests/proctests.cc index 2f024fb..4602f26 100644 --- a/src/tests/proctests.cc +++ b/src/tests/proctests.cc @@ -15,8 +15,6 @@ extern eventloop_t event_loop; constexpr static auto REG = dependency_type::REGULAR; -constexpr static auto WAITS = dependency_type::WAITS_FOR; -constexpr static auto MS = dependency_type::MILESTONE; // Friend interface to access base_process_service private/protected members. class base_process_service_test @@ -538,7 +536,7 @@ void test_scripted_start_skip() scripted_service p = scripted_service(&sset, "testscripted", std::move(command), command_offsets, depends); init_service_defaults(p); - onstart_flags_t sflags; + service_flags_t sflags; sflags.skippable = true; p.set_flags(sflags); sset.add_service(&p); @@ -588,7 +586,7 @@ void test_scripted_start_skip2() scripted_service p = scripted_service(&sset, "testscripted", std::move(command), command_offsets, depends); init_service_defaults(p); - onstart_flags_t sflags; + service_flags_t sflags; sflags.skippable = true; sflags.start_interruptible = true; p.set_flags(sflags); diff --git a/src/tests/tests.cc b/src/tests/tests.cc index b6e01f3..208d104 100644 --- a/src/tests/tests.cc +++ b/src/tests/tests.cc @@ -428,7 +428,7 @@ void test10() // Create s1 and s2. s2 depends on s1, and starts on the console. test_service *s1 = new test_service(&sset, "test-service-1", service_type_t::INTERNAL, {}); test_service *s2 = new test_service(&sset, "test-service-2", service_type_t::INTERNAL, {{s1, REG}}); - onstart_flags_t s2_flags; + service_flags_t s2_flags; s2_flags.starts_on_console = true; s2->set_flags(s2_flags); sset.add_service(s1); @@ -436,7 +436,7 @@ void test10() // Create s3, which starts and runs on console: test_service *s3 = new test_service(&sset, "test-service-3", service_type_t::INTERNAL, {}); - onstart_flags_t s3_flags; + service_flags_t s3_flags; s3_flags.starts_on_console = true; s3_flags.runs_on_console = true; sset.add_service(s3);