}
int unit_coldplug(Unit *u) {
+ Unit *other;
+ Iterator i;
int r;
assert(u);
- if (UNIT_VTABLE(u)->coldplug)
- if ((r = UNIT_VTABLE(u)->coldplug(u)) < 0)
+ /* Make sure we don't enter a loop, when coldplugging
+ * recursively. */
+ if (u->coldplugged)
+ return 0;
+
+ u->coldplugged = true;
+
+ /* Make sure everything that we might pull in through
+ * triggering is coldplugged before us */
+ SET_FOREACH(other, u->dependencies[UNIT_TRIGGERS], i) {
+ r = unit_coldplug(other);
+ if (r < 0)
return r;
+ }
+
+ if (UNIT_VTABLE(u)->coldplug) {
+ r = UNIT_VTABLE(u)->coldplug(u);
+ if (r < 0)
+ return r;
+ }
if (u->job) {
r = job_coldplug(u->job);
char *fragment_path; /* if loaded from a config file this is the primary path to it */
char *source_path; /* if converted, the source file */
char **dropin_paths;
+
usec_t fragment_mtime;
usec_t source_mtime;
usec_t dropin_mtime;
bool cgroup_realized:1;
bool cgroup_members_mask_valid:1;
bool cgroup_subtree_mask_valid:1;
+
+ /* Did we already invoke unit_coldplug() for this unit? */
+ bool coldplugged;
};
struct UnitStatusMessageFormats {