diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-09-01 03:35:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-09-01 03:35:04 +0200 |
commit | 18ffdfda48c327f56cac0aabdc6bada91cc9b7df (patch) | |
tree | 112ed572c2c55e60a89dbd0179f416e2c59f9bfa /src/unit.c | |
parent | 8f6df3fa98ee74eaf5c34dddd272d2e3c10c3c27 (diff) |
unit: unify some code
Diffstat (limited to 'src/unit.c')
-rw-r--r-- | src/unit.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/unit.c b/src/unit.c index bca4d97993..d5ed5e1421 100644 --- a/src/unit.c +++ b/src/unit.c @@ -2125,6 +2125,20 @@ Unit *unit_following(Unit *u) { 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", |