summaryrefslogtreecommitdiff
path: root/snapshot.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-21 06:01:13 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-21 06:01:13 +0200
commit701cc384c283206a29b21e4e7302e5cf5f2d9433 (patch)
tree0e8e47d12cb3ea47794bad390658c900ed61d691 /snapshot.c
parent48507e6621596b0d5503fad6cd9e0685917603f5 (diff)
manager: automatically GC unreferenced units
Diffstat (limited to 'snapshot.c')
-rw-r--r--snapshot.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/snapshot.c b/snapshot.c
index d0aaa51fee..397d09be19 100644
--- a/snapshot.c
+++ b/snapshot.c
@@ -139,10 +139,10 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value
} else if (streq(key, "requires")) {
- if ((r = unit_add_dependency_by_name(u, UNIT_AFTER, value, NULL)) < 0)
+ if ((r = unit_add_dependency_by_name(u, UNIT_AFTER, value, NULL, true)) < 0)
return r;
- if ((r = unit_add_dependency_by_name(u, UNIT_REQUIRES, value, NULL)) < 0)
+ if ((r = unit_add_dependency_by_name(u, UNIT_REQUIRES, value, NULL, true)) < 0)
return r;
} else
log_debug("Unknown serialization key '%s'", key);
@@ -211,13 +211,17 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, Snapshot **_s) {
if (k != other->meta.id)
continue;
+ if (UNIT_VTABLE(other)->check_snapshot)
+ if (!UNIT_VTABLE(other)->check_snapshot(other))
+ continue;
+
if (!UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(other)))
continue;
- if ((r = unit_add_dependency(u, UNIT_REQUIRES, other)) < 0)
+ if ((r = unit_add_dependency(u, UNIT_REQUIRES, other, true)) < 0)
goto fail;
- if ((r = unit_add_dependency(u, UNIT_AFTER, other)) < 0)
+ if ((r = unit_add_dependency(u, UNIT_AFTER, other, true)) < 0)
goto fail;
}
@@ -252,6 +256,7 @@ const UnitVTable snapshot_vtable = {
.no_alias = true,
.no_instances = true,
.no_snapshots = true,
+ .no_gc = true,
.load = unit_load_nop,
.coldplug = snapshot_coldplug,