reserved_child_watch = false;
tracking_child = false;
stop_timer_armed = false;
- start_is_interruptible = false;
}
void base_process_service::do_restart() noexcept
bool stop_timer_armed : 1;
bool reserved_child_watch : 1;
bool tracking_child : 1; // whether we expect to see child process status
- bool start_is_interruptible : 1; // whether we can interrupt start
// Launch the process with the given arguments, return true on success
bool start_ps_process(const std::vector<const char *> &args, bool on_console) noexcept;
virtual bool can_interrupt_start() noexcept override
{
- return waiting_restart_timer || start_is_interruptible || service_record::can_interrupt_start();
+ return waiting_restart_timer || onstart_flags.start_interruptible
+ || service_record::can_interrupt_start();
}
virtual bool can_proceed_to_start() noexcept override
start_timeout = timeout;
}
- void set_start_interruptible(bool value) noexcept
- {
- start_is_interruptible = value;
- }
-
// Set an additional signal (other than SIGTERM) to be used to terminate the process
void set_extra_termination_signal(int signo) noexcept
{
bool runs_on_console : 1; // run "in the foreground"
bool starts_on_console : 1; // starts in the foreground
bool pass_cs_fd : 1; // pass this service a control socket connection via fd
+ 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),
no_sigterm(false), runs_on_console(false), starts_on_console(false),
- pass_cs_fd(false), skippable(false)
+ pass_cs_fd(false), start_interruptible(false), skippable(false)
{
}
};
int term_signal = -1; // additional termination signal
bool auto_restart = false;
bool smooth_recovery = false;
- bool start_is_interruptible = false;
string socket_path;
int socket_perms = 0666;
// Note: Posix allows that uid_t and gid_t may be unsigned types, but eg chown uses -1 as an
onstart_flags.pass_cs_fd = true;
}
else if (option_txt == "start-interruptible") {
- start_is_interruptible = true;
+ onstart_flags.start_interruptible = true;
}
else if (option_txt == "skippable") {
onstart_flags.skippable = true;
rvalps->set_restart_delay(restart_delay);
rvalps->set_stop_timeout(stop_timeout);
rvalps->set_start_timeout(start_timeout);
- rvalps->set_start_interruptible(start_is_interruptible);
rvalps->set_extra_termination_signal(term_signal);
rvalps->set_run_as_uid_gid(run_as_uid, run_as_gid);
rvalps->set_workding_dir(working_dir);
rvalps->set_restart_delay(restart_delay);
rvalps->set_stop_timeout(stop_timeout);
rvalps->set_start_timeout(start_timeout);
- rvalps->set_start_interruptible(start_is_interruptible);
rvalps->set_extra_termination_signal(term_signal);
rvalps->set_run_as_uid_gid(run_as_uid, run_as_gid);
onstart_flags.runs_on_console = false;
rvalps->set_workding_dir(working_dir);
rvalps->set_stop_timeout(stop_timeout);
rvalps->set_start_timeout(start_timeout);
- rvalps->set_start_interruptible(start_is_interruptible);
rvalps->set_extra_termination_signal(term_signal);
rvalps->set_run_as_uid_gid(run_as_uid, run_as_gid);
rval = rvalps;
ps.set_restart_interval(time_val(10,0), 3);
ps.set_restart_delay(time_val(0, 200000000)); // 200 milliseconds
ps.set_stop_timeout(time_val(10,0));
- ps.set_start_interruptible(false);
}
// Regular service start
init_service_defaults(p);
onstart_flags_t sflags;
sflags.skippable = true;
+ sflags.start_interruptible = true;
p.set_flags(sflags);
- p.set_start_interruptible(true);
sset.add_service(&p);
service_record *s2 = new service_record(&sset, "test-service-2", service_type_t::INTERNAL, {{&p, REG}});