Refactor: rename onstart_flags_t to service_flags_t.
authorDavin McCall <davmac@davmac.org>
Fri, 15 Jun 2018 09:16:08 +0000 (10:16 +0100)
committerDavin McCall <davmac@davmac.org>
Fri, 15 Jun 2018 09:16:08 +0000 (10:16 +0100)
src/includes/service.h
src/load-service.cc
src/tests/proctests.cc
src/tests/tests.cc

index 09000c5b776df4391bd9aa9b8746ea32be87faf3..246a249d933f25ea919529f03d9f979e465986be 100644 (file)
  * 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;
     }
index ffc55646c62725f871d33f682f87f323736b9d88..c0c9eff39bf369e5722b054c083fadddc9245dc8 100644 (file)
@@ -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<prelim_dep> 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;
index 2f024fbdcdf6cf9f1844fbf9defb840d57d792c7..4602f263c7e8fa8a53b1cc007f4552ca1431bfca 100644 (file)
@@ -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);
index b6e01f353ddc1b16e16c41e2408ffd679e2841eb..208d104b3d9d84fede88cc3a8feb0ea2a1aeca23 100644 (file)
@@ -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);