X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Funit.c;h=87b7edf145824ee735448f6f4d44aa4fe9d6741c;hb=88bb8d215aa0f5576eb3f9c77c30cdc4b17783fe;hp=b7ff0c51fe9f40b4914da36d8513232ce40e9500;hpb=796ba5549416b8a2c037da1d40fa76cb1a53f5df;p=elogind.git diff --git a/src/unit.c b/src/unit.c index b7ff0c51f..87b7edf14 100644 --- a/src/unit.c +++ b/src/unit.c @@ -159,7 +159,7 @@ int unit_add_name(Unit *u, const char *text) { u->meta.id = s; u->meta.instance = i; - LIST_PREPEND(Meta, units_per_type, u->meta.manager->units_per_type[t], &u->meta); + LIST_PREPEND(Meta, units_by_type, u->meta.manager->units_by_type[t], &u->meta); if (UNIT_VTABLE(u)->init) UNIT_VTABLE(u)->init(u); @@ -354,7 +354,7 @@ void unit_free(Unit *u) { bidi_set_free(u, u->meta.dependencies[d]); if (u->meta.type != _UNIT_TYPE_INVALID) - LIST_REMOVE(Meta, units_per_type, u->meta.manager->units_per_type[u->meta.type], &u->meta); + LIST_REMOVE(Meta, units_by_type, u->meta.manager->units_by_type[u->meta.type], &u->meta); if (u->meta.in_load_queue) LIST_REMOVE(Meta, load_queue, u->meta.manager->load_queue, &u->meta); @@ -667,13 +667,15 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { "%s\tRefuseManualStop: %s\n" "%s\tDefaultDependencies: %s\n" "%s\tOnFailureIsolate: %s\n" - "%s\tIgnoreOnIsolate: %s\n", + "%s\tIgnoreOnIsolate: %s\n" + "%s\tIgnoreOnSnapshot: %s\n", prefix, yes_no(u->meta.stop_when_unneeded), prefix, yes_no(u->meta.refuse_manual_start), prefix, yes_no(u->meta.refuse_manual_stop), prefix, yes_no(u->meta.default_dependencies), prefix, yes_no(u->meta.on_failure_isolate), - prefix, yes_no(u->meta.ignore_on_isolate)); + prefix, yes_no(u->meta.ignore_on_isolate), + prefix, yes_no(u->meta.ignore_on_snapshot)); LIST_FOREACH(by_unit, b, u->meta.cgroup_bondings) fprintf(f, "%s\tControlGroup: %s:%s\n", @@ -2303,21 +2305,25 @@ void unit_status_printf(Unit *u, const char *format, ...) { } bool unit_need_daemon_reload(Unit *u) { - struct stat st; - assert(u); - if (!u->meta.fragment_path) - return false; + if (u->meta.fragment_path) { + struct stat st; - zero(st); - if (stat(u->meta.fragment_path, &st) < 0) - /* What, cannot access this anymore? */ - return true; + zero(st); + if (stat(u->meta.fragment_path, &st) < 0) + /* What, cannot access this anymore? */ + return true; - return - u->meta.fragment_mtime && - timespec_load(&st.st_mtim) != u->meta.fragment_mtime; + if (u->meta.fragment_mtime > 0 && + timespec_load(&st.st_mtim) != u->meta.fragment_mtime) + return true; + } + + if (UNIT_VTABLE(u)->need_daemon_reload) + return UNIT_VTABLE(u)->need_daemon_reload(u); + + return false; } void unit_reset_failed(Unit *u) {