basic.target unit has been reached, instead of when the run queue ran
empty for the first time.
- * Unit files learnt three new % specifiers that are expanded during
- loading: %S resolves to the top-level state directory (/var/lib for
- the system instance, $XDG_CONFIG_HOME for the user instance), %C
- resolves to the top-level cache directory (/var/cache for the system
- instance, $XDG_CACHE_HOME for the user instance), %L resolves to the
- top-level logs directory (/var/log for the system instance,
+ * Tmpfiles.d with user configuration are now also supported.
+ systemd-tmpfiles gained a new --user switch, and snippets placed in
+ ~/.config/user-tmpfiles.d/ and corresponding directories will be
+ executed by systemd-tmpfiles --user running in the new
+ systemd-tmpfiles-setup.service and systemd-tmpfiles-clean.service
+ running in the user session.
+
+ * Unit files and tmpfiles.d snippets learnt three new % specifiers:
+ %S resolves to the top-level state directory (/var/lib for the system
+ instance, $XDG_CONFIG_HOME for the user instance), %C resolves to the
+ top-level cache directory (/var/cache for the system instance,
+ $XDG_CACHE_HOME for the user instance), %L resolves to the top-level
+ logs directory (/var/log for the system instance,
$XDG_CONFIG_HOME/log/ for the user instance). This matches the
- existing %t specifier, that resolves to the top-level runtime
+ existing %t specifier, that resolves to the top-level runtime
directory (/run for the system instance, and $XDG_RUNTIME_DIR for the
user instance).
--- /dev/null
+@@
+expression s;
+@@
+- isempty(s) ? NULL : s
++ empty_to_null(s)
#!/bin/bash -e
-for SCRIPT in *.cocci ; do
+for SCRIPT in ${@-*.cocci} ; do
[ "$SCRIPT" = "empty-if.cocci" ] && continue
echo "--x-- Processing $SCRIPT --x--"
TMPFILE=`mktemp`
return 0;
}
+static int manager_setup_run_queue(Manager *m) {
+ int r;
+
+ assert(m);
+ assert(!m->run_queue_event_source);
+
+ r = sd_event_add_defer(m->event, &m->run_queue_event_source, manager_dispatch_run_queue, m);
+ if (r < 0)
+ return r;
+
+ r = sd_event_source_set_priority(m->run_queue_event_source, SD_EVENT_PRIORITY_IDLE);
+ if (r < 0)
+ return r;
+
+ r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_OFF);
+ if (r < 0)
+ return r;
+
+ (void) sd_event_source_set_description(m->run_queue_event_source, "manager-run-queue");
+
+ return 0;
+}
+
int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
Manager *m;
int r;
if (r < 0)
goto fail;
- r = sd_event_add_defer(m->event, &m->run_queue_event_source, manager_dispatch_run_queue, m);
+ r = manager_setup_run_queue(m);
if (r < 0)
goto fail;
- r = sd_event_source_set_priority(m->run_queue_event_source, SD_EVENT_PRIORITY_IDLE);
- if (r < 0)
- goto fail;
-
- r = sd_event_source_set_enabled(m->run_queue_event_source, SD_EVENT_OFF);
- if (r < 0)
- goto fail;
-
- (void) sd_event_source_set_description(m->run_queue_event_source, "manager-run-queue");
-
r = manager_setup_signals(m);
if (r < 0)
goto fail;
goto fail;
}
- if (MANAGER_IS_SYSTEM(m)) {
+ r = manager_setup_prefix(m);
+ if (r < 0)
+ goto fail;
+
+ if (MANAGER_IS_SYSTEM(m) && test_run_flags == 0) {
r = mkdir_label("/run/systemd/units", 0755);
if (r < 0 && r != -EEXIST)
goto fail;
}
+ m->taint_usr =
+ !in_initrd() &&
+ dir_is_empty("/usr") > 0;
+
/* Note that we do not set up the notify fd here. We do that after deserialization,
* since they might have gotten serialized across the reexec. */
- m->taint_usr = dir_is_empty("/usr") > 0;
-
- r = manager_setup_prefix(m);
- if (r < 0)
- goto fail;
-
*_m = m;
return 0;
return 0;
}
- old_owner = isempty(old_owner) ? NULL : old_owner;
- new_owner = isempty(new_owner) ? NULL : new_owner;
+ old_owner = empty_to_null(old_owner);
+ new_owner = empty_to_null(new_owner);
if (UNIT_VTABLE(u)->bus_name_owner_change)
UNIT_VTABLE(u)->bus_name_owner_change(u, name, old_owner, new_owner);