X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Funit.c;h=fefa0eb5161791e68a22f42de591bbe8b3e3207f;hb=df37291a5198818e5bb1d11c34ba134aa3d79d96;hp=0a8ee61900e206bcdbaad30e9ec84634c815263b;hpb=b4a16b7b8abddb93205577aefd126040ff5310a3;p=elogind.git diff --git a/src/unit.c b/src/unit.c index 0a8ee6190..fefa0eb51 100644 --- a/src/unit.c +++ b/src/unit.c @@ -2190,6 +2190,23 @@ bool unit_pending_inactive(Unit *u) { return false; } +bool unit_pending_active(Unit *u) { + assert(u); + + /* Returns true if the unit is inactive or going down */ + + if (UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u))) + return true; + + if (u->meta.job && + (u->meta.job->type == JOB_START || + u->meta.job->type == JOB_RELOAD_OR_START || + u->meta.job->type == JOB_RESTART)) + return true; + + return false; +} + static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = { [UNIT_STUB] = "stub", [UNIT_LOADED] = "loaded",