X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Funit.c;h=6e40bc6e9fd973f250f46f7692bba445dfc35bf9;hb=1b8689f94983b47bf190e77ddb03a8fc6af15fb3;hp=ea55c709b016752f17853ea69419c91fda96a5eb;hpb=95ae05c0e79868c22b3e8e6fbc53432786876730;p=elogind.git diff --git a/src/core/unit.c b/src/core/unit.c index ea55c709b..6e40bc6e9 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -121,7 +121,6 @@ static void unit_init(Unit *u) { cc->cpu_accounting = u->manager->default_cpu_accounting; cc->blockio_accounting = u->manager->default_blockio_accounting; cc->memory_accounting = u->manager->default_memory_accounting; - cc->cpu_quota_period_usec = u->manager->default_cpu_quota_period_usec; } ec = unit_get_exec_context(u); @@ -509,6 +508,7 @@ void unit_free(Unit *u) { } set_remove(u->manager->failed_units, u); + set_remove(u->manager->startup_units, u); free(u->description); strv_free(u->documentation); @@ -1076,12 +1076,17 @@ static int unit_add_startup_units(Unit *u) { int r = 0; c = unit_get_cgroup_context(u); - if (c != NULL && manager_state(u->manager) == MANAGER_STARTING && - (c->startup_cpu_shares_set || c->startup_blockio_weight_set)) { - r = set_put(u->manager->startup_units, u); - if (r == -EEXIST) - r = 0; - } + if (!c) + return 0; + + if (c->startup_cpu_shares == (unsigned long) -1 && + c->startup_blockio_weight == (unsigned long) -1) + return 0; + + r = set_put(u->manager->startup_units, u); + if (r == -EEXIST) + return 0; + return r; } @@ -1569,7 +1574,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su /* Note that this is called for all low-level state changes, * even if they might map to the same high-level - * UnitActiveState! That means that ns == os is OK an expected + * UnitActiveState! That means that ns == os is an expected * behavior here. For example: if a mount point is remounted * this function will be called too! */ @@ -1592,7 +1597,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su u->active_exit_timestamp = ts; } - /* Keep track of failed of units */ + /* Keep track of failed units */ if (ns == UNIT_FAILED && os != UNIT_FAILED) set_put(u->manager->failed_units, u); else if (os == UNIT_FAILED && ns != UNIT_FAILED) @@ -1717,7 +1722,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su if (UNIT_IS_ACTIVE_OR_RELOADING(ns)) { if (unit_has_name(u, SPECIAL_DBUS_SERVICE)) - /* The bus just might have become available, + /* The bus might have just become available, * hence try to connect to it, if we aren't * yet connected. */ bus_init(m, true);