From 4fe66c868143f891bc2f04b3d8ea239a590ef740 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 26 Sep 2017 16:18:50 +0200 Subject: [PATCH 1/4] core: improve dbus-cgroup error message As suggested by @keszybz in the review of #6764 --- src/core/dbus-cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c index f61ca08fcb..a99d727f4d 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c @@ -1247,7 +1247,7 @@ int bus_cgroup_set_property( return r; if (!IN_SET(family, AF_INET, AF_INET6)) - return sd_bus_error_set_errnof(error, EINVAL, "IPAddressAllow= expects IPv4 or IPv6 addresses only."); + return sd_bus_error_set_errnof(error, EINVAL, "%s= expects IPv4 or IPv6 addresses only.", name); r = sd_bus_message_read_array(message, 'y', &ap, &an); if (r < 0) @@ -1262,7 +1262,7 @@ int bus_cgroup_set_property( return r; if (prefixlen > FAMILY_ADDRESS_SIZE(family)*8) - return sd_bus_error_set_errnof(error, EINVAL, "Prefix length too large for family."); + return sd_bus_error_set_errnof(error, EINVAL, "Prefix length %" PRIu32 " too large for address family %s.", prefixlen, af_to_name(family)); if (mode != UNIT_CHECK) { IPAddressAccessItem *item; From 655aab20563b37058422e88ec3df2182ab895ee1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 26 Sep 2017 16:33:03 +0200 Subject: [PATCH 2/4] run: also show IP traffic accounting data on "systemd-run --wait" If we collect we should show it. --- src/run/run.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/run/run.c b/src/run/run.c index 2e24f46b17..f9ca5683a2 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -816,6 +816,8 @@ typedef struct RunContext { uint64_t inactive_enter_usec; char *result; uint64_t cpu_usage_nsec; + uint64_t ip_ingress_bytes; + uint64_t ip_egress_bytes; uint32_t exit_code; uint32_t exit_status; } RunContext; @@ -859,6 +861,8 @@ static int run_context_update(RunContext *c, const char *path) { { "ExecMainCode", "i", NULL, offsetof(RunContext, exit_code) }, { "ExecMainStatus", "i", NULL, offsetof(RunContext, exit_status) }, { "CPUUsageNSec", "t", NULL, offsetof(RunContext, cpu_usage_nsec) }, + { "IPIngressBytes", "t", NULL, offsetof(RunContext, ip_ingress_bytes) }, + { "IPEgressBytes", "t", NULL, offsetof(RunContext, ip_egress_bytes) }, {} }; @@ -1045,7 +1049,13 @@ static int start_transient_service( log_info("Running as unit: %s", service); if (arg_wait || arg_stdio != ARG_STDIO_NONE) { - _cleanup_(run_context_free) RunContext c = {}; + _cleanup_(run_context_free) RunContext c = { + .cpu_usage_nsec = NSEC_INFINITY, + .ip_ingress_bytes = UINT64_MAX, + .ip_egress_bytes = UINT64_MAX, + .inactive_exit_usec = USEC_INFINITY, + .inactive_enter_usec = USEC_INFINITY, + }; _cleanup_free_ char *path = NULL; const char *mt; @@ -1125,10 +1135,19 @@ static int start_transient_service( log_info("Service runtime: %s", format_timespan(ts, sizeof(ts), c.inactive_enter_usec - c.inactive_exit_usec, USEC_PER_MSEC)); } - if (c.cpu_usage_nsec > 0 && c.cpu_usage_nsec != NSEC_INFINITY) { + if (c.cpu_usage_nsec != NSEC_INFINITY) { char ts[FORMAT_TIMESPAN_MAX]; log_info("CPU time consumed: %s", format_timespan(ts, sizeof(ts), (c.cpu_usage_nsec + NSEC_PER_USEC - 1) / NSEC_PER_USEC, USEC_PER_MSEC)); } + + if (c.ip_ingress_bytes != UINT64_MAX) { + char bytes[FORMAT_BYTES_MAX]; + log_info("IP traffic received: %s", format_bytes(bytes, sizeof(bytes), c.ip_ingress_bytes)); + } + if (c.ip_egress_bytes != UINT64_MAX) { + char bytes[FORMAT_BYTES_MAX]; + log_info("IP traffic sent: %s", format_bytes(bytes, sizeof(bytes), c.ip_egress_bytes)); + } } /* Try to propagate the service's return value */ From 173f30eb6f5cd2ca59ecc45cc756f4a9c38eac1e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 26 Sep 2017 16:42:02 +0200 Subject: [PATCH 3/4] catalog: add two recent message ID additions to catalog Just brief texts for now, so that we have something (And in the long rung we should beef all this up, and add a test that every ID listed in sd-messages.h is accompanied by a matching catalog entry) --- catalog/systemd.catalog.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/catalog/systemd.catalog.in b/catalog/systemd.catalog.in index 9cd3e6bac3..27b9ad2466 100644 --- a/catalog/systemd.catalog.in +++ b/catalog/systemd.catalog.in @@ -354,3 +354,18 @@ Documentation: man:systemd-resolved.service(8) A DNSSEC trust anchor has been revoked. A new trust anchor has to be configured, or the operating system needs to be updated, to provide an updated DNSSEC trust anchor. + +-- 5eb03494b6584870a536b337290809b3 +Subject: Automatic restarting of a unit has been scheduled +Defined-By: systemd +Support: %SUPPORT_URL% + +Automatic restarting of the unit @UNIT@ has been scheduled, as the result for +the configured Restart= setting for the unit. + +-- ae8f7b866b0347b9af31fe1c80b127c0 +Subject: Resources consumed by unit runtime +Defined-By: systemd +Support: %SUPPORT_URL% + +The unit @UNIT@ completed and consumed the indicated resources. From 6722da79f28a8ce6b8b034673cab14c8c5bd79ff Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 26 Sep 2017 16:46:17 +0200 Subject: [PATCH 4/4] catalog: split out the one German language entry we have in systemd.catalog into its own file All other languages have their own file, let's make sure German does too. --- catalog/meson.build | 1 + catalog/systemd.catalog.in | 12 ------------ catalog/systemd.de.catalog.in | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 catalog/systemd.de.catalog.in diff --git a/catalog/meson.build b/catalog/meson.build index 6d205b1d42..3e61e6fc5b 100644 --- a/catalog/meson.build +++ b/catalog/meson.build @@ -2,6 +2,7 @@ in_files = ''' systemd.bg.catalog systemd.be.catalog systemd.be@latin.catalog + systemd.de.catalog systemd.fr.catalog systemd.it.catalog systemd.pl.catalog diff --git a/catalog/systemd.catalog.in b/catalog/systemd.catalog.in index 27b9ad2466..1efa021fdc 100644 --- a/catalog/systemd.catalog.in +++ b/catalog/systemd.catalog.in @@ -99,18 +99,6 @@ and storage by systemd-coredump(8). Only the first @SIZE_LIMIT@ bytes were saved. This core might still be usable, but various tools like gdb(1) will warn about the file being truncated. --- fc2e22bc6ee647b6b90729ab34a250b1 de -Subject: Speicherabbild für Prozess @COREDUMP_PID@ (@COREDUMP_COMM) generiert -Defined-By: systemd -Support: %SUPPORT_URL% -Documentation: man:core(5) - -Prozess @COREDUMP_PID@ (@COREDUMP_COMM@) ist abgebrochen worden und -ein Speicherabbild wurde generiert. - -Üblicherweise ist dies ein Hinweis auf einen Programmfehler und sollte -als Fehler dem jeweiligen Hersteller gemeldet werden. - -- 8d45620c1a4348dbb17410da57c60c66 Subject: A new session @SESSION_ID@ has been created for user @USER_ID@ Defined-By: systemd diff --git a/catalog/systemd.de.catalog.in b/catalog/systemd.de.catalog.in new file mode 100644 index 0000000000..b69a8be198 --- /dev/null +++ b/catalog/systemd.de.catalog.in @@ -0,0 +1,28 @@ +# This file is part of systemd. +# +# Copyright 2012 Lennart Poettering +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see . + +-- fc2e22bc6ee647b6b90729ab34a250b1 +Subject: Speicherabbild für Prozess @COREDUMP_PID@ (@COREDUMP_COMM) generiert +Defined-By: systemd +Support: %SUPPORT_URL% +Documentation: man:core(5) + +Prozess @COREDUMP_PID@ (@COREDUMP_COMM@) ist abgebrochen worden und +ein Speicherabbild wurde generiert. + +Üblicherweise ist dies ein Hinweis auf einen Programmfehler und sollte +als Fehler dem jeweiligen Hersteller gemeldet werden.