summaryrefslogtreecommitdiff
path: root/src/core/load-dropin.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-10-25 20:46:01 +0200
committerLennart Poettering <lennart@poettering.net>2017-11-10 19:45:29 +0100
commiteef85c4a3f8054d29383a176f6cebd1ef3a15b9a (patch)
tree318abdf98fbca40552731ef82ad2bb6d9949e1d5 /src/core/load-dropin.c
parent8f50e86a868e73e05b7587e2d2bbf4d61dd433cf (diff)
downloadsystemd-eef85c4a3f8054d29383a176f6cebd1ef3a15b9a.tar.gz
core: track why unit dependencies came to be
This replaces the dependencies Set* objects by Hashmap* objects, where the key is the depending Unit, and the value is a bitmask encoding why the specific dependency was created. The bitmask contains a number of different, defined bits, that indicate why dependencies exist, for example whether they are created due to explicitly configured deps in files, by udev rules or implicitly. Note that memory usage is not increased by this change, even though we store more information, as we manage to encode the bit mask inside the value pointer each Hashmap entry contains. Why this all? When we know how a dependency came to be, we can update dependencies correctly when a configuration source changes but others are left unaltered. Specifically: 1. We can fix UDEV_WANTS dependency generation: so far we kept adding dependencies configured that way, but if a device lost such a dependency we couldn't them again as there was no scheme for removing of dependencies in place. 2. We can implement "pin-pointed" reload of unit files. If we know what dependencies were created as result of configuration in a unit file, then we know what to flush out when we want to reload it. 3. It's useful for debugging: "systemd-analyze dump" now shows this information, helping substantially with understanding how systemd's dependency tree came to be the way it came to be.
Diffstat (limited to 'src/core/load-dropin.c')
-rw-r--r--src/core/load-dropin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c
index 00f09ce60a..948d1bc248 100644
--- a/src/core/load-dropin.c
+++ b/src/core/load-dropin.c
@@ -115,7 +115,7 @@ static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suff
log_unit_warning(u, "%s dependency dropin %s target %s has different name",
unit_dependency_to_string(dependency), *p, target);
- r = unit_add_dependency_by_name(u, dependency, entry, *p, true);
+ r = unit_add_dependency_by_name(u, dependency, entry, *p, true, UNIT_DEPENDENCY_FILE);
if (r < 0)
log_unit_error_errno(u, r, "cannot add %s dependency on %s, ignoring: %m",
unit_dependency_to_string(dependency), entry);