m->exec_runtime = exec_runtime_unref(m->exec_runtime, true);
- exec_context_destroy_runtime_directory(&m->exec_context, UNIT(m)->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
+ unit_destroy_runtime_directory(UNIT(m), &m->exec_context);
unit_unref_uid_gid(UNIT(m), true);
.active_state = mount_active_state,
.sub_state_to_string = mount_sub_state_to_string,
+ .will_restart = unit_will_restart_default,
+
.may_gc = mount_may_gc,
.sigchld_event = mount_sigchld_event,
return true;
if (s->state == SERVICE_AUTO_RESTART)
return true;
- if (!UNIT(s)->job)
- return false;
- if (UNIT(s)->job->type == JOB_START)
- return true;
- return false;
+ return unit_will_restart_default(u);
}
static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) {
s->exec_runtime = exec_runtime_unref(s->exec_runtime, true);
- exec_context_destroy_runtime_directory(&s->exec_context, UNIT(s)->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
+ unit_destroy_runtime_directory(UNIT(s), &s->exec_context);
unit_unref_uid_gid(UNIT(s), true);
.active_state = socket_active_state,
.sub_state_to_string = socket_sub_state_to_string,
+ .will_restart = unit_will_restart_default,
+
.may_gc = socket_may_gc,
.sigchld_event = socket_sigchld_event,
s->exec_runtime = exec_runtime_unref(s->exec_runtime, true);
- exec_context_destroy_runtime_directory(&s->exec_context, UNIT(s)->manager->prefix[EXEC_DIRECTORY_RUNTIME]);
+ unit_destroy_runtime_directory(UNIT(s), &s->exec_context);
unit_unref_uid_gid(UNIT(s), true);
.active_state = swap_active_state,
.sub_state_to_string = swap_sub_state_to_string,
+ .will_restart = unit_will_restart_default,
+
.may_gc = swap_may_gc,
.sigchld_event = swap_sigchld_event,
return false;
}
+bool unit_will_restart_default(Unit *u) {
+ assert(u);
+
+ if (!u->job)
+ return false;
+ if (u->job->type == JOB_START)
+ return true;
+
+ return false;
+}
+
bool unit_will_restart(Unit *u) {
assert(u);
bool unit_stop_pending(Unit *u) _pure_;
bool unit_inactive_or_pending(Unit *u) _pure_;
bool unit_active_or_pending(Unit *u);
+bool unit_will_restart_default(Unit *u);
bool unit_will_restart(Unit *u);
int unit_add_default_target_dependency(Unit *u, Unit *target);