From: Davin McCall Date: Tue, 30 May 2017 10:10:23 +0000 (+0100) Subject: Simplify allDepStarted logic. X-Git-Tag: v0.06~114 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=81839d2107186500613487ddf0ba0401e0485790;p=oweals%2Fdinit.git Simplify allDepStarted logic. Change default action of start_ps_process to call started(). This is overriden in base_process_service to launch the process. --- diff --git a/src/service.cc b/src/service.cc index 375d66b..e9a9577 100644 --- a/src/service.cc +++ b/src/service.cc @@ -636,16 +636,9 @@ void ServiceRecord::allDepsStarted(bool has_console) noexcept failed_to_start(); } - if (service_type == ServiceType::PROCESS || service_type == ServiceType::BGPROCESS - || service_type == ServiceType::SCRIPTED) { - bool start_success = start_ps_process(); - if (! start_success) { - failed_to_start(); - } - } - else { - // "internal" service - started(); + bool start_success = start_ps_process(); + if (! start_success) { + failed_to_start(); } } @@ -762,6 +755,8 @@ void ServiceRecord::failed_to_start(bool depfailed) noexcept bool ServiceRecord::start_ps_process() noexcept { + // default implementation: there is no process, so we are started. + started(); return true; } diff --git a/src/service.h b/src/service.h index 9468e4d..70b55af 100644 --- a/src/service.h +++ b/src/service.h @@ -583,6 +583,8 @@ class base_process_service : public ServiceRecord class process_service : public base_process_service { + // called when the process exits. The exit_status is the status value yielded by + // the "wait" system call. virtual void handle_exit_status(int exit_status) noexcept override; public: