assert(name);
/* Returns true if the unit is inactive or going down */
-
if (!(u = manager_get_unit(m, name)))
return true;
- if (UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(u)))
- return true;
-
- if (u->meta.job && u->meta.job->type == JOB_STOP)
- return true;
-
- return false;
+ return unit_pending_inactive(u);
}
static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
/* We don't take connections anymore if we are supposed to
* shut down anyway */
- if (s->meta.job && s->meta.job->type == JOB_STOP) {
+ if (unit_pending_inactive(UNIT(s))) {
if (cfd >= 0)
close_nointr_nofail(cfd);
else {
return NULL;
}
+bool unit_pending_inactive(Unit *u) {
+ assert(u);
+
+ /* Returns true if the unit is inactive or going down */
+
+ if (UNIT_IS_INACTIVE_OR_DEACTIVATING(unit_active_state(u)))
+ return true;
+
+ if (u->meta.job && u->meta.job->type == JOB_STOP)
+ return true;
+
+ return false;
+}
+
static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
[UNIT_STUB] = "stub",
[UNIT_LOADED] = "loaded",
Unit *unit_following(Unit *u);
+bool unit_pending_inactive(Unit *u);
+
const char *unit_load_state_to_string(UnitLoadState i);
UnitLoadState unit_load_state_from_string(const char *s);