summaryrefslogtreecommitdiff
path: root/src/core/manager.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-18 13:11:28 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-30 14:01:46 +0200
commite8630e695232bdfcd16b55f3faafb4329c961104 (patch)
treedce17c3db55aa13c5f64ed6f8a415e6eea3db7fd /src/core/manager.h
parent7d1e91d1a9504ab1bc03894038f90a8e87a4e982 (diff)
downloadsystemd-e8630e695232bdfcd16b55f3faafb4329c961104.tar.gz
pid1: use a cache for all unit aliases
This reworks how we load units from disk. Instead of chasing symlinks every time we are asked to load a unit by name, we slurp all symlinks from disk and build two hashmaps: 1. from unit name to either alias target, or fragment on disk (if an alias, we put just the target name in the hashmap, if a fragment we put an absolute path, so we can distinguish both). 2. from a unit name to all aliases Reading all this data can be pretty costly (40 ms) on my machine, so we keep it around for reuse. The advantage is that we can reliably know what all the aliases of a given unit are. This means we can reliably load dropins under all names. This fixes #11972.
Diffstat (limited to 'src/core/manager.h')
-rw-r--r--src/core/manager.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/manager.h b/src/core/manager.h
index 9879082fea..3cb37b3bf4 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -221,6 +221,8 @@ struct Manager {
UnitFileScope unit_file_scope;
LookupPaths lookup_paths;
+ Hashmap *unit_id_map;
+ Hashmap *unit_name_map;
Set *unit_path_cache;
char **transient_environment; /* The environment, as determined from config files, kernel cmdline and environment generators */