Compare commits

..

No commits in common. "1cb342447d92053ab1750e498b6591f3dd46f0f6" and "10ad50d38c712ef3ae668de656bc9d07621ddc0e" have entirely different histories.

5 changed files with 19 additions and 77 deletions

View File

@ -91,16 +91,6 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>INVOCATION_ID=</varname></term>
<term><varname>USER_INVOCATION_ID=</varname></term>
<listitem>
<para>A randomized, unique 128-bit ID identifying each runtime cycle of the unit. This is different from
<varname>_SYSTEMD_INVOCATION_ID</varname> in that it is only used for messages coming from systemd code
(e.g. logs from the system/user manager or from forked processes performing systemd-related setup).</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>SYSLOG_FACILITY=</varname></term> <term><varname>SYSLOG_FACILITY=</varname></term>
<term><varname>SYSLOG_IDENTIFIER=</varname></term> <term><varname>SYSLOG_IDENTIFIER=</varname></term>

View File

@ -881,17 +881,8 @@ int manager_new(UnitFileScope scope, ManagerTestRunFlags test_run_flags, Manager
return r; return r;
} }
if (test_run_flags == 0) { if (MANAGER_IS_SYSTEM(m) && test_run_flags == 0) {
if (MANAGER_IS_SYSTEM(m))
r = mkdir_label("/run/systemd/units", 0755); r = mkdir_label("/run/systemd/units", 0755);
else {
_cleanup_free_ char *units_path = NULL;
r = xdg_user_runtime_dir(&units_path, "/systemd/units");
if (r < 0)
return r;
r = mkdir_p_label(units_path, 0755);
}
if (r < 0 && r != -EEXIST) if (r < 0 && r != -EEXIST)
return r; return r;
} }

View File

@ -5373,32 +5373,8 @@ void unit_remove_dependencies(Unit *u, UnitDependencyMask mask) {
} }
} }
static int unit_get_invocation_path(Unit *u, char **ret) {
char *p;
int r;
assert(u);
assert(ret);
if (MANAGER_IS_SYSTEM(u->manager))
p = strjoin("/run/systemd/units/invocation:", u->id);
else {
_cleanup_free_ char *user_path = NULL;
r = xdg_user_runtime_dir(&user_path, "/systemd/units/invocation:");
if (r < 0)
return r;
p = strjoin(user_path, u->id);
}
if (!p)
return -ENOMEM;
*ret = p;
return 0;
}
static int unit_export_invocation_id(Unit *u) { static int unit_export_invocation_id(Unit *u) {
_cleanup_free_ char *p = NULL; const char *p;
int r; int r;
assert(u); assert(u);
@ -5409,10 +5385,7 @@ static int unit_export_invocation_id(Unit *u) {
if (sd_id128_is_null(u->invocation_id)) if (sd_id128_is_null(u->invocation_id))
return 0; return 0;
r = unit_get_invocation_path(u, &p); p = strjoina("/run/systemd/units/invocation:", u->id);
if (r < 0)
return log_unit_debug_errno(u, r, "Failed to get invocation path: %m");
r = symlink_atomic(u->invocation_id_string, p); r = symlink_atomic(u->invocation_id_string, p);
if (r < 0) if (r < 0)
return log_unit_debug_errno(u, r, "Failed to create invocation ID symlink %s: %m", p); return log_unit_debug_errno(u, r, "Failed to create invocation ID symlink %s: %m", p);
@ -5565,6 +5538,9 @@ void unit_export_state_files(Unit *u) {
if (!u->id) if (!u->id)
return; return;
if (!MANAGER_IS_SYSTEM(u->manager))
return;
if (MANAGER_IS_TEST_RUN(u->manager)) if (MANAGER_IS_TEST_RUN(u->manager))
return; return;
@ -5583,9 +5559,6 @@ void unit_export_state_files(Unit *u) {
(void) unit_export_invocation_id(u); (void) unit_export_invocation_id(u);
if (!MANAGER_IS_SYSTEM(u->manager))
return;
c = unit_get_exec_context(u); c = unit_get_exec_context(u);
if (c) { if (c) {
(void) unit_export_log_level_max(u, c); (void) unit_export_log_level_max(u, c);
@ -5603,19 +5576,17 @@ void unit_unlink_state_files(Unit *u) {
if (!u->id) if (!u->id)
return; return;
if (!MANAGER_IS_SYSTEM(u->manager))
return;
/* Undoes the effect of unit_export_state() */ /* Undoes the effect of unit_export_state() */
if (u->exported_invocation_id) { if (u->exported_invocation_id) {
_cleanup_free_ char *invocation_path = NULL; p = strjoina("/run/systemd/units/invocation:", u->id);
int r = unit_get_invocation_path(u, &invocation_path); (void) unlink(p);
if (r >= 0) {
(void) unlink(invocation_path);
u->exported_invocation_id = false; u->exported_invocation_id = false;
} }
}
if (!MANAGER_IS_SYSTEM(u->manager))
return;
if (u->exported_log_level_max) { if (u->exported_log_level_max) {
p = strjoina("/run/systemd/units/log-level-max:", u->id); p = strjoina("/run/systemd/units/log-level-max:", u->id);

View File

@ -325,29 +325,19 @@ static int client_context_read_invocation_id(
Server *s, Server *s,
ClientContext *c) { ClientContext *c) {
_cleanup_free_ char *p = NULL, *value = NULL; _cleanup_free_ char *value = NULL;
const char *p;
int r; int r;
assert(s); assert(s);
assert(c); assert(c);
/* Read the invocation ID of a unit off a unit. /* Read the invocation ID of a unit off a unit. PID 1 stores it in a per-unit symlink in /run/systemd/units/ */
* PID 1 stores it in a per-unit symlink in /run/systemd/units/
* User managers store it in a per-unit symlink under /run/user/<uid>/systemd/units/ */
if (!c->unit) if (!c->unit)
return 0; return 0;
if (c->user_unit) { p = strjoina("/run/systemd/units/invocation:", c->unit);
r = asprintf(&p, "/run/user/" UID_FMT "/systemd/units/invocation:%s", c->owner_uid, c->user_unit);
if (r < 0)
return r;
} else {
p = strjoin("/run/systemd/units/invocation:", c->unit);
if (!p)
return -ENOMEM;
}
r = readlink_malloc(p, &value); r = readlink_malloc(p, &value);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -629,7 +629,7 @@ int manager_rtnl_process_neighbor(sd_netlink *rtnl, sd_netlink_message *message,
r = sd_rtnl_message_neigh_get_family(message, &family); r = sd_rtnl_message_neigh_get_family(message, &family);
if (r < 0) { if (r < 0) {
log_link_warning(link, "rtnl: received neighbor message without family, ignoring."); log_link_warning(link, "rtnl: received neighbor message withot family, ignoring.");
return 0; return 0;
} else if (!IN_SET(family, AF_INET, AF_INET6)) { } else if (!IN_SET(family, AF_INET, AF_INET6)) {
log_link_debug(link, "rtnl: received neighbor message with invalid family '%i', ignoring.", family); log_link_debug(link, "rtnl: received neighbor message with invalid family '%i', ignoring.", family);