Systemd/src/shared
Lennart Poettering 4b58153dd2 core: add "invocation ID" concept to service manager
This adds a new invocation ID concept to the service manager. The invocation ID
identifies each runtime cycle of a unit uniquely. A new randomized 128bit ID is
generated each time a unit moves from and inactive to an activating or active
state.

The primary usecase for this concept is to connect the runtime data PID 1
maintains about a service with the offline data the journal stores about it.
Previously we'd use the unit name plus start/stop times, which however is
highly racy since the journal will generally process log data after the service
already ended.

The "invocation ID" kinda matches the "boot ID" concept of the Linux kernel,
except that it applies to an individual unit instead of the whole system.

The invocation ID is passed to the activated processes as environment variable.
It is additionally stored as extended attribute on the cgroup of the unit. The
latter is used by journald to automatically retrieve it for each log logged
message and attach it to the log entry. The environment variable is very easily
accessible, even for unprivileged services. OTOH the extended attribute is only
accessible to privileged processes (this is because cgroupfs only supports the
"trusted." xattr namespace, not "user."). The environment variable may be
altered by services, the extended attribute may not be, hence is the better
choice for the journal.

Note that reading the invocation ID off the extended attribute from journald is
racy, similar to the way reading the unit name for a logging process is.

This patch adds APIs to read the invocation ID to sd-id128:
sd_id128_get_invocation() may be used in a similar fashion to
sd_id128_get_boot().

PID1's own logging is updated to always include the invocation ID when it logs
information about a unit.

A new bus call GetUnitByInvocationID() is added that allows retrieving a bus
path to a unit by its invocation ID. The bus path is built using the invocation
ID, thus providing a path for referring to a unit that is valid only for the
current runtime cycleof it.

Outlook for the future: should the kernel eventually allow passing of cgroup
information along AF_UNIX/SOCK_DGRAM messages via a unique cgroup id, then we
can alter the invocation ID to be generated as hash from that rather than
entirely randomly. This way we can derive the invocation race-freely from the
messages.
2016-10-07 20:14:38 +02:00
..
linux
Makefile
acl-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
acl-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
acpi-fpdt.c shared/acpi-fpdt: use ENODATA for missing data and skip test 2016-03-04 21:45:45 -05:00
acpi-fpdt.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
apparmor-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
apparmor-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
ask-password-api.c fileio: simplify mkostemp_safe() (#4090) 2016-09-13 08:20:38 +02:00
ask-password-api.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
base-filesystem.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
base-filesystem.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
boot-timestamps.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
boot-timestamps.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
bus-unit-util.c core: add two new service settings ProtectKernelTunables= and ProtectControlGroups= 2016-09-25 10:18:48 +02:00
bus-unit-util.h bus-util: unify loop around bus_append_unit_property_assignment() 2016-08-18 22:23:31 +02:00
bus-util.c core: add "invocation ID" concept to service manager 2016-10-07 20:14:38 +02:00
bus-util.h bus-util: generalize helper for ID128 prpoerties 2016-10-07 20:14:38 +02:00
cgroup-show.c tree-wide: rename draw_special_char to special_glyph 2016-05-09 15:17:57 -04:00
cgroup-show.h shared: drop kernel_thread bool from cgroups show code 2016-04-22 16:06:20 +02:00
clean-ipc.c clean-ipc: debug log about all remove IPC objects 2016-08-19 00:37:25 +02:00
clean-ipc.h core: add RemoveIPC= setting 2016-08-19 00:37:25 +02:00
condition.c update-done, condition: write the timestamp to the file as well and use it to prevent false-positives 2016-09-15 06:36:42 +03:00
condition.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
conf-parser.c shared/conf-parser: add config_parse_many which takes strv with dirs 2016-09-16 10:32:03 -04:00
conf-parser.h shared/conf-parser: add config_parse_many which takes strv with dirs 2016-09-16 10:32:03 -04:00
dev-setup.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
dev-setup.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
dns-domain.c shared: recognize DNS names with more than one trailing dot as invalid (#4111) 2016-09-09 16:11:54 +01:00
dns-domain.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
dropin.c tree-wide: rename hidden_file to hidden_or_backup_file and optimize 2016-04-28 08:25:17 -04:00
dropin.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
efivars.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
efivars.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fdset.c build-sys: move fdset.[ch] src/basic → src/shared (#3580) 2016-06-23 05:10:53 +03:00
fdset.h build-sys: move fdset.[ch] src/basic → src/shared (#3580) 2016-06-23 05:10:53 +03:00
firewall-util.c Make the fix for net/if.h fuckup even worse (#3287) 2016-05-20 15:12:42 +02:00
firewall-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fstab-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fstab-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
gcrypt-util.c build-sys: fix build with libgrcypt disabled 2016-03-27 21:51:44 -04:00
gcrypt-util.h build-sys: fix build with libgrcypt disabled 2016-03-27 21:51:44 -04:00
generator.c Create initrd-root-device.target synchronization point (#3239) 2016-05-12 18:42:39 +02:00
generator.h Create initrd-root-device.target synchronization point (#3239) 2016-05-12 18:42:39 +02:00
gpt.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
ima-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
ima-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
import-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
import-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
initreq.h
install-printf.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
install-printf.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
install.c shared/install: fix set-default with empty root (#4118) 2016-09-10 13:07:51 +02:00
install.h shared/install: handle dangling aliases as an explicit case, report nicely 2016-05-09 15:17:56 -04:00
logs-show.c journalctl: add new output mode "short-full" (#3880) 2016-08-03 19:45:07 -04:00
logs-show.h shared: move output_mode_to_string() into output-mode.c 2016-04-22 16:16:59 +02:00
machine-image.c treewide: fix typos (#3187) 2016-05-04 11:26:17 +02:00
machine-image.h machinectl: add new "machinectl clean" command 2016-04-12 13:43:33 +02:00
machine-pool.c shared/machine-pool: fix another mkfs.btrfs checking 2016-03-14 00:54:35 +00:00
machine-pool.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
output-mode.c journalctl: add new output mode "short-full" (#3880) 2016-08-03 19:45:07 -04:00
output-mode.h journalctl: add new output mode "short-full" (#3880) 2016-08-03 19:45:07 -04:00
pager.c pager: don't start pager if the terminal is explicitly set to TERM=dumb 2016-05-30 18:23:54 +02:00
pager.h tree-wide: merge pager_open_if_enabled() to the pager_open() 2016-02-26 01:13:23 +06:00
path-lookup.c treewide: fix typos and remove accidental repetition of words 2016-07-11 16:18:43 +02:00
path-lookup.h systemctl: don't confuse sysv code with generated units 2016-04-12 13:43:32 +02:00
ptyfwd.c run: optionally, wait for the service to finish and show its result 2016-08-22 16:14:21 +02:00
ptyfwd.h run: optionally, wait for the service to finish and show its result 2016-08-22 16:14:21 +02:00
resolve-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
resolve-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
seccomp-util.c seccomp: add support for the s390 architecture (#4287) 2016-10-05 13:58:55 +02:00
seccomp-util.h core: do not fail at step SECCOMP if there is no kernel support (#4004) 2016-08-22 22:40:58 +03:00
sleep-config.c tree-wide: rename config_parse_many to …_nulstr 2016-09-16 10:32:03 -04:00
sleep-config.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
spawn-ask-password-agent.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
spawn-ask-password-agent.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
spawn-polkit-agent.c polkit: don't start polkit agent when running as root 2016-04-05 12:18:55 +02:00
spawn-polkit-agent.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
specifier.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
specifier.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
switch-root.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
switch-root.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
sysctl-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
sysctl-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
test-tables.h
tests.c tests: override XDG_RUNTIME_DIR where we use the user runtime dir 2016-04-12 13:43:33 +02:00
tests.h tests: override XDG_RUNTIME_DIR where we use the user runtime dir 2016-04-12 13:43:33 +02:00
udev-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
uid-range.c tree-wide: make ++/-- usage consistent WRT spacing 2016-02-22 20:32:04 -08:00
uid-range.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
utmp-wtmp.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
utmp-wtmp.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
vlan-util.c networkd: clean up vlan handling a bit (#3478) 2016-06-09 18:55:16 +02:00
vlan-util.h networkd: clean up vlan handling a bit (#3478) 2016-06-09 18:55:16 +02:00
watchdog.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
watchdog.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00