systemd-216-6
This commit is contained in:
parent
0ca6977a38
commit
b397f2acfb
File diff suppressed because it is too large
Load Diff
|
@ -1,52 +0,0 @@
|
|||
From fdbdf6ec29bda40763d7d3e7bb2a63e2f5d60c4c Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Tue, 19 Aug 2014 20:53:29 +0200
|
||||
Subject: [PATCH] systemctl: fail in the case that no unit files were found
|
||||
|
||||
Previously systemctl died with message
|
||||
|
||||
-bash-4.2# systemctl --root /rawhi list-unit-files
|
||||
(src/systemctl/systemctl.c:868) Out of memory.
|
||||
|
||||
in the case that no unit files were found in the --root
|
||||
or the directory did not exist.
|
||||
|
||||
So lets return ENOENT in the case that --root does not exist
|
||||
and empty list in the case that there are no unit files.
|
||||
---
|
||||
src/shared/install.c | 6 ++++++
|
||||
src/systemctl/systemctl.c | 4 ++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 0fe1371129..03c7a9da2e 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -2044,6 +2044,12 @@ int unit_file_get_list(
|
||||
if (root_dir && scope != UNIT_FILE_SYSTEM)
|
||||
return -EINVAL;
|
||||
|
||||
+ if (root_dir) {
|
||||
+ r = access(root_dir, F_OK);
|
||||
+ if (r < 0)
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
r = lookup_paths_init_from_scope(&paths, scope, root_dir);
|
||||
if (r < 0)
|
||||
return r;
|
||||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||
index 36db652316..072f615ad5 100644
|
||||
--- a/src/systemctl/systemctl.c
|
||||
+++ b/src/systemctl/systemctl.c
|
||||
@@ -1350,6 +1350,10 @@ static int list_unit_files(sd_bus *bus, char **args) {
|
||||
}
|
||||
|
||||
n_units = hashmap_size(h);
|
||||
+
|
||||
+ if (n_units == 0)
|
||||
+ return 0;
|
||||
+
|
||||
units = new(UnitFileList, n_units);
|
||||
if (!units) {
|
||||
unit_file_list_free(h);
|
|
@ -1,6 +1,6 @@
|
|||
From eb15b8e85a567772ba1c07785c7425f8948ea447 Mon Sep 17 00:00:00 2001
|
||||
From 92fb375921f57472f43cd94c8a86195c38894e98 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 7 Oct 2014 23:34:31 -0400
|
||||
Date: Sun, 2 Nov 2014 09:20:39 -0500
|
||||
Subject: [PATCH] Revert "timedated: manage systemd-timesyncd directly instead
|
||||
of lists of alternatives"
|
||||
|
||||
|
@ -11,11 +11,12 @@ Conflicts:
|
|||
NEWS
|
||||
---
|
||||
Makefile.am | 9 ++
|
||||
NEWS | 2 +
|
||||
src/timedate/timedated.c | 254 +++++++++++++++++++++++++++++------------------
|
||||
2 files changed, 169 insertions(+), 94 deletions(-)
|
||||
3 files changed, 171 insertions(+), 94 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index e52db1793b..ba7881931e 100644
|
||||
index 3666a927fd..3509665176 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -109,6 +109,7 @@ udevrulesdir=$(udevlibexecdir)/rules.d
|
||||
|
@ -26,7 +27,7 @@ index e52db1793b..ba7881931e 100644
|
|||
factory_etcdir = $(prefix)/share/factory/etc
|
||||
factory_pamdir = $(prefix)/share/factory/etc/pam.d
|
||||
|
||||
@@ -4690,6 +4691,10 @@ dist_systemunit_DATA_busnames += \
|
||||
@@ -4762,6 +4763,10 @@ dist_systemunit_DATA_busnames += \
|
||||
polkitpolicy_files += \
|
||||
src/timedate/org.freedesktop.timedate1.policy
|
||||
|
||||
|
@ -37,7 +38,7 @@ index e52db1793b..ba7881931e 100644
|
|||
SYSTEM_UNIT_ALIASES += \
|
||||
systemd-timedated.service dbus-org.freedesktop.timedate1.service
|
||||
|
||||
@@ -4768,6 +4773,10 @@ EXTRA_DIST += \
|
||||
@@ -4840,6 +4845,10 @@ EXTRA_DIST += \
|
||||
|
||||
CLEANFILES += \
|
||||
src/timesync/timesyncd.conf
|
||||
|
@ -48,8 +49,21 @@ index e52db1793b..ba7881931e 100644
|
|||
endif
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 84a43fd5df..078fabb1e5 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -218,6 +218,8 @@ CHANGES WITH 216:
|
||||
to their unit files to take over and replace systemd's NTP
|
||||
default functionality.
|
||||
|
||||
+ [ reverted in this branch ]
|
||||
+
|
||||
* systemd-sysusers gained a new line type "r" for configuring
|
||||
which UID/GID ranges to allocate system users/groups
|
||||
from. Lines of type "u" may now add an additional column
|
||||
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
|
||||
index fa3f947eaa..9e64e9c629 100644
|
||||
index 8880812b49..08b604dcca 100644
|
||||
--- a/src/timedate/timedated.c
|
||||
+++ b/src/timedate/timedated.c
|
||||
@@ -180,145 +180,211 @@ static int context_write_data_local_rtc(Context *c) {
|
|
@ -1,26 +0,0 @@
|
|||
From 413f6df864083130a380b2f7adbb5aa970139fe7 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 20 Aug 2014 11:25:23 +0200
|
||||
Subject: [PATCH] build: remove repeated KMOD section
|
||||
|
||||
---
|
||||
src/core/build.h | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/src/core/build.h b/src/core/build.h
|
||||
index d380382aba..a7f12a33e4 100644
|
||||
--- a/src/core/build.h
|
||||
+++ b/src/core/build.h
|
||||
@@ -123,12 +123,6 @@
|
||||
#define _KMOD_FEATURE_ "-KMOD"
|
||||
#endif
|
||||
|
||||
-#ifdef HAVE_KMOD
|
||||
-#define _KMOD_FEATURE_ "+KMOD"
|
||||
-#else
|
||||
-#define _KMOD_FEATURE_ "-KMOD"
|
||||
-#endif
|
||||
-
|
||||
#ifdef HAVE_LIBIDN
|
||||
#define _IDN_FEATURE_ "+IDN"
|
||||
#else
|
|
@ -0,0 +1,41 @@
|
|||
From 4ff1c91a85b2f4a546dbb2d5afc40b7c3c06e49e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 09:42:01 -0500
|
||||
Subject: [PATCH] Revert "sysctl.d: default to fq_codel, fight bufferbloat"
|
||||
|
||||
This reverts commit e6c253e363dee77ef7e5c5f44c4ca55cded3fd47.
|
||||
|
||||
Conflicts:
|
||||
NEWS
|
||||
---
|
||||
NEWS | 2 ++
|
||||
sysctl.d/50-default.conf | 3 ---
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 078fabb1e5..c3d28a6394 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -100,6 +100,8 @@ CHANGES WITH 217:
|
||||
servers that do not do forwarding, "fq" may perform better.
|
||||
Systems without a good clocksource should use "pfifo_fast".
|
||||
|
||||
+ [ reverted in this branch ]
|
||||
+
|
||||
* If kdbus is enabled during build a new option BusPolicy= is
|
||||
available for service units, that allows locking all service
|
||||
processes into a stricter bus policy, in order to limit
|
||||
diff --git a/sysctl.d/50-default.conf b/sysctl.d/50-default.conf
|
||||
index f18923399b..8fc9ab77a9 100644
|
||||
--- a/sysctl.d/50-default.conf
|
||||
+++ b/sysctl.d/50-default.conf
|
||||
@@ -25,9 +25,6 @@ net.ipv4.conf.all.accept_source_route = 0
|
||||
net.ipv4.conf.default.promote_secondaries = 1
|
||||
net.ipv4.conf.all.promote_secondaries = 1
|
||||
|
||||
-# Fair Queue CoDel packet scheduler to fight bufferbloat
|
||||
-net.core.default_qdisc = fq_codel
|
||||
-
|
||||
# Enable hard and soft link protection
|
||||
fs.protected_hardlinks = 1
|
||||
fs.protected_symlinks = 1
|
|
@ -1,120 +0,0 @@
|
|||
From 5dd6d0f8ff1681fff9369e0aa2532979954dbfde Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 20 Aug 2014 13:49:39 +0200
|
||||
Subject: [PATCH] machine-id-setup: don't try to read UUID from VM/container
|
||||
manager if we operate on a root directory that's not /
|
||||
|
||||
This should make sure no UUID from the host systemd-machine-id-setup is
|
||||
running on leaks onto a disk image that is provisioned with the tool.
|
||||
---
|
||||
src/core/machine-id-setup.c | 79 +++++++++++++++++++++++----------------------
|
||||
1 file changed, 41 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
|
||||
index 712f60cb11..efb074fcbd 100644
|
||||
--- a/src/core/machine-id-setup.c
|
||||
+++ b/src/core/machine-id-setup.c
|
||||
@@ -64,15 +64,16 @@ static int generate(char id[34], const char *root) {
|
||||
int fd, r;
|
||||
unsigned char *p;
|
||||
sd_id128_t buf;
|
||||
- char *q;
|
||||
+ char *q;
|
||||
ssize_t k;
|
||||
- const char *vm_id;
|
||||
- _cleanup_free_ char *dbus_machine_id = NULL;
|
||||
+ const char *vm_id, *dbus_machine_id;
|
||||
|
||||
assert(id);
|
||||
|
||||
- if (asprintf(&dbus_machine_id, "%s/var/lib/dbus/machine-id", root) < 0)
|
||||
- return log_oom();
|
||||
+ if (isempty(root))
|
||||
+ dbus_machine_id = "/var/lib/dbus/machine-id";
|
||||
+ else
|
||||
+ dbus_machine_id = strappenda(root, "/var/lib/dbus/machine-id");
|
||||
|
||||
/* First, try reading the D-Bus machine id, unless it is a symlink */
|
||||
fd = open(dbus_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
@@ -93,46 +94,48 @@ static int generate(char id[34], const char *root) {
|
||||
}
|
||||
}
|
||||
|
||||
- /* If that didn't work, see if we are running in a container,
|
||||
- * and a machine ID was passed in via $container_uuid the way
|
||||
- * libvirt/LXC does it */
|
||||
- r = detect_container(NULL);
|
||||
- if (r > 0) {
|
||||
- _cleanup_free_ char *e = NULL;
|
||||
-
|
||||
- r = getenv_for_pid(1, "container_uuid", &e);
|
||||
+ if (isempty(root)) {
|
||||
+ /* If that didn't work, see if we are running in a container,
|
||||
+ * and a machine ID was passed in via $container_uuid the way
|
||||
+ * libvirt/LXC does it */
|
||||
+ r = detect_container(NULL);
|
||||
if (r > 0) {
|
||||
- if (strlen(e) >= 36) {
|
||||
- r = shorten_uuid(id, e);
|
||||
- if (r >= 0) {
|
||||
- log_info("Initializing machine ID from container UUID.");
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- } else {
|
||||
- /* If we are not running in a container, see if we are
|
||||
- * running in qemu/kvm and a machine ID was passed in
|
||||
- * via -uuid on the qemu/kvm command line */
|
||||
+ _cleanup_free_ char *e = NULL;
|
||||
|
||||
- r = detect_vm(&vm_id);
|
||||
- if (r > 0 && streq(vm_id, "kvm")) {
|
||||
- char uuid[37];
|
||||
-
|
||||
- fd = open("/sys/class/dmi/id/product_uuid", O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
- if (fd >= 0) {
|
||||
- k = loop_read(fd, uuid, 36, false);
|
||||
- safe_close(fd);
|
||||
-
|
||||
- if (k >= 36) {
|
||||
- r = shorten_uuid(id, uuid);
|
||||
+ r = getenv_for_pid(1, "container_uuid", &e);
|
||||
+ if (r > 0) {
|
||||
+ if (strlen(e) >= 36) {
|
||||
+ r = shorten_uuid(id, e);
|
||||
if (r >= 0) {
|
||||
- log_info("Initializing machine ID from KVM UUID.");
|
||||
+ log_info("Initializing machine ID from container UUID.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ } else {
|
||||
+ /* If we are not running in a container, see if we are
|
||||
+ * running in qemu/kvm and a machine ID was passed in
|
||||
+ * via -uuid on the qemu/kvm command line */
|
||||
+
|
||||
+ r = detect_vm(&vm_id);
|
||||
+ if (r > 0 && streq(vm_id, "kvm")) {
|
||||
+ char uuid[37];
|
||||
+
|
||||
+ fd = open("/sys/class/dmi/id/product_uuid", O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
+ if (fd >= 0) {
|
||||
+ k = loop_read(fd, uuid, 36, false);
|
||||
+ safe_close(fd);
|
||||
+
|
||||
+ if (k >= 36) {
|
||||
+ r = shorten_uuid(id, uuid);
|
||||
+ if (r >= 0) {
|
||||
+ log_info("Initializing machine ID from KVM UUID.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From 38d3bea29a7c19a5f41d347b7658fa058c56a942 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 10:02:41 -0500
|
||||
Subject: [PATCH] Revert "units: define appropriate job timeout actions when
|
||||
boot or shutdown timeouts are hit"
|
||||
|
||||
This reverts commit 3898b80d409ae16b049d46f883bf763417bb4c8a.
|
||||
|
||||
We have various jobs that run during early boot and might cause
|
||||
basic.target not to be reached within 15 minutes. E.g. Fedora has
|
||||
fedora-autorelabel.service, which can take an arbitrarily long time on
|
||||
a large and slow drive.
|
||||
---
|
||||
units/basic.target | 2 --
|
||||
units/poweroff.target | 2 --
|
||||
units/reboot.target | 2 --
|
||||
3 files changed, 6 deletions(-)
|
||||
|
||||
diff --git a/units/basic.target b/units/basic.target
|
||||
index 228f62c4b1..b890d48bbc 100644
|
||||
--- a/units/basic.target
|
||||
+++ b/units/basic.target
|
||||
@@ -11,5 +11,3 @@ Documentation=man:systemd.special(7)
|
||||
Requires=sysinit.target
|
||||
Wants=sockets.target timers.target paths.target slices.target
|
||||
After=sysinit.target sockets.target timers.target paths.target slices.target
|
||||
-JobTimeoutSec=15min
|
||||
-JobTimeoutAction=poweroff-force
|
||||
diff --git a/units/poweroff.target b/units/poweroff.target
|
||||
index dd92d816ca..71871033a5 100644
|
||||
--- a/units/poweroff.target
|
||||
+++ b/units/poweroff.target
|
||||
@@ -12,8 +12,6 @@ DefaultDependencies=no
|
||||
Requires=systemd-poweroff.service
|
||||
After=systemd-poweroff.service
|
||||
AllowIsolate=yes
|
||||
-JobTimeoutSec=30min
|
||||
-JobTimeoutAction=poweroff-force
|
||||
|
||||
[Install]
|
||||
Alias=ctrl-alt-del.target
|
||||
diff --git a/units/reboot.target b/units/reboot.target
|
||||
index 668b98d9e4..dec8f56796 100644
|
||||
--- a/units/reboot.target
|
||||
+++ b/units/reboot.target
|
||||
@@ -12,8 +12,6 @@ DefaultDependencies=no
|
||||
Requires=systemd-reboot.service
|
||||
After=systemd-reboot.service
|
||||
AllowIsolate=yes
|
||||
-JobTimeoutSec=30min
|
||||
-JobTimeoutAction=reboot-force
|
||||
|
||||
[Install]
|
||||
Alias=ctrl-alt-del.target
|
|
@ -1,36 +0,0 @@
|
|||
From 03664a62914782dbd8f069bbcf8a0c8ca1df7010 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Wed, 20 Aug 2014 14:34:23 +0200
|
||||
Subject: [PATCH] resolved-dns-rr: fix typo
|
||||
|
||||
a->rrsig.type_covered != a->rrsig.type_covered" is always false
|
||||
regardless of the values of its operands because those operands are identical.
|
||||
---
|
||||
src/resolve/resolved-dns-rr.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c
|
||||
index c792deda47..c5f7cb931e 100644
|
||||
--- a/src/resolve/resolved-dns-rr.c
|
||||
+++ b/src/resolve/resolved-dns-rr.c
|
||||
@@ -425,13 +425,13 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor
|
||||
|
||||
case DNS_TYPE_RRSIG:
|
||||
/* do the fast comparisons first */
|
||||
- if (a->rrsig.type_covered != a->rrsig.type_covered ||
|
||||
- a->rrsig.algorithm != a->rrsig.algorithm ||
|
||||
- a->rrsig.labels != a->rrsig.labels ||
|
||||
- a->rrsig.original_ttl != a->rrsig.original_ttl ||
|
||||
- a->rrsig.expiration != a->rrsig.expiration ||
|
||||
- a->rrsig.inception != a->rrsig.inception ||
|
||||
- a->rrsig.key_tag != a->rrsig.key_tag ||
|
||||
+ if (a->rrsig.type_covered != b->rrsig.type_covered ||
|
||||
+ a->rrsig.algorithm != b->rrsig.algorithm ||
|
||||
+ a->rrsig.labels != b->rrsig.labels ||
|
||||
+ a->rrsig.original_ttl != b->rrsig.original_ttl ||
|
||||
+ a->rrsig.expiration != b->rrsig.expiration ||
|
||||
+ a->rrsig.inception != b->rrsig.inception ||
|
||||
+ a->rrsig.key_tag != b->rrsig.key_tag ||
|
||||
a->rrsig.signature_size != b->rrsig.signature_size ||
|
||||
memcmp(a->rrsig.signature, b->rrsig.signature, a->rrsig.signature_size) != 0)
|
||||
return false;
|
|
@ -0,0 +1,38 @@
|
|||
From e6407f548fcf093e1553c809036db0594d296a45 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 10:03:49 -0500
|
||||
Subject: [PATCH] Revert "Update NEWS"
|
||||
|
||||
This reverts commit 4ffd29fda1a2621d8f1711ccaad723d327fef93a.
|
||||
---
|
||||
NEWS | 17 -----------------
|
||||
1 file changed, 17 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index c3d28a6394..a590b3101b 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -22,23 +22,6 @@ CHANGES WITH 217:
|
||||
/run/systemd/user directory that was already previously
|
||||
supported, but is under the control of the user.
|
||||
|
||||
- * Job timeouts (i.e. time-outs on the time a job that is
|
||||
- queued stays in the run queue) can now optionally result in
|
||||
- immediate reboot or power-off actions (JobTimeoutAction= and
|
||||
- JobTimeoutRebootArgument=). This is useful on ".target"
|
||||
- units, to limit the maximum time a target remains
|
||||
- undispatched in the run queue, and to trigger an emergency
|
||||
- operation in such a case. This is now used by default to
|
||||
- turn off the system if boot-up (as defined by everything in
|
||||
- basic.target) hangs and does not complete for at least
|
||||
- 15min. Also, if power-off or reboot hang for at least 30min
|
||||
- an immediate power-off/reboot operation is triggered. This
|
||||
- functionality is particularly useful to increase reliability
|
||||
- on embedded devices, but also on laptops which might
|
||||
- accidentally get powered on when carried in a backpack and
|
||||
- whose boot stays stuck in a hard disk encryption passphrase
|
||||
- question.
|
||||
-
|
||||
* systemd-logind can be configured to also handle lid switch
|
||||
events even when the machine is docked or multiple displays
|
||||
are attached (HandleLidSwitchDocked= option).
|
|
@ -1,25 +0,0 @@
|
|||
From be754d5443e5fe44ead733ad509b127409cdb0f0 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 20 Aug 2014 14:47:35 +0200
|
||||
Subject: [PATCH] resolved: fix which return codes we check
|
||||
|
||||
Discovered by Lukas Nykryn
|
||||
---
|
||||
src/resolve/resolved-dns-domain.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/resolve/resolved-dns-domain.c b/src/resolve/resolved-dns-domain.c
|
||||
index 6152047ecb..8ed1ecf0a4 100644
|
||||
--- a/src/resolve/resolved-dns-domain.c
|
||||
+++ b/src/resolve/resolved-dns-domain.c
|
||||
@@ -434,8 +434,8 @@ int dns_name_endswith(const char *name, const char *suffix) {
|
||||
saved_n = n;
|
||||
|
||||
q = dns_label_unescape(&s, ls, sizeof(ls));
|
||||
- if (r < 0)
|
||||
- return r;
|
||||
+ if (q < 0)
|
||||
+ return q;
|
||||
w = dns_label_undo_idna(ls, q, ls, sizeof(ls));
|
||||
if (w < 0)
|
||||
return w;
|
|
@ -0,0 +1,227 @@
|
|||
From 6dea3619b5493cfdd9f973cb5346ea252ad75c01 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 10:05:51 -0500
|
||||
Subject: [PATCH] Revert "login: remove multi-seat-x"
|
||||
|
||||
This reverts commit 3769415e6573da64fb80e31f4bb3f850cd99031e.
|
||||
|
||||
Conflicts:
|
||||
NEWS
|
||||
---
|
||||
.gitignore | 1 +
|
||||
Makefile.am | 14 ++++++
|
||||
NEWS | 6 ---
|
||||
TODO | 2 +
|
||||
configure.ac | 9 ++++
|
||||
src/login/multi-seat-x.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
6 files changed, 134 insertions(+), 6 deletions(-)
|
||||
create mode 100644 src/login/multi-seat-x.c
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 0b71f0973b..f119b574c7 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -93,6 +93,7 @@
|
||||
/systemd-machined
|
||||
/systemd-modeset
|
||||
/systemd-modules-load
|
||||
+/systemd-multi-seat-x
|
||||
/systemd-networkd
|
||||
/systemd-networkd-wait-online
|
||||
/systemd-notify
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 3509665176..11a3033253 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -5461,6 +5461,20 @@ SYSTEM_UNIT_ALIASES += \
|
||||
BUSNAMES_TARGET_WANTS += \
|
||||
org.freedesktop.login1.busname
|
||||
|
||||
+if ENABLE_MULTI_SEAT_X
|
||||
+
|
||||
+systemd_multi_seat_x_SOURCES = \
|
||||
+ src/login/multi-seat-x.c
|
||||
+
|
||||
+systemd_multi_seat_x_LDADD = \
|
||||
+ libsystemd-label.la \
|
||||
+ libsystemd-shared.la
|
||||
+
|
||||
+rootlibexec_PROGRAMS += \
|
||||
+ systemd-multi-seat-x
|
||||
+
|
||||
+endif
|
||||
+
|
||||
dist_udevrules_DATA += \
|
||||
src/login/70-uaccess.rules \
|
||||
src/login/70-power-switch.rules
|
||||
diff --git a/NEWS b/NEWS
|
||||
index a590b3101b..c85605f1d6 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -127,12 +127,6 @@ CHANGES WITH 217:
|
||||
occur. Again: you need to update util-linux to at least
|
||||
v2.25 when updating systemd to v217.
|
||||
|
||||
- * The "multi-seat-x" tool has been removed from systemd, as
|
||||
- its functionality has been integrated into X servers 1.16,
|
||||
- and the tool is hence redundant. It is recommended to update
|
||||
- display managers invoking this tool to simply invoke X
|
||||
- directly from now on, again.
|
||||
-
|
||||
* Support for the new ALLOW_INTERACTIVE_AUTHORIZATION D-Bus
|
||||
message flag has been added for all of systemd's PolicyKit
|
||||
authenticated method calls has been added. In particular
|
||||
diff --git a/TODO b/TODO
|
||||
index b07d664715..64b24c18a7 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -88,6 +88,8 @@ Features:
|
||||
|
||||
* maybe introduce AssertXYZ= similar to ConditionXYZ= that causes a unit to fail (instead of skipping it) if some condition is not true...
|
||||
|
||||
+* remove multi-seat-x now
|
||||
+
|
||||
* refcounting in sd-resolve is borked
|
||||
|
||||
* exponential backoff in timesyncd and resolved when we cannot reach a server
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 48e094cd80..e63d3dc809 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1071,6 +1071,14 @@ fi
|
||||
AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
+have_multi_seat_x=no
|
||||
+AC_ARG_ENABLE(multi_seat_x, AS_HELP_STRING([--disable-multi-seat-x], [do not build multi-seat-x]))
|
||||
+if test "x$enable_multi_seat_x" != "xno"; then
|
||||
+ have_multi_seat_x=yes
|
||||
+fi
|
||||
+AM_CONDITIONAL(ENABLE_MULTI_SEAT_X, [test "$have_multi_seat_x" = "yes"])
|
||||
+
|
||||
+# ------------------------------------------------------------------------------
|
||||
have_terminal=no
|
||||
AC_ARG_ENABLE(terminal, AS_HELP_STRING([--enable-terminal], [enable terminal support]))
|
||||
if test "x$enable_terminal" = "xyes"; then
|
||||
@@ -1379,6 +1387,7 @@ AC_MSG_RESULT([
|
||||
nss-myhostname: ${have_myhostname}
|
||||
gudev: ${enable_gudev}
|
||||
gintrospection: ${enable_introspection}
|
||||
+ multi-seat-x: ${have_multi_seat_x}
|
||||
terminal: ${have_terminal}
|
||||
kdbus: ${have_kdbus}
|
||||
Python: ${have_python}
|
||||
diff --git a/src/login/multi-seat-x.c b/src/login/multi-seat-x.c
|
||||
new file mode 100644
|
||||
index 0000000000..83760d4191
|
||||
--- /dev/null
|
||||
+++ b/src/login/multi-seat-x.c
|
||||
@@ -0,0 +1,108 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2011 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 <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#include "util.h"
|
||||
+#include "mkdir.h"
|
||||
+
|
||||
+int main(int argc, char *argv[]) {
|
||||
+
|
||||
+ int i;
|
||||
+ const char *seat = NULL;
|
||||
+ char **new_argv;
|
||||
+ _cleanup_free_ char *path = NULL;
|
||||
+ int r;
|
||||
+ _cleanup_fclose_ FILE *f = NULL;
|
||||
+
|
||||
+ /* This binary will go away as soon as X natively takes the
|
||||
+ * arguments in question as command line parameters, instead
|
||||
+ * of requiring them in the configuration file. */
|
||||
+
|
||||
+ /* If this file is removed, don't forget to remove the code
|
||||
+ * that invokes this in gdm and other display managers. */
|
||||
+
|
||||
+ for (i = 1; i < argc; i++)
|
||||
+ if (streq(argv[i], "-seat"))
|
||||
+ seat = argv[i+1];
|
||||
+
|
||||
+ if (isempty(seat) || streq(seat, "seat0")) {
|
||||
+ argv[0] = (char*) X_SERVER;
|
||||
+ execv(X_SERVER, argv);
|
||||
+ log_error("Failed to execute real X server: %m");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ r = mkdir_safe_label("/run/systemd/multi-session-x", 0755, 0, 0);
|
||||
+ if (r < 0) {
|
||||
+ log_error("Failed to create directory: %s", strerror(-r));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ path = strappend("/run/systemd/multi-session-x/", seat);
|
||||
+ if (!path) {
|
||||
+ log_oom();
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ f = fopen(path, "we");
|
||||
+ if (!f) {
|
||||
+ log_error("Failed to write configuration file: %m");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ fprintf(f,
|
||||
+ "Section \"ServerFlags\"\n"
|
||||
+ " Option \"AutoAddDevices\" \"True\"\n"
|
||||
+ " Option \"AllowEmptyInput\" \"True\"\n"
|
||||
+ " Option \"DontVTSwitch\" \"True\"\n"
|
||||
+ "EndSection\n"
|
||||
+ "Section \"InputClass\"\n"
|
||||
+ " Identifier \"Force Input Devices to Seat\"\n"
|
||||
+ " Option \"GrabDevice\" \"True\"\n"
|
||||
+ "EndSection\n");
|
||||
+
|
||||
+ fflush(f);
|
||||
+
|
||||
+ if (ferror(f)) {
|
||||
+ log_error("Failed to write configuration file: %m");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ fclose(f);
|
||||
+ f = NULL;
|
||||
+
|
||||
+ new_argv = newa(char*, argc + 3 + 1);
|
||||
+ memcpy(new_argv, argv, sizeof(char*) * (argc + 2 + 1));
|
||||
+
|
||||
+ new_argv[0] = (char*) X_SERVER;
|
||||
+ new_argv[argc+0] = (char*) "-config";
|
||||
+ new_argv[argc+1] = path;
|
||||
+ new_argv[argc+2] = (char*) "-sharevts";
|
||||
+ new_argv[argc+3] = NULL;
|
||||
+
|
||||
+ execv(X_SERVER, new_argv);
|
||||
+ log_error("Failed to execute real X server: %m");
|
||||
+
|
||||
+fail:
|
||||
+ return EXIT_FAILURE;
|
||||
+}
|
|
@ -1,21 +0,0 @@
|
|||
From 7a855149eaf6dbd336d9defab5b4a9c70b75d5e6 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Wed, 20 Aug 2014 14:51:27 +0200
|
||||
Subject: [PATCH] journal-remote: remove unreachable code
|
||||
|
||||
---
|
||||
src/journal-remote/journal-remote.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
|
||||
index aa659d1bd4..7f422bfb37 100644
|
||||
--- a/src/journal-remote/journal-remote.c
|
||||
+++ b/src/journal-remote/journal-remote.c
|
||||
@@ -579,7 +579,6 @@ static int request_handler(
|
||||
log_error("MHD_get_connection_info failed: cannot get remote fd");
|
||||
return mhd_respond(connection, MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||
"Cannot check remote address");
|
||||
- return code;
|
||||
}
|
||||
|
||||
fd = ci->connect_fd;
|
|
@ -0,0 +1,22 @@
|
|||
From 7339a21496c9dd0d3a1fee24172843a522f0bb16 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 10:24:58 -0500
|
||||
Subject: [PATCH] Revert "service: add missing state table entry"
|
||||
|
||||
This reverts commit 1378a3b5a10444e6c9a17084c65032b4e1061c8e.
|
||||
---
|
||||
src/core/service.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index f27e63eb9a..2b16778731 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -2830,7 +2830,6 @@ static const char* const service_state_table[_SERVICE_STATE_MAX] = {
|
||||
[SERVICE_EXITED] = "exited",
|
||||
[SERVICE_RELOAD] = "reload",
|
||||
[SERVICE_STOP] = "stop",
|
||||
- [SERVICE_STOP_SIGABRT] = "stop-sigabrt",
|
||||
[SERVICE_STOP_SIGTERM] = "stop-sigterm",
|
||||
[SERVICE_STOP_SIGKILL] = "stop-sigkill",
|
||||
[SERVICE_STOP_POST] = "stop-post",
|
|
@ -1,27 +0,0 @@
|
|||
From 081e009bef5a09c986bfabdf46e96810afaed1c3 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Wed, 20 Aug 2014 15:02:09 +0200
|
||||
Subject: [PATCH] util: return after freeing all members of array
|
||||
|
||||
---
|
||||
src/shared/util.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index 85a570a2a4..9d254e0464 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -7113,10 +7113,10 @@ int unquote_many_words(const char **p, ...) {
|
||||
if (r < 0) {
|
||||
int j;
|
||||
|
||||
- for (j = 0; j < c; j++) {
|
||||
+ for (j = 0; j < c; j++)
|
||||
free(l[j]);
|
||||
- return r;
|
||||
- }
|
||||
+
|
||||
+ return r;
|
||||
}
|
||||
|
||||
if (r == 0)
|
|
@ -0,0 +1,397 @@
|
|||
From ca1cf37d559b7b155c48285ef9d090ac86f9a965 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 10:25:06 -0500
|
||||
Subject: [PATCH] Revert "core: send sigabrt on watchdog timeout to get the
|
||||
stacktrace"
|
||||
|
||||
This reverts commit db2cb23b5b179707000d28a11efb3d888d06ee80.
|
||||
---
|
||||
TODO | 2 ++
|
||||
man/systemd.service.xml | 5 ++---
|
||||
src/core/busname.c | 2 +-
|
||||
src/core/mount.c | 3 +--
|
||||
src/core/scope.c | 2 +-
|
||||
src/core/service.c | 37 +++++++++++--------------------------
|
||||
src/core/service.h | 1 -
|
||||
src/core/socket.c | 3 +--
|
||||
src/core/swap.c | 3 +--
|
||||
src/core/unit.c | 24 ++++++------------------
|
||||
src/core/unit.h | 8 +-------
|
||||
11 files changed, 27 insertions(+), 63 deletions(-)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index 64b24c18a7..68506671fa 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -48,6 +48,8 @@ Features:
|
||||
|
||||
* consider showing the unit names during boot up in the status output, not just the unit descriptions
|
||||
|
||||
+* send SIGABRT when a service watchdog is triggered, by default, so that we acquire a backtrace of the hang.
|
||||
+
|
||||
* dhcp: do we allow configuring dhcp routes on interfaces that are not the one we got the dhcp info from?
|
||||
|
||||
* maybe allow timer units with an empty Units= setting, so that they
|
||||
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
|
||||
index e563b1968b..115d1692ed 100644
|
||||
--- a/man/systemd.service.xml
|
||||
+++ b/man/systemd.service.xml
|
||||
@@ -593,9 +593,8 @@
|
||||
(i.e. the "keep-alive ping"). If the time
|
||||
between two such calls is larger than
|
||||
the configured time, then the service
|
||||
- is placed in a failed state and it will
|
||||
- be terminated with <varname>SIGABRT</varname>.
|
||||
- By setting <varname>Restart=</varname> to
|
||||
+ is placed in a failed state. By
|
||||
+ setting <varname>Restart=</varname> to
|
||||
<option>on-failure</option> or
|
||||
<option>always</option>, the service
|
||||
will be automatically restarted. The
|
||||
diff --git a/src/core/busname.c b/src/core/busname.c
|
||||
index 68cb6ca7b7..22d2a6d24b 100644
|
||||
--- a/src/core/busname.c
|
||||
+++ b/src/core/busname.c
|
||||
@@ -446,7 +446,7 @@ static void busname_enter_signal(BusName *n, BusNameState state, BusNameResult f
|
||||
|
||||
r = unit_kill_context(UNIT(n),
|
||||
&kill_context,
|
||||
- state != BUSNAME_SIGTERM ? KILL_KILL : KILL_TERMINATE,
|
||||
+ state != BUSNAME_SIGTERM,
|
||||
-1,
|
||||
n->control_pid,
|
||||
false);
|
||||
diff --git a/src/core/mount.c b/src/core/mount.c
|
||||
index 01243c381a..e284357c6f 100644
|
||||
--- a/src/core/mount.c
|
||||
+++ b/src/core/mount.c
|
||||
@@ -775,8 +775,7 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
|
||||
r = unit_kill_context(
|
||||
UNIT(m),
|
||||
&m->kill_context,
|
||||
- (state != MOUNT_MOUNTING_SIGTERM && state != MOUNT_UNMOUNTING_SIGTERM && state != MOUNT_REMOUNTING_SIGTERM) ?
|
||||
- KILL_KILL : KILL_TERMINATE,
|
||||
+ state != MOUNT_MOUNTING_SIGTERM && state != MOUNT_UNMOUNTING_SIGTERM && state != MOUNT_REMOUNTING_SIGTERM,
|
||||
-1,
|
||||
m->control_pid,
|
||||
false);
|
||||
diff --git a/src/core/scope.c b/src/core/scope.c
|
||||
index 0f7c1f97ce..e8f9e8dd73 100644
|
||||
--- a/src/core/scope.c
|
||||
+++ b/src/core/scope.c
|
||||
@@ -243,7 +243,7 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
|
||||
r = unit_kill_context(
|
||||
UNIT(s),
|
||||
&s->kill_context,
|
||||
- state != SCOPE_STOP_SIGTERM ? KILL_KILL : KILL_TERMINATE,
|
||||
+ state != SCOPE_STOP_SIGTERM,
|
||||
-1, -1, false);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 2b16778731..d160c4e93b 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -56,7 +56,6 @@ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
|
||||
[SERVICE_EXITED] = UNIT_ACTIVE,
|
||||
[SERVICE_RELOAD] = UNIT_RELOADING,
|
||||
[SERVICE_STOP] = UNIT_DEACTIVATING,
|
||||
- [SERVICE_STOP_SIGABRT] = UNIT_DEACTIVATING,
|
||||
[SERVICE_STOP_SIGTERM] = UNIT_DEACTIVATING,
|
||||
[SERVICE_STOP_SIGKILL] = UNIT_DEACTIVATING,
|
||||
[SERVICE_STOP_POST] = UNIT_DEACTIVATING,
|
||||
@@ -77,7 +76,6 @@ static const UnitActiveState state_translation_table_idle[_SERVICE_STATE_MAX] =
|
||||
[SERVICE_EXITED] = UNIT_ACTIVE,
|
||||
[SERVICE_RELOAD] = UNIT_RELOADING,
|
||||
[SERVICE_STOP] = UNIT_DEACTIVATING,
|
||||
- [SERVICE_STOP_SIGABRT] = UNIT_DEACTIVATING,
|
||||
[SERVICE_STOP_SIGTERM] = UNIT_DEACTIVATING,
|
||||
[SERVICE_STOP_SIGKILL] = UNIT_DEACTIVATING,
|
||||
[SERVICE_STOP_POST] = UNIT_DEACTIVATING,
|
||||
@@ -665,7 +663,7 @@ static void service_set_state(Service *s, ServiceState state) {
|
||||
SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_STOP_POST,
|
||||
+ SERVICE_STOP_POST,
|
||||
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL,
|
||||
SERVICE_AUTO_RESTART))
|
||||
s->timer_event_source = sd_event_source_unref(s->timer_event_source);
|
||||
@@ -674,7 +672,7 @@ static void service_set_state(Service *s, ServiceState state) {
|
||||
SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RUNNING, SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_STOP_POST,
|
||||
+ SERVICE_STOP_POST,
|
||||
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL)) {
|
||||
service_unwatch_main_pid(s);
|
||||
s->main_command = NULL;
|
||||
@@ -684,7 +682,7 @@ static void service_set_state(Service *s, ServiceState state) {
|
||||
SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_STOP_POST,
|
||||
+ SERVICE_STOP_POST,
|
||||
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL)) {
|
||||
service_unwatch_control_pid(s);
|
||||
s->control_command = NULL;
|
||||
@@ -698,7 +696,7 @@ static void service_set_state(Service *s, ServiceState state) {
|
||||
SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RUNNING, SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL, SERVICE_STOP_POST,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL) &&
|
||||
+ SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL) &&
|
||||
!(state == SERVICE_DEAD && UNIT(s)->job)) {
|
||||
service_close_socket_fd(s);
|
||||
service_connection_unref(s);
|
||||
@@ -752,7 +750,7 @@ static int service_coldplug(Unit *u) {
|
||||
SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_STOP_POST,
|
||||
+ SERVICE_STOP_POST,
|
||||
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL)) {
|
||||
|
||||
usec_t k;
|
||||
@@ -781,7 +779,7 @@ static int service_coldplug(Unit *u) {
|
||||
SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RUNNING, SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_STOP_POST,
|
||||
+ SERVICE_STOP_POST,
|
||||
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL))) {
|
||||
r = unit_watch_pid(UNIT(s), s->main_pid);
|
||||
if (r < 0)
|
||||
@@ -793,7 +791,7 @@ static int service_coldplug(Unit *u) {
|
||||
SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST,
|
||||
SERVICE_RELOAD,
|
||||
SERVICE_STOP, SERVICE_STOP_SIGTERM, SERVICE_STOP_SIGKILL,
|
||||
- SERVICE_STOP_SIGABRT, SERVICE_STOP_POST,
|
||||
+ SERVICE_STOP_POST,
|
||||
SERVICE_FINAL_SIGTERM, SERVICE_FINAL_SIGKILL)) {
|
||||
r = unit_watch_pid(UNIT(s), s->control_pid);
|
||||
if (r < 0)
|
||||
@@ -1183,8 +1181,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
|
||||
r = unit_kill_context(
|
||||
UNIT(s),
|
||||
&s->kill_context,
|
||||
- (state != SERVICE_STOP_SIGTERM && state != SERVICE_FINAL_SIGTERM && state != SERVICE_STOP_SIGABRT) ?
|
||||
- KILL_KILL : (state == SERVICE_STOP_SIGABRT ? KILL_ABORT : KILL_TERMINATE),
|
||||
+ state != SERVICE_STOP_SIGTERM && state != SERVICE_FINAL_SIGTERM,
|
||||
s->main_pid,
|
||||
s->control_pid,
|
||||
s->main_pid_alien);
|
||||
@@ -1200,7 +1197,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
|
||||
}
|
||||
|
||||
service_set_state(s, state);
|
||||
- } else if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGABRT)
|
||||
+ } else if (state == SERVICE_STOP_SIGTERM)
|
||||
service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_SUCCESS);
|
||||
else if (state == SERVICE_STOP_SIGKILL)
|
||||
service_enter_stop_post(s, SERVICE_SUCCESS);
|
||||
@@ -1214,8 +1211,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
|
||||
fail:
|
||||
log_warning_unit(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
|
||||
|
||||
- if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL ||
|
||||
- state == SERVICE_STOP_SIGABRT)
|
||||
+ if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
|
||||
service_enter_stop_post(s, SERVICE_FAILURE_RESOURCES);
|
||||
else
|
||||
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);
|
||||
@@ -1641,7 +1637,6 @@ static int service_start(Unit *u) {
|
||||
/* We cannot fulfill this request right now, try again later
|
||||
* please! */
|
||||
if (s->state == SERVICE_STOP ||
|
||||
- s->state == SERVICE_STOP_SIGABRT ||
|
||||
s->state == SERVICE_STOP_SIGTERM ||
|
||||
s->state == SERVICE_STOP_SIGKILL ||
|
||||
s->state == SERVICE_STOP_POST ||
|
||||
@@ -1700,7 +1695,6 @@ static int service_stop(Unit *u) {
|
||||
|
||||
/* Already on it */
|
||||
if (s->state == SERVICE_STOP ||
|
||||
- s->state == SERVICE_STOP_SIGABRT ||
|
||||
s->state == SERVICE_STOP_SIGTERM ||
|
||||
s->state == SERVICE_STOP_SIGKILL ||
|
||||
s->state == SERVICE_STOP_POST ||
|
||||
@@ -2132,7 +2126,6 @@ static void service_notify_cgroup_empty_event(Unit *u) {
|
||||
service_enter_running(s, SERVICE_SUCCESS);
|
||||
break;
|
||||
|
||||
- case SERVICE_STOP_SIGABRT:
|
||||
case SERVICE_STOP_SIGTERM:
|
||||
case SERVICE_STOP_SIGKILL:
|
||||
|
||||
@@ -2259,7 +2252,6 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
service_enter_running(s, f);
|
||||
break;
|
||||
|
||||
- case SERVICE_STOP_SIGABRT:
|
||||
case SERVICE_STOP_SIGTERM:
|
||||
case SERVICE_STOP_SIGKILL:
|
||||
|
||||
@@ -2400,7 +2392,6 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
service_enter_signal(s, SERVICE_STOP_SIGTERM, f);
|
||||
break;
|
||||
|
||||
- case SERVICE_STOP_SIGABRT:
|
||||
case SERVICE_STOP_SIGTERM:
|
||||
case SERVICE_STOP_SIGKILL:
|
||||
if (main_pid_good(s) <= 0)
|
||||
@@ -2470,12 +2461,6 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
||||
break;
|
||||
|
||||
- case SERVICE_STOP_SIGABRT:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stop-sigabrt timed out. Terminating.", UNIT(s)->id);
|
||||
- service_enter_signal(s, SERVICE_STOP_SIGTERM, s->result);
|
||||
- break;
|
||||
-
|
||||
case SERVICE_STOP_SIGTERM:
|
||||
if (s->kill_context.send_sigkill) {
|
||||
log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
|
||||
@@ -2543,7 +2528,7 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
|
||||
log_error_unit(UNIT(s)->id, "%s watchdog timeout (limit %s)!", UNIT(s)->id,
|
||||
format_timespan(t, sizeof(t), s->watchdog_usec, 1));
|
||||
|
||||
- service_enter_signal(s, SERVICE_STOP_SIGABRT, SERVICE_FAILURE_WATCHDOG);
|
||||
+ service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_WATCHDOG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/src/core/service.h b/src/core/service.h
|
||||
index 54fbe46fa4..0db0c4d64c 100644
|
||||
--- a/src/core/service.h
|
||||
+++ b/src/core/service.h
|
||||
@@ -39,7 +39,6 @@ typedef enum ServiceState {
|
||||
SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
|
||||
SERVICE_RELOAD,
|
||||
SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
|
||||
- SERVICE_STOP_SIGABRT, /* Watchdog timeout */
|
||||
SERVICE_STOP_SIGTERM,
|
||||
SERVICE_STOP_SIGKILL,
|
||||
SERVICE_STOP_POST,
|
||||
diff --git a/src/core/socket.c b/src/core/socket.c
|
||||
index 6ba8338d8b..9004cb42cf 100644
|
||||
--- a/src/core/socket.c
|
||||
+++ b/src/core/socket.c
|
||||
@@ -1578,8 +1578,7 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) {
|
||||
r = unit_kill_context(
|
||||
UNIT(s),
|
||||
&s->kill_context,
|
||||
- (state != SOCKET_STOP_PRE_SIGTERM && state != SOCKET_FINAL_SIGTERM) ?
|
||||
- KILL_KILL : KILL_TERMINATE,
|
||||
+ state != SOCKET_STOP_PRE_SIGTERM && state != SOCKET_FINAL_SIGTERM,
|
||||
-1,
|
||||
s->control_pid,
|
||||
false);
|
||||
diff --git a/src/core/swap.c b/src/core/swap.c
|
||||
index 1add722bf1..13e12ad67a 100644
|
||||
--- a/src/core/swap.c
|
||||
+++ b/src/core/swap.c
|
||||
@@ -687,8 +687,7 @@ static void swap_enter_signal(Swap *s, SwapState state, SwapResult f) {
|
||||
r = unit_kill_context(
|
||||
UNIT(s),
|
||||
&s->kill_context,
|
||||
- (state != SWAP_ACTIVATING_SIGTERM && state != SWAP_DEACTIVATING_SIGTERM) ?
|
||||
- KILL_KILL : KILL_TERMINATE,
|
||||
+ state != SWAP_ACTIVATING_SIGTERM && state != SWAP_DEACTIVATING_SIGTERM,
|
||||
-1,
|
||||
s->control_pid,
|
||||
false);
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||
index 84f210a312..489ea1e502 100644
|
||||
--- a/src/core/unit.c
|
||||
+++ b/src/core/unit.c
|
||||
@@ -3313,7 +3313,7 @@ int unit_make_transient(Unit *u) {
|
||||
int unit_kill_context(
|
||||
Unit *u,
|
||||
KillContext *c,
|
||||
- KillOperation k,
|
||||
+ bool sigkill,
|
||||
pid_t main_pid,
|
||||
pid_t control_pid,
|
||||
bool main_pid_alien) {
|
||||
@@ -3326,19 +3326,7 @@ int unit_kill_context(
|
||||
if (c->kill_mode == KILL_NONE)
|
||||
return 0;
|
||||
|
||||
- switch (k) {
|
||||
- case KILL_KILL:
|
||||
- sig = SIGKILL;
|
||||
- break;
|
||||
- case KILL_ABORT:
|
||||
- sig = SIGABRT;
|
||||
- break;
|
||||
- case KILL_TERMINATE:
|
||||
- sig = c->kill_signal;
|
||||
- break;
|
||||
- default:
|
||||
- assert_not_reached("KillOperation unknown");
|
||||
- }
|
||||
+ sig = sigkill ? SIGKILL : c->kill_signal;
|
||||
|
||||
if (main_pid > 0) {
|
||||
r = kill_and_sigcont(main_pid, sig);
|
||||
@@ -3352,7 +3340,7 @@ int unit_kill_context(
|
||||
if (!main_pid_alien)
|
||||
wait_for_exit = true;
|
||||
|
||||
- if (c->send_sighup && k != KILL_KILL)
|
||||
+ if (c->send_sighup && !sigkill)
|
||||
kill(main_pid, SIGHUP);
|
||||
}
|
||||
}
|
||||
@@ -3368,12 +3356,12 @@ int unit_kill_context(
|
||||
} else {
|
||||
wait_for_exit = true;
|
||||
|
||||
- if (c->send_sighup && k != KILL_KILL)
|
||||
+ if (c->send_sighup && !sigkill)
|
||||
kill(control_pid, SIGHUP);
|
||||
}
|
||||
}
|
||||
|
||||
- if ((c->kill_mode == KILL_CONTROL_GROUP || (c->kill_mode == KILL_MIXED && k == KILL_KILL)) && u->cgroup_path) {
|
||||
+ if ((c->kill_mode == KILL_CONTROL_GROUP || (c->kill_mode == KILL_MIXED && sigkill)) && u->cgroup_path) {
|
||||
_cleanup_set_free_ Set *pid_set = NULL;
|
||||
|
||||
/* Exclude the main/control pids from being killed via the cgroup */
|
||||
@@ -3397,7 +3385,7 @@ int unit_kill_context(
|
||||
|
||||
/* wait_for_exit = true; */
|
||||
|
||||
- if (c->send_sighup && k != KILL_KILL) {
|
||||
+ if (c->send_sighup && !sigkill) {
|
||||
set_free(pid_set);
|
||||
|
||||
pid_set = unit_pid_set(main_pid, control_pid);
|
||||
diff --git a/src/core/unit.h b/src/core/unit.h
|
||||
index 081ab18f10..bbad546356 100644
|
||||
--- a/src/core/unit.h
|
||||
+++ b/src/core/unit.h
|
||||
@@ -54,12 +54,6 @@ enum UnitActiveState {
|
||||
_UNIT_ACTIVE_STATE_INVALID = -1
|
||||
};
|
||||
|
||||
-typedef enum KillOperation {
|
||||
- KILL_TERMINATE,
|
||||
- KILL_KILL,
|
||||
- KILL_ABORT,
|
||||
-} KillOperation;
|
||||
-
|
||||
static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
|
||||
return t == UNIT_ACTIVE || t == UNIT_RELOADING;
|
||||
}
|
||||
@@ -582,7 +576,7 @@ int unit_write_drop_in_private_format(Unit *u, UnitSetPropertiesMode mode, const
|
||||
|
||||
int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name);
|
||||
|
||||
-int unit_kill_context(Unit *u, KillContext *c, KillOperation k, pid_t main_pid, pid_t control_pid, bool main_pid_alien);
|
||||
+int unit_kill_context(Unit *u, KillContext *c, bool sigkill, pid_t main_pid, pid_t control_pid, bool main_pid_alien);
|
||||
|
||||
int unit_make_transient(Unit *u);
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From e1ad6e245dcf63faa8f183063eb97678f4f9ac94 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Wed, 20 Aug 2014 15:13:06 +0200
|
||||
Subject: [PATCH] journal-upload: make sure that 'r' is initialized
|
||||
|
||||
---
|
||||
src/journal-remote/journal-upload.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
|
||||
index 7a7aee8170..bdeeff6778 100644
|
||||
--- a/src/journal-remote/journal-upload.c
|
||||
+++ b/src/journal-remote/journal-upload.c
|
||||
@@ -324,7 +324,7 @@ static int dispatch_fd_input(sd_event_source *event,
|
||||
}
|
||||
|
||||
static int open_file_for_upload(Uploader *u, const char *filename) {
|
||||
- int fd, r;
|
||||
+ int fd, r = 0;
|
||||
|
||||
if (streq(filename, "-"))
|
||||
fd = STDIN_FILENO;
|
|
@ -0,0 +1,23 @@
|
|||
From 04c7091101c04e0f7baf22980872e77af5ea4577 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 28 Oct 2014 20:36:32 +0100
|
||||
Subject: [PATCH] NEWS: well, it's Options= now, not Discard=
|
||||
|
||||
(cherry picked from commit c4ac990007cd0069bb7e76ec15dd731320f382fd)
|
||||
---
|
||||
NEWS | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index c85605f1d6..bf8d0ac242 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -59,7 +59,7 @@ CHANGES WITH 217:
|
||||
rotating media anymore, and nobody stepped up to actively
|
||||
maintain this component of systemd it has now been removed.
|
||||
|
||||
- * Swap units can use Discard= to specify discard options.
|
||||
+ * Swap units can use Options= to specify discard options.
|
||||
Discard options specified for swaps in /etc/fstab are now
|
||||
respected.
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
From a9feff3d774eaa1cc1b59189e8f344c01e69f888 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 20 Aug 2014 15:56:14 +0200
|
||||
Subject: [PATCH] resolved: write resolv.conf search - switch arguments
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Found by Lukáš Nykrýn.
|
||||
---
|
||||
src/resolve/resolved-manager.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
|
||||
index 04ee204074..56baf8730d 100644
|
||||
--- a/src/resolve/resolved-manager.c
|
||||
+++ b/src/resolve/resolved-manager.c
|
||||
@@ -699,7 +699,7 @@ static void write_resolv_conf_server(DnsServer *s, FILE *f, unsigned *count) {
|
||||
}
|
||||
|
||||
static void write_resolv_conf_search(const char *domain, FILE *f,
|
||||
- unsigned *length, unsigned *count) {
|
||||
+ unsigned *count, unsigned *length) {
|
||||
assert(domain);
|
||||
assert(f);
|
||||
assert(length);
|
|
@ -0,0 +1,23 @@
|
|||
From 719014b379714744760e5d65a599d100b397d548 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Wed, 29 Oct 2014 17:58:43 +0100
|
||||
Subject: [PATCH] sd-bus: properly handle removals of non-existing matches
|
||||
|
||||
(cherry picked from commit ef7b6c0190fefaacf6d8f8e1a6dda4ba8b98091b)
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-match.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c
|
||||
index 18afe0f12a..5658c61ba7 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-match.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-match.c
|
||||
@@ -537,7 +537,7 @@ static int bus_match_find_compare_value(
|
||||
else if (BUS_MATCH_CAN_HASH(t))
|
||||
n = hashmap_get(c->compare.children, value_str);
|
||||
else {
|
||||
- for (n = c->child; !value_node_same(n, t, value_u8, value_str); n = n->next)
|
||||
+ for (n = c->child; n && !value_node_same(n, t, value_u8, value_str); n = n->next)
|
||||
;
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
From 9b364545435d2b65fcf73519b3064bb7c28093b7 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Fri, 15 Aug 2014 21:04:07 +0200
|
||||
Subject: [PATCH] sd-event: add API to access epoll_fd
|
||||
|
||||
This is a prerequisite for integrating sd-event into an external
|
||||
event loop.
|
||||
---
|
||||
src/libsystemd/libsystemd.sym.m4 | 1 +
|
||||
src/libsystemd/sd-event/sd-event.c | 8 ++++++++
|
||||
src/systemd/sd-event.h | 1 +
|
||||
3 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym.m4
|
||||
index 415d89afbe..3fc9983f98 100644
|
||||
--- a/src/libsystemd/libsystemd.sym.m4
|
||||
+++ b/src/libsystemd/libsystemd.sym.m4
|
||||
@@ -374,6 +374,7 @@ global:
|
||||
sd_event_loop;
|
||||
sd_event_exit;
|
||||
sd_event_now;
|
||||
+ sd_event_get_fd;
|
||||
sd_event_get_state;
|
||||
sd_event_get_tid;
|
||||
sd_event_get_exit_code;
|
||||
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
||||
index 7917ab934a..e062997a80 100644
|
||||
--- a/src/libsystemd/sd-event/sd-event.c
|
||||
+++ b/src/libsystemd/sd-event/sd-event.c
|
||||
@@ -2361,6 +2361,14 @@ finish:
|
||||
return r;
|
||||
}
|
||||
|
||||
+_public_ int sd_event_get_fd(sd_event *e) {
|
||||
+
|
||||
+ assert_return(e, -EINVAL);
|
||||
+ assert_return(!event_pid_changed(e), -ECHILD);
|
||||
+
|
||||
+ return e->epoll_fd;
|
||||
+}
|
||||
+
|
||||
_public_ int sd_event_get_state(sd_event *e) {
|
||||
assert_return(e, -EINVAL);
|
||||
assert_return(!event_pid_changed(e), -ECHILD);
|
||||
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
|
||||
index 5d9b3be6c7..d96852a763 100644
|
||||
--- a/src/systemd/sd-event.h
|
||||
+++ b/src/systemd/sd-event.h
|
||||
@@ -90,6 +90,7 @@ int sd_event_exit(sd_event *e, int code);
|
||||
|
||||
int sd_event_now(sd_event *e, clockid_t clock, uint64_t *usec);
|
||||
|
||||
+int sd_event_get_fd(sd_event *e);
|
||||
int sd_event_get_state(sd_event *e);
|
||||
int sd_event_get_tid(sd_event *e, pid_t *tid);
|
||||
int sd_event_get_exit_code(sd_event *e, int *code);
|
|
@ -1,143 +0,0 @@
|
|||
From 730836403aee5f5bb998e6e3622ea7068fce0699 Mon Sep 17 00:00:00 2001
|
||||
From: Harald Hoyer <harald@redhat.com>
|
||||
Date: Tue, 19 Aug 2014 11:27:34 +0200
|
||||
Subject: [PATCH] journalctl: add "-t --identifier=STRING" option
|
||||
|
||||
This turns journalctl to the counterpart of systemd-cat.
|
||||
Messages sent with
|
||||
|
||||
systemd-cat --identifier foo --prioritiy debug
|
||||
|
||||
can now be shown with
|
||||
|
||||
journalctl --identifier foo --prioritiy debug
|
||||
|
||||
"--identifier" is not merged with "--unit" to make a clear
|
||||
distinction between syslog and systemd units.
|
||||
syslog identifiers can be chosen freely by anyone.
|
||||
---
|
||||
man/journalctl.xml | 14 ++++++++++++++
|
||||
src/journal/journalctl.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 56 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/man/journalctl.xml b/man/journalctl.xml
|
||||
index e10918a9c6..d4e031619a 100644
|
||||
--- a/man/journalctl.xml
|
||||
+++ b/man/journalctl.xml
|
||||
@@ -498,6 +498,20 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
+ <term><option>-t</option></term>
|
||||
+ <term><option>--identifier=<replaceable>SYSLOG_IDENTIFIER</replaceable>|<replaceable>PATTERN</replaceable></option></term>
|
||||
+
|
||||
+ <listitem><para>Show messages for the
|
||||
+ specified syslog identifier
|
||||
+ <replaceable>SYSLOG_IDENTIFIER</replaceable>, or
|
||||
+ for any of the messages with a <literal>SYSLOG_IDENTIFIER</literal>
|
||||
+ matched by <replaceable>PATTERN</replaceable>.</para>
|
||||
+
|
||||
+ <para>This parameter can be specified
|
||||
+ multiple times.</para></listitem>
|
||||
+ </varlistentry>
|
||||
+
|
||||
+ <varlistentry>
|
||||
<term><option>-u</option></term>
|
||||
<term><option>--unit=<replaceable>UNIT</replaceable>|<replaceable>PATTERN</replaceable></option></term>
|
||||
|
||||
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
|
||||
index 5c4a71d618..f3680d1ce2 100644
|
||||
--- a/src/journal/journalctl.c
|
||||
+++ b/src/journal/journalctl.c
|
||||
@@ -89,6 +89,7 @@ static bool arg_force = false;
|
||||
#endif
|
||||
static usec_t arg_since, arg_until;
|
||||
static bool arg_since_set = false, arg_until_set = false;
|
||||
+static char **arg_syslog_identifier = NULL;
|
||||
static char **arg_system_units = NULL;
|
||||
static char **arg_user_units = NULL;
|
||||
static const char *arg_field = NULL;
|
||||
@@ -180,6 +181,7 @@ static void help(void) {
|
||||
" -k --dmesg Show kernel message log from the current boot\n"
|
||||
" -u --unit=UNIT Show data only from the specified unit\n"
|
||||
" --user-unit=UNIT Show data only from the specified user session unit\n"
|
||||
+ " -t --identifier=STRING Show only messages with the specified syslog identifier\n"
|
||||
" -p --priority=RANGE Show only messages within the specified priority range\n"
|
||||
" -e --pager-end Immediately jump to end of the journal in the pager\n"
|
||||
" -f --follow Follow the journal\n"
|
||||
@@ -276,6 +278,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{ "file", required_argument, NULL, ARG_FILE },
|
||||
{ "root", required_argument, NULL, ARG_ROOT },
|
||||
{ "header", no_argument, NULL, ARG_HEADER },
|
||||
+ { "identifier", required_argument, NULL, 't' },
|
||||
{ "priority", required_argument, NULL, 'p' },
|
||||
{ "setup-keys", no_argument, NULL, ARG_SETUP_KEYS },
|
||||
{ "interval", required_argument, NULL, ARG_INTERVAL },
|
||||
@@ -304,7 +307,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
|
||||
- while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:c:u:F:xrM:", options, NULL)) >= 0)
|
||||
+ while ((c = getopt_long(argc, argv, "hefo:aln::qmb::kD:p:c:t:u:F:xrM:", options, NULL)) >= 0)
|
||||
|
||||
switch (c) {
|
||||
|
||||
@@ -590,6 +593,12 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
arg_until_set = true;
|
||||
break;
|
||||
|
||||
+ case 't':
|
||||
+ r = strv_extend(&arg_syslog_identifier, optarg);
|
||||
+ if (r < 0)
|
||||
+ return log_oom();
|
||||
+ break;
|
||||
+
|
||||
case 'u':
|
||||
r = strv_extend(&arg_system_units, optarg);
|
||||
if (r < 0)
|
||||
@@ -1212,6 +1221,32 @@ static int add_priorities(sd_journal *j) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+
|
||||
+static int add_syslog_identifier(sd_journal *j) {
|
||||
+ int r;
|
||||
+ char **i;
|
||||
+
|
||||
+ assert(j);
|
||||
+
|
||||
+ STRV_FOREACH(i, arg_syslog_identifier) {
|
||||
+ char *u;
|
||||
+
|
||||
+ u = strappenda("SYSLOG_IDENTIFIER=", *i);
|
||||
+ r = sd_journal_add_match(j, u, 0);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+ r = sd_journal_add_disjunction(j);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ r = sd_journal_add_conjunction(j);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int setup_keys(void) {
|
||||
#ifdef HAVE_GCRYPT
|
||||
size_t mpk_size, seed_size, state_size, i;
|
||||
@@ -1705,6 +1740,12 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
+ r = add_syslog_identifier(j);
|
||||
+ if (r < 0) {
|
||||
+ log_error("Failed to add filter for syslog identifiers: %s", strerror(-r));
|
||||
+ return EXIT_FAILURE;
|
||||
+ }
|
||||
+
|
||||
r = add_priorities(j);
|
||||
if (r < 0) {
|
||||
log_error("Failed to add filter for priorities: %s", strerror(-r));
|
|
@ -0,0 +1,32 @@
|
|||
From 0a54df09b797dfc1ffd076ea378d17db64623a78 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Reisner <dreisner@archlinux.org>
|
||||
Date: Wed, 29 Oct 2014 13:32:43 -0400
|
||||
Subject: [PATCH] nspawn: ignore EEXIST when creating mount point
|
||||
|
||||
A combination of commits f3c80515c and 79d80fc14 cause nspawn to
|
||||
silently fail with a commandline such as:
|
||||
|
||||
# systemd-nspawn -D /build/extra-x86_64 --bind=/usr
|
||||
|
||||
strace shows the culprit:
|
||||
|
||||
[pid 27868] writev(2, [{"Failed to create mount point /build/extra-x86_64/usr: File exists", 82}, {"\n", 1}], 2) = 83
|
||||
|
||||
(cherry picked from commit 1ab19cb167b32967556eefd8f6d3df0e3de7d67d)
|
||||
---
|
||||
src/nspawn/nspawn.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index b6d9bc631c..d88987a580 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -758,7 +758,7 @@ static int mount_binds(const char *dest, char **l, bool ro) {
|
||||
* and char devices. */
|
||||
if (S_ISDIR(source_st.st_mode)) {
|
||||
r = mkdir_label(where, 0755);
|
||||
- if (r < 0) {
|
||||
+ if (r < 0 && errno != EEXIST) {
|
||||
log_error("Failed to create mount point %s: %s", where, strerror(-r));
|
||||
|
||||
return r;
|
|
@ -1,24 +0,0 @@
|
|||
From 3fdbc8205885f117b7dea289b44217310663e731 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:10:37 +0200
|
||||
Subject: [PATCH] CODING_STYLE: document that we don't break lines at 80ch
|
||||
|
||||
---
|
||||
CODING_STYLE | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CODING_STYLE b/CODING_STYLE
|
||||
index ca3b5183f9..a3fc26c1e1 100644
|
||||
--- a/CODING_STYLE
|
||||
+++ b/CODING_STYLE
|
||||
@@ -1,6 +1,9 @@
|
||||
-
|
||||
- 8ch indent, no tabs
|
||||
|
||||
+- Don't break code lines too eagerly. We do *not* force line breaks at
|
||||
+ 80ch, all of today's screens should be much larger than that. But
|
||||
+ then again, don't overdo it, ~140ch should be enough really.
|
||||
+
|
||||
- Variables and functions *must* be static, unless they have a
|
||||
prototype, and are supposed to be exported.
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
From 220947cd72a4897fae2f90fd70d3a36db96cd9c9 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Thu, 30 Oct 2014 01:18:34 +0100
|
||||
Subject: [PATCH] udev: path_id - update comments
|
||||
|
||||
(cherry picked from commit a42cdff19f2d34f12ceca0f40707421a8aaa2c2f)
|
||||
---
|
||||
src/udev/udev-builtin-path_id.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
|
||||
index 0d247f6b5a..df996cb17a 100644
|
||||
--- a/src/udev/udev-builtin-path_id.c
|
||||
+++ b/src/udev/udev-builtin-path_id.c
|
||||
@@ -548,9 +548,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
|
||||
}
|
||||
|
||||
/*
|
||||
- * Do return devices with have an unknown type of parent device, they
|
||||
- * might produce conflicting IDs below multiple independent parent
|
||||
- * devices.
|
||||
+ * Do not return devices with an unknown parent device type. They
|
||||
+ * might produce conflicting IDs if the parent does not provide a
|
||||
+ * unique and predictable name.
|
||||
*/
|
||||
if (!supported_parent) {
|
||||
free(path);
|
||||
@@ -558,9 +558,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
|
||||
}
|
||||
|
||||
/*
|
||||
- * Do not return a have-only a single-parent block devices, some
|
||||
- * have entire hidden buses behind it, and not create predictable
|
||||
- * IDs that way.
|
||||
+ * Do not return block devices without a well-known transport. Some
|
||||
+ * devices do not expose their buses and do not provide a unique
|
||||
+ * and predictable name that way.
|
||||
*/
|
||||
if (streq(udev_device_get_subsystem(dev), "block") && !supported_transport) {
|
||||
free(path);
|
|
@ -0,0 +1,71 @@
|
|||
From c6c61aa02fc16388acdb1a04ab6192d7c749d492 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 29 Oct 2014 22:25:33 -0400
|
||||
Subject: [PATCH] bash-completion: rework startable/restartable units once more
|
||||
|
||||
I tried to use 'systemctl --all list-units' to filter unit files, but
|
||||
this always filters out unit files which are not loaded. We want to complete
|
||||
systemctl start with those units too, so this approach is not going to work.
|
||||
|
||||
New version is rather slow, but hopefully correct.
|
||||
|
||||
(cherry picked from commit 9ff8af5460d57dfab78a1137ec743b539715e82a)
|
||||
---
|
||||
shell-completion/bash/systemctl.in | 27 ++++++++++++++-------------
|
||||
1 file changed, 14 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
|
||||
index 1c44a8df01..9e538a9a5b 100644
|
||||
--- a/shell-completion/bash/systemctl.in
|
||||
+++ b/shell-completion/bash/systemctl.in
|
||||
@@ -52,20 +52,23 @@ __filter_units_by_property () {
|
||||
}
|
||||
|
||||
__get_all_units () { { __systemctl $1 list-unit-files; __systemctl $1 list-units --all; } \
|
||||
- | { while read -r a b; do echo " $a"; done; }; }
|
||||
+ | { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }; }
|
||||
__get_template_names () { __systemctl $1 list-unit-files \
|
||||
| { while read -r a b; do [[ $a =~ @\. ]] && echo " ${a%%@.*}@"; done; }; }
|
||||
|
||||
__get_active_units () { __systemctl $1 list-units \
|
||||
| { while read -r a b; do echo " $a"; done; }; }
|
||||
__get_startable_units () {
|
||||
- # find inactive or failed units, filter out masked and not-found
|
||||
- __systemctl $1 list-units --state inactive,failed -- $( __get_all_units ) | \
|
||||
- { while read -r a b c d; do [[ $b == "loaded" ]] && echo " $a"; done; }; }
|
||||
+ # find startable inactive units
|
||||
+ __filter_units_by_property $mode LoadState loaded $(
|
||||
+ __filter_units_by_property $mode ActiveState inactive $(
|
||||
+ __filter_units_by_property $mode CanStart yes $( __get_all_units )))
|
||||
+}
|
||||
__get_restartable_units () {
|
||||
- # find !masked, filter out masked and not-found
|
||||
- __systemctl $1 list-units --state active,inactive,failed -- $( __get_all_units ) | \
|
||||
- { while read -r a b c d; do [[ $b == "loaded" ]] && echo " $a"; done; }; }
|
||||
+ # filter out masked and not-found
|
||||
+ __filter_units_by_property $mode LoadState loaded $(
|
||||
+ __filter_units_by_property $mode CanStart yes $( __get_all_units ))
|
||||
+}
|
||||
__get_failed_units () { __systemctl $1 list-units \
|
||||
| { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
|
||||
__get_enabled_units () { __systemctl $1 list-unit-files \
|
||||
@@ -186,15 +189,13 @@ _systemctl () {
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[STARTABLE_UNITS]}; then
|
||||
- comps=$( __filter_units_by_property $mode CanStart yes \
|
||||
- $( __get_startable_units $mode);
|
||||
- __get_template_names $mode)
|
||||
+ comps=$( __get_startable_units $mode;
|
||||
+ __get_template_names $mode)
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[RESTARTABLE_UNITS]}; then
|
||||
- comps=$( __filter_units_by_property $mode CanStart yes \
|
||||
- $( __get_restartable_units $mode); \
|
||||
- __get_template_names $mode)
|
||||
+ comps=$( __get_restartable_units $mode;
|
||||
+ __get_template_names $mode)
|
||||
compopt -o filenames
|
||||
|
||||
elif __contains_word "$verb" ${VERBS[STOPPABLE_UNITS]}; then
|
|
@ -1,48 +0,0 @@
|
|||
From 11adc1aef7a1a6e9ba3fda8eb34eb5fadedc0385 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:10:59 +0200
|
||||
Subject: [PATCH] util: change return value of startswith() to non-const
|
||||
|
||||
This way we can use it on non-const strings, and don't end up with a
|
||||
const'ified result.
|
||||
|
||||
This is similar to libc's strstr() which also takes a const string but
|
||||
returns a non-const one.
|
||||
---
|
||||
src/shared/util.h | 20 ++++++++++++++------
|
||||
1 file changed, 14 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/shared/util.h b/src/shared/util.h
|
||||
index 87ad317319..8cd47b8294 100644
|
||||
--- a/src/shared/util.h
|
||||
+++ b/src/shared/util.h
|
||||
@@ -158,15 +158,23 @@ static inline bool isempty(const char *p) {
|
||||
return !p || !p[0];
|
||||
}
|
||||
|
||||
-static inline const char *startswith(const char *s, const char *prefix) {
|
||||
- if (strncmp(s, prefix, strlen(prefix)) == 0)
|
||||
- return s + strlen(prefix);
|
||||
+static inline char *startswith(const char *s, const char *prefix) {
|
||||
+ size_t l;
|
||||
+
|
||||
+ l = strlen(prefix);
|
||||
+ if (strncmp(s, prefix, l) == 0)
|
||||
+ return (char*) s + l;
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static inline const char *startswith_no_case(const char *s, const char *prefix) {
|
||||
- if (strncasecmp(s, prefix, strlen(prefix)) == 0)
|
||||
- return s + strlen(prefix);
|
||||
+static inline char *startswith_no_case(const char *s, const char *prefix) {
|
||||
+ size_t l;
|
||||
+
|
||||
+ l = strlen(prefix);
|
||||
+ if (strncasecmp(s, prefix, l) == 0)
|
||||
+ return (char*) s + l;
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
From e67d6e601aaa380a615bc3dfffcab56d0f4666c0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 29 Oct 2014 22:46:30 -0400
|
||||
Subject: [PATCH] systemctl: let list-{units,unit-files } honour --type
|
||||
|
||||
The docs don't clarify what is expected, but I don't see any reason
|
||||
why --type should be ignored.
|
||||
|
||||
Also restucture the compund conditions into separate clauses for
|
||||
easier reading.
|
||||
|
||||
(cherry picked from commit 6c71341aeecc3d092ed90f66e1b2c481b8e260ff)
|
||||
---
|
||||
src/systemctl/systemctl.c | 48 ++++++++++++++++++++++++++++++++++++-----------
|
||||
1 file changed, 37 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||
index 28eaa6a847..b71040be40 100644
|
||||
--- a/src/systemctl/systemctl.c
|
||||
+++ b/src/systemctl/systemctl.c
|
||||
@@ -301,21 +301,37 @@ static int compare_unit_info(const void *a, const void *b) {
|
||||
}
|
||||
|
||||
static bool output_show_unit(const UnitInfo *u, char **patterns) {
|
||||
- const char *dot;
|
||||
-
|
||||
if (!strv_isempty(patterns)) {
|
||||
char **pattern;
|
||||
|
||||
STRV_FOREACH(pattern, patterns)
|
||||
if (fnmatch(*pattern, u->id, FNM_NOESCAPE) == 0)
|
||||
- return true;
|
||||
+ goto next;
|
||||
return false;
|
||||
}
|
||||
|
||||
- return (!arg_types || ((dot = strrchr(u->id, '.')) &&
|
||||
- strv_find(arg_types, dot+1))) &&
|
||||
- (arg_all || !(streq(u->active_state, "inactive")
|
||||
- || u->following[0]) || u->job_id > 0);
|
||||
+next:
|
||||
+ if (arg_types) {
|
||||
+ const char *dot;
|
||||
+
|
||||
+ dot = strrchr(u->id, '.');
|
||||
+ if (!dot)
|
||||
+ return false;
|
||||
+
|
||||
+ if (!strv_find(arg_types, dot+1))
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (arg_all)
|
||||
+ return true;
|
||||
+
|
||||
+ if (u->job_id > 0)
|
||||
+ return true;
|
||||
+
|
||||
+ if (streq(u->active_state, "inactive") || u->following[0])
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
}
|
||||
|
||||
static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
|
||||
@@ -1231,18 +1247,28 @@ static int compare_unit_file_list(const void *a, const void *b) {
|
||||
}
|
||||
|
||||
static bool output_show_unit_file(const UnitFileList *u, char **patterns) {
|
||||
- const char *dot;
|
||||
-
|
||||
if (!strv_isempty(patterns)) {
|
||||
char **pattern;
|
||||
|
||||
STRV_FOREACH(pattern, patterns)
|
||||
if (fnmatch(*pattern, basename(u->path), FNM_NOESCAPE) == 0)
|
||||
- return true;
|
||||
+ goto next;
|
||||
return false;
|
||||
}
|
||||
|
||||
- return !arg_types || ((dot = strrchr(u->path, '.')) && strv_find(arg_types, dot+1));
|
||||
+next:
|
||||
+ if (!strv_isempty(arg_types)) {
|
||||
+ const char *dot;
|
||||
+
|
||||
+ dot = strrchr(u->path, '.');
|
||||
+ if (!dot)
|
||||
+ return false;
|
||||
+
|
||||
+ if (!strv_find(arg_types, dot+1))
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
}
|
||||
|
||||
static void output_unit_file_list(const UnitFileList *units, unsigned c) {
|
|
@ -1,55 +0,0 @@
|
|||
From a9f85faf43ae2289e19ba9105c36496aefe66072 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:13:15 +0200
|
||||
Subject: [PATCH] util: simplify close_nointr() a bit
|
||||
|
||||
---
|
||||
src/shared/util.c | 33 ++++++++++++++++-----------------
|
||||
1 file changed, 16 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index 9d254e0464..a54e879953 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -175,25 +175,24 @@ char* first_word(const char *s, const char *word) {
|
||||
}
|
||||
|
||||
int close_nointr(int fd) {
|
||||
- int r;
|
||||
-
|
||||
assert(fd >= 0);
|
||||
- r = close(fd);
|
||||
- if (r >= 0)
|
||||
- return r;
|
||||
- else if (errno == EINTR)
|
||||
- /*
|
||||
- * Just ignore EINTR; a retry loop is the wrong
|
||||
- * thing to do on Linux.
|
||||
- *
|
||||
- * http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
|
||||
- * https://bugzilla.gnome.org/show_bug.cgi?id=682819
|
||||
- * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
|
||||
- * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain
|
||||
- */
|
||||
+
|
||||
+ if (close(fd) >= 0)
|
||||
return 0;
|
||||
- else
|
||||
- return -errno;
|
||||
+
|
||||
+ /*
|
||||
+ * Just ignore EINTR; a retry loop is the wrong thing to do on
|
||||
+ * Linux.
|
||||
+ *
|
||||
+ * http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
|
||||
+ * https://bugzilla.gnome.org/show_bug.cgi?id=682819
|
||||
+ * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR
|
||||
+ * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain
|
||||
+ */
|
||||
+ if (errno == EINTR)
|
||||
+ return 0;
|
||||
+
|
||||
+ return -errno;
|
||||
}
|
||||
|
||||
int safe_close(int fd) {
|
|
@ -0,0 +1,26 @@
|
|||
From b8e4de9dcc9eebe202b2450f2c863eab48d50cc2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 29 Oct 2014 22:51:00 -0400
|
||||
Subject: [PATCH] systemctl: obey --state in list-unit-files
|
||||
|
||||
(cherry picked from commit fec1530e6b5b8d6dc352c7338010357126e84621)
|
||||
---
|
||||
src/systemctl/systemctl.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||
index b71040be40..8481a9b20c 100644
|
||||
--- a/src/systemctl/systemctl.c
|
||||
+++ b/src/systemctl/systemctl.c
|
||||
@@ -1268,6 +1268,11 @@ next:
|
||||
return false;
|
||||
}
|
||||
|
||||
+ if (!strv_isempty(arg_states)) {
|
||||
+ if (!strv_find(arg_states, unit_file_state_to_string(u->state)))
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
From 5ed1227238724959f020169f5332086439709b55 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:13:43 +0200
|
||||
Subject: [PATCH] util: make asynchronous_close() really work like an
|
||||
asynchronous version of safe_close()
|
||||
|
||||
Save/restore errno, like we do in safe_close(). And don't fork a thread
|
||||
if the parameter is already negative.
|
||||
---
|
||||
src/shared/async.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/shared/async.c b/src/shared/async.c
|
||||
index 3876deda70..115901e637 100644
|
||||
--- a/src/shared/async.c
|
||||
+++ b/src/shared/async.c
|
||||
@@ -73,7 +73,7 @@ int asynchronous_sync(void) {
|
||||
}
|
||||
|
||||
static void *close_thread(void *p) {
|
||||
- safe_close(PTR_TO_INT(p));
|
||||
+ assert_se(close_nointr(PTR_TO_INT(p)) != -EBADF);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -86,9 +86,13 @@ int asynchronous_close(int fd) {
|
||||
* but it doesn't, so we work around it, and hide this as a
|
||||
* far away as we can. */
|
||||
|
||||
- r = asynchronous_job(close_thread, INT_TO_PTR(fd));
|
||||
- if (r < 0)
|
||||
- safe_close(fd);
|
||||
+ if (fd >= 0) {
|
||||
+ PROTECT_ERRNO;
|
||||
+
|
||||
+ r = asynchronous_job(close_thread, INT_TO_PTR(fd));
|
||||
+ if (r < 0)
|
||||
+ assert_se(close_nointr(fd) != -EBADF);
|
||||
+ }
|
||||
|
||||
return -1;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
From dde552b36bcfef618dd45325ebafa73b801ec38f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 29 Oct 2014 23:06:58 -0400
|
||||
Subject: [PATCH] bash-completion: use improved filtering to make things faster
|
||||
|
||||
(cherry picked from commit 372b221166eb586c4f767969f442ed940e21f353)
|
||||
---
|
||||
shell-completion/bash/systemctl.in | 16 +++++++++++-----
|
||||
1 file changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in
|
||||
index 9e538a9a5b..9e98a1850e 100644
|
||||
--- a/shell-completion/bash/systemctl.in
|
||||
+++ b/shell-completion/bash/systemctl.in
|
||||
@@ -60,14 +60,20 @@ __get_active_units () { __systemctl $1 list-units \
|
||||
| { while read -r a b; do echo " $a"; done; }; }
|
||||
__get_startable_units () {
|
||||
# find startable inactive units
|
||||
- __filter_units_by_property $mode LoadState loaded $(
|
||||
- __filter_units_by_property $mode ActiveState inactive $(
|
||||
- __filter_units_by_property $mode CanStart yes $( __get_all_units )))
|
||||
+ __filter_units_by_property $mode ActiveState inactive $(
|
||||
+ __filter_units_by_property $mode CanStart yes $(
|
||||
+ __systemctl $mode list-unit-files --state enabled,disabled,static | \
|
||||
+ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }
|
||||
+ __systemctl $mode list-units --state inactive,failed | \
|
||||
+ { while read -r a b; do echo " $a"; done; } ))
|
||||
}
|
||||
__get_restartable_units () {
|
||||
# filter out masked and not-found
|
||||
- __filter_units_by_property $mode LoadState loaded $(
|
||||
- __filter_units_by_property $mode CanStart yes $( __get_all_units ))
|
||||
+ __filter_units_by_property $mode CanStart yes $(
|
||||
+ __systemctl $mode list-unit-files --state enabled,disabled,static | \
|
||||
+ { while read -r a b; do [[ $a =~ @\. ]] || echo " $a"; done; }
|
||||
+ __systemctl $mode list-units | \
|
||||
+ { while read -r a b; do echo " $a"; done; } )
|
||||
}
|
||||
__get_failed_units () { __systemctl $1 list-units \
|
||||
| { while read -r a b c d; do [[ $c == "failed" ]] && echo " $a"; done; }; }
|
|
@ -1,127 +0,0 @@
|
|||
From 4c94096027f21d4ed0efe991534a926d39d52369 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:15:49 +0200
|
||||
Subject: [PATCH] core: unify how we generate the prefix string when dumping
|
||||
unit state
|
||||
|
||||
---
|
||||
src/core/execute.c | 19 ++++++-------------
|
||||
src/core/service.c | 6 ++----
|
||||
src/core/socket.c | 1 +
|
||||
src/core/unit.c | 7 ++-----
|
||||
4 files changed, 11 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index d8452a666c..2544a2470c 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -2398,12 +2398,11 @@ void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix) {
|
||||
assert(s);
|
||||
assert(f);
|
||||
|
||||
- if (!prefix)
|
||||
- prefix = "";
|
||||
-
|
||||
if (s->pid <= 0)
|
||||
return;
|
||||
|
||||
+ prefix = strempty(prefix);
|
||||
+
|
||||
fprintf(f,
|
||||
"%sPID: "PID_FMT"\n",
|
||||
prefix, s->pid);
|
||||
@@ -2463,21 +2462,16 @@ char *exec_command_line(char **argv) {
|
||||
}
|
||||
|
||||
void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
|
||||
- _cleanup_free_ char *p2 = NULL;
|
||||
- const char *prefix2;
|
||||
-
|
||||
_cleanup_free_ char *cmd = NULL;
|
||||
+ const char *prefix2;
|
||||
|
||||
assert(c);
|
||||
assert(f);
|
||||
|
||||
- if (!prefix)
|
||||
- prefix = "";
|
||||
- p2 = strappend(prefix, "\t");
|
||||
- prefix2 = p2 ? p2 : prefix;
|
||||
+ prefix = strempty(prefix);
|
||||
+ prefix2 = strappenda(prefix, "\t");
|
||||
|
||||
cmd = exec_command_line(c->argv);
|
||||
-
|
||||
fprintf(f,
|
||||
"%sCommand Line: %s\n",
|
||||
prefix, cmd ? cmd : strerror(ENOMEM));
|
||||
@@ -2488,8 +2482,7 @@ void exec_command_dump(ExecCommand *c, FILE *f, const char *prefix) {
|
||||
void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix) {
|
||||
assert(f);
|
||||
|
||||
- if (!prefix)
|
||||
- prefix = "";
|
||||
+ prefix = strempty(prefix);
|
||||
|
||||
LIST_FOREACH(command, c, c)
|
||||
exec_command_dump(c, f, prefix);
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 6a4665a1ae..887b1c8514 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -463,16 +463,14 @@ static int service_load(Unit *u) {
|
||||
}
|
||||
|
||||
static void service_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
-
|
||||
ServiceExecCommand c;
|
||||
Service *s = SERVICE(u);
|
||||
const char *prefix2;
|
||||
- _cleanup_free_ char *p2 = NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
- p2 = strappend(prefix, "\t");
|
||||
- prefix2 = p2 ? p2 : prefix;
|
||||
+ prefix = strempty(prefix);
|
||||
+ prefix2 = strappenda(prefix, "\t");
|
||||
|
||||
fprintf(f,
|
||||
"%sService State: %s\n"
|
||||
diff --git a/src/core/socket.c b/src/core/socket.c
|
||||
index 1189f451d2..7ca8edbda8 100644
|
||||
--- a/src/core/socket.c
|
||||
+++ b/src/core/socket.c
|
||||
@@ -471,6 +471,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
assert(s);
|
||||
assert(f);
|
||||
|
||||
+ prefix = strempty(prefix);
|
||||
prefix2 = strappenda(prefix, "\t");
|
||||
|
||||
fprintf(f,
|
||||
diff --git a/src/core/unit.c b/src/core/unit.c
|
||||
index 08e74b4160..56102b360d 100644
|
||||
--- a/src/core/unit.c
|
||||
+++ b/src/core/unit.c
|
||||
@@ -791,7 +791,6 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
char *t, **j;
|
||||
UnitDependency d;
|
||||
Iterator i;
|
||||
- _cleanup_free_ char *p2 = NULL;
|
||||
const char *prefix2;
|
||||
char
|
||||
timestamp1[FORMAT_TIMESTAMP_MAX],
|
||||
@@ -806,10 +805,8 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
assert(u);
|
||||
assert(u->type >= 0);
|
||||
|
||||
- if (!prefix)
|
||||
- prefix = "";
|
||||
- p2 = strappend(prefix, "\t");
|
||||
- prefix2 = p2 ? p2 : prefix;
|
||||
+ prefix = strempty(prefix);
|
||||
+ prefix2 = strappenda(prefix, "\t");
|
||||
|
||||
fprintf(f,
|
||||
"%s-> Unit %s:\n"
|
|
@ -1,24 +0,0 @@
|
|||
From abb4c1cc0161cc6b371ee7ea2550df17a3bfc21e Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:17:02 +0200
|
||||
Subject: [PATCH] service: asynchronous_close() already checks for negative
|
||||
parameters, no need to duplicate that
|
||||
|
||||
---
|
||||
src/core/service.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 887b1c8514..008e81437d 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -180,9 +180,6 @@ static int service_set_main_pid(Service *s, pid_t pid) {
|
||||
static void service_close_socket_fd(Service *s) {
|
||||
assert(s);
|
||||
|
||||
- if (s->socket_fd < 0)
|
||||
- return;
|
||||
-
|
||||
s->socket_fd = asynchronous_close(s->socket_fd);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
From 0f6c8d5bf7f371e39a49e5a932d955f28f25d64f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 29 Oct 2014 23:47:55 -0400
|
||||
Subject: [PATCH] zsh-completion: update start/restart completions
|
||||
|
||||
Now zsh should behave the same for those two subcommands as bash.
|
||||
|
||||
(cherry picked from commit 81333ecf9d5497f8aa95f7fec23c67b869d5abf9)
|
||||
---
|
||||
shell-completion/zsh/_systemctl.in | 28 +++++++++++++++++++++-------
|
||||
1 file changed, 21 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in
|
||||
index 44981fe85d..7eefe53aec 100644
|
||||
--- a/shell-completion/zsh/_systemctl.in
|
||||
+++ b/shell-completion/zsh/_systemctl.in
|
||||
@@ -141,13 +141,29 @@ _filter_units_by_property() {
|
||||
done
|
||||
}
|
||||
|
||||
-_systemctl_all_units() { { __systemctl list-unit-files; __systemctl list-units --all; } | { while read -r a b; do echo -E - " $a"; done; } }
|
||||
+_systemctl_all_units() { { __systemctl list-unit-files; __systemctl list-units --all; } | { while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; } }
|
||||
_systemctl_get_template_names() { __systemctl list-unit-files | { while read -r a b; do [[ $a =~ @\. ]] && echo -E - " ${a%%@.*}@"; done; } }
|
||||
|
||||
|
||||
_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read -r a b; do echo -E - " $a"; done; }) )}
|
||||
-_systemctl_startable_units(){_sys_startable_units=($(__systemctl list-units --state inactive,failed -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )}
|
||||
-_systemctl_restartable_units(){_sys_restartable_units=($(__systemctl list-units --state inactive,failed,active -- $(_systemctl_all_units) | { while read -r a b c d; do [[ $b == "loaded" ]] && echo -E - " $a"; done; }) )}
|
||||
+
|
||||
+_systemctl_startable_units(){
|
||||
+ _sys_startable_units=(_filter_units_by_property ActiveState inactive $(
|
||||
+ _filter_units_by_property CanStart yes $(
|
||||
+ __systemctl $mode list-unit-files --state enabled,disabled,static | \
|
||||
+ { while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; }
|
||||
+ __systemctl $mode list-units --state inactive,failed | \
|
||||
+ { while read -r a b; do echo -E - " $a"; done; } )))
|
||||
+}
|
||||
+
|
||||
+_systemctl_restartable_units(){
|
||||
+ _sys_restartable_units=(_filter_units_by_property CanStart yes $(
|
||||
+ __systemctl $mode list-unit-files --state enabled,disabled,static | \
|
||||
+ { while read -r a b; do [[ $a =~ @\. ]] || echo -E - " $a"; done; }
|
||||
+ __systemctl $mode list-units | \
|
||||
+ { while read -r a b; do echo -E - " $a"; done; } ))
|
||||
+}
|
||||
+
|
||||
_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read -r a b; do echo -E - " $a"; done; }) )}
|
||||
_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read -r a b; do [[ $b == "enabled" ]] && echo -E - " $a"; done; }) )}
|
||||
_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read -r a b; do [[ $b == "disabled" ]] && echo -E - " $a"; done; }) )}
|
||||
@@ -194,8 +210,7 @@ done
|
||||
(( $+functions[_systemctl_start] )) || _systemctl_start()
|
||||
{
|
||||
_systemctl_startable_units
|
||||
- compadd "$@" - $( _filter_units_by_property CanStart yes \
|
||||
- ${_sys_startable_units[*]} )
|
||||
+ compadd "$@" - ${_sys_startable_units[*]} $(_systemctl_get_template_names)
|
||||
}
|
||||
|
||||
# Completion functions for STOPPABLE_UNITS
|
||||
@@ -231,8 +246,7 @@ for fun in restart reload-or-restart ; do
|
||||
(( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
|
||||
{
|
||||
_systemctl_restartable_units
|
||||
- compadd "$@" - $( _filter_units_by_property CanStart yes \
|
||||
- ${_sys_restartable_units[*]} )
|
||||
+ compadd "$@" - ${_sys_restartable_units[*]} $(_systemctl_get_template_names)
|
||||
}
|
||||
done
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From cbc2459556c16dca2c76b4c580e4d9d8d78279ea Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Thu, 30 Oct 2014 10:15:54 +0100
|
||||
Subject: [PATCH] keymap: Ignore brightness keys on Dell Inspiron 1520 to avoid
|
||||
double events
|
||||
|
||||
On the Dell Inspiron 1520 both the atkbd and acpi-video input devices report
|
||||
an event for pressing the brightness up / down key-combos, resulting in user
|
||||
space seeing double events and increasing / decreasing the brightness 2 steps
|
||||
for each keypress.
|
||||
|
||||
This hwdb snippet suppresses the atkbd events, making the Inspiron 1520 work
|
||||
like most modern laptops which emit brightness up / down events through
|
||||
acpi-video only.
|
||||
|
||||
Reported by Pavel Malyshev <p.malishev@gmail.com>
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1141525
|
||||
(cherry picked from commit aba248ee6b1eb10baf3d89eca2ad7569459af6ab)
|
||||
---
|
||||
hwdb/60-keyboard.hwdb | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
|
||||
index 06caba9791..d2ca965c90 100644
|
||||
--- a/hwdb/60-keyboard.hwdb
|
||||
+++ b/hwdb/60-keyboard.hwdb
|
||||
@@ -230,6 +230,11 @@ keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1110:pvr*
|
||||
keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1210:pvr*
|
||||
KEYBOARD_KEY_84=wlan
|
||||
|
||||
+# Dell Inspiron 1520
|
||||
+keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1520:pvr*
|
||||
+ KEYBOARD_KEY_85=unknown # Brightness Down, also emitted by acpi-video, ignore
|
||||
+ KEYBOARD_KEY_86=unknown # Brightness Up, also emitted by acpi-video, ignore
|
||||
+
|
||||
# Latitude XT2
|
||||
keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnLatitude*XT2:pvr*
|
||||
KEYBOARD_KEY_9b=up # tablet rocker up
|
|
@ -1,526 +0,0 @@
|
|||
From 8bb2d17d2b89e87b2e9d8f6c147a757f4670b0fc Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:19:25 +0200
|
||||
Subject: [PATCH] service: remove some pointless linebreaks, to make things
|
||||
more readable
|
||||
|
||||
---
|
||||
src/core/service.c | 200 +++++++++++++++++------------------------------------
|
||||
1 file changed, 65 insertions(+), 135 deletions(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 008e81437d..f10582d89e 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -135,8 +135,7 @@ static void service_unwatch_pid_file(Service *s) {
|
||||
if (!s->pid_file_pathspec)
|
||||
return;
|
||||
|
||||
- log_debug_unit(UNIT(s)->id, "Stopping watch for %s's PID file %s",
|
||||
- UNIT(s)->id, s->pid_file_pathspec->path);
|
||||
+ log_debug_unit(UNIT(s)->id, "Stopping watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
|
||||
path_spec_unwatch(s->pid_file_pathspec);
|
||||
path_spec_done(s->pid_file_pathspec);
|
||||
free(s->pid_file_pathspec);
|
||||
@@ -166,10 +165,7 @@ static int service_set_main_pid(Service *s, pid_t pid) {
|
||||
s->main_pid_known = true;
|
||||
|
||||
if (get_parent_of_pid(pid, &ppid) >= 0 && ppid != getpid()) {
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s: Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.",
|
||||
- UNIT(s)->id, pid);
|
||||
-
|
||||
+ log_warning_unit(UNIT(s)->id, "%s: Supervising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.", UNIT(s)->id, pid);
|
||||
s->main_pid_alien = true;
|
||||
} else
|
||||
s->main_pid_alien = false;
|
||||
@@ -362,14 +358,12 @@ static int service_add_default_dependencies(Service *s) {
|
||||
* majority of services. */
|
||||
|
||||
/* First, pull in base system */
|
||||
- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES,
|
||||
- SPECIAL_BASIC_TARGET, NULL, true);
|
||||
+ r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, SPECIAL_BASIC_TARGET, NULL, true);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Second, activate normal shutdown */
|
||||
- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS,
|
||||
- SPECIAL_SHUTDOWN_TARGET, NULL, true);
|
||||
+ r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -392,8 +386,8 @@ static void service_fix_output(Service *s) {
|
||||
}
|
||||
|
||||
static int service_load(Unit *u) {
|
||||
- int r;
|
||||
Service *s = SERVICE(u);
|
||||
+ int r;
|
||||
|
||||
assert(s);
|
||||
|
||||
@@ -556,25 +550,20 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
||||
r = read_one_line_file(s->pid_file, &k);
|
||||
if (r < 0) {
|
||||
if (may_warn)
|
||||
- log_info_unit(UNIT(s)->id,
|
||||
- "PID file %s not readable (yet?) after %s.",
|
||||
- s->pid_file, service_state_to_string(s->state));
|
||||
+ log_info_unit(UNIT(s)->id, "PID file %s not readable (yet?) after %s.", s->pid_file, service_state_to_string(s->state));
|
||||
return r;
|
||||
}
|
||||
|
||||
r = parse_pid(k, &pid);
|
||||
if (r < 0) {
|
||||
if (may_warn)
|
||||
- log_info_unit(UNIT(s)->id,
|
||||
- "Failed to read PID from file %s: %s",
|
||||
- s->pid_file, strerror(-r));
|
||||
+ log_info_unit(UNIT(s)->id, "Failed to read PID from file %s: %s", s->pid_file, strerror(-r));
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!pid_is_alive(pid)) {
|
||||
if (may_warn)
|
||||
log_info_unit(UNIT(s)->id, "PID "PID_FMT" read from file %s does not exist or is a zombie.", pid, s->pid_file);
|
||||
-
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
@@ -582,14 +571,12 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
||||
if (pid == s->main_pid)
|
||||
return 0;
|
||||
|
||||
- log_debug_unit(UNIT(s)->id,
|
||||
- "Main PID changing: "PID_FMT" -> "PID_FMT,
|
||||
- s->main_pid, pid);
|
||||
+ log_debug_unit(UNIT(s)->id, "Main PID changing: "PID_FMT" -> "PID_FMT, s->main_pid, pid);
|
||||
+
|
||||
service_unwatch_main_pid(s);
|
||||
s->main_pid_known = false;
|
||||
} else
|
||||
- log_debug_unit(UNIT(s)->id,
|
||||
- "Main PID loaded: "PID_FMT, pid);
|
||||
+ log_debug_unit(UNIT(s)->id, "Main PID loaded: "PID_FMT, pid);
|
||||
|
||||
r = service_set_main_pid(s, pid);
|
||||
if (r < 0)
|
||||
@@ -598,9 +585,7 @@ static int service_load_pid_file(Service *s, bool may_warn) {
|
||||
r = unit_watch_pid(UNIT(s), pid);
|
||||
if (r < 0) {
|
||||
/* FIXME: we need to do something here */
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "Failed to watch PID "PID_FMT" from service %s",
|
||||
- pid, UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -627,19 +612,19 @@ static int service_search_main_pid(Service *s) {
|
||||
if (pid <= 0)
|
||||
return -ENOENT;
|
||||
|
||||
- log_debug_unit(UNIT(s)->id,
|
||||
- "Main PID guessed: "PID_FMT, pid);
|
||||
+ log_debug_unit(UNIT(s)->id, "Main PID guessed: "PID_FMT, pid);
|
||||
r = service_set_main_pid(s, pid);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_watch_pid(UNIT(s), pid);
|
||||
- if (r < 0)
|
||||
+ if (r < 0) {
|
||||
/* FIXME: we need to do something here */
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "Failed to watch PID "PID_FMT" from service %s",
|
||||
- pid, UNIT(s)->id);
|
||||
- return r;
|
||||
+ log_warning_unit(UNIT(s)->id, "Failed to watch PID "PID_FMT" from service %s", pid, UNIT(s)->id);
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static void service_set_state(Service *s, ServiceState state) {
|
||||
@@ -1096,9 +1081,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run install restart timer: %s",
|
||||
- UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run install restart timer: %s", UNIT(s)->id, strerror(-r));
|
||||
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
|
||||
}
|
||||
|
||||
@@ -1136,9 +1119,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run 'stop-post' task: %s",
|
||||
- UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'stop-post' task: %s", UNIT(s)->id, strerror(-r));
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -1183,8 +1164,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r));
|
||||
|
||||
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
|
||||
service_enter_stop_post(s, SERVICE_FAILURE_RESOURCES);
|
||||
@@ -1227,8 +1207,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r));
|
||||
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -1282,8 +1261,7 @@ static void service_enter_start_post(Service *s) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r));
|
||||
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -1375,8 +1353,7 @@ static void service_enter_start(Service *s) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r));
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -1489,9 +1466,7 @@ static void service_enter_reload(Service *s) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run 'reload' task: %s",
|
||||
- UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run 'reload' task: %s", UNIT(s)->id, strerror(-r));
|
||||
s->reload_result = SERVICE_FAILURE_RESOURCES;
|
||||
service_enter_running(s, SERVICE_SUCCESS);
|
||||
}
|
||||
@@ -1525,9 +1500,7 @@ static void service_run_next_control(Service *s) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run next control task: %s",
|
||||
- UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run next control task: %s", UNIT(s)->id, strerror(-r));
|
||||
|
||||
if (s->state == SERVICE_START_PRE)
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
||||
@@ -1572,8 +1545,7 @@ static void service_run_next_main(Service *s) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r));
|
||||
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -1588,41 +1560,35 @@ static int service_execute_action(Service *s, FailureAction action, const char *
|
||||
|
||||
case SERVICE_FAILURE_ACTION_NONE:
|
||||
if (log_action_none)
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s %s, refusing to start.", UNIT(s)->id, reason);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s %s, refusing to start.", UNIT(s)->id, reason);
|
||||
break;
|
||||
|
||||
case SERVICE_FAILURE_ACTION_REBOOT: {
|
||||
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
int r;
|
||||
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s %s, rebooting.", UNIT(s)->id, reason);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s %s, rebooting.", UNIT(s)->id, reason);
|
||||
|
||||
- r = manager_add_job_by_name(UNIT(s)->manager, JOB_START,
|
||||
- SPECIAL_REBOOT_TARGET, JOB_REPLACE,
|
||||
- true, &error, NULL);
|
||||
+ r = manager_add_job_by_name(UNIT(s)->manager, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
|
||||
if (r < 0)
|
||||
- log_error_unit(UNIT(s)->id,
|
||||
- "Failed to reboot: %s.", bus_error_message(&error, r));
|
||||
+ log_error_unit(UNIT(s)->id, "Failed to reboot: %s.", bus_error_message(&error, r));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SERVICE_FAILURE_ACTION_REBOOT_FORCE:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s %s, forcibly rebooting.", UNIT(s)->id, reason);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s %s, forcibly rebooting.", UNIT(s)->id, reason);
|
||||
UNIT(s)->manager->exit_code = MANAGER_REBOOT;
|
||||
break;
|
||||
|
||||
case SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s %s, rebooting immediately.", UNIT(s)->id, reason);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s %s, rebooting immediately.", UNIT(s)->id, reason);
|
||||
+
|
||||
sync();
|
||||
+
|
||||
if (s->reboot_arg) {
|
||||
log_info("Rebooting with argument '%s'.", s->reboot_arg);
|
||||
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
|
||||
- LINUX_REBOOT_CMD_RESTART2, s->reboot_arg);
|
||||
+ syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, s->reboot_arg);
|
||||
}
|
||||
|
||||
log_info("Rebooting.");
|
||||
@@ -1630,8 +1596,7 @@ static int service_execute_action(Service *s, FailureAction action, const char *
|
||||
break;
|
||||
|
||||
default:
|
||||
- log_error_unit(UNIT(s)->id,
|
||||
- "failure action=%i", action);
|
||||
+ log_error_unit(UNIT(s)->id, "failure action=%i", action);
|
||||
assert_not_reached("Unknown FailureAction.");
|
||||
}
|
||||
|
||||
@@ -1990,7 +1955,7 @@ _pure_ static bool service_check_snapshot(Unit *u) {
|
||||
|
||||
assert(s);
|
||||
|
||||
- return (s->socket_fd < 0);
|
||||
+ return s->socket_fd < 0;
|
||||
}
|
||||
|
||||
static int service_retry_pid_file(Service *s) {
|
||||
@@ -2012,24 +1977,19 @@ static int service_retry_pid_file(Service *s) {
|
||||
static int service_watch_pid_file(Service *s) {
|
||||
int r;
|
||||
|
||||
- log_debug_unit(UNIT(s)->id,
|
||||
- "Setting watch for %s's PID file %s",
|
||||
- UNIT(s)->id, s->pid_file_pathspec->path);
|
||||
+ log_debug_unit(UNIT(s)->id, "Setting watch for %s's PID file %s", UNIT(s)->id, s->pid_file_pathspec->path);
|
||||
+
|
||||
r = path_spec_watch(s->pid_file_pathspec, service_dispatch_io);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
/* the pidfile might have appeared just before we set the watch */
|
||||
- log_debug_unit(UNIT(s)->id,
|
||||
- "Trying to read %s's PID file %s in case it changed",
|
||||
- UNIT(s)->id, s->pid_file_pathspec->path);
|
||||
+ log_debug_unit(UNIT(s)->id, "Trying to read %s's PID file %s in case it changed", UNIT(s)->id, s->pid_file_pathspec->path);
|
||||
service_retry_pid_file(s);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
- log_error_unit(UNIT(s)->id,
|
||||
- "Failed to set a watch for %s's PID file %s: %s",
|
||||
- UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r));
|
||||
+ log_error_unit(UNIT(s)->id, "Failed to set a watch for %s's PID file %s: %s", UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r));
|
||||
service_unwatch_pid_file(s);
|
||||
return r;
|
||||
}
|
||||
@@ -2116,8 +2076,8 @@ static void service_notify_cgroup_empty_event(Unit *u) {
|
||||
/* If we were hoping for the daemon to write its PID file,
|
||||
* we can give up now. */
|
||||
if (s->pid_file_pathspec) {
|
||||
- log_warning_unit(u->id,
|
||||
- "%s never wrote its PID file. Failing.", UNIT(s)->id);
|
||||
+ log_warning_unit(u->id, "%s never wrote its PID file. Failing.", UNIT(s)->id);
|
||||
+
|
||||
service_unwatch_pid_file(s);
|
||||
if (s->state == SERVICE_START)
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
|
||||
@@ -2223,9 +2183,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
/* There is another command to *
|
||||
* execute, so let's do that. */
|
||||
|
||||
- log_debug_unit(u->id,
|
||||
- "%s running next main command for state %s",
|
||||
- u->id, service_state_to_string(s->state));
|
||||
+ log_debug_unit(u->id, "%s running next main command for state %s", u->id, service_state_to_string(s->state));
|
||||
service_run_next_main(s);
|
||||
|
||||
} else {
|
||||
@@ -2285,8 +2243,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
s->control_pid = 0;
|
||||
|
||||
if (s->control_command) {
|
||||
- exec_status_exit(&s->control_command->exec_status,
|
||||
- &s->exec_context, pid, code, status);
|
||||
+ exec_status_exit(&s->control_command->exec_status, &s->exec_context, pid, code, status);
|
||||
|
||||
if (s->control_command->ignore)
|
||||
f = SERVICE_SUCCESS;
|
||||
@@ -2311,9 +2268,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
/* There is another command to *
|
||||
* execute, so let's do that. */
|
||||
|
||||
- log_debug_unit(u->id,
|
||||
- "%s running next control command for state %s",
|
||||
- u->id, service_state_to_string(s->state));
|
||||
+ log_debug_unit(u->id, "%s running next control command for state %s", u->id, service_state_to_string(s->state));
|
||||
service_run_next_control(s);
|
||||
|
||||
} else {
|
||||
@@ -2323,9 +2278,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
s->control_command = NULL;
|
||||
s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID;
|
||||
|
||||
- log_debug_unit(u->id,
|
||||
- "%s got final SIGCHLD for state %s",
|
||||
- u->id, service_state_to_string(s->state));
|
||||
+ log_debug_unit(u->id, "%s got final SIGCHLD for state %s", u->id, service_state_to_string(s->state));
|
||||
|
||||
switch (s->state) {
|
||||
|
||||
@@ -2453,40 +2406,32 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
|
||||
case SERVICE_START_PRE:
|
||||
case SERVICE_START:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s %s operation timed out. Terminating.",
|
||||
- UNIT(s)->id,
|
||||
- s->state == SERVICE_START ? "start" : "start-pre");
|
||||
+ log_warning_unit(UNIT(s)->id, "%s %s operation timed out. Terminating.", UNIT(s)->id, s->state == SERVICE_START ? "start" : "start-pre");
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
||||
break;
|
||||
|
||||
case SERVICE_START_POST:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s start-post operation timed out. Stopping.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s start-post operation timed out. Stopping.", UNIT(s)->id);
|
||||
service_enter_stop(s, SERVICE_FAILURE_TIMEOUT);
|
||||
break;
|
||||
|
||||
case SERVICE_RELOAD:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s reload operation timed out. Stopping.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s reload operation timed out. Stopping.", UNIT(s)->id);
|
||||
s->reload_result = SERVICE_FAILURE_TIMEOUT;
|
||||
service_enter_running(s, SERVICE_SUCCESS);
|
||||
break;
|
||||
|
||||
case SERVICE_STOP:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stopping timed out. Terminating.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s stopping timed out. Terminating.", UNIT(s)->id);
|
||||
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
||||
break;
|
||||
|
||||
case SERVICE_STOP_SIGTERM:
|
||||
if (s->kill_context.send_sigkill) {
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Killing.", UNIT(s)->id);
|
||||
service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_TIMEOUT);
|
||||
} else {
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stop-sigterm timed out. Skipping SIGKILL.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s stop-sigterm timed out. Skipping SIGKILL.", UNIT(s)->id);
|
||||
service_enter_stop_post(s, SERVICE_FAILURE_TIMEOUT);
|
||||
}
|
||||
|
||||
@@ -2497,34 +2442,28 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
* Must be something we cannot kill, so let's just be
|
||||
* weirded out and continue */
|
||||
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s still around after SIGKILL. Ignoring.", UNIT(s)->id);
|
||||
service_enter_stop_post(s, SERVICE_FAILURE_TIMEOUT);
|
||||
break;
|
||||
|
||||
case SERVICE_STOP_POST:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stop-post timed out. Terminating.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s stop-post timed out. Terminating.", UNIT(s)->id);
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_TIMEOUT);
|
||||
break;
|
||||
|
||||
case SERVICE_FINAL_SIGTERM:
|
||||
if (s->kill_context.send_sigkill) {
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stop-final-sigterm timed out. Killing.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s stop-final-sigterm timed out. Killing.", UNIT(s)->id);
|
||||
service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_FAILURE_TIMEOUT);
|
||||
} else {
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s stop-final-sigterm timed out. Skipping SIGKILL. Entering failed mode.",
|
||||
- UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s stop-final-sigterm timed out. Skipping SIGKILL. Entering failed mode.", UNIT(s)->id);
|
||||
service_enter_dead(s, SERVICE_FAILURE_TIMEOUT, false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SERVICE_FINAL_SIGKILL:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s still around after final SIGKILL. Entering failed mode.", UNIT(s)->id);
|
||||
+ log_warning_unit(UNIT(s)->id, "%s still around after final SIGKILL. Entering failed mode.", UNIT(s)->id);
|
||||
service_enter_dead(s, SERVICE_FAILURE_TIMEOUT, true);
|
||||
break;
|
||||
|
||||
@@ -2551,10 +2490,9 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
|
||||
assert(s);
|
||||
assert(source == s->watchdog_event_source);
|
||||
|
||||
- log_error_unit(UNIT(s)->id,
|
||||
- "%s watchdog timeout (limit %s)!",
|
||||
- UNIT(s)->id,
|
||||
+ log_error_unit(UNIT(s)->id, "%s watchdog timeout (limit %s)!", UNIT(s)->id,
|
||||
format_timespan(t, sizeof(t), s->watchdog_usec, 1));
|
||||
+
|
||||
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_WATCHDOG);
|
||||
|
||||
return 0;
|
||||
@@ -2571,9 +2509,7 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
||||
u->id, pid, tags && *tags ? tags[0] : "(empty)");
|
||||
|
||||
if (s->notify_access == NOTIFY_NONE) {
|
||||
- log_warning_unit(u->id,
|
||||
- "%s: Got notification message from PID "PID_FMT", but reception is disabled.",
|
||||
- u->id, pid);
|
||||
+ log_warning_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception is disabled.", u->id, pid);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2693,17 +2629,11 @@ static void service_bus_name_owner_change(
|
||||
assert(old_owner || new_owner);
|
||||
|
||||
if (old_owner && new_owner)
|
||||
- log_debug_unit(u->id,
|
||||
- "%s's D-Bus name %s changed owner from %s to %s",
|
||||
- u->id, name, old_owner, new_owner);
|
||||
+ log_debug_unit(u->id, "%s's D-Bus name %s changed owner from %s to %s", u->id, name, old_owner, new_owner);
|
||||
else if (old_owner)
|
||||
- log_debug_unit(u->id,
|
||||
- "%s's D-Bus name %s no longer registered by %s",
|
||||
- u->id, name, old_owner);
|
||||
+ log_debug_unit(u->id, "%s's D-Bus name %s no longer registered by %s", u->id, name, old_owner);
|
||||
else
|
||||
- log_debug_unit(u->id,
|
||||
- "%s's D-Bus name %s now registered by %s",
|
||||
- u->id, name, new_owner);
|
||||
+ log_debug_unit(u->id, "%s's D-Bus name %s now registered by %s", u->id, name, new_owner);
|
||||
|
||||
s->bus_name_good = !!new_owner;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
From f49650cee2c5256dc0491432e1f12a4ae19be6c5 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:20:17 +0200
|
||||
Subject: [PATCH] service: don't invoke functions at the same time as declaring
|
||||
variables
|
||||
|
||||
---
|
||||
src/core/service.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index f10582d89e..fc952e848f 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -694,9 +694,13 @@ static void service_set_state(Service *s, ServiceState state) {
|
||||
/* For remain_after_exit services, let's see if we can "release" the
|
||||
* hold on the console, since unit_notify() only does that in case of
|
||||
* change of state */
|
||||
- if (state == SERVICE_EXITED && s->remain_after_exit &&
|
||||
+ if (state == SERVICE_EXITED &&
|
||||
+ s->remain_after_exit &&
|
||||
UNIT(s)->manager->n_on_console > 0) {
|
||||
- ExecContext *ec = unit_get_exec_context(UNIT(s));
|
||||
+
|
||||
+ ExecContext *ec;
|
||||
+
|
||||
+ ec = unit_get_exec_context(UNIT(s));
|
||||
if (ec && exec_context_may_touch_console(ec)) {
|
||||
Manager *m = UNIT(s)->manager;
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
From c1cd55e4ea29a31a8420c6461eeec360139301f3 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Guthrie <colin@mageia.org>
|
||||
Date: Wed, 29 Oct 2014 14:03:41 +0000
|
||||
Subject: [PATCH] sysusers: Preserve ownership and mode on /etc/passwd and
|
||||
friends
|
||||
|
||||
When running sysusers we would clobber file ownership and permissions
|
||||
on the files /etc/passwd, /etc/group and /etc/[g]shadow.
|
||||
|
||||
This simply preserves the ownership and mode if existing files are
|
||||
found.
|
||||
|
||||
(cherry picked from commit e3c72c21d62aadabf4df436c3e2c7219eeeccc1c)
|
||||
---
|
||||
src/sysusers/sysusers.c | 61 +++++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 41 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
|
||||
index 9b9be96a0a..c133dc5f10 100644
|
||||
--- a/src/sysusers/sysusers.c
|
||||
+++ b/src/sysusers/sysusers.c
|
||||
@@ -358,6 +358,7 @@ static int write_files(void) {
|
||||
_cleanup_fclose_ FILE *passwd = NULL, *group = NULL, *shadow = NULL, *gshadow = NULL;
|
||||
_cleanup_free_ char *passwd_tmp = NULL, *group_tmp = NULL, *shadow_tmp = NULL, *gshadow_tmp = NULL;
|
||||
const char *passwd_path = NULL, *group_path = NULL, *shadow_path = NULL, *gshadow_path = NULL;
|
||||
+ struct stat st;
|
||||
bool group_changed = false;
|
||||
Iterator iterator;
|
||||
Item *i;
|
||||
@@ -372,15 +373,17 @@ static int write_files(void) {
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
- if (fchmod(fileno(group), 0644) < 0) {
|
||||
- r = -errno;
|
||||
- goto finish;
|
||||
- }
|
||||
-
|
||||
original = fopen(group_path, "re");
|
||||
if (original) {
|
||||
struct group *gr;
|
||||
|
||||
+ if (fstat(fileno(original), &st) < 0 ||
|
||||
+ fchmod(fileno(group), st.st_mode & 07777) < 0 ||
|
||||
+ fchown(fileno(group), st.st_uid, st.st_gid) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
+ }
|
||||
+
|
||||
errno = 0;
|
||||
while ((gr = fgetgrent(original))) {
|
||||
/* Safety checks against name and GID
|
||||
@@ -418,6 +421,9 @@ static int write_files(void) {
|
||||
} else if (errno != ENOENT) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
+ } else if (fchmod(fileno(group), 0644) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
HASHMAP_FOREACH(i, todo_gids, iterator) {
|
||||
@@ -449,15 +455,17 @@ static int write_files(void) {
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
- if (fchmod(fileno(gshadow), 0000) < 0) {
|
||||
- r = -errno;
|
||||
- goto finish;
|
||||
- }
|
||||
-
|
||||
original = fopen(gshadow_path, "re");
|
||||
if (original) {
|
||||
struct sgrp *sg;
|
||||
|
||||
+ if (fstat(fileno(original), &st) < 0 ||
|
||||
+ fchmod(fileno(gshadow), st.st_mode & 07777) < 0 ||
|
||||
+ fchown(fileno(gshadow), st.st_uid, st.st_gid) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
+ }
|
||||
+
|
||||
errno = 0;
|
||||
while ((sg = fgetsgent(original))) {
|
||||
|
||||
@@ -483,6 +491,9 @@ static int write_files(void) {
|
||||
} else if (errno != ENOENT) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
+ } else if (fchmod(fileno(gshadow), 0000) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
HASHMAP_FOREACH(i, todo_gids, iterator) {
|
||||
@@ -513,15 +524,17 @@ static int write_files(void) {
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
- if (fchmod(fileno(passwd), 0644) < 0) {
|
||||
- r = -errno;
|
||||
- goto finish;
|
||||
- }
|
||||
-
|
||||
original = fopen(passwd_path, "re");
|
||||
if (original) {
|
||||
struct passwd *pw;
|
||||
|
||||
+ if (fstat(fileno(original), &st) < 0 ||
|
||||
+ fchmod(fileno(passwd), st.st_mode & 07777) < 0 ||
|
||||
+ fchown(fileno(passwd), st.st_uid, st.st_gid) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
+ }
|
||||
+
|
||||
errno = 0;
|
||||
while ((pw = fgetpwent(original))) {
|
||||
|
||||
@@ -552,6 +565,9 @@ static int write_files(void) {
|
||||
} else if (errno != ENOENT) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
+ } else if (fchmod(fileno(passwd), 0644) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
HASHMAP_FOREACH(i, todo_uids, iterator) {
|
||||
@@ -596,15 +612,17 @@ static int write_files(void) {
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
- if (fchmod(fileno(shadow), 0000) < 0) {
|
||||
- r = -errno;
|
||||
- goto finish;
|
||||
- }
|
||||
-
|
||||
original = fopen(shadow_path, "re");
|
||||
if (original) {
|
||||
struct spwd *sp;
|
||||
|
||||
+ if (fstat(fileno(original), &st) < 0 ||
|
||||
+ fchmod(fileno(shadow), st.st_mode & 07777) < 0 ||
|
||||
+ fchown(fileno(shadow), st.st_uid, st.st_gid) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
+ }
|
||||
+
|
||||
errno = 0;
|
||||
while ((sp = fgetspent(original))) {
|
||||
|
||||
@@ -629,6 +647,9 @@ static int write_files(void) {
|
||||
} else if (errno != ENOENT) {
|
||||
r = -errno;
|
||||
goto finish;
|
||||
+ } else if (fchmod(fileno(shadow), 0000) < 0) {
|
||||
+ r = -errno;
|
||||
+ goto finish;
|
||||
}
|
||||
|
||||
lstchg = (long) (now(CLOCK_REALTIME) / USEC_PER_DAY);
|
|
@ -1,139 +0,0 @@
|
|||
From 28849dbadb7cd127f7f89e8892ec94c6a05070da Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:22:34 +0200
|
||||
Subject: [PATCH] service,strv: introduce strv_find_startswith() and make use
|
||||
of it
|
||||
|
||||
Unlike strv_find_prefix() the new call will return a pointer to the
|
||||
suffix of the item we found, instead of the whole item. This is more
|
||||
closer inline with what startswith() does, and allows us to simplify a
|
||||
couple of invocations.
|
||||
---
|
||||
src/core/service.c | 44 +++++++++++++++++++++-----------------------
|
||||
src/shared/strv.c | 17 +++++++++++++++++
|
||||
src/shared/strv.h | 1 +
|
||||
3 files changed, 39 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index fc952e848f..262a40cc8b 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -2526,12 +2526,13 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
||||
}
|
||||
|
||||
/* Interpret MAINPID= */
|
||||
- e = strv_find_prefix(tags, "MAINPID=");
|
||||
+ e = strv_find_startswith(tags, "MAINPID=");
|
||||
if (e && IN_SET(s->state, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD)) {
|
||||
- if (parse_pid(e + 8, &pid) < 0)
|
||||
+ if (parse_pid(e, &pid) < 0)
|
||||
log_warning_unit(u->id, "Failed to parse MAINPID= field in notification message: %s", e);
|
||||
else {
|
||||
- log_debug_unit(u->id, "%s: got %s", u->id, e);
|
||||
+ log_debug_unit(u->id, "%s: got MAINPID=%s", u->id, e);
|
||||
+
|
||||
service_set_main_pid(s, pid);
|
||||
unit_watch_pid(UNIT(s), pid);
|
||||
notify_dbus = true;
|
||||
@@ -2546,44 +2547,41 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
||||
}
|
||||
|
||||
/* Interpret STATUS= */
|
||||
- e = strv_find_prefix(tags, "STATUS=");
|
||||
+ e = strv_find_startswith(tags, "STATUS=");
|
||||
if (e) {
|
||||
- char *t;
|
||||
+ _cleanup_free_ char *t = NULL;
|
||||
|
||||
- if (e[7]) {
|
||||
- if (!utf8_is_valid(e+7)) {
|
||||
+ if (!isempty(e)) {
|
||||
+ if (!utf8_is_valid(e))
|
||||
log_warning_unit(u->id, "Status message in notification is not UTF-8 clean.");
|
||||
- return;
|
||||
- }
|
||||
+ else {
|
||||
+ log_debug_unit(u->id, "%s: got STATUS=%s", u->id, e);
|
||||
|
||||
- log_debug_unit(u->id, "%s: got %s", u->id, e);
|
||||
-
|
||||
- t = strdup(e+7);
|
||||
- if (!t) {
|
||||
- log_oom();
|
||||
- return;
|
||||
+ t = strdup(e);
|
||||
+ if (!t)
|
||||
+ log_oom();
|
||||
}
|
||||
-
|
||||
- } else
|
||||
- t = NULL;
|
||||
+ }
|
||||
|
||||
if (!streq_ptr(s->status_text, t)) {
|
||||
+
|
||||
free(s->status_text);
|
||||
s->status_text = t;
|
||||
+ t = NULL;
|
||||
+
|
||||
notify_dbus = true;
|
||||
- } else
|
||||
- free(t);
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Interpret ERRNO= */
|
||||
- e = strv_find_prefix(tags, "ERRNO=");
|
||||
+ e = strv_find_startswith(tags, "ERRNO=");
|
||||
if (e) {
|
||||
int status_errno;
|
||||
|
||||
- if (safe_atoi(e + 6, &status_errno) < 0 || status_errno < 0)
|
||||
+ if (safe_atoi(e, &status_errno) < 0 || status_errno < 0)
|
||||
log_warning_unit(u->id, "Failed to parse ERRNO= field in notification message: %s", e);
|
||||
else {
|
||||
- log_debug_unit(u->id, "%s: got %s", u->id, e);
|
||||
+ log_debug_unit(u->id, "%s: got ERRNO=%s", u->id, e);
|
||||
|
||||
if (s->status_errno != status_errno) {
|
||||
s->status_errno = status_errno;
|
||||
diff --git a/src/shared/strv.c b/src/shared/strv.c
|
||||
index 6448f3170f..0df978d23b 100644
|
||||
--- a/src/shared/strv.c
|
||||
+++ b/src/shared/strv.c
|
||||
@@ -52,6 +52,23 @@ char *strv_find_prefix(char **l, const char *name) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+char *strv_find_startswith(char **l, const char *name) {
|
||||
+ char **i, *e;
|
||||
+
|
||||
+ assert(name);
|
||||
+
|
||||
+ /* Like strv_find_prefix, but actually returns only the
|
||||
+ * suffix, not the whole item */
|
||||
+
|
||||
+ STRV_FOREACH(i, l) {
|
||||
+ e = startswith(*i, name);
|
||||
+ if (e)
|
||||
+ return e;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
void strv_free(char **l) {
|
||||
char **k;
|
||||
|
||||
diff --git a/src/shared/strv.h b/src/shared/strv.h
|
||||
index ee55c148aa..9c9633c515 100644
|
||||
--- a/src/shared/strv.h
|
||||
+++ b/src/shared/strv.h
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
char *strv_find(char **l, const char *name) _pure_;
|
||||
char *strv_find_prefix(char **l, const char *name) _pure_;
|
||||
+char *strv_find_startswith(char **l, const char *name) _pure_;
|
||||
|
||||
void strv_free(char **l);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
|
|
@ -0,0 +1,23 @@
|
|||
From 514a189346af541c31687dd9285afb997a26313e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 28 Oct 2014 12:36:17 -0400
|
||||
Subject: [PATCH] snapshot: return error when snapshot exists
|
||||
|
||||
(cherry picked from commit 7cabba07745b388497e8c0fc19b61984167fd474)
|
||||
---
|
||||
src/core/snapshot.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/snapshot.c b/src/core/snapshot.c
|
||||
index 5eed615a15..c2678cbe6e 100644
|
||||
--- a/src/core/snapshot.c
|
||||
+++ b/src/core/snapshot.c
|
||||
@@ -208,7 +208,7 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, sd_bus_error *e,
|
||||
return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s lacks snapshot suffix.", name);
|
||||
|
||||
if (manager_get_unit(m, name))
|
||||
- sd_bus_error_setf(e, BUS_ERROR_UNIT_EXISTS, "Snapshot %s exists already.", name);
|
||||
+ return sd_bus_error_setf(e, BUS_ERROR_UNIT_EXISTS, "Snapshot %s exists already.", name);
|
||||
|
||||
} else {
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
From 55836941ff642d42403921fa9d5fd2f8376ae722 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:51:44 +0200
|
||||
Subject: [PATCH] manager: reuse sockaddr_union instead of redefining our own
|
||||
version of it
|
||||
|
||||
---
|
||||
src/core/manager.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index 445461b6b9..e488aba5f8 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -527,13 +527,10 @@ static int manager_setup_notify(Manager *m) {
|
||||
|
||||
if (m->notify_fd < 0) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
- union {
|
||||
- struct sockaddr sa;
|
||||
- struct sockaddr_un un;
|
||||
- } sa = {
|
||||
+ union sockaddr_union sa = {
|
||||
.sa.sa_family = AF_UNIX,
|
||||
};
|
||||
- int one = 1;
|
||||
+ static const int one = 1;
|
||||
|
||||
/* First free all secondary fields */
|
||||
free(m->notify_socket);
|
|
@ -0,0 +1,30 @@
|
|||
From 83b7b5f5db1e251d0ddc6c60bf4b32639ea9f49f Mon Sep 17 00:00:00 2001
|
||||
From: Dan Williams <dcbw@redhat.com>
|
||||
Date: Thu, 30 Oct 2014 14:23:00 -0500
|
||||
Subject: [PATCH] sd-dhcp-client: clean up raw socket sd_event_source when
|
||||
creating new UDP socket
|
||||
|
||||
The raw socket sd_event_source used for DHCP server solicitations
|
||||
was simply dropped on the floor when creating the new UDP socket
|
||||
after a lease has been acquired. Clean it up properly so we're
|
||||
not still listening and responding to events on it.
|
||||
|
||||
(cherry picked from commit affaa94fc38a980a70534f70f6a6c58a4129b062)
|
||||
---
|
||||
src/libsystemd-network/sd-dhcp-client.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
|
||||
index 0eba4c379d..1f7f238ca0 100644
|
||||
--- a/src/libsystemd-network/sd-dhcp-client.c
|
||||
+++ b/src/libsystemd-network/sd-dhcp-client.c
|
||||
@@ -1269,6 +1269,9 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
|
||||
if (r >= 0) {
|
||||
client->timeout_resend =
|
||||
sd_event_source_unref(client->timeout_resend);
|
||||
+ client->receive_message =
|
||||
+ sd_event_source_unref(client->receive_message);
|
||||
+ client->fd = asynchronous_close(client->fd);
|
||||
|
||||
if (IN_SET(client->state, DHCP_STATE_REQUESTING,
|
||||
DHCP_STATE_REBOOTING))
|
|
@ -1,99 +0,0 @@
|
|||
From 70af4d17dafe81acc96f71f4ec06fbea7386bc38 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 16:52:41 +0200
|
||||
Subject: [PATCH] manager: don#t dispatch sd_notify() messages and SIGCHLD
|
||||
multiple times to the same units
|
||||
|
||||
---
|
||||
src/core/manager.c | 44 +++++++++++++++++++++++---------------------
|
||||
1 file changed, 23 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index e488aba5f8..c91ece116f 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -562,7 +562,7 @@ static int manager_setup_notify(Manager *m) {
|
||||
strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
|
||||
r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
|
||||
if (r < 0) {
|
||||
- log_error("bind(@%s) failed: %m", sa.un.sun_path+1);
|
||||
+ log_error("bind(%s) failed: %m", sa.un.sun_path);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@@ -1398,7 +1398,7 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
|
||||
.msg_controllen = sizeof(control),
|
||||
};
|
||||
struct ucred *ucred;
|
||||
- Unit *u;
|
||||
+ Unit *u1, *u2, *u3;
|
||||
|
||||
n = recvmsg(m->notify_fd, &msghdr, MSG_DONTWAIT);
|
||||
if (n <= 0) {
|
||||
@@ -1424,21 +1424,23 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
|
||||
assert((size_t) n < sizeof(buf));
|
||||
buf[n] = 0;
|
||||
|
||||
- u = manager_get_unit_by_pid(m, ucred->pid);
|
||||
- if (u) {
|
||||
- manager_invoke_notify_message(m, u, ucred->pid, buf, n);
|
||||
+ /* Notify every unit that might be interested, but try
|
||||
+ * to avoid notifying the same one multiple times. */
|
||||
+ u1 = manager_get_unit_by_pid(m, ucred->pid);
|
||||
+ if (u1) {
|
||||
+ manager_invoke_notify_message(m, u1, ucred->pid, buf, n);
|
||||
found = true;
|
||||
}
|
||||
|
||||
- u = hashmap_get(m->watch_pids1, LONG_TO_PTR(ucred->pid));
|
||||
- if (u) {
|
||||
- manager_invoke_notify_message(m, u, ucred->pid, buf, n);
|
||||
+ u2 = hashmap_get(m->watch_pids1, LONG_TO_PTR(ucred->pid));
|
||||
+ if (u2 && u2 != u1) {
|
||||
+ manager_invoke_notify_message(m, u2, ucred->pid, buf, n);
|
||||
found = true;
|
||||
}
|
||||
|
||||
- u = hashmap_get(m->watch_pids2, LONG_TO_PTR(ucred->pid));
|
||||
- if (u) {
|
||||
- manager_invoke_notify_message(m, u, ucred->pid, buf, n);
|
||||
+ u3 = hashmap_get(m->watch_pids2, LONG_TO_PTR(ucred->pid));
|
||||
+ if (u3 && u3 != u2 && u3 != u1) {
|
||||
+ manager_invoke_notify_message(m, u3, ucred->pid, buf, n);
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -1485,7 +1487,7 @@ static int manager_dispatch_sigchld(Manager *m) {
|
||||
|
||||
if (si.si_code == CLD_EXITED || si.si_code == CLD_KILLED || si.si_code == CLD_DUMPED) {
|
||||
_cleanup_free_ char *name = NULL;
|
||||
- Unit *u;
|
||||
+ Unit *u1, *u2, *u3;
|
||||
|
||||
get_process_comm(si.si_pid, &name);
|
||||
|
||||
@@ -1499,15 +1501,15 @@ static int manager_dispatch_sigchld(Manager *m) {
|
||||
|
||||
/* And now figure out the unit this belongs
|
||||
* to, it might be multiple... */
|
||||
- u = manager_get_unit_by_pid(m, si.si_pid);
|
||||
- if (u)
|
||||
- invoke_sigchld_event(m, u, &si);
|
||||
- u = hashmap_get(m->watch_pids1, LONG_TO_PTR(si.si_pid));
|
||||
- if (u)
|
||||
- invoke_sigchld_event(m, u, &si);
|
||||
- u = hashmap_get(m->watch_pids2, LONG_TO_PTR(si.si_pid));
|
||||
- if (u)
|
||||
- invoke_sigchld_event(m, u, &si);
|
||||
+ u1 = manager_get_unit_by_pid(m, si.si_pid);
|
||||
+ if (u1)
|
||||
+ invoke_sigchld_event(m, u1, &si);
|
||||
+ u2 = hashmap_get(m->watch_pids1, LONG_TO_PTR(si.si_pid));
|
||||
+ if (u2 && u2 != u1)
|
||||
+ invoke_sigchld_event(m, u2, &si);
|
||||
+ u3 = hashmap_get(m->watch_pids2, LONG_TO_PTR(si.si_pid));
|
||||
+ if (u3 && u3 != u2 && u3 != u1)
|
||||
+ invoke_sigchld_event(m, u3, &si);
|
||||
}
|
||||
|
||||
/* And now, we actually reap the zombie. */
|
|
@ -0,0 +1,37 @@
|
|||
From de2315fd8b3e2712b5f5790c24182e2d61eb6116 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Reisner <dreisner@archlinux.org>
|
||||
Date: Thu, 30 Oct 2014 20:12:05 -0400
|
||||
Subject: [PATCH] shared/install: avoid prematurely rejecting "missing" units
|
||||
|
||||
f7101b7368df copied some logic to prevent enabling masked units, but
|
||||
also added a check which causes attempts to enable templated units to
|
||||
fail. Since we know the logic beyond this check will properly handle
|
||||
units which truly do not exist, we can rely on the unit file state
|
||||
comparison to suffice for expressing the intent of f7101b7368df.
|
||||
|
||||
ref: https://bugs.archlinux.org/task/42616
|
||||
(cherry picked from commit 0ffce503cd6e5a5ff5ba5cd1cc23684cfb8bb9e3)
|
||||
---
|
||||
src/shared/install.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 035b44cc52..cab93e8dc6 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -1620,12 +1620,10 @@ int unit_file_enable(
|
||||
STRV_FOREACH(i, files) {
|
||||
UnitFileState state;
|
||||
|
||||
+ /* We only want to know if this unit is masked, so we ignore
|
||||
+ * errors from unit_file_get_state, deferring other checks.
|
||||
+ * This allows templated units to be enabled on the fly. */
|
||||
state = unit_file_get_state(scope, root_dir, *i);
|
||||
- if (state < 0) {
|
||||
- log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
|
||||
- return state;
|
||||
- }
|
||||
-
|
||||
if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
|
||||
log_error("Failed to enable unit: Unit %s is masked", *i);
|
||||
return -ENOTSUP;
|
|
@ -1,471 +0,0 @@
|
|||
From 308d72dc1e2106f94ae637e2ea510e8d466d2af1 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 17:03:15 +0200
|
||||
Subject: [PATCH] core: allow informing systemd about service status changes
|
||||
with RELOADING=1 and STOPPING=1 sd_notify() messages
|
||||
|
||||
---
|
||||
man/sd_notify.xml | 93 ++++++++++++++++++++++++++++---------------
|
||||
src/core/service.c | 105 +++++++++++++++++++++++++++++++++++++++++++------
|
||||
src/core/service.h | 13 ++++++
|
||||
src/test/test-daemon.c | 22 +++++++++--
|
||||
4 files changed, 185 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/man/sd_notify.xml b/man/sd_notify.xml
|
||||
index 6bf8230763..fbb882dfd2 100644
|
||||
--- a/man/sd_notify.xml
|
||||
+++ b/man/sd_notify.xml
|
||||
@@ -46,7 +46,7 @@
|
||||
<refnamediv>
|
||||
<refname>sd_notify</refname>
|
||||
<refname>sd_notifyf</refname>
|
||||
- <refpurpose>Notify service manager about start-up completion and other daemon status changes</refpurpose>
|
||||
+ <refpurpose>Notify service manager about start-up completion and other service status changes</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
@@ -70,12 +70,12 @@
|
||||
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
- <para><function>sd_notify()</function> shall be called
|
||||
- by a daemon to notify the init system about status
|
||||
- changes. It can be used to send arbitrary information,
|
||||
- encoded in an environment-block-like string. Most
|
||||
- importantly it can be used for start-up completion
|
||||
- notification.</para>
|
||||
+ <para><function>sd_notify()</function> may be called
|
||||
+ by a service to notify the service manager about
|
||||
+ state changes. It can be used to send arbitrary
|
||||
+ information, encoded in an environment-block-like
|
||||
+ string. Most importantly it can be used for start-up
|
||||
+ completion notification.</para>
|
||||
|
||||
<para>If the <parameter>unset_environment</parameter>
|
||||
parameter is non-zero, <function>sd_notify()</function>
|
||||
@@ -99,58 +99,87 @@
|
||||
<varlistentry>
|
||||
<term>READY=1</term>
|
||||
|
||||
- <listitem><para>Tells the init system
|
||||
- that daemon startup is finished. This
|
||||
- is only used by systemd if the service
|
||||
- definition file has Type=notify
|
||||
- set. The passed argument is a boolean
|
||||
- "1" or "0". Since there is little
|
||||
+ <listitem><para>Tells the service
|
||||
+ manager that service startup is
|
||||
+ finished. This is only used by systemd
|
||||
+ if the service definition file has
|
||||
+ Type=notify set. Since there is little
|
||||
value in signaling non-readiness, the
|
||||
- only value daemons should send is
|
||||
- "READY=1".</para></listitem>
|
||||
+ only value services should send is
|
||||
+ <literal>READY=1</literal>
|
||||
+ (i.e. <literal>READY=0</literal> is
|
||||
+ not defined).</para></listitem>
|
||||
+ </varlistentry>
|
||||
+
|
||||
+ <varlistentry>
|
||||
+ <term>RELOADING=1</term>
|
||||
+
|
||||
+ <listitem><para>Tells the service manager
|
||||
+ that the service is reloading its
|
||||
+ configuration. This is useful to allow
|
||||
+ the service manager to track the service's
|
||||
+ internal state, and present it to the
|
||||
+ user. Note that a service that sends
|
||||
+ this notification must also send a
|
||||
+ <literal>READY=1</literal>
|
||||
+ notification when it completed
|
||||
+ reloading its
|
||||
+ configuration.</para></listitem>
|
||||
+ </varlistentry>
|
||||
+
|
||||
+ <varlistentry>
|
||||
+ <term>STOPPING=1</term>
|
||||
+
|
||||
+ <listitem><para>Tells the service manager
|
||||
+ that the service is beginning its
|
||||
+ shutdown. This is useful to allow the
|
||||
+ service manager to track the service's
|
||||
+ internal state, and present it to the
|
||||
+ user.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>STATUS=...</term>
|
||||
|
||||
<listitem><para>Passes a single-line
|
||||
- status string back to the init system
|
||||
- that describes the daemon state. This
|
||||
+ UTF-8 status string back to the service manager
|
||||
+ that describes the service state. This
|
||||
is free-form and can be used for
|
||||
various purposes: general state
|
||||
feedback, fsck-like programs could
|
||||
pass completion percentages and
|
||||
failing programs could pass a human
|
||||
readable error message. Example:
|
||||
- "STATUS=Completed 66% of file system
|
||||
- check..."</para></listitem>
|
||||
+ <literal>STATUS=Completed 66% of file
|
||||
+ system
|
||||
+ check...</literal></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>ERRNO=...</term>
|
||||
|
||||
- <listitem><para>If a daemon fails, the
|
||||
+ <listitem><para>If a service fails, the
|
||||
errno-style error code, formatted as
|
||||
- string. Example: "ERRNO=2" for
|
||||
+ string. Example: <literal>ERRNO=2</literal> for
|
||||
ENOENT.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>BUSERROR=...</term>
|
||||
|
||||
- <listitem><para>If a daemon fails, the
|
||||
+ <listitem><para>If a service fails, the
|
||||
D-Bus error-style error code. Example:
|
||||
- "BUSERROR=org.freedesktop.DBus.Error.TimedOut"</para></listitem>
|
||||
+ <literal>BUSERROR=org.freedesktop.DBus.Error.TimedOut</literal></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>MAINPID=...</term>
|
||||
|
||||
<listitem><para>The main pid of the
|
||||
- daemon, in case the init system did
|
||||
+ service, in case the service manager did
|
||||
not fork off the process
|
||||
itself. Example:
|
||||
- "MAINPID=4711"</para></listitem>
|
||||
+ <literal>MAINPID=4711</literal></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -183,7 +212,7 @@
|
||||
clashes.</para>
|
||||
|
||||
<para>Note that systemd will accept status data sent
|
||||
- from a daemon only if the
|
||||
+ from a service only if the
|
||||
<varname>NotifyAccess=</varname> option is correctly
|
||||
set in the service definition file. See
|
||||
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
@@ -222,7 +251,7 @@
|
||||
<varname>$NOTIFY_SOCKET</varname> is <literal>@</literal>, the string is
|
||||
understood as Linux abstract namespace socket. The
|
||||
datagram is accompanied by the process credentials of
|
||||
- the sending daemon, using SCM_CREDENTIALS.</para>
|
||||
+ the sending service, using SCM_CREDENTIALS.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -232,7 +261,7 @@
|
||||
<varlistentry>
|
||||
<term><varname>$NOTIFY_SOCKET</varname></term>
|
||||
|
||||
- <listitem><para>Set by the init system
|
||||
+ <listitem><para>Set by the service manager
|
||||
for supervised processes for status
|
||||
and start-up completion
|
||||
notification. This environment variable
|
||||
@@ -249,9 +278,9 @@
|
||||
<example>
|
||||
<title>Start-up Notification</title>
|
||||
|
||||
- <para>When a daemon finished starting up, it
|
||||
+ <para>When a service finished starting up, it
|
||||
might issue the following call to notify
|
||||
- the init system:</para>
|
||||
+ the service manager:</para>
|
||||
|
||||
<programlisting>sd_notify(0, "READY=1");</programlisting>
|
||||
</example>
|
||||
@@ -259,7 +288,7 @@
|
||||
<example>
|
||||
<title>Extended Start-up Notification</title>
|
||||
|
||||
- <para>A daemon could send the following after
|
||||
+ <para>A service could send the following after
|
||||
completing initialization:</para>
|
||||
|
||||
<programlisting>sd_notifyf(0, "READY=1\n"
|
||||
@@ -271,7 +300,7 @@
|
||||
<example>
|
||||
<title>Error Cause Notification</title>
|
||||
|
||||
- <para>A daemon could send the following shortly before exiting, on failure</para>
|
||||
+ <para>A service could send the following shortly before exiting, on failure</para>
|
||||
|
||||
<programlisting>sd_notifyf(0, "STATUS=Failed to start up: %s\n"
|
||||
"ERRNO=%i",
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 262a40cc8b..3221938793 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -92,6 +92,7 @@ static int service_dispatch_timer(sd_event_source *source, usec_t usec, void *us
|
||||
static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void *userdata);
|
||||
|
||||
static void service_enter_signal(Service *s, ServiceState state, ServiceResult f);
|
||||
+static void service_enter_reload_by_notify(Service *s);
|
||||
|
||||
static void service_init(Unit *u) {
|
||||
Service *s = SERVICE(u);
|
||||
@@ -473,7 +474,8 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
"%sGuessMainPID: %s\n"
|
||||
"%sType: %s\n"
|
||||
"%sRestart: %s\n"
|
||||
- "%sNotifyAccess: %s\n",
|
||||
+ "%sNotifyAccess: %s\n"
|
||||
+ "%sNotifyState: %s\n",
|
||||
prefix, service_state_to_string(s->state),
|
||||
prefix, service_result_to_string(s->result),
|
||||
prefix, service_result_to_string(s->reload_result),
|
||||
@@ -483,7 +485,8 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
|
||||
prefix, yes_no(s->guess_main_pid),
|
||||
prefix, service_type_to_string(s->type),
|
||||
prefix, service_restart_to_string(s->restart),
|
||||
- prefix, notify_access_to_string(s->notify_access));
|
||||
+ prefix, notify_access_to_string(s->notify_access),
|
||||
+ prefix, notify_state_to_string(s->notify_state));
|
||||
|
||||
if (s->control_pid > 0)
|
||||
fprintf(f,
|
||||
@@ -1176,6 +1179,17 @@ fail:
|
||||
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);
|
||||
}
|
||||
|
||||
+static void service_enter_stop_by_notify(Service *s) {
|
||||
+ assert(s);
|
||||
+
|
||||
+ unit_watch_all_pids(UNIT(s));
|
||||
+
|
||||
+ if (s->timeout_stop_usec > 0)
|
||||
+ service_arm_timer(s, s->timeout_stop_usec);
|
||||
+
|
||||
+ service_set_state(s, SERVICE_STOP);
|
||||
+}
|
||||
+
|
||||
static void service_enter_stop(Service *s, ServiceResult f) {
|
||||
int r;
|
||||
|
||||
@@ -1226,9 +1240,18 @@ static void service_enter_running(Service *s, ServiceResult f) {
|
||||
cgroup_ok = cgroup_good(s);
|
||||
|
||||
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
|
||||
- (s->bus_name_good || s->type != SERVICE_DBUS))
|
||||
- service_set_state(s, SERVICE_RUNNING);
|
||||
- else if (s->remain_after_exit)
|
||||
+ (s->bus_name_good || s->type != SERVICE_DBUS)) {
|
||||
+
|
||||
+ /* If there are any queued up sd_notify()
|
||||
+ * notifications, process them now */
|
||||
+ if (s->notify_state == NOTIFY_RELOADING)
|
||||
+ service_enter_reload_by_notify(s);
|
||||
+ else if (s->notify_state == NOTIFY_STOPPING)
|
||||
+ service_enter_stop_by_notify(s);
|
||||
+ else
|
||||
+ service_set_state(s, SERVICE_RUNNING);
|
||||
+
|
||||
+ } else if (s->remain_after_exit)
|
||||
service_set_state(s, SERVICE_EXITED);
|
||||
else
|
||||
service_enter_stop(s, SERVICE_SUCCESS);
|
||||
@@ -1433,12 +1456,19 @@ static void service_enter_restart(Service *s) {
|
||||
return;
|
||||
|
||||
fail:
|
||||
- log_warning_unit(UNIT(s)->id,
|
||||
- "%s failed to schedule restart job: %s",
|
||||
- UNIT(s)->id, bus_error_message(&error, -r));
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed to schedule restart job: %s", UNIT(s)->id, bus_error_message(&error, -r));
|
||||
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
|
||||
}
|
||||
|
||||
+static void service_enter_reload_by_notify(Service *s) {
|
||||
+ assert(s);
|
||||
+
|
||||
+ if (s->timeout_start_usec > 0)
|
||||
+ service_arm_timer(s, s->timeout_start_usec);
|
||||
+
|
||||
+ service_set_state(s, SERVICE_RELOAD);
|
||||
+}
|
||||
+
|
||||
static void service_enter_reload(Service *s) {
|
||||
int r;
|
||||
|
||||
@@ -1667,6 +1697,8 @@ static int service_start(Unit *u) {
|
||||
s->status_text = NULL;
|
||||
s->status_errno = 0;
|
||||
|
||||
+ s->notify_state = NOTIFY_UNKNOWN;
|
||||
+
|
||||
service_enter_start_pre(s);
|
||||
return 0;
|
||||
}
|
||||
@@ -2504,13 +2536,15 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
|
||||
|
||||
static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
||||
Service *s = SERVICE(u);
|
||||
- const char *e;
|
||||
+ _cleanup_free_ char *cc = NULL;
|
||||
bool notify_dbus = false;
|
||||
+ const char *e;
|
||||
|
||||
assert(u);
|
||||
|
||||
- log_debug_unit(u->id, "%s: Got notification message from PID "PID_FMT" (%s...)",
|
||||
- u->id, pid, tags && *tags ? tags[0] : "(empty)");
|
||||
+ cc = strv_join(tags, ", ");
|
||||
+ log_debug_unit(u->id, "%s: Got notification message from PID "PID_FMT" (%s)",
|
||||
+ u->id, pid, isempty(cc) ? "n/a" : cc);
|
||||
|
||||
if (s->notify_access == NOTIFY_NONE) {
|
||||
log_warning_unit(u->id, "%s: Got notification message from PID "PID_FMT", but reception is disabled.", u->id, pid);
|
||||
@@ -2539,10 +2573,46 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Interpret RELOADING= */
|
||||
+ if (strv_find(tags, "RELOADING=1")) {
|
||||
+
|
||||
+ log_debug_unit(u->id, "%s: got RELOADING=1", u->id);
|
||||
+ s->notify_state = NOTIFY_RELOADING;
|
||||
+
|
||||
+ if (s->state == SERVICE_RUNNING)
|
||||
+ service_enter_reload_by_notify(s);
|
||||
+
|
||||
+ notify_dbus = true;
|
||||
+ }
|
||||
+
|
||||
/* Interpret READY= */
|
||||
- if (s->type == SERVICE_NOTIFY && s->state == SERVICE_START && strv_find(tags, "READY=1")) {
|
||||
+ if (strv_find(tags, "READY=1")) {
|
||||
+
|
||||
log_debug_unit(u->id, "%s: got READY=1", u->id);
|
||||
- service_enter_start_post(s);
|
||||
+ s->notify_state = NOTIFY_READY;
|
||||
+
|
||||
+ /* Type=notify services inform us about completed
|
||||
+ * initialization with READY=1 */
|
||||
+ if (s->type == SERVICE_NOTIFY && s->state == SERVICE_START)
|
||||
+ service_enter_start_post(s);
|
||||
+
|
||||
+ /* Sending READY=1 while we are reloading informs us
|
||||
+ * that the reloading is complete */
|
||||
+ if (s->state == SERVICE_RELOAD && s->control_pid == 0)
|
||||
+ service_enter_running(s, SERVICE_SUCCESS);
|
||||
+
|
||||
+ notify_dbus = true;
|
||||
+ }
|
||||
+
|
||||
+ /* Interpret STOPPING= */
|
||||
+ if (strv_find(tags, "STOPPING=1")) {
|
||||
+
|
||||
+ log_debug_unit(u->id, "%s: got STOPPING=1", u->id);
|
||||
+ s->notify_state = NOTIFY_STOPPING;
|
||||
+
|
||||
+ if (s->state == SERVICE_RUNNING)
|
||||
+ service_enter_stop_by_notify(s);
|
||||
+
|
||||
notify_dbus = true;
|
||||
}
|
||||
|
||||
@@ -2798,6 +2868,15 @@ static const char* const notify_access_table[_NOTIFY_ACCESS_MAX] = {
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(notify_access, NotifyAccess);
|
||||
|
||||
+static const char* const notify_state_table[_NOTIFY_STATE_MAX] = {
|
||||
+ [NOTIFY_UNKNOWN] = "unknown",
|
||||
+ [NOTIFY_READY] = "ready",
|
||||
+ [NOTIFY_RELOADING] = "reloading",
|
||||
+ [NOTIFY_STOPPING] = "stopping",
|
||||
+};
|
||||
+
|
||||
+DEFINE_STRING_TABLE_LOOKUP(notify_state, NotifyState);
|
||||
+
|
||||
static const char* const service_result_table[_SERVICE_RESULT_MAX] = {
|
||||
[SERVICE_SUCCESS] = "success",
|
||||
[SERVICE_FAILURE_RESOURCES] = "resources",
|
||||
diff --git a/src/core/service.h b/src/core/service.h
|
||||
index 686cf4b0bd..0227321d99 100644
|
||||
--- a/src/core/service.h
|
||||
+++ b/src/core/service.h
|
||||
@@ -91,6 +91,15 @@ typedef enum NotifyAccess {
|
||||
_NOTIFY_ACCESS_INVALID = -1
|
||||
} NotifyAccess;
|
||||
|
||||
+typedef enum NotifyState {
|
||||
+ NOTIFY_UNKNOWN,
|
||||
+ NOTIFY_READY,
|
||||
+ NOTIFY_RELOADING,
|
||||
+ NOTIFY_STOPPING,
|
||||
+ _NOTIFY_STATE_MAX,
|
||||
+ _NOTIFY_STATE_INVALID = -1
|
||||
+} NotifyState;
|
||||
+
|
||||
typedef enum ServiceResult {
|
||||
SERVICE_SUCCESS,
|
||||
SERVICE_FAILURE_RESOURCES,
|
||||
@@ -196,6 +205,7 @@ struct Service {
|
||||
PathSpec *pid_file_pathspec;
|
||||
|
||||
NotifyAccess notify_access;
|
||||
+ NotifyState notify_state;
|
||||
};
|
||||
|
||||
extern const UnitVTable service_vtable;
|
||||
@@ -219,6 +229,9 @@ ServiceExecCommand service_exec_command_from_string(const char *s) _pure_;
|
||||
const char* notify_access_to_string(NotifyAccess i) _const_;
|
||||
NotifyAccess notify_access_from_string(const char *s) _pure_;
|
||||
|
||||
+const char* notify_state_to_string(NotifyState i) _const_;
|
||||
+NotifyState notify_state_from_string(const char *s) _pure_;
|
||||
+
|
||||
const char* service_result_to_string(ServiceResult i) _const_;
|
||||
ServiceResult service_result_from_string(const char *s) _pure_;
|
||||
|
||||
diff --git a/src/test/test-daemon.c b/src/test/test-daemon.c
|
||||
index bcc049b325..7e0ac754d1 100644
|
||||
--- a/src/test/test-daemon.c
|
||||
+++ b/src/test/test-daemon.c
|
||||
@@ -25,13 +25,29 @@
|
||||
|
||||
int main(int argc, char*argv[]) {
|
||||
|
||||
- sd_notify(0, "STATUS=Starting up");
|
||||
+ sd_notify(0,
|
||||
+ "STATUS=Starting up");
|
||||
+ sleep(5);
|
||||
+
|
||||
+ sd_notify(0,
|
||||
+ "STATUS=Running\n"
|
||||
+ "READY=1");
|
||||
+ sleep(5);
|
||||
+
|
||||
+ sd_notify(0,
|
||||
+ "STATUS=Reloading\n"
|
||||
+ "RELOADING=1");
|
||||
sleep(5);
|
||||
+
|
||||
sd_notify(0,
|
||||
"STATUS=Running\n"
|
||||
"READY=1");
|
||||
- sleep(10);
|
||||
- sd_notify(0, "STATUS=Quitting");
|
||||
+ sleep(5);
|
||||
+
|
||||
+ sd_notify(0,
|
||||
+ "STATUS=Quitting\n"
|
||||
+ "STOPPING=1");
|
||||
+ sleep(5);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
From e268a9380de7c5848e6cd8a92b89d68d7eef2bd4 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 30 Oct 2014 20:53:23 +0100
|
||||
Subject: [PATCH] nspawn: don't make up -1 as error code
|
||||
|
||||
(cherry picked from commit fddbb89c46ea5d39e52e361b390ea34a06cbb67c)
|
||||
---
|
||||
src/nspawn/nspawn.c | 27 +++++++++++----------------
|
||||
1 file changed, 11 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index d88987a580..7e96efd425 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -2931,33 +2931,30 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
|
||||
}
|
||||
|
||||
switch (status.si_code) {
|
||||
+
|
||||
case CLD_EXITED:
|
||||
r = status.si_status;
|
||||
if (r == 0) {
|
||||
if (!arg_quiet)
|
||||
- log_debug("Container %s exited successfully.",
|
||||
- arg_machine);
|
||||
+ log_debug("Container %s exited successfully.", arg_machine);
|
||||
|
||||
*container = CONTAINER_TERMINATED;
|
||||
- } else {
|
||||
- log_error("Container %s failed with error code %i.",
|
||||
- arg_machine, status.si_status);
|
||||
- }
|
||||
+ } else
|
||||
+ log_error("Container %s failed with error code %i.", arg_machine, status.si_status);
|
||||
+
|
||||
break;
|
||||
|
||||
case CLD_KILLED:
|
||||
if (status.si_status == SIGINT) {
|
||||
if (!arg_quiet)
|
||||
- log_info("Container %s has been shut down.",
|
||||
- arg_machine);
|
||||
+ log_info("Container %s has been shut down.", arg_machine);
|
||||
|
||||
*container = CONTAINER_TERMINATED;
|
||||
r = 0;
|
||||
break;
|
||||
} else if (status.si_status == SIGHUP) {
|
||||
if (!arg_quiet)
|
||||
- log_info("Container %s is being rebooted.",
|
||||
- arg_machine);
|
||||
+ log_info("Container %s is being rebooted.", arg_machine);
|
||||
|
||||
*container = CONTAINER_REBOOTED;
|
||||
r = 0;
|
||||
@@ -2966,15 +2963,13 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
|
||||
/* CLD_KILLED fallthrough */
|
||||
|
||||
case CLD_DUMPED:
|
||||
- log_error("Container %s terminated by signal %s.",
|
||||
- arg_machine, signal_to_string(status.si_status));
|
||||
- r = -1;
|
||||
+ log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));
|
||||
+ r = -EIO;
|
||||
break;
|
||||
|
||||
default:
|
||||
- log_error("Container %s failed due to unknown reason.",
|
||||
- arg_machine);
|
||||
- r = -1;
|
||||
+ log_error("Container %s failed due to unknown reason.", arg_machine);
|
||||
+ r = -EIO;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
From af4ec4309e8f82aad87a8d574785c12f8763d5f8 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 17:19:28 +0200
|
||||
Subject: [PATCH] notify: send STOPPING=1 from our daemons
|
||||
|
||||
---
|
||||
src/bus-proxyd/bus-proxyd.c | 6 +++++-
|
||||
src/core/manager.c | 3 ++-
|
||||
src/initctl/initctl.c | 1 +
|
||||
src/journal-remote/journal-remote.c | 6 ++++--
|
||||
src/journal-remote/journal-upload.c | 5 ++++-
|
||||
src/journal/journald.c | 4 +++-
|
||||
src/login/logind.c | 1 +
|
||||
src/machine/machined.c | 1 +
|
||||
src/network/networkd.c | 1 +
|
||||
src/nspawn/nspawn.c | 8 +++++++-
|
||||
src/resolve/resolved.c | 4 +++-
|
||||
src/shutdownd/shutdownd.c | 1 +
|
||||
src/timesync/timesyncd.c | 8 ++++++--
|
||||
13 files changed, 39 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
|
||||
index d8d989b9b0..d35d7f63b2 100644
|
||||
--- a/src/bus-proxyd/bus-proxyd.c
|
||||
+++ b/src/bus-proxyd/bus-proxyd.c
|
||||
@@ -239,7 +239,7 @@ static int rename_service(sd_bus *a, sd_bus *b) {
|
||||
pid, p,
|
||||
uid, name,
|
||||
a->unique_name);
|
||||
- ;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1474,6 +1474,10 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
finish:
|
||||
+ sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
+ "STATUS=Shutting down.");
|
||||
+
|
||||
policy_free(&policy);
|
||||
strv_free(arg_configuration);
|
||||
free(arg_address);
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index c91ece116f..7401817844 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -2551,7 +2551,8 @@ void manager_check_finished(Manager *m) {
|
||||
bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
|
||||
|
||||
sd_notifyf(false,
|
||||
- "READY=1\nSTATUS=Startup finished in %s.",
|
||||
+ "READY=1\n"
|
||||
+ "STATUS=Startup finished in %s.",
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC));
|
||||
}
|
||||
|
||||
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
|
||||
index 0954e58afd..f1c2b8dfb4 100644
|
||||
--- a/src/initctl/initctl.c
|
||||
+++ b/src/initctl/initctl.c
|
||||
@@ -431,6 +431,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
fail:
|
||||
sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
"STATUS=Shutting down...");
|
||||
|
||||
server_done(&server);
|
||||
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
|
||||
index 7f422bfb37..1cc86aeaf3 100644
|
||||
--- a/src/journal-remote/journal-remote.c
|
||||
+++ b/src/journal-remote/journal-remote.c
|
||||
@@ -1530,10 +1530,12 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
- server_destroy(&s);
|
||||
+ sd_notifyf(false,
|
||||
+ "STOPPING=1\n"
|
||||
+ "STATUS=Shutting down after writing %" PRIu64 " entries...", s.event_count);
|
||||
log_info("Finishing after writing %" PRIu64 " entries", s.event_count);
|
||||
|
||||
- sd_notify(false, "STATUS=Shutting down...");
|
||||
+ server_destroy(&s);
|
||||
|
||||
free(arg_key);
|
||||
free(arg_cert);
|
||||
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
|
||||
index bdeeff6778..40c380aa9e 100644
|
||||
--- a/src/journal-remote/journal-upload.c
|
||||
+++ b/src/journal-remote/journal-upload.c
|
||||
@@ -818,7 +818,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
cleanup:
|
||||
- sd_notify(false, "STATUS=Shutting down...");
|
||||
+ sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
+ "STATUS=Shutting down...");
|
||||
+
|
||||
destroy_uploader(&u);
|
||||
|
||||
finish:
|
||||
diff --git a/src/journal/journald.c b/src/journal/journald.c
|
||||
index b1a0e25d0c..de40827d6a 100644
|
||||
--- a/src/journal/journald.c
|
||||
+++ b/src/journal/journald.c
|
||||
@@ -116,7 +116,9 @@ int main(int argc, char *argv[]) {
|
||||
server_driver_message(&server, SD_MESSAGE_JOURNAL_STOP, "Journal stopped");
|
||||
|
||||
finish:
|
||||
- sd_notify(false, "STATUS=Shutting down...");
|
||||
+ sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
+ "STATUS=Shutting down...");
|
||||
|
||||
server_done(&server);
|
||||
|
||||
diff --git a/src/login/logind.c b/src/login/logind.c
|
||||
index 006c56ae51..52e1c43a47 100644
|
||||
--- a/src/login/logind.c
|
||||
+++ b/src/login/logind.c
|
||||
@@ -1226,6 +1226,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
finish:
|
||||
sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
"STATUS=Shutting down...");
|
||||
|
||||
if (m)
|
||||
diff --git a/src/machine/machined.c b/src/machine/machined.c
|
||||
index 6160320127..f9d180d24a 100644
|
||||
--- a/src/machine/machined.c
|
||||
+++ b/src/machine/machined.c
|
||||
@@ -350,6 +350,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
finish:
|
||||
sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
"STATUS=Shutting down...");
|
||||
|
||||
if (m)
|
||||
diff --git a/src/network/networkd.c b/src/network/networkd.c
|
||||
index 665f4c4709..fdb80368d4 100644
|
||||
--- a/src/network/networkd.c
|
||||
+++ b/src/network/networkd.c
|
||||
@@ -125,6 +125,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
out:
|
||||
sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
"STATUS=Shutting down...");
|
||||
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index d01da45930..2c718557ee 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -3071,7 +3071,9 @@ int main(int argc, char *argv[]) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
- sd_notify(0, "READY=1");
|
||||
+ sd_notify(false,
|
||||
+ "READY=1\n"
|
||||
+ "STATUS=Container running.");
|
||||
|
||||
assert_se(sigemptyset(&mask) == 0);
|
||||
assert_se(sigemptyset(&mask_chld) == 0);
|
||||
@@ -3504,6 +3506,10 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
finish:
|
||||
+ sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
+ "STATUS=Terminating...");
|
||||
+
|
||||
loop_remove(loop_nr, &image_fd);
|
||||
|
||||
if (pid > 0)
|
||||
diff --git a/src/resolve/resolved.c b/src/resolve/resolved.c
|
||||
index 8235558585..88c3bcc591 100644
|
||||
--- a/src/resolve/resolved.c
|
||||
+++ b/src/resolve/resolved.c
|
||||
@@ -100,7 +100,9 @@ int main(int argc, char *argv[]) {
|
||||
sd_event_get_exit_code(m->event, &r);
|
||||
|
||||
finish:
|
||||
- sd_notify(false, "STATUS=Shutting down...");
|
||||
+ sd_notify(false,
|
||||
+ "STOPPIN=1\n"
|
||||
+ "STATUS=Shutting down...");
|
||||
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
diff --git a/src/shutdownd/shutdownd.c b/src/shutdownd/shutdownd.c
|
||||
index 92907497ed..99aa4b32b3 100644
|
||||
--- a/src/shutdownd/shutdownd.c
|
||||
+++ b/src/shutdownd/shutdownd.c
|
||||
@@ -456,6 +456,7 @@ finish:
|
||||
}
|
||||
|
||||
sd_notify(false,
|
||||
+ "STOPPING=\n"
|
||||
"STATUS=Exiting...");
|
||||
|
||||
return r;
|
||||
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
|
||||
index 351bfd0236..ee3bc99ae0 100644
|
||||
--- a/src/timesync/timesyncd.c
|
||||
+++ b/src/timesync/timesyncd.c
|
||||
@@ -132,7 +132,9 @@ int main(int argc, char *argv[]) {
|
||||
log_warning("Failed to parse configuration file: %s", strerror(-r));
|
||||
|
||||
log_debug("systemd-timesyncd running as pid %lu", (unsigned long) getpid());
|
||||
- sd_notify(false, "READY=1");
|
||||
+ sd_notify(false,
|
||||
+ "READY=1\n"
|
||||
+ "STATUS=Daemon is running");
|
||||
|
||||
if (network_is_online()) {
|
||||
r = manager_connect(m);
|
||||
@@ -153,7 +155,9 @@ int main(int argc, char *argv[]) {
|
||||
sd_event_get_exit_code(m->event, &r);
|
||||
|
||||
finish:
|
||||
- sd_notify(false, "STATUS=Shutting down...");
|
||||
+ sd_notify(false,
|
||||
+ "STOPPING=1\n"
|
||||
+ "STATUS=Shutting down...");
|
||||
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
From 6dc664b38675e2b763fa598e2ef8d466cbc93f43 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 31 Oct 2014 16:22:36 +0100
|
||||
Subject: [PATCH] units: don't order journal flushing afte remote-fs.target
|
||||
|
||||
Instead, only depend on the actual file systems we need.
|
||||
|
||||
This should solve dep loops on setups where remote-fs.target is moved
|
||||
into late boot.
|
||||
|
||||
(cherry picked from commit 919699ec301ea507edce4a619141ed22e789ac0d)
|
||||
---
|
||||
src/nspawn/nspawn.c | 38 ++++++++++++++--------------------
|
||||
units/systemd-journal-flush.service.in | 3 ++-
|
||||
2 files changed, 18 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index 7e96efd425..f332ade03e 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -2911,8 +2911,8 @@ static int change_uid_gid(char **_home) {
|
||||
* container argument.
|
||||
* > 0 : The program executed in the container terminated with an
|
||||
* error. The exit code of the program executed in the
|
||||
- * container is returned. No change is made to the container
|
||||
- * argument.
|
||||
+ * container is returned. The container argument has been set
|
||||
+ * to CONTAINER_TERMINATED.
|
||||
* 0 : The container is being rebooted, has been shut down or exited
|
||||
* successfully. The container argument has been set to either
|
||||
* CONTAINER_TERMINATED or CONTAINER_REBOOTED.
|
||||
@@ -2921,8 +2921,8 @@ static int change_uid_gid(char **_home) {
|
||||
* error is indicated by a non-zero value.
|
||||
*/
|
||||
static int wait_for_container(pid_t pid, ContainerStatus *container) {
|
||||
- int r;
|
||||
siginfo_t status;
|
||||
+ int r;
|
||||
|
||||
r = wait_for_terminate(pid, &status);
|
||||
if (r < 0) {
|
||||
@@ -2933,44 +2933,38 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
|
||||
switch (status.si_code) {
|
||||
|
||||
case CLD_EXITED:
|
||||
- r = status.si_status;
|
||||
- if (r == 0) {
|
||||
- if (!arg_quiet)
|
||||
- log_debug("Container %s exited successfully.", arg_machine);
|
||||
+ if (status.si_status == 0) {
|
||||
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s exited successfully.", arg_machine);
|
||||
|
||||
- *container = CONTAINER_TERMINATED;
|
||||
} else
|
||||
- log_error("Container %s failed with error code %i.", arg_machine, status.si_status);
|
||||
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s failed with error code %i.", arg_machine, status.si_status);
|
||||
|
||||
- break;
|
||||
+ *container = CONTAINER_TERMINATED;
|
||||
+ return status.si_status;
|
||||
|
||||
case CLD_KILLED:
|
||||
if (status.si_status == SIGINT) {
|
||||
- if (!arg_quiet)
|
||||
- log_info("Container %s has been shut down.", arg_machine);
|
||||
|
||||
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s has been shut down.", arg_machine);
|
||||
*container = CONTAINER_TERMINATED;
|
||||
- r = 0;
|
||||
- break;
|
||||
+ return 0;
|
||||
+
|
||||
} else if (status.si_status == SIGHUP) {
|
||||
- if (!arg_quiet)
|
||||
- log_info("Container %s is being rebooted.", arg_machine);
|
||||
|
||||
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s is being rebooted.", arg_machine);
|
||||
*container = CONTAINER_REBOOTED;
|
||||
- r = 0;
|
||||
- break;
|
||||
+ return 0;
|
||||
}
|
||||
+
|
||||
/* CLD_KILLED fallthrough */
|
||||
|
||||
case CLD_DUMPED:
|
||||
log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));
|
||||
- r = -EIO;
|
||||
- break;
|
||||
+ return -EIO;
|
||||
|
||||
default:
|
||||
log_error("Container %s failed due to unknown reason.", arg_machine);
|
||||
- r = -EIO;
|
||||
- break;
|
||||
+ return -EIO;
|
||||
}
|
||||
|
||||
return r;
|
||||
diff --git a/units/systemd-journal-flush.service.in b/units/systemd-journal-flush.service.in
|
||||
index 699670bb4e..2612220e2e 100644
|
||||
--- a/units/systemd-journal-flush.service.in
|
||||
+++ b/units/systemd-journal-flush.service.in
|
||||
@@ -10,8 +10,9 @@ Description=Trigger Flushing of Journal to Persistent Storage
|
||||
Documentation=man:systemd-journald.service(8) man:journald.conf(5)
|
||||
DefaultDependencies=no
|
||||
Requires=systemd-journald.service
|
||||
-After=systemd-journald.service local-fs.target remote-fs.target
|
||||
+After=systemd-journald.service
|
||||
Before=systemd-user-sessions.service systemd-tmpfiles-setup.service
|
||||
+RequiresMountsFor=/var/log/journal
|
||||
|
||||
[Service]
|
||||
ExecStart=@rootbindir@/journalctl --flush
|
|
@ -0,0 +1,75 @@
|
|||
From 99025d810c1d252369e5052d36b33eccdb78f8d9 Mon Sep 17 00:00:00 2001
|
||||
From: Marcel Holtmann <marcel@holtmann.org>
|
||||
Date: Fri, 31 Oct 2014 20:37:59 +0100
|
||||
Subject: [PATCH] hwdb: Update database of Bluetooth company identifiers
|
||||
|
||||
(cherry picked from commit 5d20fde4a5c4dff4d7c737b545fbd13582d544c1)
|
||||
---
|
||||
hwdb/20-bluetooth-vendor-product.hwdb | 57 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 57 insertions(+)
|
||||
|
||||
diff --git a/hwdb/20-bluetooth-vendor-product.hwdb b/hwdb/20-bluetooth-vendor-product.hwdb
|
||||
index ee2efdff2e..58ca87d69d 100644
|
||||
--- a/hwdb/20-bluetooth-vendor-product.hwdb
|
||||
+++ b/hwdb/20-bluetooth-vendor-product.hwdb
|
||||
@@ -1166,3 +1166,60 @@ bluetooth:v0181*
|
||||
|
||||
bluetooth:v0182*
|
||||
ID_VENDOR_FROM_DATABASE=HOP Ubiquitous
|
||||
+
|
||||
+bluetooth:v0183*
|
||||
+ ID_VENDOR_FROM_DATABASE=To Be Assigned
|
||||
+
|
||||
+bluetooth:v0184*
|
||||
+ ID_VENDOR_FROM_DATABASE=Nectar
|
||||
+
|
||||
+bluetooth:v0185*
|
||||
+ ID_VENDOR_FROM_DATABASE=bel'apps LLC
|
||||
+
|
||||
+bluetooth:v0186*
|
||||
+ ID_VENDOR_FROM_DATABASE=CORE Lighting Ltd
|
||||
+
|
||||
+bluetooth:v0187*
|
||||
+ ID_VENDOR_FROM_DATABASE=Seraphim Sense Ltd
|
||||
+
|
||||
+bluetooth:v0188*
|
||||
+ ID_VENDOR_FROM_DATABASE=Unico RBC
|
||||
+
|
||||
+bluetooth:v0189*
|
||||
+ ID_VENDOR_FROM_DATABASE=Physical Enterprises Inc.
|
||||
+
|
||||
+bluetooth:v018A*
|
||||
+ ID_VENDOR_FROM_DATABASE=Able Trend Technology Limited
|
||||
+
|
||||
+bluetooth:v018B*
|
||||
+ ID_VENDOR_FROM_DATABASE=Konica Minolta, Inc.
|
||||
+
|
||||
+bluetooth:v018C*
|
||||
+ ID_VENDOR_FROM_DATABASE=Wilo SE
|
||||
+
|
||||
+bluetooth:v018D*
|
||||
+ ID_VENDOR_FROM_DATABASE=Extron Design Services
|
||||
+
|
||||
+bluetooth:v018E*
|
||||
+ ID_VENDOR_FROM_DATABASE=Fitbit, Inc.
|
||||
+
|
||||
+bluetooth:v018F*
|
||||
+ ID_VENDOR_FROM_DATABASE=Fireflies Systems
|
||||
+
|
||||
+bluetooth:v0190*
|
||||
+ ID_VENDOR_FROM_DATABASE=Intelletto Technologies Inc.
|
||||
+
|
||||
+bluetooth:v0191*
|
||||
+ ID_VENDOR_FROM_DATABASE=FDK CORPORATION
|
||||
+
|
||||
+bluetooth:v0192*
|
||||
+ ID_VENDOR_FROM_DATABASE=Cloudleaf, Inc
|
||||
+
|
||||
+bluetooth:v0193*
|
||||
+ ID_VENDOR_FROM_DATABASE=Maveric Automation LLC
|
||||
+
|
||||
+bluetooth:v0194*
|
||||
+ ID_VENDOR_FROM_DATABASE=Acoustic Stream Corporation
|
||||
+
|
||||
+bluetooth:v0195*
|
||||
+ ID_VENDOR_FROM_DATABASE=Zuli
|
|
@ -1,34 +0,0 @@
|
|||
From 55cdcbacf70f05a40a155af24f6d2da6b478cba6 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 17:20:00 +0200
|
||||
Subject: [PATCH] update TODO
|
||||
|
||||
---
|
||||
TODO | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index cbd8384b4a..868518ab75 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -38,9 +38,6 @@ Features:
|
||||
for "systemctl suspend" to finish to know when the suspending is
|
||||
complete.
|
||||
|
||||
-* sd_notify("SHUTDOWN=1") to fix a dbus activation race.
|
||||
- http://lists.freedesktop.org/archives/systemd-devel/2014-July/020983.html
|
||||
-
|
||||
* merge ~/.local/share and ~/.local/lib into one similar /usr/lib and /usr/share....
|
||||
|
||||
* make "systemctl suspend" block until we are back from suspend
|
||||
@@ -603,9 +600,7 @@ Features:
|
||||
|
||||
* make sure systemd-ask-password-wall does not shutdown systemd-ask-password-console too early
|
||||
|
||||
-* support sd_notify() style notification when reload begins (RELOADING=1), reload is finished (READY=1), and add ReloadSignal= then to use in combination
|
||||
-
|
||||
-* support sd_notify() style notification when shutting down, to make auto-exit bus services work (STOPPING=1)
|
||||
+* add ReloadSignal= for configuring a reload signal to use
|
||||
|
||||
* verify that the AF_UNIX sockets of a service in the fs still exist
|
||||
when we start a service in order to avoid confusion when a user
|
|
@ -1,49 +0,0 @@
|
|||
From 430e21c2f7e77d600257ead56419f511e48e854a Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 17:20:19 +0200
|
||||
Subject: [PATCH] bus: when terminating our bus-actviated services that
|
||||
exit-on-idle send STOPPING=1 via sd_notify()
|
||||
|
||||
This should fix a race where a service thatis idle drops its name, and
|
||||
is immediately requested by another client, which causes dbus-daemon to
|
||||
ask systemd to activate it again, but since systemd still assumes it is
|
||||
running it won't do anything.
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-util.c | 16 ++++++++++++----
|
||||
1 file changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
|
||||
index 475ed34a53..c97bf7d99d 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-util.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-util.c
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/capability.h>
|
||||
|
||||
+#include "systemd/sd-daemon.h"
|
||||
+
|
||||
#include "util.h"
|
||||
#include "strv.h"
|
||||
#include "macro.h"
|
||||
@@ -128,11 +130,17 @@ int bus_event_loop_with_idle(
|
||||
if (r == -EBUSY)
|
||||
continue;
|
||||
|
||||
+ /* Fallback for dbus1 connections: we
|
||||
+ * unregister the name and wait for the
|
||||
+ * response to come through for it */
|
||||
if (r == -ENOTSUP) {
|
||||
- /* Fallback for dbus1 connections: we
|
||||
- * unregister the name and wait for
|
||||
- * the response to come through for
|
||||
- * it */
|
||||
+
|
||||
+ /* Inform the service manager that we
|
||||
+ * are going down, so that it will
|
||||
+ * queue all further start requests,
|
||||
+ * instead of assuming we are already
|
||||
+ * running. */
|
||||
+ sd_notify(false, "STOPPING=1");
|
||||
|
||||
r = bus_async_unregister_and_exit(e, bus, name);
|
||||
if (r < 0)
|
|
@ -0,0 +1,60 @@
|
|||
From 4acc3dbd1fc3326918739d2e898cb4b1ed67c000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 1 Nov 2014 11:32:44 -0400
|
||||
Subject: [PATCH] libudev: modernization
|
||||
|
||||
This brings udev logging style a bit closer to normal systemd convention.
|
||||
|
||||
(cherry picked from commit fe756ed9ec2c0fa33c30b1d9a33d745dc1593aed)
|
||||
---
|
||||
src/libudev/libudev.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
|
||||
index e2ab960d55..7803863b2e 100644
|
||||
--- a/src/libudev/libudev.c
|
||||
+++ b/src/libudev/libudev.c
|
||||
@@ -119,7 +119,7 @@ _public_ struct udev *udev_new(void)
|
||||
{
|
||||
struct udev *udev;
|
||||
const char *env;
|
||||
- FILE *f;
|
||||
+ _cleanup_free_ FILE *f = NULL;
|
||||
|
||||
udev = new0(struct udev, 1);
|
||||
if (udev == NULL)
|
||||
@@ -132,7 +132,7 @@ _public_ struct udev *udev_new(void)
|
||||
f = fopen("/etc/udev/udev.conf", "re");
|
||||
if (f != NULL) {
|
||||
char line[UTIL_LINE_SIZE];
|
||||
- int line_nr = 0;
|
||||
+ unsigned line_nr = 0;
|
||||
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
size_t len;
|
||||
@@ -153,7 +153,7 @@ _public_ struct udev *udev_new(void)
|
||||
/* split key/value */
|
||||
val = strchr(key, '=');
|
||||
if (val == NULL) {
|
||||
- udev_err(udev, "missing <key>=<value> in /etc/udev/udev.conf[%i]; skip line\n", line_nr);
|
||||
+ udev_err(udev, "/etc/udev/udev.conf:%u: missing assignment, skipping line.\n", line_nr);
|
||||
continue;
|
||||
}
|
||||
val[0] = '\0';
|
||||
@@ -185,7 +185,7 @@ _public_ struct udev *udev_new(void)
|
||||
/* unquote */
|
||||
if (val[0] == '"' || val[0] == '\'') {
|
||||
if (val[len-1] != val[0]) {
|
||||
- udev_err(udev, "inconsistent quoting in /etc/udev/udev.conf[%i]; skip line\n", line_nr);
|
||||
+ udev_err(udev, "/etc/udev/udev.conf:%u: inconsistent quoting, skipping line.\n", line_nr);
|
||||
continue;
|
||||
}
|
||||
val[len-1] = '\0';
|
||||
@@ -197,7 +197,6 @@ _public_ struct udev *udev_new(void)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- fclose(f);
|
||||
}
|
||||
|
||||
/* environment overrides config */
|
|
@ -1,25 +0,0 @@
|
|||
From f461c8073dee9cd10bfae5ae3586e785ec8a5d07 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 17:35:19 +0200
|
||||
Subject: [PATCH] execute: explain in a comment, why close_all_fds() is invoked
|
||||
the second time differently
|
||||
|
||||
---
|
||||
src/core/execute.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index 2544a2470c..b5b22472d5 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -1635,7 +1635,9 @@ int exec_spawn(ExecCommand *command,
|
||||
}
|
||||
|
||||
/* We repeat the fd closing here, to make sure that
|
||||
- * nothing is leaked from the PAM modules */
|
||||
+ * nothing is leaked from the PAM modules. Note that
|
||||
+ * we are more aggressive this time since socket_fd
|
||||
+ * and the netns fds we don#t need anymore. */
|
||||
err = close_all_fds(fds, n_fds);
|
||||
if (err >= 0)
|
||||
err = shift_fds(fds, n_fds);
|
|
@ -0,0 +1,72 @@
|
|||
From 83b62da30bd9a62bf25847b16bb36bcd1270b5f3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 1 Nov 2014 12:06:41 -0400
|
||||
Subject: [PATCH] libudev: do not accept invalid log levels
|
||||
|
||||
Invalid log levels lead to a assert failure later on.
|
||||
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=85657
|
||||
(cherry picked from commit ee7122c0ec6aa11f02e9e8d94254b353f12d2c14)
|
||||
---
|
||||
src/libudev/libudev-util.c | 10 +++++++---
|
||||
src/libudev/libudev.c | 19 ++++++++++++++++---
|
||||
2 files changed, 23 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
|
||||
index f3fdf3b5aa..0bc10f3470 100644
|
||||
--- a/src/libudev/libudev-util.c
|
||||
+++ b/src/libudev/libudev-util.c
|
||||
@@ -159,9 +159,13 @@ int util_log_priority(const char *priority)
|
||||
char *endptr;
|
||||
int prio;
|
||||
|
||||
- prio = strtol(priority, &endptr, 10);
|
||||
- if (endptr[0] == '\0' || isspace(endptr[0]))
|
||||
- return prio;
|
||||
+ prio = strtoul(priority, &endptr, 10);
|
||||
+ if (endptr[0] == '\0' || isspace(endptr[0])) {
|
||||
+ if (prio >= 0 && prio <= 7)
|
||||
+ return prio;
|
||||
+ else
|
||||
+ return -ERANGE;
|
||||
+ }
|
||||
|
||||
return log_level_from_string(priority);
|
||||
}
|
||||
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
|
||||
index 7803863b2e..8464427651 100644
|
||||
--- a/src/libudev/libudev.c
|
||||
+++ b/src/libudev/libudev.c
|
||||
@@ -193,7 +193,13 @@ _public_ struct udev *udev_new(void)
|
||||
}
|
||||
|
||||
if (streq(key, "udev_log")) {
|
||||
- udev_set_log_priority(udev, util_log_priority(val));
|
||||
+ int prio;
|
||||
+
|
||||
+ prio = util_log_priority(val);
|
||||
+ if (prio < 0)
|
||||
+ udev_err(udev, "/etc/udev/udev.conf:%u: invalid logging level '%s', ignoring.\n", line_nr, val);
|
||||
+ else
|
||||
+ udev_set_log_priority(udev, prio);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -201,8 +207,15 @@ _public_ struct udev *udev_new(void)
|
||||
|
||||
/* environment overrides config */
|
||||
env = secure_getenv("UDEV_LOG");
|
||||
- if (env != NULL)
|
||||
- udev_set_log_priority(udev, util_log_priority(env));
|
||||
+ if (env != NULL) {
|
||||
+ int prio;
|
||||
+
|
||||
+ prio = util_log_priority(env);
|
||||
+ if (prio < 0)
|
||||
+ udev_err(udev, "$UDEV_LOG specifies invalid logging level '%s', ignoring.\n", env);
|
||||
+ else
|
||||
+ udev_set_log_priority(udev, prio);
|
||||
+ }
|
||||
|
||||
return udev;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
From 02f8fb24f91116a5f315e607f5fc0ea6f7627a51 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 1 Nov 2014 14:36:29 -0400
|
||||
Subject: [PATCH] man: describe all log levels in udevadm(8)
|
||||
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=85657
|
||||
(cherry picked from commit e03234a16047dc635d13f7118fc9fcf243744b51)
|
||||
---
|
||||
man/udevadm.xml | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/man/udevadm.xml b/man/udevadm.xml
|
||||
index b85d9a9249..fd17f40be3 100644
|
||||
--- a/man/udevadm.xml
|
||||
+++ b/man/udevadm.xml
|
||||
@@ -368,9 +368,14 @@
|
||||
<term><option>-l</option></term>
|
||||
<term><option>--log-priority=<replaceable>value</replaceable></option></term>
|
||||
<listitem>
|
||||
- <para>Set the internal log level of systemd-udevd. Valid values are the numerical
|
||||
- syslog priorities or their textual representations: <option>err</option>,
|
||||
- <option>info</option> and <option>debug</option>.</para>
|
||||
+ <para>Set the internal log level of
|
||||
+ <filename>systemd-udevd</filename>. Valid values are the
|
||||
+ numerical syslog priorities or their textual
|
||||
+ representations: <option>emerg</option>,
|
||||
+ <option>alert</option>, <option>crit</option>,
|
||||
+ <option>err</option>, <option>warning</option>,
|
||||
+ <option>notice</option>, <option>info</option>, and
|
||||
+ <option>debug</option>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
|
@ -1,106 +0,0 @@
|
|||
From 21b2ce39d4038cd6176394836fdcfb7fba63f424 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 18:01:22 +0200
|
||||
Subject: [PATCH] service: use the right timeout for stop processes we fork
|
||||
|
||||
---
|
||||
src/core/service.c | 23 +++++++++++------------
|
||||
1 file changed, 11 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 3221938793..7d6ea73e05 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -862,7 +862,7 @@ fail:
|
||||
static int service_spawn(
|
||||
Service *s,
|
||||
ExecCommand *c,
|
||||
- bool timeout,
|
||||
+ usec_t timeout,
|
||||
bool pass_fds,
|
||||
bool apply_permissions,
|
||||
bool apply_chroot,
|
||||
@@ -907,8 +907,8 @@ static int service_spawn(
|
||||
}
|
||||
}
|
||||
|
||||
- if (timeout && s->timeout_start_usec > 0) {
|
||||
- r = service_arm_timer(s, s->timeout_start_usec);
|
||||
+ if (timeout > 0) {
|
||||
+ r = service_arm_timer(s, timeout);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
} else
|
||||
@@ -1108,7 +1108,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->control_command,
|
||||
- true,
|
||||
+ s->timeout_stop_usec,
|
||||
false,
|
||||
!s->permissions_start_only,
|
||||
!s->root_directory_start_only,
|
||||
@@ -1207,7 +1207,7 @@ static void service_enter_stop(Service *s, ServiceResult f) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->control_command,
|
||||
- true,
|
||||
+ s->timeout_stop_usec,
|
||||
false,
|
||||
!s->permissions_start_only,
|
||||
!s->root_directory_start_only,
|
||||
@@ -1270,7 +1270,7 @@ static void service_enter_start_post(Service *s) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->control_command,
|
||||
- true,
|
||||
+ s->timeout_start_usec,
|
||||
false,
|
||||
!s->permissions_start_only,
|
||||
!s->root_directory_start_only,
|
||||
@@ -1334,8 +1334,7 @@ static void service_enter_start(Service *s) {
|
||||
|
||||
r = service_spawn(s,
|
||||
c,
|
||||
- s->type == SERVICE_FORKING || s->type == SERVICE_DBUS ||
|
||||
- s->type == SERVICE_NOTIFY || s->type == SERVICE_ONESHOT,
|
||||
+ IN_SET(s->type, SERVICE_FORKING, SERVICE_DBUS, SERVICE_NOTIFY, SERVICE_ONESHOT) ? s->timeout_start_usec : 0,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
@@ -1401,7 +1400,7 @@ static void service_enter_start_pre(Service *s) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->control_command,
|
||||
- true,
|
||||
+ s->timeout_start_usec,
|
||||
false,
|
||||
!s->permissions_start_only,
|
||||
!s->root_directory_start_only,
|
||||
@@ -1482,7 +1481,7 @@ static void service_enter_reload(Service *s) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->control_command,
|
||||
- true,
|
||||
+ s->timeout_start_usec,
|
||||
false,
|
||||
!s->permissions_start_only,
|
||||
!s->root_directory_start_only,
|
||||
@@ -1519,7 +1518,7 @@ static void service_run_next_control(Service *s) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->control_command,
|
||||
- true,
|
||||
+ IN_SET(s->state, SERVICE_START_PRE, SERVICE_START, SERVICE_START_POST, SERVICE_RUNNING, SERVICE_RELOAD) ? s->timeout_start_usec : s->timeout_stop_usec,
|
||||
false,
|
||||
!s->permissions_start_only,
|
||||
!s->root_directory_start_only,
|
||||
@@ -1563,7 +1562,7 @@ static void service_run_next_main(Service *s) {
|
||||
|
||||
r = service_spawn(s,
|
||||
s->main_command,
|
||||
- true,
|
||||
+ s->timeout_start_usec,
|
||||
true,
|
||||
true,
|
||||
true,
|
|
@ -0,0 +1,47 @@
|
|||
From 74f80e9a5df498af7c3af1433b406f606d6433a3 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Synacek <jsynacek@redhat.com>
|
||||
Date: Fri, 31 Oct 2014 10:16:45 +0100
|
||||
Subject: [PATCH] core: improve error message when machine id is missing
|
||||
|
||||
(cherry picked from commit 86fb9ca7ae49790880d4b3ce523988b01b13d9ae)
|
||||
---
|
||||
src/core/machine-id-setup.c | 17 ++++++++++++-----
|
||||
1 file changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
|
||||
index efb074fcbd..ce6d8e02d0 100644
|
||||
--- a/src/core/machine-id-setup.c
|
||||
+++ b/src/core/machine-id-setup.c
|
||||
@@ -162,7 +162,7 @@ static int generate(char id[34], const char *root) {
|
||||
int machine_id_setup(const char *root) {
|
||||
const char *etc_machine_id, *run_machine_id;
|
||||
_cleanup_close_ int fd = -1;
|
||||
- bool writable = false;
|
||||
+ bool writable = true;
|
||||
struct stat st;
|
||||
char id[34]; /* 32 + \n + \0 */
|
||||
int r;
|
||||
@@ -186,12 +186,19 @@ int machine_id_setup(const char *root) {
|
||||
|
||||
mkdir_parents(etc_machine_id, 0755);
|
||||
fd = open(etc_machine_id, O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY, 0444);
|
||||
- if (fd >= 0)
|
||||
- writable = true;
|
||||
- else {
|
||||
+ if (fd < 0) {
|
||||
+ int old_errno = errno;
|
||||
+
|
||||
fd = open(etc_machine_id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
if (fd < 0) {
|
||||
- log_error("Cannot open %s: %m", etc_machine_id);
|
||||
+ if (old_errno == EROFS && errno == ENOENT)
|
||||
+ log_error("System cannot boot: Missing /etc/machine-id and /etc is mounted read-only.\n"
|
||||
+ "Booting up is supported only when:\n"
|
||||
+ "1) /etc/machine-id exists and is populated.\n"
|
||||
+ "2) /etc/machine-id exists and is empty.\n"
|
||||
+ "3) /etc/machine-id is missing and /etc is writable.\n");
|
||||
+ else
|
||||
+ log_error("Cannot open %s: %m", etc_machine_id);
|
||||
return -errno;
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From 1954ea346dc28226c0fffde848d49a297165b0a9 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 18:01:47 +0200
|
||||
Subject: [PATCH] update TODO
|
||||
|
||||
---
|
||||
TODO | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index 868518ab75..16b61d045c 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -40,8 +40,6 @@ Features:
|
||||
|
||||
* merge ~/.local/share and ~/.local/lib into one similar /usr/lib and /usr/share....
|
||||
|
||||
-* make "systemctl suspend" block until we are back from suspend
|
||||
-
|
||||
* remove readahead in 217
|
||||
|
||||
* journald: allows specification of UID range for splitting up journal files
|
|
@ -0,0 +1,42 @@
|
|||
From 7ea6b0745f5795dbf0dde547971215ef139c59f1 Mon Sep 17 00:00:00 2001
|
||||
From: Umut Tezduyar Lindskog <umut.tezduyar@axis.com>
|
||||
Date: Wed, 29 Oct 2014 11:20:02 +0100
|
||||
Subject: [PATCH] man: explain journalctl --flush correctly
|
||||
|
||||
(cherry picked from commit 2a97b03b3b087e724867e7501ae0c1535ee35031)
|
||||
---
|
||||
NEWS | 4 ++++
|
||||
man/journalctl.xml | 4 ++--
|
||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index bf8d0ac242..afc73a781f 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -7,6 +7,10 @@ CHANGES WITH 217:
|
||||
show log timestamps in the UTC timezone. journalctl now also
|
||||
accepts -n/--lines=all to disable line capping in a pager.
|
||||
|
||||
+ * journalctl gained a new switch, --flush, that flushes
|
||||
+ logs from /run/log/journal to /var/log/journal if
|
||||
+ persistent storage is enabled.
|
||||
+
|
||||
* Services can notify the manager before they start a reload
|
||||
(by sending RELOADING=1) or shutdown (by sending
|
||||
STOPPING=1). This allows the manager to track and show the
|
||||
diff --git a/man/journalctl.xml b/man/journalctl.xml
|
||||
index db2a1e142b..0ed3ca3bc8 100644
|
||||
--- a/man/journalctl.xml
|
||||
+++ b/man/journalctl.xml
|
||||
@@ -883,9 +883,9 @@
|
||||
|
||||
<listitem><para>Asks the Journal
|
||||
daemon to flush any log data stored in
|
||||
- <filename>/run/systemd/log</filename>
|
||||
+ <filename>/run/log/journal</filename>
|
||||
into
|
||||
- <filename>/var/systemd/log</filename>,
|
||||
+ <filename>/var/log/journal</filename>,
|
||||
if persistent storage is enabled. This
|
||||
call does not return until the
|
||||
operation is
|
|
@ -1,166 +0,0 @@
|
|||
From 96fb8242cc1ef6b0e28f6c86a4f57950095dd7f1 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 18:50:42 +0200
|
||||
Subject: [PATCH] service: allow services of Type=oneshot that specify no
|
||||
ExecStart= commands
|
||||
|
||||
This is useful for services that simply want to run something on
|
||||
shutdown, but not at bootup. They should only set ExecStop= but leave
|
||||
ExecStart= unset.
|
||||
---
|
||||
man/systemd.service.xml | 44 +++++++++++++++++++++++++++-----------------
|
||||
src/core/service.c | 39 +++++++++++++++++++++++++++++----------
|
||||
2 files changed, 56 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
|
||||
index 5c4bd6569f..e584a1f006 100644
|
||||
--- a/man/systemd.service.xml
|
||||
+++ b/man/systemd.service.xml
|
||||
@@ -139,9 +139,10 @@
|
||||
|
||||
<para>If set to
|
||||
<option>simple</option> (the default
|
||||
- value if neither
|
||||
+ if neither
|
||||
<varname>Type=</varname> nor
|
||||
- <varname>BusName=</varname> are
|
||||
+ <varname>BusName=</varname>, but
|
||||
+ <varname>ExecStart=</varname> are
|
||||
specified), it is expected that the
|
||||
process configured with
|
||||
<varname>ExecStart=</varname> is the
|
||||
@@ -177,13 +178,17 @@
|
||||
exits.</para>
|
||||
|
||||
<para>Behavior of
|
||||
- <option>oneshot</option> is similar
|
||||
- to <option>simple</option>; however,
|
||||
- it is expected that the process has to
|
||||
+ <option>oneshot</option> is similar to
|
||||
+ <option>simple</option>; however, it
|
||||
+ is expected that the process has to
|
||||
exit before systemd starts follow-up
|
||||
units. <varname>RemainAfterExit=</varname>
|
||||
is particularly useful for this type
|
||||
- of service.</para>
|
||||
+ of service. This is the implied
|
||||
+ default if neither
|
||||
+ <varname>Type=</varname> or
|
||||
+ <varname>ExecStart=</varname> are
|
||||
+ specified.</para>
|
||||
|
||||
<para>Behavior of
|
||||
<option>dbus</option> is similar to
|
||||
@@ -313,22 +318,27 @@
|
||||
|
||||
<para>When <varname>Type</varname> is
|
||||
not <option>oneshot</option>, only one
|
||||
- command may be given. When
|
||||
+ command may and must be given. When
|
||||
<varname>Type=oneshot</varname> is
|
||||
- used, more than one command may be
|
||||
- specified. Multiple command lines may
|
||||
- be concatenated in a single directive
|
||||
- by separating them with semicolons
|
||||
- (these semicolons must be passed as
|
||||
- separate words). Alternatively, this
|
||||
- directive may be specified more than
|
||||
- once with the same effect.
|
||||
- Lone semicolons may be escaped as
|
||||
+ used, none or more than one command
|
||||
+ may be specified. Multiple command
|
||||
+ lines may be concatenated in a single
|
||||
+ directive by separating them with
|
||||
+ semicolons (these semicolons must be
|
||||
+ passed as separate
|
||||
+ words). Alternatively, this directive
|
||||
+ may be specified more than once with
|
||||
+ the same effect. Lone semicolons may
|
||||
+ be escaped as
|
||||
<literal>\;</literal>. If the empty
|
||||
string is assigned to this option, the
|
||||
list of commands to start is reset,
|
||||
prior assignments of this option will
|
||||
- have no effect.</para>
|
||||
+ have no effect. If no
|
||||
+ <varname>ExecStart=</varname> is
|
||||
+ specified, then the service must have
|
||||
+ <varname>RemainAfterExit=yes</varname>
|
||||
+ set.</para>
|
||||
|
||||
<para>Each command line is split on
|
||||
whitespace, with the first item being
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 7d6ea73e05..1b864c4c8c 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -313,14 +313,23 @@ static int service_verify(Service *s) {
|
||||
if (UNIT(s)->load_state != UNIT_LOADED)
|
||||
return 0;
|
||||
|
||||
- if (!s->exec_command[SERVICE_EXEC_START]) {
|
||||
- log_error_unit(UNIT(s)->id, "%s lacks ExecStart setting. Refusing.", UNIT(s)->id);
|
||||
+ if (!s->exec_command[SERVICE_EXEC_START] && !s->exec_command[SERVICE_EXEC_STOP]) {
|
||||
+ log_error_unit(UNIT(s)->id, "%s lacks both ExecStart= and ExecStop= setting. Refusing.", UNIT(s)->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- if (s->type != SERVICE_ONESHOT &&
|
||||
- s->exec_command[SERVICE_EXEC_START]->command_next) {
|
||||
- log_error_unit(UNIT(s)->id, "%s has more than one ExecStart setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
|
||||
+ if (s->type != SERVICE_ONESHOT && !s->exec_command[SERVICE_EXEC_START]) {
|
||||
+ log_error_unit(UNIT(s)->id, "%s has no ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (!s->remain_after_exit && !s->exec_command[SERVICE_EXEC_START]) {
|
||||
+ log_error_unit(UNIT(s)->id, "%s has no ExecStart= setting, which is only allowed for RemainAfterExit=yes services. Refusing.", UNIT(s)->id);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (s->type != SERVICE_ONESHOT && s->exec_command[SERVICE_EXEC_START]->command_next) {
|
||||
+ log_error_unit(UNIT(s)->id, "%s has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -410,8 +419,15 @@ static int service_load(Unit *u) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- if (s->type == _SERVICE_TYPE_INVALID)
|
||||
- s->type = s->bus_name ? SERVICE_DBUS : SERVICE_SIMPLE;
|
||||
+ if (s->type == _SERVICE_TYPE_INVALID) {
|
||||
+ /* Figure out a type automatically */
|
||||
+ if (s->bus_name)
|
||||
+ s->type = SERVICE_DBUS;
|
||||
+ else if (s->exec_command[SERVICE_EXEC_START])
|
||||
+ s->type = SERVICE_SIMPLE;
|
||||
+ else
|
||||
+ s->type = SERVICE_ONESHOT;
|
||||
+ }
|
||||
|
||||
/* Oneshot services have disabled start timeout by default */
|
||||
if (s->type == SERVICE_ONESHOT && !s->start_timeout_defined)
|
||||
@@ -1309,9 +1325,6 @@ static void service_enter_start(Service *s) {
|
||||
|
||||
assert(s);
|
||||
|
||||
- assert(s->exec_command[SERVICE_EXEC_START]);
|
||||
- assert(!s->exec_command[SERVICE_EXEC_START]->command_next || s->type == SERVICE_ONESHOT);
|
||||
-
|
||||
service_unwatch_control_pid(s);
|
||||
service_unwatch_main_pid(s);
|
||||
|
||||
@@ -1332,6 +1345,12 @@ static void service_enter_start(Service *s) {
|
||||
c = s->main_command = s->exec_command[SERVICE_EXEC_START];
|
||||
}
|
||||
|
||||
+ if (!c) {
|
||||
+ assert(s->type == SERVICE_ONESHOT);
|
||||
+ service_enter_start_post(s);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
r = service_spawn(s,
|
||||
c,
|
||||
IN_SET(s->type, SERVICE_FORKING, SERVICE_DBUS, SERVICE_NOTIFY, SERVICE_ONESHOT) ? s->timeout_start_usec : 0,
|
|
@ -1,126 +0,0 @@
|
|||
From 59ccf93d97f0a37522e5f4fbf5cc0288dbedf495 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 19:08:30 +0200
|
||||
Subject: [PATCH] install: simplify usage of _cleanup_ macros
|
||||
|
||||
---
|
||||
src/shared/install.c | 27 +++++++++++++--------------
|
||||
src/shared/path-lookup.h | 4 ++--
|
||||
2 files changed, 15 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 03c7a9da2e..4b09a69456 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -45,8 +45,6 @@ typedef struct {
|
||||
Hashmap *have_installed;
|
||||
} InstallContext;
|
||||
|
||||
-#define _cleanup_install_context_done_ _cleanup_(install_context_done)
|
||||
-
|
||||
static int in_search_path(const char *path, char **search) {
|
||||
_cleanup_free_ char *parent = NULL;
|
||||
int r;
|
||||
@@ -1161,7 +1159,7 @@ static int unit_file_can_install(
|
||||
const char *name,
|
||||
bool allow_symlink) {
|
||||
|
||||
- _cleanup_install_context_done_ InstallContext c = {};
|
||||
+ _cleanup_(install_context_done) InstallContext c = {};
|
||||
InstallInfo *i;
|
||||
int r;
|
||||
|
||||
@@ -1498,7 +1496,7 @@ int unit_file_enable(
|
||||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
- _cleanup_install_context_done_ InstallContext c = {};
|
||||
+ _cleanup_(install_context_done) InstallContext c = {};
|
||||
char **i;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
int r;
|
||||
@@ -1537,7 +1535,7 @@ int unit_file_disable(
|
||||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
- _cleanup_install_context_done_ InstallContext c = {};
|
||||
+ _cleanup_(install_context_done) InstallContext c = {};
|
||||
char **i;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
|
||||
@@ -1597,7 +1595,7 @@ int unit_file_set_default(
|
||||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
- _cleanup_install_context_done_ InstallContext c = {};
|
||||
+ _cleanup_(install_context_done) InstallContext c = {};
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
char *path;
|
||||
int r;
|
||||
@@ -1859,7 +1857,7 @@ int unit_file_preset(
|
||||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
- _cleanup_install_context_done_ InstallContext plus = {}, minus = {};
|
||||
+ _cleanup_(install_context_done) InstallContext plus = {}, minus = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
char **i;
|
||||
@@ -1927,7 +1925,7 @@ int unit_file_preset_all(
|
||||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
- _cleanup_install_context_done_ InstallContext plus = {}, minus = {};
|
||||
+ _cleanup_(install_context_done) InstallContext plus = {}, minus = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
char **i;
|
||||
@@ -2019,14 +2017,15 @@ int unit_file_preset_all(
|
||||
return r;
|
||||
}
|
||||
|
||||
-static void unitfilelist_free(UnitFileList **f) {
|
||||
- if (!*f)
|
||||
+static void unit_file_list_free_one(UnitFileList *f) {
|
||||
+ if (!f)
|
||||
return;
|
||||
|
||||
- free((*f)->path);
|
||||
- free(*f);
|
||||
+ free(f->path);
|
||||
+ free(f);
|
||||
}
|
||||
-#define _cleanup_unitfilelist_free_ _cleanup_(unitfilelist_free)
|
||||
+
|
||||
+DEFINE_TRIVIAL_CLEANUP_FUNC(UnitFileList*, unit_file_list_free_one);
|
||||
|
||||
int unit_file_get_list(
|
||||
UnitFileScope scope,
|
||||
@@ -2071,7 +2070,7 @@ int unit_file_get_list(
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
- _cleanup_unitfilelist_free_ UnitFileList *f = NULL;
|
||||
+ _cleanup_(unit_file_list_free_onep) UnitFileList *f = NULL;
|
||||
struct dirent *de;
|
||||
|
||||
errno = 0;
|
||||
diff --git a/src/shared/path-lookup.h b/src/shared/path-lookup.h
|
||||
index 2fe8173f44..4bbd47ec39 100644
|
||||
--- a/src/shared/path-lookup.h
|
||||
+++ b/src/shared/path-lookup.h
|
||||
@@ -38,8 +38,6 @@ typedef enum SystemdRunningAs {
|
||||
_SYSTEMD_RUNNING_AS_INVALID = -1
|
||||
} SystemdRunningAs;
|
||||
|
||||
-#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
|
||||
-
|
||||
int user_config_home(char **config_home);
|
||||
|
||||
int lookup_paths_init(LookupPaths *p,
|
||||
@@ -50,3 +48,5 @@ int lookup_paths_init(LookupPaths *p,
|
||||
const char *generator_early,
|
||||
const char *generator_late);
|
||||
void lookup_paths_free(LookupPaths *p);
|
||||
+
|
||||
+#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
|
|
@ -0,0 +1,45 @@
|
|||
From b7248e47e1938d9d4a0cc63b78ddd3d0a0861552 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 1 Nov 2014 13:52:14 -0400
|
||||
Subject: [PATCH] systemd-journal-flush.service: remove "trigger" from
|
||||
description
|
||||
|
||||
This service is now synchronous, so "trigger" is misleading.
|
||||
|
||||
(cherry picked from commit a65b82457735df2ef58736a55846f400124a8dc0)
|
||||
---
|
||||
NEWS | 7 ++++---
|
||||
units/systemd-journal-flush.service.in | 2 +-
|
||||
2 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index afc73a781f..ac987ad5b7 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -7,9 +7,10 @@ CHANGES WITH 217:
|
||||
show log timestamps in the UTC timezone. journalctl now also
|
||||
accepts -n/--lines=all to disable line capping in a pager.
|
||||
|
||||
- * journalctl gained a new switch, --flush, that flushes
|
||||
- logs from /run/log/journal to /var/log/journal if
|
||||
- persistent storage is enabled.
|
||||
+ * journalctl gained a new switch, --flush, that synchronously
|
||||
+ flushes logs from /run/log/journal to /var/log/journal if
|
||||
+ persistent storage is enabled. systemd-journal-flush.service
|
||||
+ now waits until the operation is complete.
|
||||
|
||||
* Services can notify the manager before they start a reload
|
||||
(by sending RELOADING=1) or shutdown (by sending
|
||||
diff --git a/units/systemd-journal-flush.service.in b/units/systemd-journal-flush.service.in
|
||||
index 2612220e2e..fa290897d6 100644
|
||||
--- a/units/systemd-journal-flush.service.in
|
||||
+++ b/units/systemd-journal-flush.service.in
|
||||
@@ -6,7 +6,7 @@
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
-Description=Trigger Flushing of Journal to Persistent Storage
|
||||
+Description=Flush Journal to Persistent Storage
|
||||
Documentation=man:systemd-journald.service(8) man:journald.conf(5)
|
||||
DefaultDependencies=no
|
||||
Requires=systemd-journald.service
|
|
@ -0,0 +1,36 @@
|
|||
From 05530aba2c48b99a269544cf8f7c45e427b9cb20 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chapman <mike@very.puzzling.org>
|
||||
Date: Wed, 29 Oct 2014 11:54:07 +1100
|
||||
Subject: [PATCH] kernel-install/90-loaderentry.install: fix cmdline parsing
|
||||
|
||||
A recent commit (2f3a215) changed the parsing of /proc/cmdline to use a
|
||||
shell array. Unfortunately, this introduced a bug: "read -ar line"
|
||||
populates the shell variable $r, not $line. This breaks installation of
|
||||
new loader entries:
|
||||
|
||||
# kernel-install add 3.17.1-304.fc21.x86_64 \
|
||||
/boot/vmlinuz-3.17.1-304.fc21.x86_64
|
||||
Could not determine the kernel command line parameters.
|
||||
Please specify the kernel command line in /etc/kernel/cmdline!
|
||||
|
||||
This commit alters the read command to correctly populate the $line
|
||||
array instead.
|
||||
|
||||
(cherry picked from commit c008f6ee8df9aa36782378d1a3767543b3635a54)
|
||||
---
|
||||
src/kernel-install/90-loaderentry.install | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
|
||||
index 6f032b5a4b..d433e00a5c 100644
|
||||
--- a/src/kernel-install/90-loaderentry.install
|
||||
+++ b/src/kernel-install/90-loaderentry.install
|
||||
@@ -47,7 +47,7 @@ if [[ -f /etc/kernel/cmdline ]]; then
|
||||
fi
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
- read -ar line < /proc/cmdline
|
||||
+ read -a line -r < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
BOOT_OPTIONS[${#BOOT_OPTIONS[@]}]="$i"
|
|
@ -1,46 +0,0 @@
|
|||
From 4fe1be9ce2e0cca6354a4167f0a1a7e1f943c91c Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 19:10:26 +0200
|
||||
Subject: [PATCH] systemctl: in list-unit-files, always show legend, even if we
|
||||
know about no unit files
|
||||
|
||||
---
|
||||
src/systemctl/systemctl.c | 14 +++++---------
|
||||
1 file changed, 5 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||
index 072f615ad5..d9b8bee28d 100644
|
||||
--- a/src/systemctl/systemctl.c
|
||||
+++ b/src/systemctl/systemctl.c
|
||||
@@ -1351,11 +1351,8 @@ static int list_unit_files(sd_bus *bus, char **args) {
|
||||
|
||||
n_units = hashmap_size(h);
|
||||
|
||||
- if (n_units == 0)
|
||||
- return 0;
|
||||
-
|
||||
units = new(UnitFileList, n_units);
|
||||
- if (!units) {
|
||||
+ if (!units && n_units > 0) {
|
||||
unit_file_list_free(h);
|
||||
return log_oom();
|
||||
}
|
||||
@@ -1411,14 +1408,13 @@ static int list_unit_files(sd_bus *bus, char **args) {
|
||||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
- if (c > 0) {
|
||||
- qsort(units, c, sizeof(UnitFileList), compare_unit_file_list);
|
||||
- output_unit_file_list(units, c);
|
||||
- }
|
||||
+ qsort_safe(units, c, sizeof(UnitFileList), compare_unit_file_list);
|
||||
+ output_unit_file_list(units, c);
|
||||
|
||||
- if (avoid_bus())
|
||||
+ if (avoid_bus()) {
|
||||
for (unit = units; unit < units + c; unit++)
|
||||
free(unit->path);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
From b456d500bb70e4eb1f42816adac4f1f4a7efffa0 Mon Sep 17 00:00:00 2001
|
||||
From: Joe Lawrence <joe.lawrence@stratus.com>
|
||||
Date: Sat, 1 Nov 2014 12:18:08 -0400
|
||||
Subject: [PATCH] scsi_id: fix usage spelling
|
||||
|
||||
s/threat/treat/g
|
||||
|
||||
(cherry picked from commit 85f13fce322e6303e7e4e55cb43104f81827f36b)
|
||||
---
|
||||
src/udev/scsi_id/scsi_id.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
|
||||
index 4d9378a5c0..48c6cf7dba 100644
|
||||
--- a/src/udev/scsi_id/scsi_id.c
|
||||
+++ b/src/udev/scsi_id/scsi_id.c
|
||||
@@ -317,8 +317,8 @@ static void help(void) {
|
||||
" -f,--config= location of config file\n"
|
||||
" -p,--page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n"
|
||||
" -s,--sg-version=3|4 use SGv3 or SGv4\n"
|
||||
- " -b,--blacklisted threat device as blacklisted\n"
|
||||
- " -g,--whitelisted threat device as whitelisted\n"
|
||||
+ " -b,--blacklisted treat device as blacklisted\n"
|
||||
+ " -g,--whitelisted treat device as whitelisted\n"
|
||||
" -u,--replace-whitespace replace all whitespace by underscores\n"
|
||||
" -v,--verbose verbose logging\n"
|
||||
" --version print version\n"
|
|
@ -1,24 +0,0 @@
|
|||
From 337ce7442a0602116c6253ebf202bd34f675f627 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Thu, 21 Aug 2014 19:12:43 +0200
|
||||
Subject: [PATCH] update TODO
|
||||
|
||||
---
|
||||
TODO | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index 16b61d045c..3073f3a5a2 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -521,10 +521,6 @@ Features:
|
||||
|
||||
* properly handle loop back mounts via fstab, especially regards to fsck/passno
|
||||
|
||||
-* allow services with no ExecStart= but with an ExecStop=
|
||||
-
|
||||
-* dracut-shutdown needs to be ordered before unmounting /boot
|
||||
-
|
||||
* initialize the hostname from the fs label of /, if /etc/hostname does not exist?
|
||||
|
||||
* rename "userspace" to "core-os"
|
|
@ -1,59 +0,0 @@
|
|||
From 0975b63fb31263e535a2d26ed41e66e23f468bc5 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 12:44:17 +0200
|
||||
Subject: [PATCH] dbus1-generator: properly free the FILE*
|
||||
|
||||
Also, rework the code to make use of fflush_and_check().
|
||||
|
||||
Issue discovered by Simon Danner.
|
||||
---
|
||||
src/dbus1-generator/dbus1-generator.c | 20 ++++++++++++--------
|
||||
1 file changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/dbus1-generator/dbus1-generator.c b/src/dbus1-generator/dbus1-generator.c
|
||||
index e1ffc5515f..3c4522b589 100644
|
||||
--- a/src/dbus1-generator/dbus1-generator.c
|
||||
+++ b/src/dbus1-generator/dbus1-generator.c
|
||||
@@ -40,6 +40,7 @@ static int create_dbus_files(
|
||||
|
||||
_cleanup_free_ char *b = NULL, *s = NULL, *lnk = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
+ int r;
|
||||
|
||||
assert(path);
|
||||
assert(name);
|
||||
@@ -100,12 +101,15 @@ static int create_dbus_files(
|
||||
}
|
||||
}
|
||||
|
||||
- fflush(f);
|
||||
- if (ferror(f)) {
|
||||
- log_error("Failed to write %s: %m", a);
|
||||
- return -errno;
|
||||
+ r = fflush_and_check(f);
|
||||
+ if (r < 0) {
|
||||
+ log_error("Failed to write %s: %s", a, strerror(-r));
|
||||
+ return r;
|
||||
}
|
||||
|
||||
+ fclose(f);
|
||||
+ f = NULL;
|
||||
+
|
||||
service = s;
|
||||
}
|
||||
|
||||
@@ -134,10 +138,10 @@ static int create_dbus_files(
|
||||
name,
|
||||
service);
|
||||
|
||||
- fflush(f);
|
||||
- if (ferror(f)) {
|
||||
- log_error("Failed to write %s: %m", b);
|
||||
- return -errno;
|
||||
+ r = fflush_and_check(f);
|
||||
+ if (r < 0) {
|
||||
+ log_error("Failed to write %s: %s", b, strerror(-r));
|
||||
+ return r;
|
||||
}
|
||||
|
||||
lnk = strjoin(arg_dest_late, "/" SPECIAL_BUSNAMES_TARGET ".wants/", name, ".busname", NULL);
|
|
@ -0,0 +1,28 @@
|
|||
From 18a4017bd49458570e8c3058d3e1d6c53fffd246 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Walters <walters@verbum.org>
|
||||
Date: Sat, 1 Nov 2014 15:49:53 -0400
|
||||
Subject: [PATCH] libudev: Use correct free function
|
||||
|
||||
FILE * wants cleanup_fclose().
|
||||
|
||||
Spotted by udev hwdb segfaulting in gnome-continuous' buildroot
|
||||
construction.
|
||||
|
||||
(cherry picked from commit ea55caa60c6860e33fa4f1a216c003ff666e9c68)
|
||||
---
|
||||
src/libudev/libudev.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
|
||||
index 8464427651..05f3b479fa 100644
|
||||
--- a/src/libudev/libudev.c
|
||||
+++ b/src/libudev/libudev.c
|
||||
@@ -119,7 +119,7 @@ _public_ struct udev *udev_new(void)
|
||||
{
|
||||
struct udev *udev;
|
||||
const char *env;
|
||||
- _cleanup_free_ FILE *f = NULL;
|
||||
+ _cleanup_fclose_ FILE *f = NULL;
|
||||
|
||||
udev = new0(struct udev, 1);
|
||||
if (udev == NULL)
|
|
@ -0,0 +1,40 @@
|
|||
From fce17a6ce48d44d99108bb9d14bb0cff6a627f89 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 12:10:42 -0500
|
||||
Subject: [PATCH] Raise level of 'Found dependency...' lines
|
||||
|
||||
This way they always show up together with 'Found ordering cycle...'.
|
||||
Ordering cycles are a serious error and a major pain to debug. If
|
||||
quiet is enabled, only the first and the last line of output are
|
||||
shown:
|
||||
|
||||
systemd[1]: Found ordering cycle on basic.target/start
|
||||
systemd[1]: Breaking ordering cycle by deleting job timers.target/start
|
||||
systemd[1]: Job timers.target/start deleted to break ordering cycle starting with basic.target/start
|
||||
|
||||
which isn't particularly enlightening. So just show the whole message
|
||||
at the same level.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1158206
|
||||
(cherry picked from commit 14fe721b5f6d8457cc8737fa75f2ed79e7fa534b)
|
||||
---
|
||||
src/core/transaction.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/core/transaction.c b/src/core/transaction.c
|
||||
index dbb4133fe3..91f5ee18df 100644
|
||||
--- a/src/core/transaction.c
|
||||
+++ b/src/core/transaction.c
|
||||
@@ -377,9 +377,9 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
||||
for (k = from; k; k = ((k->generation == generation && k->marker != k) ? k->marker : NULL)) {
|
||||
|
||||
/* logging for j not k here here to provide consistent narrative */
|
||||
- log_info_unit(j->unit->id,
|
||||
- "Found dependency on %s/%s",
|
||||
- k->unit->id, job_type_to_string(k->type));
|
||||
+ log_warning_unit(j->unit->id,
|
||||
+ "Found dependency on %s/%s",
|
||||
+ k->unit->id, job_type_to_string(k->type));
|
||||
|
||||
if (!delete && hashmap_get(tr->jobs, k->unit) &&
|
||||
!unit_matters_to_anchor(k->unit, k)) {
|
|
@ -1,75 +0,0 @@
|
|||
From 40a1eebde6be7ac3f1885147fc24e06ad1da260c Mon Sep 17 00:00:00 2001
|
||||
From: David Herrmann <dh.herrmann@gmail.com>
|
||||
Date: Fri, 22 Aug 2014 13:55:57 +0200
|
||||
Subject: [PATCH] shared: add MAXSIZE() and use it in resolved
|
||||
|
||||
The MAXSIZE() macro takes two types and returns the size of the larger
|
||||
one. It is much simpler to use than MAX(sizeof(A), sizeof(B)) and also
|
||||
avoids any compiler-extensions, unlike CONST_MAX() and MAX() (which are
|
||||
needed to avoid evaluating arguments more than once). This was suggested
|
||||
by Daniele Nicolodi <daniele@grinta.net>.
|
||||
|
||||
Also make resolved use this macro instead of CONST_MAX(). This enhances
|
||||
readability quite a bit.
|
||||
---
|
||||
src/resolve/resolved-dns-stream.c | 2 +-
|
||||
src/resolve/resolved-manager.c | 2 +-
|
||||
src/shared/macro.h | 3 +++
|
||||
src/test/test-util.c | 4 ++++
|
||||
4 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/resolve/resolved-dns-stream.c b/src/resolve/resolved-dns-stream.c
|
||||
index 8b3a3ced4b..8aad5e4df1 100644
|
||||
--- a/src/resolve/resolved-dns-stream.c
|
||||
+++ b/src/resolve/resolved-dns-stream.c
|
||||
@@ -64,7 +64,7 @@ static int dns_stream_complete(DnsStream *s, int error) {
|
||||
static int dns_stream_identify(DnsStream *s) {
|
||||
union {
|
||||
struct cmsghdr header; /* For alignment */
|
||||
- uint8_t buffer[CMSG_SPACE(CONST_MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
|
||||
+ uint8_t buffer[CMSG_SPACE(MAXSIZE(struct in_pktinfo, struct in6_pktinfo))
|
||||
+ EXTRA_CMSG_SPACE /* kernel appears to require extra space */];
|
||||
} control;
|
||||
struct msghdr mh = {};
|
||||
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
|
||||
index 56baf8730d..659b1dacc8 100644
|
||||
--- a/src/resolve/resolved-manager.c
|
||||
+++ b/src/resolve/resolved-manager.c
|
||||
@@ -841,7 +841,7 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
|
||||
_cleanup_(dns_packet_unrefp) DnsPacket *p = NULL;
|
||||
union {
|
||||
struct cmsghdr header; /* For alignment */
|
||||
- uint8_t buffer[CMSG_SPACE(CONST_MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
|
||||
+ uint8_t buffer[CMSG_SPACE(MAXSIZE(struct in_pktinfo, struct in6_pktinfo))
|
||||
+ CMSG_SPACE(int) /* ttl/hoplimit */
|
||||
+ EXTRA_CMSG_SPACE /* kernel appears to require extra buffer space */];
|
||||
} control;
|
||||
diff --git a/src/shared/macro.h b/src/shared/macro.h
|
||||
index 179b24c983..43fa3e556f 100644
|
||||
--- a/src/shared/macro.h
|
||||
+++ b/src/shared/macro.h
|
||||
@@ -149,6 +149,9 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
|
||||
((_A) > (_B)) ? (_A) : (_B), \
|
||||
(void)0))
|
||||
|
||||
+/* takes two types and returns the size of the larger one */
|
||||
+#define MAXSIZE(A, B) (sizeof(union _packed_ { typeof(A) a; typeof(B) b; }))
|
||||
+
|
||||
#define MAX3(x,y,z) \
|
||||
__extension__ ({ \
|
||||
const typeof(x) _c = MAX(x,y); \
|
||||
diff --git a/src/test/test-util.c b/src/test/test-util.c
|
||||
index ac1afce86b..34d5f2ed7d 100644
|
||||
--- a/src/test/test-util.c
|
||||
+++ b/src/test/test-util.c
|
||||
@@ -90,6 +90,10 @@ static void test_max(void) {
|
||||
assert_se(val1.a == 100);
|
||||
assert_se(MAX(++d, 0) == 1);
|
||||
assert_se(d == 1);
|
||||
+
|
||||
+ assert_cc(MAXSIZE(char[3], uint16_t) == 3);
|
||||
+ assert_cc(MAXSIZE(char[3], uint32_t) == 4);
|
||||
+ assert_cc(MAXSIZE(char, long) == sizeof(long));
|
||||
}
|
||||
|
||||
static void test_first_word(void) {
|
|
@ -0,0 +1,124 @@
|
|||
From d3bcf051780f5c294c80a5b1d28d80c00f0da0d6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 2 Nov 2014 12:19:38 -0500
|
||||
Subject: [PATCH] manager: do not print timing when running in test mode
|
||||
|
||||
(cherry picked from commit 56dacdbc1ca95cef8bf8c97c0d7af761a71eaab3)
|
||||
---
|
||||
src/core/manager.c | 84 ++++++++++++++++++++++++++++++------------------------
|
||||
1 file changed, 46 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index d427d88d4e..ff29ae1d9d 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -2584,45 +2584,13 @@ bool manager_unit_inactive_or_pending(Manager *m, const char *name) {
|
||||
return unit_inactive_or_pending(u);
|
||||
}
|
||||
|
||||
-void manager_check_finished(Manager *m) {
|
||||
+static void manager_notify_finished(Manager *m) {
|
||||
char userspace[FORMAT_TIMESPAN_MAX], initrd[FORMAT_TIMESPAN_MAX], kernel[FORMAT_TIMESPAN_MAX], sum[FORMAT_TIMESPAN_MAX];
|
||||
usec_t firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec;
|
||||
- Unit *u = NULL;
|
||||
- Iterator i;
|
||||
|
||||
- assert(m);
|
||||
-
|
||||
- if (m->n_running_jobs == 0)
|
||||
- m->jobs_in_progress_event_source = sd_event_source_unref(m->jobs_in_progress_event_source);
|
||||
-
|
||||
- if (hashmap_size(m->jobs) > 0) {
|
||||
-
|
||||
- if (m->jobs_in_progress_event_source)
|
||||
- sd_event_source_set_time(m->jobs_in_progress_event_source, now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC);
|
||||
-
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- manager_flip_auto_status(m, false);
|
||||
-
|
||||
- /* Notify Type=idle units that we are done now */
|
||||
- m->idle_pipe_event_source = sd_event_source_unref(m->idle_pipe_event_source);
|
||||
- manager_close_idle_pipe(m);
|
||||
-
|
||||
- /* Turn off confirm spawn now */
|
||||
- m->confirm_spawn = false;
|
||||
-
|
||||
- /* No need to update ask password status when we're going non-interactive */
|
||||
- manager_close_ask_password(m);
|
||||
-
|
||||
- /* This is no longer the first boot */
|
||||
- manager_set_first_boot(m, false);
|
||||
-
|
||||
- if (dual_timestamp_is_set(&m->finish_timestamp))
|
||||
+ if (m->test_run)
|
||||
return;
|
||||
|
||||
- dual_timestamp_get(&m->finish_timestamp);
|
||||
-
|
||||
if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0) {
|
||||
|
||||
/* Note that m->kernel_usec.monotonic is always at 0,
|
||||
@@ -2677,10 +2645,6 @@ void manager_check_finished(Manager *m) {
|
||||
NULL);
|
||||
}
|
||||
|
||||
- SET_FOREACH(u, m->startup_units, i)
|
||||
- if (u->cgroup_path)
|
||||
- cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
|
||||
-
|
||||
bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
|
||||
|
||||
sd_notifyf(false,
|
||||
@@ -2689,6 +2653,50 @@ void manager_check_finished(Manager *m) {
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC));
|
||||
}
|
||||
|
||||
+void manager_check_finished(Manager *m) {
|
||||
+ Unit *u = NULL;
|
||||
+ Iterator i;
|
||||
+
|
||||
+ assert(m);
|
||||
+
|
||||
+ if (m->n_running_jobs == 0)
|
||||
+ m->jobs_in_progress_event_source = sd_event_source_unref(m->jobs_in_progress_event_source);
|
||||
+
|
||||
+ if (hashmap_size(m->jobs) > 0) {
|
||||
+
|
||||
+ if (m->jobs_in_progress_event_source)
|
||||
+ sd_event_source_set_time(m->jobs_in_progress_event_source, now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC);
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ manager_flip_auto_status(m, false);
|
||||
+
|
||||
+ /* Notify Type=idle units that we are done now */
|
||||
+ m->idle_pipe_event_source = sd_event_source_unref(m->idle_pipe_event_source);
|
||||
+ manager_close_idle_pipe(m);
|
||||
+
|
||||
+ /* Turn off confirm spawn now */
|
||||
+ m->confirm_spawn = false;
|
||||
+
|
||||
+ /* No need to update ask password status when we're going non-interactive */
|
||||
+ manager_close_ask_password(m);
|
||||
+
|
||||
+ /* This is no longer the first boot */
|
||||
+ manager_set_first_boot(m, false);
|
||||
+
|
||||
+ if (dual_timestamp_is_set(&m->finish_timestamp))
|
||||
+ return;
|
||||
+
|
||||
+ dual_timestamp_get(&m->finish_timestamp);
|
||||
+
|
||||
+ manager_notify_finished(m);
|
||||
+
|
||||
+ SET_FOREACH(u, m->startup_units, i)
|
||||
+ if (u->cgroup_path)
|
||||
+ cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
|
||||
+}
|
||||
+
|
||||
static int create_generator_dir(Manager *m, char **generator, const char *name) {
|
||||
char *p;
|
||||
int r;
|
|
@ -1,25 +0,0 @@
|
|||
From a7d611f280b3eadafd6b411b659a321b4d6e63f4 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Mack <zonque@gmail.com>
|
||||
Date: Fri, 22 Aug 2014 15:39:36 +0200
|
||||
Subject: [PATCH] missing.h: add fake __NR_memfd_create for MIPS
|
||||
|
||||
We don't have the correct __NR_memfd_create syscall number yet, so set it to
|
||||
0xffffffff for now to prevent compile time errors.
|
||||
---
|
||||
src/shared/missing.h | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/shared/missing.h b/src/shared/missing.h
|
||||
index 3ff1a21720..3051cb5640 100644
|
||||
--- a/src/shared/missing.h
|
||||
+++ b/src/shared/missing.h
|
||||
@@ -167,6 +167,9 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
|
||||
# define __NR_fanotify_mark 5296
|
||||
# endif
|
||||
# endif
|
||||
+# ifndef __NR_memfd_create
|
||||
+# define __NR_memfd_create 0xffffffff /* FIXME */
|
||||
+# endif
|
||||
#else
|
||||
# ifndef __NR_fanotify_init
|
||||
# define __NR_fanotify_init 338
|
|
@ -1,23 +0,0 @@
|
|||
From 2de1851fe3611c59abf77127c6b5bc1b91eb7cba Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Mack <zonque@gmail.com>
|
||||
Date: Fri, 22 Aug 2014 16:10:02 +0200
|
||||
Subject: [PATCH] missing.h: add a cpp warning for __NR_memfd_create on MIPS
|
||||
|
||||
---
|
||||
src/shared/missing.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shared/missing.h b/src/shared/missing.h
|
||||
index 3051cb5640..a9dd274274 100644
|
||||
--- a/src/shared/missing.h
|
||||
+++ b/src/shared/missing.h
|
||||
@@ -168,7 +168,8 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
|
||||
# endif
|
||||
# endif
|
||||
# ifndef __NR_memfd_create
|
||||
-# define __NR_memfd_create 0xffffffff /* FIXME */
|
||||
+# warning "__NR_memfd_create not yet defined for MIPS"
|
||||
+# define __NR_memfd_create 0xffffffff
|
||||
# endif
|
||||
#else
|
||||
# ifndef __NR_fanotify_init
|
|
@ -1,704 +0,0 @@
|
|||
From 2928b0a863091f8f291fddb168988711afd389ef Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 16:36:38 +0200
|
||||
Subject: [PATCH] core: add support for a configurable system-wide start-up
|
||||
timeout
|
||||
|
||||
When this system-wide start-up timeout is hit we execute one of the
|
||||
failure actions already implemented for services that fail.
|
||||
|
||||
This should not only be useful on embedded devices, but also on laptops
|
||||
which have the power-button reachable when the lid is closed. This
|
||||
devices, when in a backpack might get powered on by accident due to the
|
||||
easily reachable power button. We want to make sure that the system
|
||||
turns itself off if it starts up due this after a while.
|
||||
|
||||
When the system manages to fully start-up logind will suspend the
|
||||
machine by default if the lid is closed. However, in some cases we don't
|
||||
even get as far as logind, and the boot hangs much earlier, for example
|
||||
because we ask for a LUKS password that nobody ever enters.
|
||||
|
||||
Yeah, this is a real-life problem on my Yoga 13, which has one of those
|
||||
easily accessible power buttons, even if the device is closed.
|
||||
---
|
||||
Makefile.am | 4 +-
|
||||
man/systemd-system.conf.xml | 27 ++++++++++++-
|
||||
man/systemd.service.xml | 23 +++++------
|
||||
src/core/failure-action.c | 94 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/core/failure-action.h | 40 +++++++++++++++++++
|
||||
src/core/main.c | 13 +++++++
|
||||
src/core/manager.c | 43 +++++++++++++++++++--
|
||||
src/core/manager.h | 10 +++++
|
||||
src/core/service.c | 77 ++++---------------------------------
|
||||
src/core/service.h | 16 +-------
|
||||
src/core/system.conf | 3 ++
|
||||
src/shared/util.c | 21 ++++++++++
|
||||
src/shared/util.h | 2 +
|
||||
src/test/test-tables.c | 2 +-
|
||||
14 files changed, 273 insertions(+), 102 deletions(-)
|
||||
create mode 100644 src/core/failure-action.c
|
||||
create mode 100644 src/core/failure-action.h
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 4028112a62..cbf98bdac3 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -1112,7 +1112,9 @@ libsystemd_core_la_SOURCES = \
|
||||
src/core/audit-fd.c \
|
||||
src/core/audit-fd.h \
|
||||
src/core/show-status.c \
|
||||
- src/core/show-status.h
|
||||
+ src/core/show-status.h \
|
||||
+ src/core/failure-action.c \
|
||||
+ src/core/failure-action.h
|
||||
|
||||
if HAVE_KMOD
|
||||
libsystemd_core_la_SOURCES += \
|
||||
diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml
|
||||
index 6105c5131c..48690024f4 100644
|
||||
--- a/man/systemd-system.conf.xml
|
||||
+++ b/man/systemd-system.conf.xml
|
||||
@@ -254,7 +254,6 @@
|
||||
signal.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
-
|
||||
<varlistentry>
|
||||
<term><varname>TimerSlackNSec=</varname></term>
|
||||
|
||||
@@ -281,6 +280,32 @@
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
+ <term><varname>StartTimeoutSec=</varname></term>
|
||||
+ <term><varname>StartTimeoutAction=</varname></term>
|
||||
+ <term><varname>StartTimeoutRebootArgument=</varname></term>
|
||||
+
|
||||
+ <listitem><para>Configures an over-all
|
||||
+ system start-up timeout and controls
|
||||
+ what to do when the timeout is
|
||||
+ reached. <varname>StartTimeoutSec=</varname>
|
||||
+ specifies the timeout, and defaults to
|
||||
+ <literal>15min</literal>. <varname>StartTimeoutAction=</varname>
|
||||
+ configures the action to take when the
|
||||
+ system did not finish boot-up within
|
||||
+ the specified time. It takes the same
|
||||
+ values as the per-service
|
||||
+ <varname>StartLimitAction=</varname>
|
||||
+ setting, see
|
||||
+ <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
+ for details. Defaults to
|
||||
+ <option>reboot-force</option>. <varname>StartTimeoutRebootArgument=</varname>
|
||||
+ configures an optional reboot string
|
||||
+ to pass to the
|
||||
+ <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
|
||||
+ system call.</para></listitem>
|
||||
+ </varlistentry>
|
||||
+
|
||||
+ <varlistentry>
|
||||
<term><varname>DefaultTimerAccuracySec=</varname></term>
|
||||
|
||||
<listitem><para>Sets the default
|
||||
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
|
||||
index e584a1f006..20d2a0d755 100644
|
||||
--- a/man/systemd.service.xml
|
||||
+++ b/man/systemd.service.xml
|
||||
@@ -1155,29 +1155,30 @@ ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
+ <term><varname>FailureAction=</varname></term>
|
||||
+ <listitem><para>Configure the action
|
||||
+ to take when the service enters a failed
|
||||
+ state. Takes the same values as
|
||||
+ <varname>StartLimitAction=</varname>
|
||||
+ and executes the same actions.
|
||||
+ Defaults to <option>none</option>.
|
||||
+ </para></listitem>
|
||||
+ </varlistentry>
|
||||
+
|
||||
+ <varlistentry>
|
||||
<term><varname>RebootArgument=</varname></term>
|
||||
<listitem><para>Configure the optional
|
||||
argument for the
|
||||
<citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
|
||||
system call if
|
||||
<varname>StartLimitAction=</varname>
|
||||
+ or <varname>FailureAction=</varname>
|
||||
is a reboot action. This works just
|
||||
like the optional argument to
|
||||
<command>systemctl reboot</command>
|
||||
command.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
- <varlistentry>
|
||||
- <term><varname>FailureAction=</varname></term>
|
||||
- <listitem><para>Configure the action
|
||||
- to take when the service enters a failed
|
||||
- state. Takes the same values as
|
||||
- <varname>StartLimitAction=</varname>
|
||||
- and executes the same actions.
|
||||
- Defaults to <option>none</option>.
|
||||
- </para></listitem>
|
||||
- </varlistentry>
|
||||
-
|
||||
</variablelist>
|
||||
|
||||
<para>Check
|
||||
diff --git a/src/core/failure-action.c b/src/core/failure-action.c
|
||||
new file mode 100644
|
||||
index 0000000000..ca807b68da
|
||||
--- /dev/null
|
||||
+++ b/src/core/failure-action.c
|
||||
@@ -0,0 +1,94 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Lennart Poettering
|
||||
+ Copyright 2012 Michael Olbrich
|
||||
+
|
||||
+ 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 <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#include <sys/reboot.h>
|
||||
+#include <linux/reboot.h>
|
||||
+#include <sys/syscall.h>
|
||||
+
|
||||
+#include "bus-util.h"
|
||||
+#include "bus-error.h"
|
||||
+#include "special.h"
|
||||
+#include "failure-action.h"
|
||||
+
|
||||
+int failure_action(
|
||||
+ Manager *m,
|
||||
+ FailureAction action,
|
||||
+ const char *reboot_arg) {
|
||||
+
|
||||
+ int r;
|
||||
+
|
||||
+ assert(m);
|
||||
+ assert(action >= 0);
|
||||
+ assert(action < _FAILURE_ACTION_MAX);
|
||||
+
|
||||
+ switch (action) {
|
||||
+
|
||||
+ case FAILURE_ACTION_NONE:
|
||||
+ break;
|
||||
+
|
||||
+ case FAILURE_ACTION_REBOOT: {
|
||||
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
+
|
||||
+ log_warning("Rebooting as result of failure.");
|
||||
+
|
||||
+ update_reboot_param_file(reboot_arg);
|
||||
+ r = manager_add_job_by_name(m, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
|
||||
+ if (r < 0)
|
||||
+ log_error("Failed to reboot: %s.", bus_error_message(&error, r));
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case FAILURE_ACTION_REBOOT_FORCE:
|
||||
+ log_warning("Forcibly rebooting as result of failure.");
|
||||
+ update_reboot_param_file(reboot_arg);
|
||||
+ m->exit_code = MANAGER_REBOOT;
|
||||
+ break;
|
||||
+
|
||||
+ case FAILURE_ACTION_REBOOT_IMMEDIATE:
|
||||
+ log_warning("Rebooting immediately as result of failure.");
|
||||
+
|
||||
+ sync();
|
||||
+
|
||||
+ if (reboot_arg) {
|
||||
+ log_info("Rebooting with argument '%s'.", reboot_arg);
|
||||
+ syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_arg);
|
||||
+ }
|
||||
+
|
||||
+ log_info("Rebooting.");
|
||||
+ reboot(RB_AUTOBOOT);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ assert_not_reached("Unknown failure action");
|
||||
+ }
|
||||
+
|
||||
+ return -ECANCELED;
|
||||
+}
|
||||
+
|
||||
+static const char* const failure_action_table[_FAILURE_ACTION_MAX] = {
|
||||
+ [FAILURE_ACTION_NONE] = "none",
|
||||
+ [FAILURE_ACTION_REBOOT] = "reboot",
|
||||
+ [FAILURE_ACTION_REBOOT_FORCE] = "reboot-force",
|
||||
+ [FAILURE_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate"
|
||||
+};
|
||||
+DEFINE_STRING_TABLE_LOOKUP(failure_action, FailureAction);
|
||||
diff --git a/src/core/failure-action.h b/src/core/failure-action.h
|
||||
new file mode 100644
|
||||
index 0000000000..5353192f31
|
||||
--- /dev/null
|
||||
+++ b/src/core/failure-action.h
|
||||
@@ -0,0 +1,40 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Lennart Poettering
|
||||
+ Copyright 2012 Michael Olbrich
|
||||
+
|
||||
+ 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 <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+typedef enum FailureAction {
|
||||
+ FAILURE_ACTION_NONE,
|
||||
+ FAILURE_ACTION_REBOOT,
|
||||
+ FAILURE_ACTION_REBOOT_FORCE,
|
||||
+ FAILURE_ACTION_REBOOT_IMMEDIATE,
|
||||
+ _FAILURE_ACTION_MAX,
|
||||
+ _FAILURE_ACTION_INVALID = -1
|
||||
+} FailureAction;
|
||||
+
|
||||
+#include "macro.h"
|
||||
+#include "manager.h"
|
||||
+
|
||||
+int failure_action(Manager *m, FailureAction action, const char *reboot_arg);
|
||||
+
|
||||
+const char* failure_action_to_string(FailureAction i) _const_;
|
||||
+FailureAction failure_action_from_string(const char *s) _pure_;
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index 792b316c61..ed690162bf 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -116,6 +116,9 @@ static FILE* arg_serialization = NULL;
|
||||
static bool arg_default_cpu_accounting = false;
|
||||
static bool arg_default_blockio_accounting = false;
|
||||
static bool arg_default_memory_accounting = false;
|
||||
+static usec_t arg_start_timeout_usec = DEFAULT_MANAGER_START_TIMEOUT_USEC;
|
||||
+static FailureAction arg_start_timeout_action = FAILURE_ACTION_REBOOT_FORCE;
|
||||
+static char *arg_start_timeout_reboot_arg = NULL;
|
||||
|
||||
static void nop_handler(int sig) {}
|
||||
|
||||
@@ -669,6 +672,9 @@ static int parse_config_file(void) {
|
||||
{ "Manager", "DefaultCPUAccounting", config_parse_bool, 0, &arg_default_cpu_accounting },
|
||||
{ "Manager", "DefaultBlockIOAccounting", config_parse_bool, 0, &arg_default_blockio_accounting },
|
||||
{ "Manager", "DefaultMemoryAccounting", config_parse_bool, 0, &arg_default_memory_accounting },
|
||||
+ { "Manager", "StartTimeoutSec", config_parse_sec, 0, &arg_start_timeout_usec },
|
||||
+ { "Manager", "StartTimeoutAction", config_parse_failure_action, 0, &arg_start_timeout_action },
|
||||
+ { "Manager", "StartTimeoutRebootArgument",config_parse_string, 0, &arg_start_timeout_reboot_arg },
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -1628,6 +1634,10 @@ int main(int argc, char *argv[]) {
|
||||
m->default_memory_accounting = arg_default_memory_accounting;
|
||||
m->runtime_watchdog = arg_runtime_watchdog;
|
||||
m->shutdown_watchdog = arg_shutdown_watchdog;
|
||||
+ m->start_timeout_usec = arg_start_timeout_usec;
|
||||
+ m->start_timeout_action = arg_start_timeout_action;
|
||||
+ free_and_strdup(&m->start_timeout_reboot_arg, arg_start_timeout_reboot_arg);
|
||||
+
|
||||
m->userspace_timestamp = userspace_timestamp;
|
||||
m->kernel_timestamp = kernel_timestamp;
|
||||
m->initrd_timestamp = initrd_timestamp;
|
||||
@@ -1816,6 +1826,9 @@ finish:
|
||||
set_free(arg_syscall_archs);
|
||||
arg_syscall_archs = NULL;
|
||||
|
||||
+ free(arg_start_timeout_reboot_arg);
|
||||
+ arg_start_timeout_reboot_arg = NULL;
|
||||
+
|
||||
label_finish();
|
||||
|
||||
if (reexecute) {
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index 7401817844..1bb0c9025f 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -435,6 +435,8 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
|
||||
m->running_as = running_as;
|
||||
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
|
||||
m->default_timer_accuracy_usec = USEC_PER_MINUTE;
|
||||
+ m->start_timeout_usec = DEFAULT_MANAGER_START_TIMEOUT_USEC;
|
||||
+ m->start_timeout_action = FAILURE_ACTION_REBOOT_FORCE;
|
||||
|
||||
m->idle_pipe[0] = m->idle_pipe[1] = m->idle_pipe[2] = m->idle_pipe[3] = -1;
|
||||
|
||||
@@ -823,6 +825,9 @@ void manager_free(Manager *m) {
|
||||
|
||||
manager_close_idle_pipe(m);
|
||||
|
||||
+ sd_event_source_unref(m->start_timeout_event_source);
|
||||
+ free(m->start_timeout_reboot_arg);
|
||||
+
|
||||
udev_unref(m->udev);
|
||||
sd_event_unref(m->event);
|
||||
|
||||
@@ -970,6 +975,20 @@ static int manager_distribute_fds(Manager *m, FDSet *fds) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int on_start_timeout(sd_event_source *s, usec_t usec, void *userdata) {
|
||||
+ Manager *m = userdata;
|
||||
+
|
||||
+ assert(s);
|
||||
+ assert(m);
|
||||
+
|
||||
+ m->start_timeout_event_source = sd_event_source_unref(m->start_timeout_event_source);
|
||||
+
|
||||
+ log_error("Startup timed out.");
|
||||
+
|
||||
+ failure_action(m, m->start_timeout_action, m->start_timeout_reboot_arg);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
|
||||
int r, q;
|
||||
|
||||
@@ -1042,6 +1061,22 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
|
||||
m->send_reloading_done = true;
|
||||
}
|
||||
|
||||
+ /* Possibly set up a start timeout */
|
||||
+ if (!dual_timestamp_is_set(&m->finish_timestamp)) {
|
||||
+ m->start_timeout_event_source = sd_event_source_unref(m->start_timeout_event_source);
|
||||
+
|
||||
+ if (m->start_timeout_usec) {
|
||||
+ r = sd_event_add_time(
|
||||
+ m->event,
|
||||
+ &m->start_timeout_event_source,
|
||||
+ CLOCK_MONOTONIC,
|
||||
+ now(CLOCK_MONOTONIC) + m->start_timeout_usec, 0,
|
||||
+ on_start_timeout, m);
|
||||
+ if (r < 0)
|
||||
+ log_error("Failed to add start timeout event: %s", strerror(-r));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -2462,10 +2497,8 @@ void manager_check_finished(Manager *m) {
|
||||
|
||||
if (hashmap_size(m->jobs) > 0) {
|
||||
|
||||
- if (m->jobs_in_progress_event_source) {
|
||||
- sd_event_source_set_time(m->jobs_in_progress_event_source,
|
||||
- now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC);
|
||||
- }
|
||||
+ if (m->jobs_in_progress_event_source)
|
||||
+ sd_event_source_set_time(m->jobs_in_progress_event_source, now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2487,6 +2520,8 @@ void manager_check_finished(Manager *m) {
|
||||
|
||||
dual_timestamp_get(&m->finish_timestamp);
|
||||
|
||||
+ m->start_timeout_event_source = sd_event_source_unref(m->start_timeout_event_source);
|
||||
+
|
||||
if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0) {
|
||||
|
||||
/* Note that m->kernel_usec.monotonic is always at 0,
|
||||
diff --git a/src/core/manager.h b/src/core/manager.h
|
||||
index 7cb76f7f00..7d26c3adea 100644
|
||||
--- a/src/core/manager.h
|
||||
+++ b/src/core/manager.h
|
||||
@@ -33,6 +33,8 @@
|
||||
/* Enforce upper limit how many names we allow */
|
||||
#define MANAGER_MAX_NAMES 131072 /* 128K */
|
||||
|
||||
+#define DEFAULT_MANAGER_START_TIMEOUT_USEC (15*USEC_PER_MINUTE)
|
||||
+
|
||||
typedef struct Manager Manager;
|
||||
|
||||
typedef enum ManagerState {
|
||||
@@ -69,6 +71,7 @@ typedef enum ManagerExitCode {
|
||||
#include "unit-name.h"
|
||||
#include "exit-status.h"
|
||||
#include "show-status.h"
|
||||
+#include "failure-action.h"
|
||||
|
||||
struct Manager {
|
||||
/* Note that the set of units we know of is allowed to be
|
||||
@@ -152,6 +155,7 @@ struct Manager {
|
||||
dual_timestamp initrd_timestamp;
|
||||
dual_timestamp userspace_timestamp;
|
||||
dual_timestamp finish_timestamp;
|
||||
+
|
||||
dual_timestamp security_start_timestamp;
|
||||
dual_timestamp security_finish_timestamp;
|
||||
dual_timestamp generators_start_timestamp;
|
||||
@@ -279,6 +283,12 @@ struct Manager {
|
||||
|
||||
/* Used for processing polkit authorization responses */
|
||||
Hashmap *polkit_registry;
|
||||
+
|
||||
+ /* System wide startup timeouts */
|
||||
+ usec_t start_timeout_usec;
|
||||
+ sd_event_source *start_timeout_event_source;
|
||||
+ FailureAction start_timeout_action;
|
||||
+ char *start_timeout_reboot_arg;
|
||||
};
|
||||
|
||||
int manager_new(SystemdRunningAs running_as, bool test_run, Manager **m);
|
||||
diff --git a/src/core/service.c b/src/core/service.c
|
||||
index 1b864c4c8c..223e4b3a41 100644
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <signal.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
-#include <sys/reboot.h>
|
||||
-#include <linux/reboot.h>
|
||||
-#include <sys/syscall.h>
|
||||
|
||||
#include "async.h"
|
||||
#include "manager.h"
|
||||
@@ -1052,8 +1049,6 @@ static int cgroup_good(Service *s) {
|
||||
return !r;
|
||||
}
|
||||
|
||||
-static int service_execute_action(Service *s, FailureAction action, const char *reason, bool log_action_none);
|
||||
-
|
||||
static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) {
|
||||
int r;
|
||||
assert(s);
|
||||
@@ -1063,8 +1058,10 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
|
||||
|
||||
service_set_state(s, s->result != SERVICE_SUCCESS ? SERVICE_FAILED : SERVICE_DEAD);
|
||||
|
||||
- if (s->result != SERVICE_SUCCESS)
|
||||
- service_execute_action(s, s->failure_action, "failed", false);
|
||||
+ if (s->result != SERVICE_SUCCESS) {
|
||||
+ log_warning_unit(UNIT(s)->id, "%s failed.", UNIT(s)->id);
|
||||
+ failure_action(UNIT(s)->manager, s->failure_action, s->reboot_arg);
|
||||
+ }
|
||||
|
||||
if (allow_restart &&
|
||||
!s->forbid_restart &&
|
||||
@@ -1601,67 +1598,15 @@ fail:
|
||||
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
|
||||
}
|
||||
|
||||
-static int service_execute_action(Service *s, FailureAction action, const char *reason, bool log_action_none) {
|
||||
- assert(s);
|
||||
-
|
||||
- if (action == SERVICE_FAILURE_ACTION_REBOOT ||
|
||||
- action == SERVICE_FAILURE_ACTION_REBOOT_FORCE)
|
||||
- update_reboot_param_file(s->reboot_arg);
|
||||
-
|
||||
- switch (action) {
|
||||
-
|
||||
- case SERVICE_FAILURE_ACTION_NONE:
|
||||
- if (log_action_none)
|
||||
- log_warning_unit(UNIT(s)->id, "%s %s, refusing to start.", UNIT(s)->id, reason);
|
||||
- break;
|
||||
-
|
||||
- case SERVICE_FAILURE_ACTION_REBOOT: {
|
||||
- _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
- int r;
|
||||
-
|
||||
- log_warning_unit(UNIT(s)->id, "%s %s, rebooting.", UNIT(s)->id, reason);
|
||||
-
|
||||
- r = manager_add_job_by_name(UNIT(s)->manager, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
|
||||
- if (r < 0)
|
||||
- log_error_unit(UNIT(s)->id, "Failed to reboot: %s.", bus_error_message(&error, r));
|
||||
-
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- case SERVICE_FAILURE_ACTION_REBOOT_FORCE:
|
||||
- log_warning_unit(UNIT(s)->id, "%s %s, forcibly rebooting.", UNIT(s)->id, reason);
|
||||
- UNIT(s)->manager->exit_code = MANAGER_REBOOT;
|
||||
- break;
|
||||
-
|
||||
- case SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE:
|
||||
- log_warning_unit(UNIT(s)->id, "%s %s, rebooting immediately.", UNIT(s)->id, reason);
|
||||
-
|
||||
- sync();
|
||||
-
|
||||
- if (s->reboot_arg) {
|
||||
- log_info("Rebooting with argument '%s'.", s->reboot_arg);
|
||||
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, s->reboot_arg);
|
||||
- }
|
||||
-
|
||||
- log_info("Rebooting.");
|
||||
- reboot(RB_AUTOBOOT);
|
||||
- break;
|
||||
-
|
||||
- default:
|
||||
- log_error_unit(UNIT(s)->id, "failure action=%i", action);
|
||||
- assert_not_reached("Unknown FailureAction.");
|
||||
- }
|
||||
-
|
||||
- return -ECANCELED;
|
||||
-}
|
||||
-
|
||||
static int service_start_limit_test(Service *s) {
|
||||
assert(s);
|
||||
|
||||
if (ratelimit_test(&s->start_limit))
|
||||
return 0;
|
||||
|
||||
- return service_execute_action(s, s->start_limit_action, "start request repeated too quickly", true);
|
||||
+ log_warning_unit(UNIT(s)->id, "start request repeated too quickly for %s", UNIT(s)->id);
|
||||
+
|
||||
+ return failure_action(UNIT(s)->manager, s->start_limit_action, s->reboot_arg);
|
||||
}
|
||||
|
||||
static int service_start(Unit *u) {
|
||||
@@ -2908,14 +2853,6 @@ static const char* const service_result_table[_SERVICE_RESULT_MAX] = {
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(service_result, ServiceResult);
|
||||
|
||||
-static const char* const failure_action_table[_SERVICE_FAILURE_ACTION_MAX] = {
|
||||
- [SERVICE_FAILURE_ACTION_NONE] = "none",
|
||||
- [SERVICE_FAILURE_ACTION_REBOOT] = "reboot",
|
||||
- [SERVICE_FAILURE_ACTION_REBOOT_FORCE] = "reboot-force",
|
||||
- [SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate"
|
||||
-};
|
||||
-DEFINE_STRING_TABLE_LOOKUP(failure_action, FailureAction);
|
||||
-
|
||||
const UnitVTable service_vtable = {
|
||||
.object_size = sizeof(Service),
|
||||
.exec_context_offset = offsetof(Service, exec_context),
|
||||
diff --git a/src/core/service.h b/src/core/service.h
|
||||
index 0227321d99..5bcfd14339 100644
|
||||
--- a/src/core/service.h
|
||||
+++ b/src/core/service.h
|
||||
@@ -28,6 +28,7 @@ typedef struct Service Service;
|
||||
#include "ratelimit.h"
|
||||
#include "kill.h"
|
||||
#include "exit-status.h"
|
||||
+#include "failure-action.h"
|
||||
|
||||
typedef enum ServiceState {
|
||||
SERVICE_DEAD,
|
||||
@@ -113,15 +114,6 @@ typedef enum ServiceResult {
|
||||
_SERVICE_RESULT_INVALID = -1
|
||||
} ServiceResult;
|
||||
|
||||
-typedef enum FailureAction {
|
||||
- SERVICE_FAILURE_ACTION_NONE,
|
||||
- SERVICE_FAILURE_ACTION_REBOOT,
|
||||
- SERVICE_FAILURE_ACTION_REBOOT_FORCE,
|
||||
- SERVICE_FAILURE_ACTION_REBOOT_IMMEDIATE,
|
||||
- _SERVICE_FAILURE_ACTION_MAX,
|
||||
- _SERVICE_FAILURE_ACTION_INVALID = -1
|
||||
-} FailureAction;
|
||||
-
|
||||
struct Service {
|
||||
Unit meta;
|
||||
|
||||
@@ -193,10 +185,9 @@ struct Service {
|
||||
char *status_text;
|
||||
int status_errno;
|
||||
|
||||
- FailureAction failure_action;
|
||||
-
|
||||
RateLimit start_limit;
|
||||
FailureAction start_limit_action;
|
||||
+ FailureAction failure_action;
|
||||
char *reboot_arg;
|
||||
|
||||
UnitRef accept_socket;
|
||||
@@ -234,6 +225,3 @@ NotifyState notify_state_from_string(const char *s) _pure_;
|
||||
|
||||
const char* service_result_to_string(ServiceResult i) _const_;
|
||||
ServiceResult service_result_from_string(const char *s) _pure_;
|
||||
-
|
||||
-const char* failure_action_to_string(FailureAction i) _const_;
|
||||
-FailureAction failure_action_from_string(const char *s) _pure_;
|
||||
diff --git a/src/core/system.conf b/src/core/system.conf
|
||||
index 65a35a0689..45448de328 100644
|
||||
--- a/src/core/system.conf
|
||||
+++ b/src/core/system.conf
|
||||
@@ -23,6 +23,9 @@
|
||||
#CapabilityBoundingSet=
|
||||
#SystemCallArchitectures=
|
||||
#TimerSlackNSec=
|
||||
+#StartTimeoutSec=15min
|
||||
+#StartTimeoutAction=reboot-force
|
||||
+#StartTimeoutRebootArgument=
|
||||
#DefaultTimerAccuracySec=1min
|
||||
#DefaultStandardOutput=journal
|
||||
#DefaultStandardError=inherit
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index a54e879953..fc6f668726 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -7137,3 +7137,24 @@ int unquote_many_words(const char **p, ...) {
|
||||
|
||||
return c;
|
||||
}
|
||||
+
|
||||
+int free_and_strdup(char **p, const char *s) {
|
||||
+ char *t;
|
||||
+
|
||||
+ assert(p);
|
||||
+
|
||||
+ /* Replaces a string pointer with an strdup()ed new string,
|
||||
+ * possibly freeing the old one. */
|
||||
+
|
||||
+ if (s) {
|
||||
+ t = strdup(s);
|
||||
+ if (!t)
|
||||
+ return -ENOMEM;
|
||||
+ } else
|
||||
+ t = NULL;
|
||||
+
|
||||
+ free(*p);
|
||||
+ *p = t;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/src/shared/util.h b/src/shared/util.h
|
||||
index 8cd47b8294..cd947dbbef 100644
|
||||
--- a/src/shared/util.h
|
||||
+++ b/src/shared/util.h
|
||||
@@ -978,3 +978,5 @@ int is_symlink(const char *path);
|
||||
|
||||
int unquote_first_word(const char **p, char **ret);
|
||||
int unquote_many_words(const char **p, ...) _sentinel_;
|
||||
+
|
||||
+int free_and_strdup(char **p, const char *s);
|
||||
diff --git a/src/test/test-tables.c b/src/test/test-tables.c
|
||||
index 88e7d10c60..58fe4433b7 100644
|
||||
--- a/src/test/test-tables.c
|
||||
+++ b/src/test/test-tables.c
|
||||
@@ -63,7 +63,7 @@ int main(int argc, char **argv) {
|
||||
test_table(device_state, DEVICE_STATE);
|
||||
test_table(exec_input, EXEC_INPUT);
|
||||
test_table(exec_output, EXEC_OUTPUT);
|
||||
- test_table(failure_action, SERVICE_FAILURE_ACTION);
|
||||
+ test_table(failure_action, FAILURE_ACTION);
|
||||
test_table(job_mode, JOB_MODE);
|
||||
test_table(job_result, JOB_RESULT);
|
||||
test_table(job_state, JOB_STATE);
|
|
@ -1,85 +0,0 @@
|
|||
From e12919e8be5c80efe09a57f642bbd2411b313ced Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 16:41:00 +0200
|
||||
Subject: [PATCH] core: print 'startup finished' messages even if we log to
|
||||
console
|
||||
|
||||
---
|
||||
src/core/manager.c | 55 ++++++++++++++++++++++++++----------------------------
|
||||
1 file changed, 26 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index 1bb0c9025f..7508fefaef 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -2539,44 +2539,41 @@ void manager_check_finished(Manager *m) {
|
||||
kernel_usec = m->initrd_timestamp.monotonic - m->kernel_timestamp.monotonic;
|
||||
initrd_usec = m->userspace_timestamp.monotonic - m->initrd_timestamp.monotonic;
|
||||
|
||||
- if (!log_on_console())
|
||||
- log_struct(LOG_INFO,
|
||||
- MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
|
||||
- "KERNEL_USEC="USEC_FMT, kernel_usec,
|
||||
- "INITRD_USEC="USEC_FMT, initrd_usec,
|
||||
- "USERSPACE_USEC="USEC_FMT, userspace_usec,
|
||||
- "MESSAGE=Startup finished in %s (kernel) + %s (initrd) + %s (userspace) = %s.",
|
||||
- format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC),
|
||||
- format_timespan(initrd, sizeof(initrd), initrd_usec, USEC_PER_MSEC),
|
||||
- format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC),
|
||||
- format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC),
|
||||
- NULL);
|
||||
+ log_struct(LOG_INFO,
|
||||
+ MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
|
||||
+ "KERNEL_USEC="USEC_FMT, kernel_usec,
|
||||
+ "INITRD_USEC="USEC_FMT, initrd_usec,
|
||||
+ "USERSPACE_USEC="USEC_FMT, userspace_usec,
|
||||
+ "MESSAGE=Startup finished in %s (kernel) + %s (initrd) + %s (userspace) = %s.",
|
||||
+ format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC),
|
||||
+ format_timespan(initrd, sizeof(initrd), initrd_usec, USEC_PER_MSEC),
|
||||
+ format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC),
|
||||
+ format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC),
|
||||
+ NULL);
|
||||
} else {
|
||||
kernel_usec = m->userspace_timestamp.monotonic - m->kernel_timestamp.monotonic;
|
||||
initrd_usec = 0;
|
||||
|
||||
- if (!log_on_console())
|
||||
- log_struct(LOG_INFO,
|
||||
- MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
|
||||
- "KERNEL_USEC="USEC_FMT, kernel_usec,
|
||||
- "USERSPACE_USEC="USEC_FMT, userspace_usec,
|
||||
- "MESSAGE=Startup finished in %s (kernel) + %s (userspace) = %s.",
|
||||
- format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC),
|
||||
- format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC),
|
||||
- format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC),
|
||||
- NULL);
|
||||
- }
|
||||
- } else {
|
||||
- firmware_usec = loader_usec = initrd_usec = kernel_usec = 0;
|
||||
- total_usec = userspace_usec = m->finish_timestamp.monotonic - m->userspace_timestamp.monotonic;
|
||||
-
|
||||
- if (!log_on_console())
|
||||
log_struct(LOG_INFO,
|
||||
MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
|
||||
+ "KERNEL_USEC="USEC_FMT, kernel_usec,
|
||||
"USERSPACE_USEC="USEC_FMT, userspace_usec,
|
||||
- "MESSAGE=Startup finished in %s.",
|
||||
+ "MESSAGE=Startup finished in %s (kernel) + %s (userspace) = %s.",
|
||||
+ format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC),
|
||||
+ format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC),
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC),
|
||||
NULL);
|
||||
+ }
|
||||
+ } else {
|
||||
+ firmware_usec = loader_usec = initrd_usec = kernel_usec = 0;
|
||||
+ total_usec = userspace_usec = m->finish_timestamp.monotonic - m->userspace_timestamp.monotonic;
|
||||
+
|
||||
+ log_struct(LOG_INFO,
|
||||
+ MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED),
|
||||
+ "USERSPACE_USEC="USEC_FMT, userspace_usec,
|
||||
+ "MESSAGE=Startup finished in %s.",
|
||||
+ format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC),
|
||||
+ NULL);
|
||||
}
|
||||
|
||||
SET_FOREACH(u, m->startup_units, i)
|
|
@ -1,22 +0,0 @@
|
|||
From c4147df156835513c43260a14fc9f7af177f737f Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 16:58:25 +0200
|
||||
Subject: [PATCH] resolved: fix typo in log message
|
||||
|
||||
---
|
||||
src/resolve/resolved-manager.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
|
||||
index 659b1dacc8..f97989754d 100644
|
||||
--- a/src/resolve/resolved-manager.c
|
||||
+++ b/src/resolve/resolved-manager.c
|
||||
@@ -449,7 +449,7 @@ static int manager_llmnr_start(Manager *m) {
|
||||
return 0;
|
||||
|
||||
eaddrinuse:
|
||||
- log_warning("There appears to be another LLMNR respondering running. Turning off LLMNR support.");
|
||||
+ log_warning("There appears to be another LLMNR responder running. Turning off LLMNR support.");
|
||||
m->llmnr_support = SUPPORT_NO;
|
||||
manager_llmnr_stop(m);
|
||||
|
|
@ -1,219 +0,0 @@
|
|||
From f07756bfe25c64119704c93a634162d6c88b5c89 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 16:59:46 +0200
|
||||
Subject: [PATCH] core: introduce "poweroff" as new failure action types
|
||||
|
||||
Also, change the default action on a system start-up timeout to powering off.
|
||||
---
|
||||
man/systemd-system.conf.xml | 2 +-
|
||||
man/systemd.service.xml | 31 +++++++++++++++++++-----------
|
||||
src/core/failure-action.c | 46 +++++++++++++++++++++++++++++++++++++++++----
|
||||
src/core/failure-action.h | 3 +++
|
||||
src/core/main.c | 2 +-
|
||||
src/core/manager.c | 2 +-
|
||||
src/core/shutdown.c | 3 +--
|
||||
src/core/system.conf | 2 +-
|
||||
8 files changed, 70 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml
|
||||
index 48690024f4..1fad1dba80 100644
|
||||
--- a/man/systemd-system.conf.xml
|
||||
+++ b/man/systemd-system.conf.xml
|
||||
@@ -298,7 +298,7 @@
|
||||
setting, see
|
||||
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
for details. Defaults to
|
||||
- <option>reboot-force</option>. <varname>StartTimeoutRebootArgument=</varname>
|
||||
+ <option>poweroff-force</option>. <varname>StartTimeoutRebootArgument=</varname>
|
||||
configures an optional reboot string
|
||||
to pass to the
|
||||
<citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
|
||||
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
|
||||
index 20d2a0d755..8b17f857ce 100644
|
||||
--- a/man/systemd.service.xml
|
||||
+++ b/man/systemd.service.xml
|
||||
@@ -1131,26 +1131,35 @@ ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
|
||||
hit. Takes one of
|
||||
<option>none</option>,
|
||||
<option>reboot</option>,
|
||||
- <option>reboot-force</option>, or
|
||||
- <option>reboot-immediate</option>. If
|
||||
- <option>none</option> is set,
|
||||
- hitting the rate limit will trigger no
|
||||
- action besides that the start will not
|
||||
- be permitted. <option>reboot</option>
|
||||
+ <option>reboot-force</option>,
|
||||
+ <option>reboot-immediate</option>,
|
||||
+ <option>poweroff</option>,
|
||||
+ <option>poweroff-force</option> or
|
||||
+ <option>poweroff-immediate</option>. If
|
||||
+ <option>none</option> is set, hitting
|
||||
+ the rate limit will trigger no action
|
||||
+ besides that the start will not be
|
||||
+ permitted. <option>reboot</option>
|
||||
causes a reboot following the normal
|
||||
shutdown procedure (i.e. equivalent to
|
||||
<command>systemctl reboot</command>).
|
||||
- <option>reboot-force</option> causes
|
||||
- a forced reboot which will terminate
|
||||
- all processes forcibly but should
|
||||
- cause no dirty file systems on reboot
|
||||
+ <option>reboot-force</option> causes a
|
||||
+ forced reboot which will terminate all
|
||||
+ processes forcibly but should cause no
|
||||
+ dirty file systems on reboot
|
||||
(i.e. equivalent to <command>systemctl
|
||||
reboot -f</command>) and
|
||||
<option>reboot-immediate</option>
|
||||
causes immediate execution of the
|
||||
<citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
|
||||
system call, which might result in
|
||||
- data loss. Defaults to
|
||||
+ data loss. Similar,
|
||||
+ <option>poweroff</option>,
|
||||
+ <option>poweroff-force</option>,
|
||||
+ <option>poweroff-immediate</option>
|
||||
+ have the effect of powering down the
|
||||
+ system with similar
|
||||
+ semantics. Defaults to
|
||||
<option>none</option>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
diff --git a/src/core/failure-action.c b/src/core/failure-action.c
|
||||
index ca807b68da..941747429f 100644
|
||||
--- a/src/core/failure-action.c
|
||||
+++ b/src/core/failure-action.c
|
||||
@@ -40,10 +40,19 @@ int failure_action(
|
||||
assert(action >= 0);
|
||||
assert(action < _FAILURE_ACTION_MAX);
|
||||
|
||||
- switch (action) {
|
||||
+ if (action == FAILURE_ACTION_NONE)
|
||||
+ return -ECANCELED;
|
||||
|
||||
- case FAILURE_ACTION_NONE:
|
||||
- break;
|
||||
+ if (m->running_as == SYSTEMD_USER) {
|
||||
+ /* Downgrade all options to simply exiting if we run
|
||||
+ * in user mode */
|
||||
+
|
||||
+ log_warning("Exiting as result of failure.");
|
||||
+ m->exit_code = MANAGER_EXIT;
|
||||
+ return -ECANCELED;
|
||||
+ }
|
||||
+
|
||||
+ switch (action) {
|
||||
|
||||
case FAILURE_ACTION_REBOOT: {
|
||||
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
@@ -78,6 +87,32 @@ int failure_action(
|
||||
reboot(RB_AUTOBOOT);
|
||||
break;
|
||||
|
||||
+ case FAILURE_ACTION_POWEROFF: {
|
||||
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
+
|
||||
+ log_warning("Powering off as result of failure.");
|
||||
+
|
||||
+ r = manager_add_job_by_name(m, JOB_START, SPECIAL_POWEROFF_TARGET, JOB_REPLACE, true, &error, NULL);
|
||||
+ if (r < 0)
|
||||
+ log_error("Failed to poweroff: %s.", bus_error_message(&error, r));
|
||||
+
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case FAILURE_ACTION_POWEROFF_FORCE:
|
||||
+ log_warning("Forcibly powering off as result of failure.");
|
||||
+ m->exit_code = MANAGER_POWEROFF;
|
||||
+ break;
|
||||
+
|
||||
+ case FAILURE_ACTION_POWEROFF_IMMEDIATE:
|
||||
+ log_warning("Powering off immediately as result of failure.");
|
||||
+
|
||||
+ sync();
|
||||
+
|
||||
+ log_info("Powering off.");
|
||||
+ reboot(RB_POWER_OFF);
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
assert_not_reached("Unknown failure action");
|
||||
}
|
||||
@@ -89,6 +124,9 @@ static const char* const failure_action_table[_FAILURE_ACTION_MAX] = {
|
||||
[FAILURE_ACTION_NONE] = "none",
|
||||
[FAILURE_ACTION_REBOOT] = "reboot",
|
||||
[FAILURE_ACTION_REBOOT_FORCE] = "reboot-force",
|
||||
- [FAILURE_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate"
|
||||
+ [FAILURE_ACTION_REBOOT_IMMEDIATE] = "reboot-immediate",
|
||||
+ [FAILURE_ACTION_POWEROFF] = "poweroff",
|
||||
+ [FAILURE_ACTION_POWEROFF_FORCE] = "poweroff-force",
|
||||
+ [FAILURE_ACTION_POWEROFF_IMMEDIATE] = "poweroff-immediate"
|
||||
};
|
||||
DEFINE_STRING_TABLE_LOOKUP(failure_action, FailureAction);
|
||||
diff --git a/src/core/failure-action.h b/src/core/failure-action.h
|
||||
index 5353192f31..1af4dd987b 100644
|
||||
--- a/src/core/failure-action.h
|
||||
+++ b/src/core/failure-action.h
|
||||
@@ -27,6 +27,9 @@ typedef enum FailureAction {
|
||||
FAILURE_ACTION_REBOOT,
|
||||
FAILURE_ACTION_REBOOT_FORCE,
|
||||
FAILURE_ACTION_REBOOT_IMMEDIATE,
|
||||
+ FAILURE_ACTION_POWEROFF,
|
||||
+ FAILURE_ACTION_POWEROFF_FORCE,
|
||||
+ FAILURE_ACTION_POWEROFF_IMMEDIATE,
|
||||
_FAILURE_ACTION_MAX,
|
||||
_FAILURE_ACTION_INVALID = -1
|
||||
} FailureAction;
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index ed690162bf..bd148b1b33 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -117,7 +117,7 @@ static bool arg_default_cpu_accounting = false;
|
||||
static bool arg_default_blockio_accounting = false;
|
||||
static bool arg_default_memory_accounting = false;
|
||||
static usec_t arg_start_timeout_usec = DEFAULT_MANAGER_START_TIMEOUT_USEC;
|
||||
-static FailureAction arg_start_timeout_action = FAILURE_ACTION_REBOOT_FORCE;
|
||||
+static FailureAction arg_start_timeout_action = FAILURE_ACTION_POWEROFF_FORCE;
|
||||
static char *arg_start_timeout_reboot_arg = NULL;
|
||||
|
||||
static void nop_handler(int sig) {}
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index 7508fefaef..7639aeef19 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -436,7 +436,7 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
|
||||
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
|
||||
m->default_timer_accuracy_usec = USEC_PER_MINUTE;
|
||||
m->start_timeout_usec = DEFAULT_MANAGER_START_TIMEOUT_USEC;
|
||||
- m->start_timeout_action = FAILURE_ACTION_REBOOT_FORCE;
|
||||
+ m->start_timeout_action = FAILURE_ACTION_POWEROFF_FORCE;
|
||||
|
||||
m->idle_pipe[0] = m->idle_pipe[1] = m->idle_pipe[2] = m->idle_pipe[3] = -1;
|
||||
|
||||
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
|
||||
index 1abc140e7d..0e2ea5754f 100644
|
||||
--- a/src/core/shutdown.c
|
||||
+++ b/src/core/shutdown.c
|
||||
@@ -435,8 +435,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (read_one_line_file(REBOOT_PARAM_FILE, ¶m) >= 0) {
|
||||
log_info("Rebooting with argument '%s'.", param);
|
||||
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
|
||||
- LINUX_REBOOT_CMD_RESTART2, param);
|
||||
+ syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, param);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/core/system.conf b/src/core/system.conf
|
||||
index 45448de328..5a723bb20e 100644
|
||||
--- a/src/core/system.conf
|
||||
+++ b/src/core/system.conf
|
||||
@@ -24,7 +24,7 @@
|
||||
#SystemCallArchitectures=
|
||||
#TimerSlackNSec=
|
||||
#StartTimeoutSec=15min
|
||||
-#StartTimeoutAction=reboot-force
|
||||
+#StartTimeoutAction=poweroff-force
|
||||
#StartTimeoutRebootArgument=
|
||||
#DefaultTimerAccuracySec=1min
|
||||
#DefaultStandardOutput=journal
|
|
@ -1,88 +0,0 @@
|
|||
From d81afec1c9bf4b73e3df8996d65ecae95d19b6db Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 18:07:18 +0200
|
||||
Subject: [PATCH] core: split up "starting" manager state into "initializing"
|
||||
and "starting"
|
||||
|
||||
We'll stay in "initializing" until basic.target has reached, at which
|
||||
point we will enter "starting".
|
||||
|
||||
This is preparation so that we can change the startip timeout to only
|
||||
apply to the first phase of startup, not the full procedure.
|
||||
---
|
||||
src/core/cgroup.c | 4 ++--
|
||||
src/core/manager.c | 11 +++++++++--
|
||||
src/core/manager.h | 1 +
|
||||
3 files changed, 12 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
|
||||
index 9248cb523b..6c6e4f5e7b 100644
|
||||
--- a/src/core/cgroup.c
|
||||
+++ b/src/core/cgroup.c
|
||||
@@ -300,7 +300,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
||||
char buf[MAX(DECIMAL_STR_MAX(unsigned long), DECIMAL_STR_MAX(usec_t)) + 1];
|
||||
|
||||
sprintf(buf, "%lu\n",
|
||||
- state == MANAGER_STARTING && c->startup_cpu_shares != (unsigned long) -1 ? c->startup_cpu_shares :
|
||||
+ IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_cpu_shares != (unsigned long) -1 ? c->startup_cpu_shares :
|
||||
c->cpu_shares != (unsigned long) -1 ? c->cpu_shares : 1024);
|
||||
r = cg_set_attribute("cpu", path, "cpu.shares", buf);
|
||||
if (r < 0)
|
||||
@@ -328,7 +328,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha
|
||||
CGroupBlockIODeviceBandwidth *b;
|
||||
|
||||
if (!is_root) {
|
||||
- sprintf(buf, "%lu\n", state == MANAGER_STARTING && c->startup_blockio_weight != (unsigned long) -1 ? c->startup_blockio_weight :
|
||||
+ sprintf(buf, "%lu\n", IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_blockio_weight != (unsigned long) -1 ? c->startup_blockio_weight :
|
||||
c->blockio_weight != (unsigned long) -1 ? c->blockio_weight : 1000);
|
||||
r = cg_set_attribute("blkio", path, "blkio.weight", buf);
|
||||
if (r < 0)
|
||||
diff --git a/src/core/manager.c b/src/core/manager.c
|
||||
index 7639aeef19..9abdf475cf 100644
|
||||
--- a/src/core/manager.c
|
||||
+++ b/src/core/manager.c
|
||||
@@ -2837,7 +2837,7 @@ static bool manager_get_show_status(Manager *m) {
|
||||
if (m->no_console_output)
|
||||
return false;
|
||||
|
||||
- if (!IN_SET(manager_state(m), MANAGER_STARTING, MANAGER_STOPPING))
|
||||
+ if (!IN_SET(manager_state(m), MANAGER_INITIALIZING, MANAGER_STARTING, MANAGER_STOPPING))
|
||||
return false;
|
||||
|
||||
if (m->show_status > 0)
|
||||
@@ -2928,8 +2928,14 @@ ManagerState manager_state(Manager *m) {
|
||||
assert(m);
|
||||
|
||||
/* Did we ever finish booting? If not then we are still starting up */
|
||||
- if (!dual_timestamp_is_set(&m->finish_timestamp))
|
||||
+ if (!dual_timestamp_is_set(&m->finish_timestamp)) {
|
||||
+
|
||||
+ u = manager_get_unit(m, SPECIAL_BASIC_TARGET);
|
||||
+ if (!u || !UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u)))
|
||||
+ return MANAGER_INITIALIZING;
|
||||
+
|
||||
return MANAGER_STARTING;
|
||||
+ }
|
||||
|
||||
/* Is the special shutdown target queued? If so, we are in shutdown state */
|
||||
u = manager_get_unit(m, SPECIAL_SHUTDOWN_TARGET);
|
||||
@@ -2955,6 +2961,7 @@ ManagerState manager_state(Manager *m) {
|
||||
}
|
||||
|
||||
static const char *const manager_state_table[_MANAGER_STATE_MAX] = {
|
||||
+ [MANAGER_INITIALIZING] = "initializing",
|
||||
[MANAGER_STARTING] = "starting",
|
||||
[MANAGER_RUNNING] = "running",
|
||||
[MANAGER_DEGRADED] = "degraded",
|
||||
diff --git a/src/core/manager.h b/src/core/manager.h
|
||||
index 7d26c3adea..8e3c146b42 100644
|
||||
--- a/src/core/manager.h
|
||||
+++ b/src/core/manager.h
|
||||
@@ -38,6 +38,7 @@
|
||||
typedef struct Manager Manager;
|
||||
|
||||
typedef enum ManagerState {
|
||||
+ MANAGER_INITIALIZING,
|
||||
MANAGER_STARTING,
|
||||
MANAGER_RUNNING,
|
||||
MANAGER_DEGRADED,
|
|
@ -1,32 +0,0 @@
|
|||
From d74f9e8e8a3dcddb043ef193e4bb14f58efa095f Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Fri, 22 Aug 2014 18:10:22 +0200
|
||||
Subject: [PATCH] update TODO
|
||||
|
||||
---
|
||||
TODO | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index 3073f3a5a2..0fcd3a0b8e 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -24,6 +24,9 @@ External:
|
||||
|
||||
Features:
|
||||
|
||||
+* apply start timeout during the "initializing" manager state only,
|
||||
+ instead of both "initializing" and "starting".
|
||||
+
|
||||
* journald: make use of uid-range.h to managed uid ranges to split
|
||||
journals in.
|
||||
|
||||
@@ -138,8 +141,6 @@ Features:
|
||||
* For timer units: add some mechanisms so that timer units that trigger immediately on boot do not have the services
|
||||
they run added to the initial transaction and thus confuse Type=idle.
|
||||
|
||||
-* Add timeout to early-boot, and shut down the system if it is hit. Solves the laptop-in-bag problem and is useful for embedded cases
|
||||
-
|
||||
* Run most system services with cgroupfs read-only and procfs with a more secure mode (doesn't work, since the hidepid= option is per-pid-namespace, not per-mount)
|
||||
|
||||
* sd-event: generate a failure of a default event loop is executed out-of-thread
|
|
@ -1,27 +0,0 @@
|
|||
From 41a451cc2901a5deb985aea4cc8de204a22e5612 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Mon, 25 Aug 2014 15:29:50 +0200
|
||||
Subject: [PATCH] systemctl: fix broken list-unit-files with --root
|
||||
|
||||
This patch modifies unit_file_get_list which will now return
|
||||
hashmap of structures where f->path is *without* root_dir prefix.
|
||||
|
||||
This change should be ok, because current code either does not use
|
||||
root_dir at all or calls basename() on the f->path.
|
||||
---
|
||||
src/shared/install.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 4b09a69456..a07d1dd315 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -2099,7 +2099,7 @@ int unit_file_get_list(
|
||||
if (!f)
|
||||
return -ENOMEM;
|
||||
|
||||
- f->path = path_make_absolute(de->d_name, units_dir);
|
||||
+ f->path = path_make_absolute(de->d_name, *i);
|
||||
if (!f->path)
|
||||
return -ENOMEM;
|
||||
|
|
@ -1,244 +0,0 @@
|
|||
From c45a5a74465a39280b855f9d720b2ab4779a47fa Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Fri, 15 Aug 2014 18:49:29 +0200
|
||||
Subject: [PATCH] sd-event: split run into prepare/wait/dispatch
|
||||
|
||||
This will allow sd-event to be integrated into an external event loop, which
|
||||
in turn will allow (say) glib-based applications to use our various libraries,
|
||||
without manually integrating each of them (bus, rtnl, dhcp, ...).
|
||||
|
||||
The external event-loop should integrate sd-event int he following way:
|
||||
|
||||
Every iteration must start with a call to sd_event_prepare(), which will
|
||||
return 0 if no event sources are ready to be processed, a positive value if
|
||||
they are and a negative value on error. sd_event_prepare() may only be called
|
||||
following sd_event_dispatch(); a call to sd_event_wait() indicating that no
|
||||
sources are ready to be dispatched; or a failed call to sd_event_dispatch() or
|
||||
sd_event_wait().
|
||||
|
||||
A successful call to sd_event_prepare() indicating that no event sources are
|
||||
ready to be dispatched must be followed by a call to sd_event_wait(),
|
||||
which will return 0 if it timed out without event sources being ready to
|
||||
be processed, a negative value on error and a positive value otherwise.
|
||||
sd_event_wait() may only be called following a successful call to
|
||||
sd_event_prepare() indicating that no event sources are ready to be dispatched.
|
||||
|
||||
If sd_event_wait() indicates that some events sources are ready to be
|
||||
dispatched, it must be followed by a call to sd_event_dispatch(). This
|
||||
is the only time sd_event_dispatch() may be called.
|
||||
---
|
||||
src/libsystemd/sd-event/sd-event.c | 122 +++++++++++++++++++++++++++++--------
|
||||
src/systemd/sd-event.h | 5 ++
|
||||
2 files changed, 102 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
||||
index e062997a80..a71962c24c 100644
|
||||
--- a/src/libsystemd/sd-event/sd-event.c
|
||||
+++ b/src/libsystemd/sd-event/sd-event.c
|
||||
@@ -2210,12 +2210,8 @@ static int process_watchdog(sd_event *e) {
|
||||
return arm_watchdog(e);
|
||||
}
|
||||
|
||||
-_public_ int sd_event_run(sd_event *e, uint64_t timeout) {
|
||||
- struct epoll_event *ev_queue;
|
||||
- unsigned ev_queue_max;
|
||||
- sd_event_source *p;
|
||||
- int r, i, m;
|
||||
- bool timedout;
|
||||
+_public_ int sd_event_prepare(sd_event *e) {
|
||||
+ int r;
|
||||
|
||||
assert_return(e, -EINVAL);
|
||||
assert_return(!event_pid_changed(e), -ECHILD);
|
||||
@@ -2223,38 +2219,60 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
|
||||
assert_return(e->state == SD_EVENT_PASSIVE, -EBUSY);
|
||||
|
||||
if (e->exit_requested)
|
||||
- return dispatch_exit(e);
|
||||
+ goto pending;
|
||||
|
||||
- sd_event_ref(e);
|
||||
e->iteration++;
|
||||
- e->state = SD_EVENT_RUNNING;
|
||||
|
||||
r = event_prepare(e);
|
||||
if (r < 0)
|
||||
- goto finish;
|
||||
+ return r;
|
||||
|
||||
r = event_arm_timer(e, &e->realtime);
|
||||
if (r < 0)
|
||||
- goto finish;
|
||||
+ return r;
|
||||
|
||||
r = event_arm_timer(e, &e->boottime);
|
||||
if (r < 0)
|
||||
- goto finish;
|
||||
+ return r;
|
||||
|
||||
r = event_arm_timer(e, &e->monotonic);
|
||||
if (r < 0)
|
||||
- goto finish;
|
||||
+ return r;
|
||||
|
||||
r = event_arm_timer(e, &e->realtime_alarm);
|
||||
if (r < 0)
|
||||
- goto finish;
|
||||
+ return r;
|
||||
|
||||
r = event_arm_timer(e, &e->boottime_alarm);
|
||||
if (r < 0)
|
||||
- goto finish;
|
||||
+ return r;
|
||||
|
||||
if (event_next_pending(e) || e->need_process_child)
|
||||
- timeout = 0;
|
||||
+ goto pending;
|
||||
+
|
||||
+ e->state = SD_EVENT_PREPARED;
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+pending:
|
||||
+ e->state = SD_EVENT_PREPARED;
|
||||
+ return sd_event_wait(e, 0);
|
||||
+}
|
||||
+
|
||||
+_public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
||||
+ struct epoll_event *ev_queue;
|
||||
+ unsigned ev_queue_max;
|
||||
+ int r, m, i;
|
||||
+
|
||||
+ assert_return(e, -EINVAL);
|
||||
+ assert_return(!event_pid_changed(e), -ECHILD);
|
||||
+ assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
|
||||
+ assert_return(e->state == SD_EVENT_PREPARED, -EBUSY);
|
||||
+
|
||||
+ if (e->exit_requested) {
|
||||
+ e->state = SD_EVENT_PENDING;
|
||||
+ return 1;
|
||||
+ }
|
||||
|
||||
ev_queue_max = CLAMP(e->n_sources, 1U, EPOLL_QUEUE_MAX);
|
||||
ev_queue = newa(struct epoll_event, ev_queue_max);
|
||||
@@ -2262,12 +2280,16 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
|
||||
m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,
|
||||
timeout == (uint64_t) -1 ? -1 : (int) ((timeout + USEC_PER_MSEC - 1) / USEC_PER_MSEC));
|
||||
if (m < 0) {
|
||||
- r = errno == EAGAIN || errno == EINTR ? 1 : -errno;
|
||||
+ if (errno == EINTR) {
|
||||
+ e->state = SD_EVENT_PENDING;
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ r = -errno;
|
||||
+
|
||||
goto finish;
|
||||
}
|
||||
|
||||
- timedout = m == 0;
|
||||
-
|
||||
dual_timestamp_get(&e->timestamp);
|
||||
e->timestamp_boottime = now(CLOCK_BOOTTIME);
|
||||
|
||||
@@ -2324,21 +2346,71 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
- p = event_next_pending(e);
|
||||
- if (!p) {
|
||||
- r = !timedout;
|
||||
- goto finish;
|
||||
+ if (event_next_pending(e)) {
|
||||
+ e->state = SD_EVENT_PENDING;
|
||||
+
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
- r = source_dispatch(p);
|
||||
+ r = 0;
|
||||
|
||||
finish:
|
||||
e->state = SD_EVENT_PASSIVE;
|
||||
- sd_event_unref(e);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
+_public_ int sd_event_dispatch(sd_event *e) {
|
||||
+ sd_event_source *p;
|
||||
+ int r;
|
||||
+
|
||||
+ assert_return(e, -EINVAL);
|
||||
+ assert_return(!event_pid_changed(e), -ECHILD);
|
||||
+ assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
|
||||
+ assert_return(e->state == SD_EVENT_PENDING, -EBUSY);
|
||||
+
|
||||
+ if (e->exit_requested)
|
||||
+ return dispatch_exit(e);
|
||||
+
|
||||
+ p = event_next_pending(e);
|
||||
+ if (p) {
|
||||
+ sd_event_ref(e);
|
||||
+
|
||||
+ e->state = SD_EVENT_RUNNING;
|
||||
+ r = source_dispatch(p);
|
||||
+ e->state = SD_EVENT_PASSIVE;
|
||||
+
|
||||
+ sd_event_unref(e);
|
||||
+
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ e->state = SD_EVENT_PASSIVE;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+_public_ int sd_event_run(sd_event *e, uint64_t timeout) {
|
||||
+ int r;
|
||||
+
|
||||
+ assert_return(e, -EINVAL);
|
||||
+ assert_return(!event_pid_changed(e), -ECHILD);
|
||||
+ assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
|
||||
+ assert_return(e->state == SD_EVENT_PASSIVE, -EBUSY);
|
||||
+
|
||||
+ r = sd_event_prepare(e);
|
||||
+ if (r > 0)
|
||||
+ return sd_event_dispatch(e);
|
||||
+ else if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
+ r = sd_event_wait(e, timeout);
|
||||
+ if (r > 0)
|
||||
+ return sd_event_dispatch(e);
|
||||
+ else
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
_public_ int sd_event_loop(sd_event *e) {
|
||||
int r;
|
||||
|
||||
diff --git a/src/systemd/sd-event.h b/src/systemd/sd-event.h
|
||||
index d96852a763..8e013b33f6 100644
|
||||
--- a/src/systemd/sd-event.h
|
||||
+++ b/src/systemd/sd-event.h
|
||||
@@ -52,6 +52,8 @@ enum {
|
||||
|
||||
enum {
|
||||
SD_EVENT_PASSIVE,
|
||||
+ SD_EVENT_PREPARED,
|
||||
+ SD_EVENT_PENDING,
|
||||
SD_EVENT_RUNNING,
|
||||
SD_EVENT_EXITING,
|
||||
SD_EVENT_FINISHED
|
||||
@@ -84,6 +86,9 @@ int sd_event_add_defer(sd_event *e, sd_event_source **s, sd_event_handler_t call
|
||||
int sd_event_add_post(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
|
||||
int sd_event_add_exit(sd_event *e, sd_event_source **s, sd_event_handler_t callback, void *userdata);
|
||||
|
||||
+int sd_event_prepare(sd_event *e);
|
||||
+int sd_event_wait(sd_event *e, uint64_t timeout);
|
||||
+int sd_event_dispatch(sd_event *e);
|
||||
int sd_event_run(sd_event *e, uint64_t timeout);
|
||||
int sd_event_loop(sd_event *e);
|
||||
int sd_event_exit(sd_event *e, int code);
|
|
@ -1,27 +0,0 @@
|
|||
From 6d148a842ebb04a9a9bc2853e167a9d8eddf8cd8 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Tue, 26 Aug 2014 00:22:06 +0200
|
||||
Subject: [PATCH] sd-event: sd_event_prepare - stay in PREPARED if
|
||||
sd_event_wait() indicates that no sources are pending
|
||||
|
||||
---
|
||||
src/libsystemd/sd-event/sd-event.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
|
||||
index a71962c24c..32777e386b 100644
|
||||
--- a/src/libsystemd/sd-event/sd-event.c
|
||||
+++ b/src/libsystemd/sd-event/sd-event.c
|
||||
@@ -2256,7 +2256,11 @@ _public_ int sd_event_prepare(sd_event *e) {
|
||||
|
||||
pending:
|
||||
e->state = SD_EVENT_PREPARED;
|
||||
- return sd_event_wait(e, 0);
|
||||
+ r = sd_event_wait(e, 0);
|
||||
+ if (r == 0)
|
||||
+ e->state = SD_EVENT_PREPARED;
|
||||
+
|
||||
+ return r;
|
||||
}
|
||||
|
||||
_public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
|
|
@ -1,30 +0,0 @@
|
|||
From 42aeb14a4a0fa7d43da96a8ed0fb0e180a2dd5c8 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 03:59:05 +0200
|
||||
Subject: [PATCH] update TODO
|
||||
|
||||
---
|
||||
TODO | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index 0fcd3a0b8e..471d3b29bc 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -24,8 +24,15 @@ External:
|
||||
|
||||
Features:
|
||||
|
||||
+* remove multi-seat-x now
|
||||
+
|
||||
+* refcounting in sd-resolve is borked
|
||||
+
|
||||
+* exponential backoff in timesyncd and resolved when we cannot reach a server
|
||||
+
|
||||
* apply start timeout during the "initializing" manager state only,
|
||||
- instead of both "initializing" and "starting".
|
||||
+ instead of both "initializing" and "starting". maybe rename the
|
||||
+ timeout to "initialization-timeout" then or so?
|
||||
|
||||
* journald: make use of uid-range.h to managed uid ranges to split
|
||||
journals in.
|
|
@ -1,26 +0,0 @@
|
|||
From 4fc13f521ab44eb55c599b07c18860c1aeca35a7 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 04:03:24 +0200
|
||||
Subject: [PATCH] Revert "systemctl: fix broken list-unit-files with --root"
|
||||
|
||||
This reverts commit 41a451cc2901a5deb985aea4cc8de204a22e5612.
|
||||
|
||||
This breaks checks for masking of units file, since we invoke
|
||||
null_or_empty_path() on the resulting path.
|
||||
---
|
||||
src/shared/install.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index a07d1dd315..4b09a69456 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -2099,7 +2099,7 @@ int unit_file_get_list(
|
||||
if (!f)
|
||||
return -ENOMEM;
|
||||
|
||||
- f->path = path_make_absolute(de->d_name, *i);
|
||||
+ f->path = path_make_absolute(de->d_name, units_dir);
|
||||
if (!f->path)
|
||||
return -ENOMEM;
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
From 77cf759ea05bea476cdcb8d0dcd04c4e6fb3b2ff Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Tue, 26 Aug 2014 18:27:36 +0200
|
||||
Subject: [PATCH] udev: hwdb - do not look at "usb_device" parents
|
||||
|
||||
Based on a patch from Simon McVittie <simon.mcvittie@collabora.co.uk>.
|
||||
|
||||
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758050
|
||||
---
|
||||
src/udev/udev-builtin-hwdb.c | 22 ++++++++++++++--------
|
||||
1 file changed, 14 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
|
||||
index cac97e756b..695a31a12f 100644
|
||||
--- a/src/udev/udev-builtin-hwdb.c
|
||||
+++ b/src/udev/udev-builtin-hwdb.c
|
||||
@@ -88,9 +88,10 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device
|
||||
const char *filter, bool test) {
|
||||
struct udev_device *d;
|
||||
char s[16];
|
||||
- int n = 0;
|
||||
+ bool last = false;
|
||||
+ int r = 0;
|
||||
|
||||
- for (d = srcdev; d; d = udev_device_get_parent(d)) {
|
||||
+ for (d = srcdev; d && !last; d = udev_device_get_parent(d)) {
|
||||
const char *dsubsys;
|
||||
const char *modalias = NULL;
|
||||
|
||||
@@ -104,19 +105,24 @@ static int udev_builtin_hwdb_search(struct udev_device *dev, struct udev_device
|
||||
|
||||
modalias = udev_device_get_property_value(d, "MODALIAS");
|
||||
|
||||
- /* the usb_device does not have a modalias, compose one */
|
||||
- if (!modalias && streq(dsubsys, "usb"))
|
||||
- modalias = modalias_usb(d, s, sizeof(s));
|
||||
+ if (streq(dsubsys, "usb") && streq_ptr(udev_device_get_devtype(d), "usb_device")) {
|
||||
+ /* if the usb_device does not have a modalias, compose one */
|
||||
+ if (!modalias)
|
||||
+ modalias = modalias_usb(d, s, sizeof(s));
|
||||
+
|
||||
+ /* avoid looking at any parent device, they are usually just a USB hub */
|
||||
+ last = true;
|
||||
+ }
|
||||
|
||||
if (!modalias)
|
||||
continue;
|
||||
|
||||
- n = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test);
|
||||
- if (n > 0)
|
||||
+ r = udev_builtin_hwdb_lookup(dev, prefix, modalias, filter, test);
|
||||
+ if (r > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
- return n;
|
||||
+ return r;
|
||||
}
|
||||
|
||||
static int builtin_hwdb(struct udev_device *dev, int argc, char *argv[], bool test) {
|
|
@ -1,24 +0,0 @@
|
|||
From 8dac15b6e9792c2b0f503ddf78ac499817904a6f Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 20:23:49 +0200
|
||||
Subject: [PATCH] update TODO
|
||||
|
||||
---
|
||||
TODO | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/TODO b/TODO
|
||||
index 471d3b29bc..09f82d3c37 100644
|
||||
--- a/TODO
|
||||
+++ b/TODO
|
||||
@@ -24,6 +24,10 @@ External:
|
||||
|
||||
Features:
|
||||
|
||||
+* dbus: add new message hdr field for allowing interactive auth, write spec for it. update dbus spec to mandate that unknown flags *must* be ignored...
|
||||
+
|
||||
+* maybe introduce AssertXYZ= similar to ConditionXYZ= that causes a unit to fail (instead of skipping it) if some condition is not true...
|
||||
+
|
||||
* remove multi-seat-x now
|
||||
|
||||
* refcounting in sd-resolve is borked
|
|
@ -1,33 +0,0 @@
|
|||
From daa05349dfefb12638c96e034c11be613bdc39b7 Mon Sep 17 00:00:00 2001
|
||||
From: Ansgar Burchardt <ansgar@43-1.org>
|
||||
Date: Tue, 26 Aug 2014 00:19:54 +0200
|
||||
Subject: [PATCH] NEWS: Fix typos.
|
||||
|
||||
---
|
||||
NEWS | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 7dad765a33..2fca2cdc93 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -42,8 +42,8 @@ CHANGES WITH 216:
|
||||
|
||||
* systemd-resolved now includes a caching DNS stub resolver
|
||||
and a complete LLMNR name resolution implementation. A new
|
||||
- NSS module "nss-resolve" has been added which make be used
|
||||
- of glibc's own "nss-dns" to resolve hostnames via
|
||||
+ NSS module "nss-resolve" has been added which can be used
|
||||
+ instead of glibc's own "nss-dns" to resolve hostnames via
|
||||
systemd-resolved. Hostnames, addresses and arbitrary RRs may
|
||||
be resolved via systemd-resolved D-Bus APIs. In contrast to
|
||||
the glibc internal resolver systemd-resolved is aware of
|
||||
@@ -606,7 +606,7 @@ CHANGES WITH 214:
|
||||
|
||||
* Access modes specified in tmpfiles snippets may now be
|
||||
prefixed with "~", which indicates that they shall be masked
|
||||
- by whether the existing file or directly is currently
|
||||
+ by whether the existing file or directory is currently
|
||||
writable, readable or executable at all. Also, if specified,
|
||||
the sgid/suid/sticky bits will be masked for all
|
||||
non-directories.
|
|
@ -1,22 +0,0 @@
|
|||
From 7965435e588c8d2fb824c5fd4b8c2739bc30acdf Mon Sep 17 00:00:00 2001
|
||||
From: Michael Olbrich <m.olbrich@pengutronix.de>
|
||||
Date: Thu, 21 Aug 2014 12:38:08 +0200
|
||||
Subject: [PATCH] missing: add BPF_XOR
|
||||
|
||||
BPF_XOR was introduced in kernel 3.7
|
||||
---
|
||||
src/shared/missing.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/shared/missing.h b/src/shared/missing.h
|
||||
index a9dd274274..c80ed2ad99 100644
|
||||
--- a/src/shared/missing.h
|
||||
+++ b/src/shared/missing.h
|
||||
@@ -593,3 +593,7 @@ static inline int setns(int fd, int nstype) {
|
||||
#ifndef NET_NAME_RENAMED
|
||||
# define NET_NAME_RENAMED 4
|
||||
#endif
|
||||
+
|
||||
+#ifndef BPF_XOR
|
||||
+# define BPF_XOR 0xa0
|
||||
+#endif
|
|
@ -1,23 +0,0 @@
|
|||
From 32dfe42c66085c55916e5306a9a07d42d3958b6b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <stlman@poczta.fm>
|
||||
Date: Tue, 26 Aug 2014 12:28:28 +0200
|
||||
Subject: [PATCH] networkd-wait-online: add missing short option 'i' to
|
||||
optstring
|
||||
|
||||
---
|
||||
src/network/networkd-wait-online.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/network/networkd-wait-online.c b/src/network/networkd-wait-online.c
|
||||
index 6c2fdd1b2c..714343656b 100644
|
||||
--- a/src/network/networkd-wait-online.c
|
||||
+++ b/src/network/networkd-wait-online.c
|
||||
@@ -59,7 +59,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
|
||||
- while ((c = getopt_long(argc, argv, "+hq", options, NULL)) >= 0)
|
||||
+ while ((c = getopt_long(argc, argv, "+hiq", options, NULL)) >= 0)
|
||||
|
||||
switch (c) {
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
From 52754725e185f1331f821d85ed2ef78fb92af1fe Mon Sep 17 00:00:00 2001
|
||||
From: Filipe Brandenburger <filbranden@google.com>
|
||||
Date: Mon, 25 Aug 2014 22:05:02 -0700
|
||||
Subject: [PATCH] test-compress: make sure asserts with side effects use
|
||||
assert_se()
|
||||
|
||||
Otherwise the test fails when built with CPPFLAGS='-DNDEBUG' which disables
|
||||
assertions.
|
||||
|
||||
Tested:
|
||||
- make check TESTS='test-compress' CPPFLAGS='-DNDEBUG'
|
||||
---
|
||||
src/journal/test-compress.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c
|
||||
index f5f5f8df39..026d630ac2 100644
|
||||
--- a/src/journal/test-compress.c
|
||||
+++ b/src/journal/test-compress.c
|
||||
@@ -145,11 +145,11 @@ static void test_compress_stream(int compression,
|
||||
|
||||
assert_se((dst = mkostemp_safe(pattern, O_RDWR|O_CLOEXEC)) >= 0);
|
||||
|
||||
- assert(compress(src, dst, -1) == 0);
|
||||
+ assert_se(compress(src, dst, -1) == 0);
|
||||
|
||||
if (cat) {
|
||||
assert_se(asprintf(&cmd, "%s %s | diff %s -", cat, pattern, srcfile) > 0);
|
||||
- assert(system(cmd) == 0);
|
||||
+ assert_se(system(cmd) == 0);
|
||||
}
|
||||
|
||||
log_debug("/* test decompression */");
|
|
@ -1,78 +0,0 @@
|
|||
From 8d95631ea6c039a60bb7ac456f687a8fdf0c4381 Mon Sep 17 00:00:00 2001
|
||||
From: Filipe Brandenburger <filbranden@google.com>
|
||||
Date: Mon, 25 Aug 2014 22:05:03 -0700
|
||||
Subject: [PATCH] test-path-util: use assert_se in all assertions
|
||||
|
||||
Otherwise they get optimized out when CPPFLAGS='-DNDEBUG' is used, and that
|
||||
causes the tests to fail.
|
||||
|
||||
Tested:
|
||||
- make check TESTS='test-path-util' CPPFLAGS='-DNDEBUG'
|
||||
---
|
||||
src/test/test-path-util.c | 30 +++++++++++++++---------------
|
||||
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
|
||||
index c8dcd85397..01afb3e6fe 100644
|
||||
--- a/src/test/test-path-util.c
|
||||
+++ b/src/test/test-path-util.c
|
||||
@@ -79,35 +79,35 @@ static void test_path(void) {
|
||||
char p2[] = "//aaa/.////ccc";
|
||||
char p3[] = "/./";
|
||||
|
||||
- assert(path_equal(path_kill_slashes(p1), "aaa/bbb/ccc"));
|
||||
- assert(path_equal(path_kill_slashes(p2), "/aaa/./ccc"));
|
||||
- assert(path_equal(path_kill_slashes(p3), "/./"));
|
||||
+ assert_se(path_equal(path_kill_slashes(p1), "aaa/bbb/ccc"));
|
||||
+ assert_se(path_equal(path_kill_slashes(p2), "/aaa/./ccc"));
|
||||
+ assert_se(path_equal(path_kill_slashes(p3), "/./"));
|
||||
}
|
||||
}
|
||||
|
||||
static void test_find_binary(const char *self) {
|
||||
char *p;
|
||||
|
||||
- assert(find_binary("/bin/sh", &p) == 0);
|
||||
+ assert_se(find_binary("/bin/sh", &p) == 0);
|
||||
puts(p);
|
||||
- assert(streq(p, "/bin/sh"));
|
||||
+ assert_se(streq(p, "/bin/sh"));
|
||||
free(p);
|
||||
|
||||
- assert(find_binary(self, &p) == 0);
|
||||
+ assert_se(find_binary(self, &p) == 0);
|
||||
puts(p);
|
||||
- assert(endswith(p, "/test-path-util"));
|
||||
- assert(path_is_absolute(p));
|
||||
+ assert_se(endswith(p, "/test-path-util"));
|
||||
+ assert_se(path_is_absolute(p));
|
||||
free(p);
|
||||
|
||||
- assert(find_binary("sh", &p) == 0);
|
||||
+ assert_se(find_binary("sh", &p) == 0);
|
||||
puts(p);
|
||||
- assert(endswith(p, "/sh"));
|
||||
- assert(path_is_absolute(p));
|
||||
+ assert_se(endswith(p, "/sh"));
|
||||
+ assert_se(path_is_absolute(p));
|
||||
free(p);
|
||||
|
||||
- assert(find_binary("xxxx-xxxx", &p) == -ENOENT);
|
||||
+ assert_se(find_binary("xxxx-xxxx", &p) == -ENOENT);
|
||||
|
||||
- assert(find_binary("/some/dir/xxxx-xxxx", &p) == -ENOENT);
|
||||
+ assert_se(find_binary("/some/dir/xxxx-xxxx", &p) == -ENOENT);
|
||||
}
|
||||
|
||||
static void test_prefixes(void) {
|
||||
@@ -156,8 +156,8 @@ static void test_prefixes(void) {
|
||||
|
||||
b = false;
|
||||
PATH_FOREACH_PREFIX_MORE(s, "") {
|
||||
- assert(!b);
|
||||
- assert(streq(s, ""));
|
||||
+ assert_se(!b);
|
||||
+ assert_se(streq(s, ""));
|
||||
b = true;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
From 684fc8927e0f83496d4384ac434e265f7cd7a87b Mon Sep 17 00:00:00 2001
|
||||
From: Filipe Brandenburger <filbranden@google.com>
|
||||
Date: Mon, 25 Aug 2014 22:05:04 -0700
|
||||
Subject: [PATCH] test-util: use assert_se() for call to safe_mkdir with side
|
||||
effect
|
||||
|
||||
Otherwise it gets optimized out when CPPFLAGS='-DNDEBUG' is used.
|
||||
|
||||
Tested:
|
||||
- make check TESTS='test-util' CPPFLAGS='-DNDEBUG'
|
||||
---
|
||||
src/test/test-util.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/test/test-util.c b/src/test/test-util.c
|
||||
index 34d5f2ed7d..4d9b28f9c8 100644
|
||||
--- a/src/test/test-util.c
|
||||
+++ b/src/test/test-util.c
|
||||
@@ -863,7 +863,7 @@ static void test_readlink_and_make_absolute(void) {
|
||||
char name_alias[] = "/tmp/test-readlink_and_make_absolute-alias";
|
||||
char *r = NULL;
|
||||
|
||||
- assert(mkdir_safe(tempdir, 0755, getuid(), getgid()) >= 0);
|
||||
+ assert_se(mkdir_safe(tempdir, 0755, getuid(), getgid()) >= 0);
|
||||
assert_se(touch(name) >= 0);
|
||||
|
||||
assert_se(symlink(name, name_alias) >= 0);
|
|
@ -1,65 +0,0 @@
|
|||
From bb19cb17076bbec942ad08f94d41ba36b28a5a13 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 20:35:31 +0200
|
||||
Subject: [PATCH] sd-bus: remove unused call bus_kernel_create_monitor()
|
||||
|
||||
Noticed by Djalal Harouni
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-kernel.c | 31 -------------------------------
|
||||
src/libsystemd/sd-bus/bus-kernel.h | 1 -
|
||||
2 files changed, 32 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
|
||||
index 3ca271c704..03c4165095 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-kernel.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-kernel.c
|
||||
@@ -1535,37 +1535,6 @@ int bus_kernel_create_domain(const char *name, char **s) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
-int bus_kernel_create_monitor(const char *bus) {
|
||||
- struct kdbus_cmd_hello *hello;
|
||||
- int fd;
|
||||
-
|
||||
- assert(bus);
|
||||
-
|
||||
- fd = bus_kernel_open_bus_fd(bus, NULL);
|
||||
- if (fd < 0)
|
||||
- return fd;
|
||||
-
|
||||
- hello = alloca0(sizeof(struct kdbus_cmd_hello));
|
||||
- hello->size = sizeof(struct kdbus_cmd_hello);
|
||||
- hello->conn_flags = KDBUS_HELLO_ACTIVATOR;
|
||||
- hello->pool_size = KDBUS_POOL_SIZE;
|
||||
-
|
||||
- if (ioctl(fd, KDBUS_CMD_HELLO, hello) < 0) {
|
||||
- safe_close(fd);
|
||||
- return -errno;
|
||||
- }
|
||||
-
|
||||
- /* The higher 32bit of both flags fields are considered
|
||||
- * 'incompatible flags'. Refuse them all for now. */
|
||||
- if (hello->bus_flags > 0xFFFFFFFFULL ||
|
||||
- hello->conn_flags > 0xFFFFFFFFULL) {
|
||||
- safe_close(fd);
|
||||
- return -ENOTSUP;
|
||||
- }
|
||||
-
|
||||
- return fd;
|
||||
-}
|
||||
-
|
||||
int bus_kernel_try_close(sd_bus *bus) {
|
||||
assert(bus);
|
||||
assert(bus->is_kernel);
|
||||
diff --git a/src/libsystemd/sd-bus/bus-kernel.h b/src/libsystemd/sd-bus/bus-kernel.h
|
||||
index 87f98c58bf..448dd3a797 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-kernel.h
|
||||
+++ b/src/libsystemd/sd-bus/bus-kernel.h
|
||||
@@ -70,7 +70,6 @@ int bus_kernel_make_starter(int fd, const char *name, bool activating, bool acce
|
||||
|
||||
int bus_kernel_create_bus(const char *name, bool world, char **s);
|
||||
int bus_kernel_create_domain(const char *name, char **s);
|
||||
-int bus_kernel_create_monitor(const char *bus);
|
||||
|
||||
int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *mapped, size_t *allocated);
|
||||
void bus_kernel_push_memfd(sd_bus *bus, int fd, void *address, size_t mapped, size_t allocated);
|
|
@ -1,25 +0,0 @@
|
|||
From 498cfc230af8f83675be2e92057956f1792969e4 Mon Sep 17 00:00:00 2001
|
||||
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
|
||||
Date: Sat, 23 Aug 2014 21:11:44 +0200
|
||||
Subject: [PATCH] systemctl: Correct error message printed when
|
||||
bus_process_wait fails
|
||||
|
||||
Actually use the variable containing the return code of bus_process_wait when
|
||||
printing the error message as a result of it failing.
|
||||
---
|
||||
src/systemctl/systemctl.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||
index d9b8bee28d..65348193b7 100644
|
||||
--- a/src/systemctl/systemctl.c
|
||||
+++ b/src/systemctl/systemctl.c
|
||||
@@ -2382,7 +2382,7 @@ static int wait_for_jobs(sd_bus *bus, Set *s) {
|
||||
while (!set_isempty(s)) {
|
||||
q = bus_process_wait(bus);
|
||||
if (q < 0) {
|
||||
- log_error("Failed to wait for response: %s", strerror(-r));
|
||||
+ log_error("Failed to wait for response: %s", strerror(-q));
|
||||
return q;
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
From f2322f0b64107b2eee1fadb6c59857381277a9f8 Mon Sep 17 00:00:00 2001
|
||||
From: Hristo Venev <mustrumr97@gmail.com>
|
||||
Date: Tue, 26 Aug 2014 20:40:35 +0200
|
||||
Subject: [PATCH] sd-bus: don't include internal header memfd.h in public
|
||||
header sd-bus.h
|
||||
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=83097
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-message.c | 1 +
|
||||
src/systemd/sd-bus.h | 1 -
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
|
||||
index c058b06f41..d00455a112 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-message.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-message.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "strv.h"
|
||||
#include "time-util.h"
|
||||
#include "cgroup-util.h"
|
||||
+#include "memfd.h"
|
||||
|
||||
#include "sd-bus.h"
|
||||
#include "bus-message.h"
|
||||
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
|
||||
index 1e23a93a60..036ab556c1 100644
|
||||
--- a/src/systemd/sd-bus.h
|
||||
+++ b/src/systemd/sd-bus.h
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "sd-id128.h"
|
||||
#include "sd-event.h"
|
||||
-#include "memfd.h"
|
||||
#include "_sd-common.h"
|
||||
|
||||
_SD_BEGIN_DECLARATIONS;
|
|
@ -1,47 +0,0 @@
|
|||
From 24a5d6b04e17d447cf122f02a8a2dedd843cce45 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 21:03:20 +0200
|
||||
Subject: [PATCH] util: make sure reset_all_signal_handlers() continues with
|
||||
all other signal handlers when one sigaction() fails
|
||||
|
||||
After all, we usually don't check for failures here, and it is better to
|
||||
do as much as we can...
|
||||
---
|
||||
src/shared/util.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index fc6f668726..4af2d3ceba 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -937,7 +937,7 @@ int readlink_and_canonicalize(const char *p, char **r) {
|
||||
}
|
||||
|
||||
int reset_all_signal_handlers(void) {
|
||||
- int sig;
|
||||
+ int sig, r = 0;
|
||||
|
||||
for (sig = 1; sig < _NSIG; sig++) {
|
||||
struct sigaction sa = {
|
||||
@@ -945,17 +945,18 @@ int reset_all_signal_handlers(void) {
|
||||
.sa_flags = SA_RESTART,
|
||||
};
|
||||
|
||||
+ /* These two cannot be caught... */
|
||||
if (sig == SIGKILL || sig == SIGSTOP)
|
||||
continue;
|
||||
|
||||
/* On Linux the first two RT signals are reserved by
|
||||
* glibc, and sigaction() will return EINVAL for them. */
|
||||
if ((sigaction(sig, &sa, NULL) < 0))
|
||||
- if (errno != EINVAL)
|
||||
- return -errno;
|
||||
+ if (errno != EINVAL && r == 0)
|
||||
+ r = -errno;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ return r;
|
||||
}
|
||||
|
||||
char *strstrip(char *s) {
|
|
@ -1,66 +0,0 @@
|
|||
From 1dedb74a2e1d840b531b76b01a76979f3b57456b Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 21:04:21 +0200
|
||||
Subject: [PATCH] util: reset signals when we fork off agents
|
||||
|
||||
If we invoke agents, we should make sure we actually can kill them
|
||||
again. I mean, it's probably not our job to cleanup the signals if our
|
||||
tools are invoked in weird contexts, but at least we should make sure,
|
||||
that the subprocesses we invoke and intend to control work as intended.
|
||||
|
||||
Also see:
|
||||
|
||||
http://lists.freedesktop.org/archives/systemd-devel/2014-August/022460.html
|
||||
---
|
||||
src/shared/util.c | 18 ++++++++++++++++++
|
||||
src/shared/util.h | 1 +
|
||||
2 files changed, 19 insertions(+)
|
||||
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index 4af2d3ceba..98c07163da 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -959,6 +959,18 @@ int reset_all_signal_handlers(void) {
|
||||
return r;
|
||||
}
|
||||
|
||||
+int reset_signal_mask(void) {
|
||||
+ sigset_t ss;
|
||||
+
|
||||
+ if (sigemptyset(&ss) < 0)
|
||||
+ return -errno;
|
||||
+
|
||||
+ if (sigprocmask(SIG_SETMASK, &ss, NULL) < 0)
|
||||
+ return -errno;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
char *strstrip(char *s) {
|
||||
char *e;
|
||||
|
||||
@@ -5131,6 +5143,12 @@ int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *pa
|
||||
/* Don't leak fds to the agent */
|
||||
close_all_fds(except, n_except);
|
||||
|
||||
+ /* Make sure we actually can kill the agent, if we need to, in
|
||||
+ * case somebody invoked us from a shell script that trapped
|
||||
+ * SIGTERM or so... */
|
||||
+ reset_all_signal_handlers();
|
||||
+ reset_signal_mask();
|
||||
+
|
||||
stdout_is_tty = isatty(STDOUT_FILENO);
|
||||
stderr_is_tty = isatty(STDERR_FILENO);
|
||||
|
||||
diff --git a/src/shared/util.h b/src/shared/util.h
|
||||
index cd947dbbef..ea87c96956 100644
|
||||
--- a/src/shared/util.h
|
||||
+++ b/src/shared/util.h
|
||||
@@ -274,6 +274,7 @@ int readlink_and_make_absolute(const char *p, char **r);
|
||||
int readlink_and_canonicalize(const char *p, char **r);
|
||||
|
||||
int reset_all_signal_handlers(void);
|
||||
+int reset_signal_mask(void);
|
||||
|
||||
char *strstrip(char *s);
|
||||
char *delete_chars(char *s, const char *bad);
|
|
@ -1,101 +0,0 @@
|
|||
From 1b6d7fa742e303611dff8d7ebfa86ee5fb8b7dc7 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 21:11:35 +0200
|
||||
Subject: [PATCH] util: make use of newly added reset_signal_mask() call
|
||||
wherever appropriate
|
||||
|
||||
---
|
||||
src/core/execute.c | 6 ++----
|
||||
src/core/main.c | 7 ++-----
|
||||
src/nspawn/nspawn.c | 4 +---
|
||||
src/shared/util.c | 5 +----
|
||||
4 files changed, 6 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/core/execute.c b/src/core/execute.c
|
||||
index b5b22472d5..066efd6fdf 100644
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -1301,7 +1301,6 @@ int exec_spawn(ExecCommand *command,
|
||||
int dont_close[n_fds + 3];
|
||||
uid_t uid = (uid_t) -1;
|
||||
gid_t gid = (gid_t) -1;
|
||||
- sigset_t ss;
|
||||
int i, err;
|
||||
|
||||
/* child */
|
||||
@@ -1319,9 +1318,8 @@ int exec_spawn(ExecCommand *command,
|
||||
if (context->ignore_sigpipe)
|
||||
ignore_signals(SIGPIPE, -1);
|
||||
|
||||
- assert_se(sigemptyset(&ss) == 0);
|
||||
- if (sigprocmask(SIG_SETMASK, &ss, NULL) < 0) {
|
||||
- err = -errno;
|
||||
+ err = reset_signal_mask();
|
||||
+ if (err < 0) {
|
||||
r = EXIT_SIGNAL_MASK;
|
||||
goto fail_child;
|
||||
}
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index bd148b1b33..95ab40fffc 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -1834,7 +1834,6 @@ finish:
|
||||
if (reexecute) {
|
||||
const char **args;
|
||||
unsigned i, args_size;
|
||||
- sigset_t ss;
|
||||
|
||||
/* Close and disarm the watchdog, so that the new
|
||||
* instance can reinitialize it, but doesn't get
|
||||
@@ -1918,12 +1917,10 @@ finish:
|
||||
args[i++] = NULL;
|
||||
assert(i <= args_size);
|
||||
|
||||
- /* reenable any blocked signals, especially important
|
||||
+ /* Reenable any blocked signals, especially important
|
||||
* if we switch from initial ramdisk to init=... */
|
||||
reset_all_signal_handlers();
|
||||
-
|
||||
- assert_se(sigemptyset(&ss) == 0);
|
||||
- assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
|
||||
+ reset_signal_mask();
|
||||
|
||||
if (switch_root_init) {
|
||||
args[0] = switch_root_init;
|
||||
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
||||
index 2c718557ee..56d9cc68c6 100644
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -3156,9 +3156,7 @@ int main(int argc, char *argv[]) {
|
||||
kmsg_socket_pair[0] = safe_close(kmsg_socket_pair[0]);
|
||||
|
||||
reset_all_signal_handlers();
|
||||
-
|
||||
- assert_se(sigemptyset(&mask) == 0);
|
||||
- assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
|
||||
+ reset_signal_mask();
|
||||
|
||||
k = open_terminal(console, O_RDWR);
|
||||
if (k != STDIN_FILENO) {
|
||||
diff --git a/src/shared/util.c b/src/shared/util.c
|
||||
index 98c07163da..fdcf5719fa 100644
|
||||
--- a/src/shared/util.c
|
||||
+++ b/src/shared/util.c
|
||||
@@ -3890,16 +3890,13 @@ void execute_directory(const char *directory, DIR *d, usec_t timeout, char *argv
|
||||
_cleanup_hashmap_free_free_ Hashmap *pids = NULL;
|
||||
_cleanup_closedir_ DIR *_d = NULL;
|
||||
struct dirent *de;
|
||||
- sigset_t ss;
|
||||
|
||||
/* We fork this all off from a child process so that
|
||||
* we can somewhat cleanly make use of SIGALRM to set
|
||||
* a time limit */
|
||||
|
||||
reset_all_signal_handlers();
|
||||
-
|
||||
- assert_se(sigemptyset(&ss) == 0);
|
||||
- assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
|
||||
+ reset_signal_mask();
|
||||
|
||||
assert_se(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0);
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From 36202fd2bc252616966166c98ccb0e0e5ece1fc9 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <lennart@poettering.net>
|
||||
Date: Tue, 26 Aug 2014 21:47:46 +0200
|
||||
Subject: [PATCH] sd-journal: never log anything by default from a library
|
||||
|
||||
---
|
||||
src/journal/sd-journal.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
|
||||
index b9ec90230d..80ff8fef57 100644
|
||||
--- a/src/journal/sd-journal.c
|
||||
+++ b/src/journal/sd-journal.c
|
||||
@@ -2557,7 +2557,7 @@ _public_ int sd_journal_enumerate_unique(sd_journal *j, const void **data, size_
|
||||
|
||||
/* Let's do the type check by hand, since we used 0 context above. */
|
||||
if (o->object.type != OBJECT_DATA) {
|
||||
- log_error("%s:offset " OFSfmt ": object has type %d, expected %d",
|
||||
+ log_debug("%s:offset " OFSfmt ": object has type %d, expected %d",
|
||||
j->unique_file->path, j->unique_offset,
|
||||
o->object.type, OBJECT_DATA);
|
||||
return -EBADMSG;
|
|
@ -1,244 +0,0 @@
|
|||
From 3c56cab44150ad47323970cfadfb0257c6305a74 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Wolsieffer <benwolsieffer@gmail.com>
|
||||
Date: Tue, 26 Aug 2014 22:08:02 +0200
|
||||
Subject: [PATCH] logind: add HandleLidSwitchDocked= option to logind.conf +
|
||||
documentation
|
||||
|
||||
https://bugs.freedesktop.org/show_bug.cgi?id=82485
|
||||
---
|
||||
man/logind.conf.xml | 16 +++++++++++-----
|
||||
src/login/logind-action.c | 18 ------------------
|
||||
src/login/logind-button.c | 18 ++++++++++++++++--
|
||||
src/login/logind-core.c | 22 ++++++++++++++++++++++
|
||||
src/login/logind-dbus.c | 1 +
|
||||
src/login/logind-gperf.gperf | 1 +
|
||||
src/login/logind.c | 7 +++++--
|
||||
src/login/logind.conf | 1 +
|
||||
src/login/logind.h | 2 ++
|
||||
9 files changed, 59 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
|
||||
index f037da259b..8ba95230be 100644
|
||||
--- a/man/logind.conf.xml
|
||||
+++ b/man/logind.conf.xml
|
||||
@@ -224,6 +224,7 @@
|
||||
<term><varname>HandleSuspendKey=</varname></term>
|
||||
<term><varname>HandleHibernateKey=</varname></term>
|
||||
<term><varname>HandleLidSwitch=</varname></term>
|
||||
+ <term><varname>HandleLidSwitchDocked=</varname></term>
|
||||
|
||||
<listitem><para>Controls whether
|
||||
logind shall handle the system power
|
||||
@@ -255,13 +256,18 @@
|
||||
and
|
||||
<varname>HandleLidSwitch=</varname>
|
||||
default to <literal>suspend</literal>.
|
||||
+ <varname>HandleLidSwitchDocked=</varname>
|
||||
+ defaults to <literal>ignore</literal>.
|
||||
<varname>HandleHibernateKey=</varname>
|
||||
defaults to
|
||||
- <literal>hibernate</literal>. Note
|
||||
- that the lid switch is ignored if the
|
||||
- system is inserted in a docking
|
||||
- station, or if more than one display
|
||||
- is connected.</para></listitem>
|
||||
+ <literal>hibernate</literal>. If the
|
||||
+ system is inserted in a docking station,
|
||||
+ or if more than one display is connected,
|
||||
+ the action specified by
|
||||
+ <varname>HandleLidSwitchDocked=</varname>
|
||||
+ occurs; otherwise the
|
||||
+ <varname>HandleLidSwitch=</varname>
|
||||
+ action occurs.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
|
||||
index 36ee4418b8..0844df20a9 100644
|
||||
--- a/src/login/logind-action.c
|
||||
+++ b/src/login/logind-action.c
|
||||
@@ -71,24 +71,6 @@ int manager_handle_action(
|
||||
}
|
||||
|
||||
if (inhibit_key == INHIBIT_HANDLE_LID_SWITCH) {
|
||||
- int n;
|
||||
-
|
||||
- /* If we are docked don't react to lid closing */
|
||||
- if (manager_is_docked(m)) {
|
||||
- log_debug("Ignoring lid switch request, system is docked.");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- /* If we have more than one display connected,
|
||||
- * don't react to lid closing. */
|
||||
- n = manager_count_displays(m);
|
||||
- if (n < 0)
|
||||
- log_warning("Display counting failed: %s", strerror(-n));
|
||||
- else if (n > 1) {
|
||||
- log_debug("Ignoring lid switch request, %i displays connected.", n);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
/* If the last system suspend or startup is too close,
|
||||
* let's not suspend for now, to give USB docking
|
||||
* stations some time to settle so that we can
|
||||
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
|
||||
index 2561d13c67..57e619efe6 100644
|
||||
--- a/src/login/logind-button.c
|
||||
+++ b/src/login/logind-button.c
|
||||
@@ -97,13 +97,27 @@ int button_set_seat(Button *b, const char *sn) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void button_lid_switch_handle_action(Manager *manager, bool is_edge) {
|
||||
+ HandleAction handle_action;
|
||||
+
|
||||
+ assert(manager);
|
||||
+
|
||||
+ /* If we are docked, handle the lid switch differently */
|
||||
+ if (manager_is_docked_or_multiple_displays(manager))
|
||||
+ handle_action = manager->handle_lid_switch_docked;
|
||||
+ else
|
||||
+ handle_action = manager->handle_lid_switch;
|
||||
+
|
||||
+ manager_handle_action(manager, INHIBIT_HANDLE_LID_SWITCH, handle_action, manager->lid_switch_ignore_inhibited, is_edge);
|
||||
+}
|
||||
+
|
||||
static int button_recheck(sd_event_source *e, void *userdata) {
|
||||
Button *b = userdata;
|
||||
|
||||
assert(b);
|
||||
assert(b->lid_closed);
|
||||
|
||||
- manager_handle_action(b->manager, INHIBIT_HANDLE_LID_SWITCH, b->manager->handle_lid_switch, b->manager->lid_switch_ignore_inhibited, false);
|
||||
+ button_lid_switch_handle_action(b->manager, false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -186,7 +200,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
NULL);
|
||||
|
||||
b->lid_closed = true;
|
||||
- manager_handle_action(b->manager, INHIBIT_HANDLE_LID_SWITCH, b->manager->handle_lid_switch, b->manager->lid_switch_ignore_inhibited, true);
|
||||
+ button_lid_switch_handle_action(b->manager, true);
|
||||
button_install_check_event_source(b);
|
||||
|
||||
} else if (ev.code == SW_DOCK) {
|
||||
diff --git a/src/login/logind-core.c b/src/login/logind-core.c
|
||||
index 053d2ed63e..ed7ea5da31 100644
|
||||
--- a/src/login/logind-core.c
|
||||
+++ b/src/login/logind-core.c
|
||||
@@ -537,3 +537,25 @@ int manager_count_displays(Manager *m) {
|
||||
|
||||
return n;
|
||||
}
|
||||
+
|
||||
+bool manager_is_docked_or_multiple_displays(Manager *m) {
|
||||
+ int n;
|
||||
+
|
||||
+ /* If we are docked don't react to lid closing */
|
||||
+ if (manager_is_docked(m)) {
|
||||
+ log_debug("System is docked.");
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ /* If we have more than one display connected,
|
||||
+ * assume that we are docked. */
|
||||
+ n = manager_count_displays(m);
|
||||
+ if (n < 0)
|
||||
+ log_warning("Display counting failed: %s", strerror(-n));
|
||||
+ else if (n > 1) {
|
||||
+ log_debug("Multiple (%i) displays connected.", n);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
|
||||
index acef5119b1..0b2b7b5afe 100644
|
||||
--- a/src/login/logind-dbus.c
|
||||
+++ b/src/login/logind-dbus.c
|
||||
@@ -1919,6 +1919,7 @@ const sd_bus_vtable manager_vtable[] = {
|
||||
SD_BUS_PROPERTY("HandleSuspendKey", "s", property_get_handle_action, offsetof(Manager, handle_suspend_key), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("HandleHibernateKey", "s", property_get_handle_action, offsetof(Manager, handle_hibernate_key), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("HandleLidSwitch", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
+ SD_BUS_PROPERTY("HandleLidSwitchDocked", "s", property_get_handle_action, offsetof(Manager, handle_lid_switch_docked), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("IdleAction", "s", property_get_handle_action, offsetof(Manager, idle_action), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("IdleActionUSec", "t", NULL, offsetof(Manager, idle_action_usec), SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("PreparingForShutdown", "b", property_get_preparing, 0, 0),
|
||||
diff --git a/src/login/logind-gperf.gperf b/src/login/logind-gperf.gperf
|
||||
index 006f7286c5..62460673b9 100644
|
||||
--- a/src/login/logind-gperf.gperf
|
||||
+++ b/src/login/logind-gperf.gperf
|
||||
@@ -24,6 +24,7 @@ Login.HandlePowerKey, config_parse_handle_action, 0, offsetof(Manag
|
||||
Login.HandleSuspendKey, config_parse_handle_action, 0, offsetof(Manager, handle_suspend_key)
|
||||
Login.HandleHibernateKey, config_parse_handle_action, 0, offsetof(Manager, handle_hibernate_key)
|
||||
Login.HandleLidSwitch, config_parse_handle_action, 0, offsetof(Manager, handle_lid_switch)
|
||||
+Login.HandleLidSwitchDocked, config_parse_handle_action, 0, offsetof(Manager, handle_lid_switch_docked)
|
||||
Login.PowerKeyIgnoreInhibited, config_parse_bool, 0, offsetof(Manager, power_key_ignore_inhibited)
|
||||
Login.SuspendKeyIgnoreInhibited, config_parse_bool, 0, offsetof(Manager, suspend_key_ignore_inhibited)
|
||||
Login.HibernateKeyIgnoreInhibited, config_parse_bool, 0, offsetof(Manager, hibernate_key_ignore_inhibited)
|
||||
diff --git a/src/login/logind.c b/src/login/logind.c
|
||||
index 52e1c43a47..1f94a97bd0 100644
|
||||
--- a/src/login/logind.c
|
||||
+++ b/src/login/logind.c
|
||||
@@ -55,6 +55,7 @@ Manager *manager_new(void) {
|
||||
m->handle_suspend_key = HANDLE_SUSPEND;
|
||||
m->handle_hibernate_key = HANDLE_HIBERNATE;
|
||||
m->handle_lid_switch = HANDLE_SUSPEND;
|
||||
+ m->handle_lid_switch_docked = HANDLE_IGNORE;
|
||||
m->lid_switch_ignore_inhibited = true;
|
||||
|
||||
m->idle_action_usec = 30 * USEC_PER_MINUTE;
|
||||
@@ -232,7 +233,8 @@ static int manager_enumerate_buttons(Manager *m) {
|
||||
if (m->handle_power_key == HANDLE_IGNORE &&
|
||||
m->handle_suspend_key == HANDLE_IGNORE &&
|
||||
m->handle_hibernate_key == HANDLE_IGNORE &&
|
||||
- m->handle_lid_switch == HANDLE_IGNORE)
|
||||
+ m->handle_lid_switch == HANDLE_IGNORE &&
|
||||
+ m->handle_lid_switch_docked == HANDLE_IGNORE)
|
||||
return 0;
|
||||
|
||||
e = udev_enumerate_new(m->udev);
|
||||
@@ -875,7 +877,8 @@ static int manager_connect_udev(Manager *m) {
|
||||
if (m->handle_power_key != HANDLE_IGNORE ||
|
||||
m->handle_suspend_key != HANDLE_IGNORE ||
|
||||
m->handle_hibernate_key != HANDLE_IGNORE ||
|
||||
- m->handle_lid_switch != HANDLE_IGNORE) {
|
||||
+ m->handle_lid_switch != HANDLE_IGNORE ||
|
||||
+ m->handle_lid_switch_docked != HANDLE_IGNORE) {
|
||||
|
||||
m->udev_button_monitor = udev_monitor_new_from_netlink(m->udev, "udev");
|
||||
if (!m->udev_button_monitor)
|
||||
diff --git a/src/login/logind.conf b/src/login/logind.conf
|
||||
index 79f96ec05b..4608a2c0e2 100644
|
||||
--- a/src/login/logind.conf
|
||||
+++ b/src/login/logind.conf
|
||||
@@ -18,6 +18,7 @@
|
||||
#HandleSuspendKey=suspend
|
||||
#HandleHibernateKey=hibernate
|
||||
#HandleLidSwitch=suspend
|
||||
+#HandleLidSwitchDocked=ignore
|
||||
#PowerKeyIgnoreInhibited=no
|
||||
#SuspendKeyIgnoreInhibited=no
|
||||
#HibernateKeyIgnoreInhibited=no
|
||||
diff --git a/src/login/logind.h b/src/login/logind.h
|
||||
index 31353eff02..2f76572580 100644
|
||||
--- a/src/login/logind.h
|
||||
+++ b/src/login/logind.h
|
||||
@@ -114,6 +114,7 @@ struct Manager {
|
||||
HandleAction handle_suspend_key;
|
||||
HandleAction handle_hibernate_key;
|
||||
HandleAction handle_lid_switch;
|
||||
+ HandleAction handle_lid_switch_docked;
|
||||
|
||||
bool power_key_ignore_inhibited;
|
||||
bool suspend_key_ignore_inhibited;
|
||||
@@ -159,6 +160,7 @@ int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session);
|
||||
|
||||
bool manager_is_docked(Manager *m);
|
||||
int manager_count_displays(Manager *m);
|
||||
+bool manager_is_docked_or_multiple_displays(Manager *m);
|
||||
|
||||
extern const sd_bus_vtable manager_vtable[];
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue