Backport fixes and hwdb changes

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-11-19 17:28:44 -05:00
parent 7c25c33b5a
commit 930e1b89bd
117 changed files with 6591 additions and 155 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/x86_64/ /x86_64/
/systemd-*src.rpm /systemd-*src.rpm
/systemd-*.tar.xz /systemd-*.tar.xz
/*.rpm

View File

@ -20,6 +20,3 @@ index b094f34..a7c83ed 100644
struct acpi_table_header *tbl; struct acpi_table_header *tbl;
size_t l; size_t l;
struct acpi_fpdt_header *rec; struct acpi_fpdt_header *rec;
--
1.8.4.652.g0d6e0ce

View File

@ -49,6 +49,3 @@ index b0e75db..5caa5d5 100644
Conflicts=shutdown.target Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service
Before=sysinit.target shutdown.target Before=sysinit.target shutdown.target
--
1.8.4.652.g0d6e0ce

View File

@ -20,6 +20,3 @@ index a7c83ed..af58c7c 100644
struct acpi_table_header *tbl; struct acpi_table_header *tbl;
size_t l; size_t l;
struct acpi_fpdt_header *rec; struct acpi_fpdt_header *rec;
--
1.8.4.652.g0d6e0ce

View File

@ -129,6 +129,3 @@ index bb7ada9..d75281f 100644
if (r) if (r)
return r; return r;
--
1.8.4.652.g0d6e0ce

View File

@ -43,6 +43,3 @@ index 22b5eea..769c3e4 100644
free(opt_hash); free(opt_hash);
opt_hash = t; opt_hash = t;
--
1.8.4.652.g0d6e0ce

View File

@ -20,6 +20,3 @@ index 1236403..81c344f 100644
o->field.hash = htole64(hash); o->field.hash = htole64(hash);
memcpy(o->field.payload, field, size); memcpy(o->field.payload, field, size);
--
1.8.4.652.g0d6e0ce

View File

@ -29,6 +29,3 @@ index 0e66f3d..cac948e 100644
if (isempty(p)) if (isempty(p))
return false; return false;
--
1.8.4.652.g0d6e0ce

View File

@ -25,6 +25,3 @@ index 3f766fb..db0880f 100644
} }
int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) { int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {
--
1.8.4.652.g0d6e0ce

View File

@ -22,6 +22,3 @@ index 7b19ee0..49ee420 100644
} }
r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs); r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
--
1.8.4.652.g0d6e0ce

View File

@ -21,6 +21,3 @@ index 1d5b6f9..c015b16 100644
*options = list; *options = list;
return count; return count;
--
1.8.4.652.g0d6e0ce

View File

@ -22,6 +22,3 @@ index 5e29629..7976881 100644
return e; return e;
} }
--
1.8.4.652.g0d6e0ce

View File

@ -20,6 +20,3 @@ index b7e5c6e..43c6ea6 100644
} }
static int is_dir(const char* path) { static int is_dir(const char* path) {
--
1.8.4.652.g0d6e0ce

View File

@ -21,6 +21,3 @@ index b630440..a05c657 100644
m /var/log/journal/%m 2755 root systemd-journal - - m /var/log/journal/%m 2755 root systemd-journal - -
+m /run/log/journal 2755 root systemd-journal - - +m /run/log/journal 2755 root systemd-journal - -
+m /run/log/journal/%m 2755 root systemd-journal - - +m /run/log/journal/%m 2755 root systemd-journal - -
--
1.8.4.652.g0d6e0ce

View File

@ -164,6 +164,3 @@ index 3718a57..3f8b59d 100644
ExecStart=-@rootlibexecdir@/systemd --user ExecStart=-@rootlibexecdir@/systemd --user
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket
Slice=user-%i.slice Slice=user-%i.slice
--
1.8.4.652.g0d6e0ce

View File

@ -40,6 +40,3 @@ index 9fc4b7c..e8b630d 100644
names.</para></listitem> names.</para></listitem>
</varlistentry> </varlistentry>
--
1.8.4.652.g0d6e0ce

View File

@ -119,6 +119,3 @@ index 49296b5..973daf7 100644
/* Make this a NOP on non-logind systems */ /* Make this a NOP on non-logind systems */
if (!logind_running()) if (!logind_running())
--
1.8.4.652.g0d6e0ce

View File

@ -35,6 +35,3 @@ index ca54925..d2b4213 100644
r = 0; r = 0;
goto finish; goto finish;
} }
--
1.8.4.652.g0d6e0ce

View File

@ -36,6 +36,3 @@ index 3d46557..93bfa99 100644
if (r < 0) if (r < 0)
goto fail; goto fail;
--
1.8.4.652.g0d6e0ce

View File

@ -40,6 +40,3 @@ index 676a07f..8f4d017 100644
if (!dbus_message_iter_init(message, &iter)) if (!dbus_message_iter_init(message, &iter))
goto oom; goto oom;
--
1.8.4.652.g0d6e0ce

View File

@ -20,6 +20,3 @@ index 5f6bafb..be4e01c 100644
" <arg name=\"force\" type=\"b\"/>\n" \ " <arg name=\"force\" type=\"b\"/>\n" \
" </method>\n" \ " </method>\n" \
" <method name=\"ReleaseControl\"/>\n" \ " <method name=\"ReleaseControl\"/>\n" \
--
1.8.4.652.g0d6e0ce

View File

@ -24,6 +24,3 @@ index 93bfa99..db055f0 100644
r = unit_require_mounts_for(UNIT(m), pm->what); r = unit_require_mounts_for(UNIT(m), pm->what);
if (r < 0) if (r < 0)
return r; return r;
--
1.8.4.652.g0d6e0ce

View File

@ -176,6 +176,3 @@ index db055f0..70cd372 100644
static int mount_add_device_links(Mount *m) { static int mount_add_device_links(Mount *m) {
MountParameters *p; MountParameters *p;
bool device_wants_mount = false; bool device_wants_mount = false;
--
1.8.4.652.g0d6e0ce

View File

@ -42,6 +42,3 @@ index 7bd0db1..f0182ee 100644
} }
static void test_utf8_is_valid(void) { static void test_utf8_is_valid(void) {
--
1.8.4.652.g0d6e0ce

View File

@ -45,6 +45,3 @@ index 2f3dedb..59ba4be 100644
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
--
1.8.4.652.g0d6e0ce

View File

@ -46,6 +46,3 @@ index 6792024..98b1599 100644
} else } else
log_debug_unit(u->id, "Unknown serialization key '%s'", key); log_debug_unit(u->id, "Unknown serialization key '%s'", key);
--
1.8.4.652.g0d6e0ce

View File

@ -35,6 +35,3 @@ index 98b1599..96ed2d3 100644
else else
s->forbid_restart = b; s->forbid_restart = b;
} else } else
--
1.8.4.652.g0d6e0ce

View File

@ -20,6 +20,3 @@ index c73ad8f..8d5effb 100644
continue; continue;
} }
--
1.8.4.652.g0d6e0ce

View File

@ -37,6 +37,3 @@ index 20d398f..b497f92 100644
KEYBOARD_KEY_ce=! # Fn+F8 keyboard backlight up KEYBOARD_KEY_ce=! # Fn+F8 keyboard backlight up
KEYBOARD_KEY_8d=! # Fn+F7 keyboard backlight down KEYBOARD_KEY_8d=! # Fn+F7 keyboard backlight down
KEYBOARD_KEY_96=! # Fn+F1 performance mode (?) KEYBOARD_KEY_96=! # Fn+F1 performance mode (?)
--
1.8.4.652.g0d6e0ce

View File

@ -28,6 +28,3 @@ index af58c7c..75648b4 100644
if (loader_start) if (loader_start)
*loader_start = brec.startup_start / 1000; *loader_start = brec.startup_start / 1000;
if (loader_exit) if (loader_exit)
--
1.8.4.652.g0d6e0ce

View File

@ -34,6 +34,3 @@ index 4f47eb1..e03e413 100644
else { else {
hashmap_replace(s->user_journals, k, f); hashmap_replace(s->user_journals, k, f);
server_fix_perms(s, f, PTR_TO_UINT32(k)); server_fix_perms(s, f, PTR_TO_UINT32(k));
--
1.8.4.652.g0d6e0ce

View File

@ -22,6 +22,3 @@ index 71d8c29..6c27dfe 100644
unsigned u; unsigned u;
int r; int r;
--
1.8.4.652.g0d6e0ce

View File

@ -22,6 +22,3 @@ index 6c27dfe..7e25041 100644
if (r < 0) if (r < 0)
return r; return r;
--
1.8.4.652.g0d6e0ce

View File

@ -29,6 +29,3 @@ index d0b257d..b959216 100644
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
--
1.8.4.652.g0d6e0ce

View File

@ -380,6 +380,3 @@ index d75281f..036828b 100644
for (u = unit_infos; u < unit_infos + c; u++) { for (u = unit_infos; u < unit_infos + c; u++) {
_cleanup_free_ char *p = NULL; _cleanup_free_ char *p = NULL;
--
1.8.4.652.g0d6e0ce

View File

@ -66,6 +66,3 @@ index c727cae..3ba2d87 100644
return 0; return 0;
} }
--
1.8.4.652.g0d6e0ce

View File

@ -24,6 +24,3 @@ index 4b97710..1db7d06 100644
if (unlink(q) < 0) if (unlink(q) < 0)
r = errno == ENOENT ? 0 : -errno; r = errno == ENOENT ? 0 : -errno;
else else
--
1.8.4.652.g0d6e0ce

View File

@ -25,6 +25,3 @@ index 44920d6..f01843d 100644
return r; return r;
} }
--
1.8.4.652.g0d6e0ce

View File

@ -19,6 +19,3 @@ index 5b38c0b..56e10a6 100644
*.stamp *.stamp
*.pyc *.pyc
__pycache__/ __pycache__/
--
1.8.4.652.g0d6e0ce

View File

@ -92,6 +92,3 @@ index b959216..a1ffe42 100644
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
--
1.8.4.652.g0d6e0ce

View File

@ -23,6 +23,3 @@ index 748f1bb..6c88040 100644
if (k == GLOB_NOMATCH) if (k == GLOB_NOMATCH)
return -ENOENT; return -ENOENT;
--
1.8.4.652.g0d6e0ce

View File

@ -33,6 +33,3 @@ index cc44ab4..aa0f017 100644
if(flags & OUTPUT_FULL_WIDTH) if(flags & OUTPUT_FULL_WIDTH)
n_columns = 0; n_columns = 0;
--
1.8.4.652.g0d6e0ce

View File

@ -29,6 +29,3 @@ index f8c97c2..7f86cfe 100644
ps->sample->runtime = atoll(rt); ps->sample->runtime = atoll(rt);
ps->sample->waittime = atoll(wt); ps->sample->waittime = atoll(wt);
--
1.8.4.652.g0d6e0ce

View File

@ -32,6 +32,3 @@ index fe6e331..85c06d3 100644
<term><varname>emergency</varname></term> <term><varname>emergency</varname></term>
<listitem><para>Boot into emergency <listitem><para>Boot into emergency
--
1.8.4.652.g0d6e0ce

View File

@ -44,6 +44,3 @@ index 0407609..04e735e 100644
<allow receive_sender="org.freedesktop.login1"/> <allow receive_sender="org.freedesktop.login1"/>
</policy> </policy>
--
1.8.4.652.g0d6e0ce

View File

@ -30,6 +30,3 @@ index bbb7d0c..3c99475 100644
# Ignore raid devices that are not yet assembled and started # Ignore raid devices that are not yet assembled and started
SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0" SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0"
--
1.8.4.652.g0d6e0ce

View File

@ -33,6 +33,3 @@ index 3c99475..307f18f 100644
+SUBSYSTEM=="module", KERNEL=="configfs", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount" +SUBSYSTEM=="module", KERNEL=="configfs", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
LABEL="systemd_end" LABEL="systemd_end"
--
1.8.4.652.g0d6e0ce

View File

@ -32,6 +32,3 @@ index 8122d6a..239e56b 100644
continue; continue;
} }
--
1.8.4.652.g0d6e0ce

View File

@ -1627,6 +1627,3 @@ index fdb534d..289f81c 100644
pci:v00009005d00000285sv0000108Esd00000287* pci:v00009005d00000285sv0000108Esd00000287*
ID_MODEL_FROM_DATABASE=STK RAID EXT ID_MODEL_FROM_DATABASE=STK RAID EXT
--
1.8.4.652.g0d6e0ce

View File

@ -38,6 +38,3 @@ index f764789..679dfdf 100644
KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse" KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"
--
1.8.4.652.g0d6e0ce

View File

@ -31,6 +31,3 @@ index a4f15eb..9a69795 100644
svg("<text x=\"20\" y=\"50\">%s</text>", pretty_times); svg("<text x=\"20\" y=\"50\">%s</text>", pretty_times);
svg("<text x=\"20\" y=\"30\">%s %s (%s %s) %s</text>", svg("<text x=\"20\" y=\"30\">%s %s (%s %s) %s</text>",
isempty(osname) ? "Linux" : osname, isempty(osname) ? "Linux" : osname,
--
1.8.4.652.g0d6e0ce

View File

@ -79,6 +79,3 @@ index 37c60f5..2eda5fe 100644
'set-log-level:Set systemd log threshold' 'set-log-level:Set systemd log threshold'
) )
--
1.8.4.652.g0d6e0ce

View File

@ -0,0 +1,174 @@
From df3db39c105ff8a6ba409ae8e28216d8571dece7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 22 Oct 2013 20:39:18 -0400
Subject: [PATCH] systemd: use unit name in PrivateTmp directories
Unit name is used whole in the directory name, so that the unit name
can be easily extracted from it, e.g. "/tmp/systemd-abcd.service-DEDBIF1".
https://bugzilla.redhat.com/show_bug.cgi?id=957439
---
Makefile.am | 7 ++++++
src/core/execute.c | 2 +-
src/core/namespace.c | 15 ++++++++-----
src/core/namespace.h | 5 ++++-
src/test/test-namespace.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 77 insertions(+), 8 deletions(-)
create mode 100644 src/test/test-namespace.c
diff --git a/Makefile.am b/Makefile.am
index 8d9c587..5e3e5d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1130,6 +1130,7 @@ tests += \
test-unit-file \
test-utf8 \
test-util \
+ test-namespace \
test-date \
test-sleep \
test-replace-var \
@@ -1256,6 +1257,12 @@ test_util_CFLAGS = \
test_util_LDADD = \
libsystemd-core.la
+test_namespace_SOURCES = \
+ src/test/test-namespace.c
+
+test_namespace_LDADD = \
+ libsystemd-core.la
+
test_hashmap_SOURCES = \
src/test/test-hashmap.c
diff --git a/src/core/execute.c b/src/core/execute.c
index 3f7ca52..58be72a 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1089,7 +1089,7 @@ int exec_spawn(ExecCommand *command,
free(line);
if (context->private_tmp && !context->tmp_dir && !context->var_tmp_dir) {
- r = setup_tmpdirs(&context->tmp_dir, &context->var_tmp_dir);
+ r = setup_tmpdirs(unit_id, &context->tmp_dir, &context->var_tmp_dir);
if (r < 0)
return r;
}
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 936f368..b453f8d 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -184,26 +184,29 @@ static int make_read_only(BindMount *m) {
return 0;
}
-int setup_tmpdirs(char **tmp_dir,
+int setup_tmpdirs(const char *unit_id,
+ char **tmp_dir,
char **var_tmp_dir) {
int r = 0;
- char tmp_dir_template[] = "/tmp/systemd-private-XXXXXX",
- var_tmp_dir_template[] = "/var/tmp/systemd-private-XXXXXX";
+ _cleanup_free_ char *tmp = NULL, *var = NULL;
assert(tmp_dir);
assert(var_tmp_dir);
- r = create_tmp_dir(tmp_dir_template, tmp_dir);
+ tmp = strjoin("/tmp/systemd-", unit_id, "-XXXXXXX", NULL);
+ var = strjoin("/var/tmp/systemd-", unit_id, "-XXXXXXX", NULL);
+
+ r = create_tmp_dir(tmp, tmp_dir);
if (r < 0)
return r;
- r = create_tmp_dir(var_tmp_dir_template, var_tmp_dir);
+ r = create_tmp_dir(var, var_tmp_dir);
if (r == 0)
return 0;
/* failure */
rmdir(*tmp_dir);
- rmdir(tmp_dir_template);
+ rmdir(tmp);
free(*tmp_dir);
*tmp_dir = NULL;
diff --git a/src/core/namespace.h b/src/core/namespace.h
index ddb5794..ee7416b 100644
--- a/src/core/namespace.h
+++ b/src/core/namespace.h
@@ -23,7 +23,10 @@
#include <stdbool.h>
-int setup_tmpdirs(char **tmp_dir, char **var_tmp_dir);
+int setup_tmpdirs(const char *unit_id,
+ char **tmp_dir,
+ char **var_tmp_dir);
+
int setup_namespace(char **read_write_dirs,
char **read_only_dirs,
char **inaccessible_dirs,
diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c
new file mode 100644
index 0000000..1c04676
--- /dev/null
+++ b/src/test/test-namespace.c
@@ -0,0 +1,56 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2013 Zbigniew Jędrzejewski-Szmek
+
+ 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 <libgen.h>
+
+#include "namespace.h"
+#include "util.h"
+
+static void test_tmpdir(const char *id, const char *A, const char *B) {
+ _cleanup_free_ char *a, *b;
+
+ assert_se(setup_tmpdirs(id, &a, &b) == 0);
+ assert(startswith(a, A));
+ assert(startswith(b, B));
+ assert(access(a, F_OK) == 0);
+ assert(access(b, F_OK) == 0);
+
+ assert_se(rmdir(a) == 0);
+ assert_se(rmdir(b) == 0);
+
+ assert(endswith(a, "/tmp"));
+ assert(endswith(b, "/tmp"));
+
+ assert_se(rmdir(dirname(a)) == 0);
+ assert_se(rmdir(dirname(b)) == 0);
+}
+
+int main(int argc, char *argv[]) {
+ test_tmpdir("abcd.service",
+ "/tmp/systemd-abcd.service-",
+ "/var/tmp/systemd-abcd.service-");
+
+ test_tmpdir("sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device",
+ "/tmp/systemd-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-",
+ "/var/tmp/systemd-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
+
+ return 0;
+}

View File

@ -0,0 +1,89 @@
From 5048d22d69d889d17eaea99f223fd9369eadc919 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 24 Oct 2013 00:45:10 -0400
Subject: [PATCH] catalog: remove links to non-existent wiki pages
AFAIK, we don't have even one page with message explanations.
If/when we add them, we can add links.
https://bugzilla.redhat.com/show_bug.cgi?id=1017161
---
catalog/systemd.catalog | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/catalog/systemd.catalog b/catalog/systemd.catalog
index 892b2ad..3c2fe64 100644
--- a/catalog/systemd.catalog
+++ b/catalog/systemd.catalog
@@ -204,7 +204,6 @@ Unit @UNIT@ has begun shutting down.
Subject: Unit @UNIT@ has finished shutting down
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has finished shutting down.
@@ -212,7 +211,6 @@ Unit @UNIT@ has finished shutting down.
Subject: Unit @UNIT@ has failed
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has failed.
@@ -222,7 +220,6 @@ The result is @RESULT@.
Subject: Unit @UNIT@ has begun with reloading its configuration
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has begun with reloading its configuration
@@ -230,7 +227,6 @@ Unit @UNIT@ has begun with reloading its configuration
Subject: Unit @UNIT@ has finished reloading its configuration
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
Unit @UNIT@ has finished reloading its configuration
@@ -240,7 +236,6 @@ The result is @RESULT@.
Subject: Process @EXECUTABLE@ could not be executed
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
The process @EXECUTABLE@ could not be executed and failed.
@@ -250,7 +245,6 @@ The error number returned while executing this process is @ERRNO@.
Subject: One or more messages could not be forwarded to syslog
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
One or more messages could not be forwarded to the syslog service
running side-by-side with journald. This usually indicates that the
@@ -261,7 +255,6 @@ messages queued.
Subject: Mount point is not empty
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
The directory @WHERE@ is specified as the mount point (second field in
/etc/fstab or Where= field in systemd unit file) and is not empty.
@@ -274,7 +267,6 @@ location.
Subject: A virtual machine or container has been started
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
The virtual machine @NAME@ with its leader PID @LEADER@ has been
started is now ready to use.
@@ -283,7 +275,6 @@ started is now ready to use.
Subject: A virtual machine or container has been terminated
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@
The virtual machine @NAME@ with its leader PID @LEADER@ has been
shut down.

View File

@ -0,0 +1,239 @@
From e94957b964380c0c9b0f3264ba5e35166d543ca7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 28 Oct 2013 23:43:57 -0400
Subject: [PATCH] journalctl: add --list-boots to show boot IDs and times
Suggested by David Wilkins <dwilkins@maths.tcd.ie> in
https://bugzilla.redhat.com/show_bug.cgi?id=967521:
> [Specific boot ID is a] bit of a palaver to obtain. I consulted the
> verbose dump of the journal to discover the _BOOT_ID for the
> timestamp, and then generated the journal dump for that boot using
> journalctl _BOOT_ID=foo -o short-monotonic.
---
man/journalctl.xml | 11 ++++
shell-completion/bash/journalctl | 2 +-
shell-completion/zsh/_journalctl | 1 +
src/journal/journalctl.c | 105 +++++++++++++++++++++++++++++++++++++--
4 files changed, 113 insertions(+), 6 deletions(-)
diff --git a/man/journalctl.xml b/man/journalctl.xml
index b5a0c53..c0cc96d 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -478,6 +478,17 @@
</varlistentry>
<varlistentry>
+ <term><option>--list-boots</option></term>
+
+ <listitem><para>Show a tabular list of
+ boot numbers (relative to current
+ boot), their IDs, and the timestamps
+ of the first and last message
+ pertaining to the boot.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-k</option></term>
<term><option>--dmesg</option></term>
diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl
index 3c40d57..942a253 100644
--- a/shell-completion/bash/journalctl
+++ b/shell-completion/bash/journalctl
@@ -42,7 +42,7 @@ _journalctl() {
--disk-usage -f --follow --header
-h --help -l --local --new-id128 -m --merge --no-pager
--no-tail -q --quiet --setup-keys --this-boot --verify
- --version --list-catalog --update-catalog'
+ --version --list-catalog --update-catalog --list-boots'
[ARG]='-b --boot --this-boot -D --directory -F --field
-o --output -u --unit --user-unit'
[ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until
diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index 73646b5..29ff3e3 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -70,6 +70,7 @@ _arguments -s \
{-q,--quiet}"[Don't show privilege warning]" \
{-m,--merge}'[Show entries from all available journals]' \
{-b+,--boot=}'[Show data only from the specified boot or offset]:boot id or offset:_journal_boots' \
+ '--list-boots[List boots ordered by time]' \
{-k,--dmesg}'[Show only kernel messages, Implies -b]' \
{-u+,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
'--user-unit=[Show data only from the specified user session unit]:units:_journal_fields USER_UNIT' \
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 0876ee6..a5c4779 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -104,12 +104,14 @@ static enum {
ACTION_DISK_USAGE,
ACTION_LIST_CATALOG,
ACTION_DUMP_CATALOG,
- ACTION_UPDATE_CATALOG
+ ACTION_UPDATE_CATALOG,
+ ACTION_LIST_BOOTS,
} arg_action = ACTION_SHOW;
typedef struct boot_id_t {
sd_id128_t id;
- uint64_t timestamp;
+ uint64_t first;
+ uint64_t last;
} boot_id_t;
static int help(void) {
@@ -125,6 +127,7 @@ static int help(void) {
" --after-cursor=CURSOR Start showing entries from specified cursor\n"
" --show-cursor Print the cursor after all the entries\n"
" -b --boot[=ID] Show data only from ID or current boot if unspecified\n"
+ " --list-boots Show terse information about recorded boots\n"
" -k --dmesg Show kernel message log from 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"
@@ -177,6 +180,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_NO_PAGER,
ARG_NO_TAIL,
ARG_NEW_ID128,
+ ARG_LIST_BOOTS,
ARG_USER,
ARG_SYSTEM,
ARG_ROOT,
@@ -214,6 +218,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "quiet", no_argument, NULL, 'q' },
{ "merge", no_argument, NULL, 'm' },
{ "boot", optional_argument, NULL, 'b' },
+ { "list-boots", no_argument, NULL, ARG_LIST_BOOTS },
{ "this-boot", optional_argument, NULL, 'b' }, /* deprecated */
{ "dmesg", no_argument, NULL, 'k' },
{ "system", no_argument, NULL, ARG_SYSTEM },
@@ -364,6 +369,10 @@ static int parse_argv(int argc, char *argv[]) {
break;
+ case ARG_LIST_BOOTS:
+ arg_action = ACTION_LIST_BOOTS;
+ break;
+
case 'k':
arg_boot = arg_dmesg = true;
break;
@@ -692,12 +701,93 @@ static int add_matches(sd_journal *j, char **args) {
static int boot_id_cmp(const void *a, const void *b) {
uint64_t _a, _b;
- _a = ((const boot_id_t *)a)->timestamp;
- _b = ((const boot_id_t *)b)->timestamp;
+ _a = ((const boot_id_t *)a)->first;
+ _b = ((const boot_id_t *)b)->first;
return _a < _b ? -1 : (_a > _b ? 1 : 0);
}
+static int list_boots(sd_journal *j) {
+ int r;
+ const void *data;
+ unsigned int count = 0;
+ int w, i;
+ size_t length, allocated = 0;
+ boot_id_t *id;
+ _cleanup_free_ boot_id_t *all_ids = NULL;
+
+ r = sd_journal_query_unique(j, "_BOOT_ID");
+ if (r < 0)
+ return r;
+
+ SD_JOURNAL_FOREACH_UNIQUE(j, data, length) {
+ if (length < strlen("_BOOT_ID="))
+ continue;
+
+ if (!GREEDY_REALLOC(all_ids, allocated, count + 1))
+ return log_oom();
+
+ id = &all_ids[count];
+
+ r = sd_id128_from_string(((const char *)data) + strlen("_BOOT_ID="), &id->id);
+ if (r < 0)
+ continue;
+
+ r = sd_journal_add_match(j, data, length);
+ if (r < 0)
+ return r;
+
+ r = sd_journal_seek_head(j);
+ if (r < 0)
+ return r;
+
+ r = sd_journal_next(j);
+ if (r < 0)
+ return r;
+ else if (r == 0)
+ goto flush;
+
+ r = sd_journal_get_realtime_usec(j, &id->first);
+ if (r < 0)
+ return r;
+
+ r = sd_journal_seek_tail(j);
+ if (r < 0)
+ return r;
+
+ r = sd_journal_previous(j);
+ if (r < 0)
+ return r;
+ else if (r == 0)
+ goto flush;
+
+ r = sd_journal_get_realtime_usec(j, &id->last);
+ if (r < 0)
+ return r;
+
+ count++;
+ flush:
+ sd_journal_flush_matches(j);
+ }
+
+ qsort_safe(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
+
+ /* numbers are one less, but we need an extra char for the sign */
+ w = DECIMAL_STR_WIDTH(count - 1) + 1;
+
+ for (id = all_ids, i = 0; id < all_ids + count; id++, i++) {
+ char a[FORMAT_TIMESTAMP_MAX], b[FORMAT_TIMESTAMP_MAX];
+
+ printf("% *i " SD_ID128_FORMAT_STR " %s—%s\n",
+ w, i - count + 1,
+ SD_ID128_FORMAT_VAL(id->id),
+ format_timestamp(a, sizeof(a), id->first),
+ format_timestamp(b, sizeof(b), id->last));
+ }
+
+ return 0;
+}
+
static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative) {
int r;
const void *data;
@@ -743,7 +833,7 @@ static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative
else if (r == 0)
goto flush;
- r = sd_journal_get_realtime_usec(j, &id->timestamp);
+ r = sd_journal_get_realtime_usec(j, &id->first);
if (r < 0)
return r;
@@ -1403,6 +1493,11 @@ int main(int argc, char *argv[]) {
return EXIT_SUCCESS;
}
+ if (arg_action == ACTION_LIST_BOOTS) {
+ r = list_boots(j);
+ goto finish;
+ }
+
/* add_boot() must be called first!
* It may need to seek the journal to find parent boot IDs. */
r = add_boot(j);

View File

@ -0,0 +1,47 @@
From d22ea78deff9fe2c87a3a90381ae2d4e8234d1ca Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sat, 26 Oct 2013 12:22:04 +0200
Subject: [PATCH] udev-builtin: path_id - add support for bcma bus
This matches the bcma support in the network device naming.
Eventually wa want to make sure ID_PATH is equivalent to ID_NET_NAME_PATH,
so we never need to match on the latter.
---
src/udev/udev-builtin-path_id.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index 0659967..763f3c3 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -452,6 +452,19 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path)
return parent;
}
+static struct udev_device *handle_bcma(struct udev_device *parent, char **path)
+{
+ const char *sysname;
+ unsigned int core;
+
+ sysname = udev_device_get_sysname(parent);
+ if (sscanf(sysname, "bcma%*u:%u", &core) != 1)
+ return NULL;
+
+ path_prepend(path, "bcma-%u", core);
+ return parent;
+}
+
static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path)
{
struct udev_device *scsi_dev;
@@ -509,6 +522,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool
} else if (streq(subsys, "usb")) {
parent = handle_usb(parent, &path);
some_transport = true;
+ } else if (streq(subsys, "bcma")) {
+ parent = handle_bcma(parent, &path);
+ some_transport = true;
} else if (streq(subsys, "serio")) {
path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent));
parent = skip_subsystem(parent, "serio");

View File

@ -0,0 +1,22 @@
From e323253480b01f0df71ee409cbf9aba88ec1a5e4 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Wed, 30 Oct 2013 14:34:58 +0100
Subject: [PATCH] udev: ata_id: log faling ioctls as "debug"
---
src/udev/ata_id/ata_id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index 68a06b9..d375d43 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -501,7 +501,7 @@ int main(int argc, char *argv[])
} else {
/* If this fails, then try HDIO_GET_IDENTITY */
if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
- log_info("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
+ log_debug("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
rc = 2;
goto close;
}

View File

@ -0,0 +1,23 @@
From d0aeff58c118ae0be82d346ae0ce75bf9a20f02d Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 30 Oct 2013 15:09:01 +0100
Subject: [PATCH] libudev: default log_priority to INFO
This brings it in sync with the default config file.
---
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 208039a..bc73a5a 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -125,7 +125,7 @@ _public_ struct udev *udev_new(void)
return NULL;
udev->refcount = 1;
udev->log_fn = log_stderr;
- udev->log_priority = LOG_ERR;
+ udev->log_priority = LOG_INFO;
udev_list_init(udev, &udev->properties_list, true);
f = fopen("/etc/udev/udev.conf", "re");

View File

@ -0,0 +1,22 @@
From 7aa2bfdb3b0c3babc6bb8c4a9534a328b8ac37ab Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 30 Oct 2013 18:40:21 +0100
Subject: [PATCH] nspawn: only pass in slice setting if it is set
---
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 eb9605c..9616dbf 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1202,7 +1202,7 @@ static int register_machine(void) {
"container",
(uint32_t) 0,
strempty(arg_directory),
- 1, "Slice", "s", strempty(arg_slice));
+ !isempty(arg_slice), "Slice", "s", arg_slice);
if (r < 0) {
log_error("Failed to register machine: %s", error.message ? error.message : strerror(-r));
return r;

View File

@ -0,0 +1,60 @@
From 0f25880b6e0feea046923d2d796e6e10abdd7c6a Mon Sep 17 00:00:00 2001
From: Ronny Chevalier <chevalier.ronny@gmail.com>
Date: Wed, 30 Oct 2013 21:57:44 +0100
Subject: [PATCH] zsh-completion: add systemd-run
---
Makefile.am | 1 +
shell-completion/zsh/_systemd-run | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
create mode 100644 shell-completion/zsh/_systemd-run
diff --git a/Makefile.am b/Makefile.am
index 5e3e5d2..7ab345a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -352,6 +352,7 @@ dist_zshcompletion_DATA = \
shell-completion/zsh/_kernel-install \
shell-completion/zsh/_systemd-nspawn \
shell-completion/zsh/_systemd-analyze \
+ shell-completion/zsh/_systemd-run \
shell-completion/zsh/_sd_hosts_or_user_at_host \
shell-completion/zsh/_systemd-delta \
shell-completion/zsh/_systemd
diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run
new file mode 100644
index 0000000..0c81c54
--- /dev/null
+++ b/shell-completion/zsh/_systemd-run
@@ -0,0 +1,31 @@
+#compdef systemd-run
+
+__systemctl() {
+ local -a _modes
+ _modes=("--user" "--system")
+ systemctl ${words:*_modes} --full --no-legend --no-pager "$@" 2>/dev/null
+}
+
+__get_slices () {
+ __systemctl list-units --all -t slice \
+ | { while read -r a b; do echo $a; done; };
+}
+
+__slices () {
+ local -a _slices
+ _slices=(${(fo)"$(__get_slices)"})
+ typeset -U _slices
+ _describe 'slices' _slices
+}
+
+_arguments \
+ {-h,--help}'[Show help message]' \
+ '--version[Show package version]' \
+ '--user[Run as user unit]' \
+ '--scope[Run this as scope rather than service]' \
+ '--unit=[Run under the specified unit name]:unit name' \
+ '--description=[Description for unit]:description' \
+ '--slice=[Run in the specified slice]:slices:__slices' \
+ {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \
+ '--send-sighup[Send SIGHUP when terminating]' \
+ '*::command:_command'

View File

@ -0,0 +1,33 @@
From 04547df8f2b71ec3fb4e18e9363da583264a3915 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Thu, 31 Oct 2013 14:36:41 +0100
Subject: [PATCH] man: explain NAME in systemctl man page
---
man/systemctl.xml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/man/systemctl.xml b/man/systemctl.xml
index e789d4b..166282c 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -63,6 +63,19 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
introspect and control the state of the
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
system and service manager.</para>
+
+ <para>For Unit Commands the <replaceable>NAME</replaceable> represents full name of unit.
+ <programlisting>
+systemctl start foo.service
+ </programlisting>
+ For Unit File Commands the <replaceable>NAME</replaceable> represents full name of the unit file, or absolute path to the unit file.
+ <programlisting>
+systemctl start /path/to/foo.service
+ </programlisting>
+ While working with services/service files, <command>systemctl</command> is able to append .service suffix when it is missing.
+ <programlisting>
+systemctl start foo
+ </programlisting></para>
</refsect1>
<refsect1>

View File

@ -0,0 +1,298 @@
From 48a66a7f6a23ee71bcf54da5bd0bbd69a0710582 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 31 Oct 2013 16:23:06 +0100
Subject: [PATCH] virt: move caching of virtualization check results into
detect_vm() and detect_container()
After all, we ended up calling detect_container() more often than
detect_virtualization(), hence the former one should cache the results,
since the latter is only a wrapper around the former.
---
src/detect-virt/detect-virt.c | 2 +-
src/shared/virt.c | 180 ++++++++++++++++++++----------------------
2 files changed, 87 insertions(+), 95 deletions(-)
diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c
index bd3ee45..72ff2a8 100644
--- a/src/detect-virt/detect-virt.c
+++ b/src/detect-virt/detect-virt.c
@@ -114,8 +114,8 @@ static int parse_argv(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
const char *id = NULL;
- int r;
int retval = EXIT_SUCCESS;
+ int r;
/* This is mostly intended to be used for scripts which want
* to detect whether we are being run in a virtualized
diff --git a/src/shared/virt.c b/src/shared/virt.c
index 4f8134a..537ccda 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -60,6 +60,9 @@ int detect_vm(const char **id) {
/* http://msdn.microsoft.com/en-us/library/ff542428.aspx */
"Microsoft Hv\0" "microsoft\0";
+ static __thread int cached_found = -1;
+ static __thread const char *cached_id = NULL;
+
uint32_t eax, ecx;
union {
uint32_t sig32[3];
@@ -69,6 +72,15 @@ int detect_vm(const char **id) {
const char *j, *k;
bool hypervisor;
_cleanup_free_ char *hvtype = NULL;
+ const char *_id = NULL;
+
+ if (_likely_(cached_found >= 0)) {
+
+ if (id)
+ *id = cached_id;
+
+ return cached_found;
+ }
/* Try high-level hypervisor sysfs file first:
*
@@ -76,10 +88,9 @@ int detect_vm(const char **id) {
r = read_one_line_file("/sys/hypervisor/type", &hvtype);
if (r >= 0) {
if (streq(hvtype, "xen")) {
- if (id)
- *id = "xen";
-
- return 1;
+ _id = "xen";
+ r = 1;
+ goto finish;
}
} else if (r != -ENOENT)
return r;
@@ -125,17 +136,14 @@ int detect_vm(const char **id) {
NULSTR_FOREACH_PAIR(j, k, cpuid_vendor_table)
if (streq(sig.text, j)) {
-
- if (id)
- *id = k;
-
- return 1;
+ _id = k;
+ r = 1;
+ goto finish;
}
}
for (i = 0; i < ELEMENTSOF(dmi_vendors); i++) {
_cleanup_free_ char *s = NULL;
- const char *found = NULL;
r = read_one_line_file(dmi_vendors[i], &s);
if (r < 0) {
@@ -146,22 +154,17 @@ int detect_vm(const char **id) {
}
NULSTR_FOREACH_PAIR(j, k, dmi_vendor_table)
- if (startswith(s, j))
- found = k;
-
- if (found) {
- if (id)
- *id = found;
-
- return 1;
- }
+ if (startswith(s, j)) {
+ _id = k;
+ r = 1;
+ goto finish;
+ }
}
if (hypervisor || hvtype) {
- if (id)
- *id = "other";
-
- return 1;
+ _id = "other";
+ r = 1;
+ goto finish;
}
#endif
@@ -171,17 +174,40 @@ int detect_vm(const char **id) {
if (r < 0)
return r;
if (strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n")) {
- *id = "uml";
- return 1;
+ _id = "uml";
+ r = 1;
+ goto finish;
}
- return 0;
+ r = 0;
+
+finish:
+ cached_found = r;
+
+ cached_id = _id;
+ if (id)
+ *id = _id;
+
+ return r;
}
int detect_container(const char **id) {
+
+ static __thread int cached_found = -1;
+ static __thread const char *cached_id = NULL;
+
_cleanup_free_ char *e = NULL;
+ const char *_id = NULL;
int r;
+ if (_likely_(cached_found >= 0)) {
+
+ if (id)
+ *id = cached_id;
+
+ return cached_found;
+ }
+
/* Unfortunately many of these operations require root access
* in one way or another */
@@ -189,95 +215,61 @@ int detect_container(const char **id) {
if (r < 0)
return r;
if (r > 0) {
-
- if (id)
- *id = "chroot";
-
- return 1;
+ _id = "chroot";
+ goto finish;
}
/* /proc/vz exists in container and outside of the container,
* /proc/bc only outside of the container. */
if (access("/proc/vz", F_OK) >= 0 &&
access("/proc/bc", F_OK) < 0) {
-
- if (id)
- *id = "openvz";
-
- return 1;
+ _id = "openvz";
+ r = 1;
+ goto finish;
}
r = getenv_for_pid(1, "container", &e);
- if (r <= 0)
+ if (r < 0)
return r;
+ if (r == 0)
+ goto finish;
/* We only recognize a selected few here, since we want to
* enforce a redacted namespace */
- if (streq(e, "lxc")) {
- if (id)
- *id = "lxc";
- } else if (streq(e, "lxc-libvirt")) {
- if (id)
- *id = "lxc-libvirt";
- } else if (streq(e, "systemd-nspawn")) {
- if (id)
- *id = "systemd-nspawn";
- } else {
- if (id)
- *id = "other";
- }
+ if (streq(e, "lxc"))
+ _id ="lxc";
+ else if (streq(e, "lxc-libvirt"))
+ _id = "lxc-libvirt";
+ else if (streq(e, "systemd-nspawn"))
+ _id = "systemd-nspawn";
+ else
+ _id = "other";
+
+finish:
+ cached_found = r;
+
+ cached_id = _id;
+ if (id)
+ *id = _id;
return r;
}
/* Returns a short identifier for the various VM/container implementations */
Virtualization detect_virtualization(const char **id) {
-
- static __thread Virtualization cached_virt = _VIRTUALIZATION_INVALID;
- static __thread const char *cached_id = NULL;
-
- const char *_id;
int r;
- Virtualization v;
-
- if (_likely_(cached_virt >= 0)) {
-
- if (id && cached_virt > 0)
- *id = cached_id;
- return cached_virt;
- }
-
- r = detect_container(&_id);
- if (r < 0) {
- v = r;
- goto finish;
- } else if (r > 0) {
- v = VIRTUALIZATION_CONTAINER;
- goto finish;
- }
-
- r = detect_vm(&_id);
- if (r < 0) {
- v = r;
- goto finish;
- } else if (r > 0) {
- v = VIRTUALIZATION_VM;
- goto finish;
- }
-
- v = VIRTUALIZATION_NONE;
-
-finish:
- if (v > 0) {
- cached_id = _id;
-
- if (id)
- *id = _id;
- }
+ r = detect_container(id);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ return VIRTUALIZATION_CONTAINER;
- if (v >= 0)
- cached_virt = v;
+ r = detect_vm(id);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ return VIRTUALIZATION_VM;
- return v;
+ return VIRTUALIZATION_NONE;
}

View File

@ -0,0 +1,22 @@
From 93a311b380a9c7367efe46fbc1d45902a9abcff5 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Fri, 1 Nov 2013 20:46:49 +0100
Subject: [PATCH] systemctl: fix typo in help text
---
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 036828b..36040db 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4743,7 +4743,7 @@ static int systemctl_help(void) {
" -f --force When enabling unit files, override existing symlinks\n"
" When shutting down, execute action immediately\n"
" --root=PATH Enable unit files in the specified root directory\n"
- " -n --lines=INTEGER Numer of journal entries to show\n"
+ " -n --lines=INTEGER Number of journal entries to show\n"
" -o --output=STRING Change journal output mode (short, short-monotonic,\n"
" verbose, export, json, json-pretty, json-sse, cat)\n\n"
"Unit Commands:\n"

View File

@ -0,0 +1,91 @@
From 319b9f00eb3d84744453ae70bf9c89c37131124b Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Fri, 1 Nov 2013 22:57:47 +0100
Subject: [PATCH] analyze: plot: place the text on the side with most space
Set the width of the svg to always fit the longest string
while taking its starting position into consideration.
Place the text on the right while the starting point is
in the first half of the screen. After that we put it on
the left to save the svg from being wider that it has to.
---
src/analyze/systemd-analyze.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 9a69795..f4c7f68 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -462,7 +462,7 @@ static int analyze_plot(DBusConnection *bus) {
m++;
for (u = times; u < times + n; u++) {
- double len;
+ double text_start, text_width;
if (u->ixt < boot->userspace_time ||
u->ixt > boot->finish_time) {
@@ -470,10 +470,14 @@ static int analyze_plot(DBusConnection *bus) {
u->name = NULL;
continue;
}
- len = ((boot->firmware_time + u->ixt) * SCALE_X)
- + (10.0 * strlen(u->name));
- if (len > width)
- width = len;
+
+ /* If the text cannot fit on the left side then
+ * increase the svg width so it fits on the right.
+ * TODO: calculate the text width more accurately */
+ text_width = 8.0 * strlen(u->name);
+ text_start = (boot->firmware_time + u->ixt) * SCALE_X;
+ if (text_width > text_start && text_width + text_start > width)
+ width = text_width + text_start;
if (u->iet > u->ixt && u->iet <= boot->finish_time
&& u->aet == 0 && u->axt == 0)
@@ -561,7 +565,7 @@ static int analyze_plot(DBusConnection *bus) {
svg_bar("active", boot->userspace_time, boot->finish_time, y);
svg_bar("generators", boot->generators_start_time, boot->generators_finish_time, y);
svg_bar("unitsload", boot->unitsload_start_time, boot->unitsload_finish_time, y);
- svg_text("left", boot->userspace_time, y, "systemd");
+ svg_text(true, boot->userspace_time, y, "systemd");
y++;
for (u = times; u < times + n; u++) {
@@ -575,7 +579,8 @@ static int analyze_plot(DBusConnection *bus) {
svg_bar("active", u->aet, u->axt, y);
svg_bar("deactivating", u->axt, u->iet, y);
- b = u->ixt * SCALE_X > width * 2 / 3;
+ /* place the text on the left if we have passed the half of the svg width */
+ b = u->ixt * SCALE_X < width / 2;
if (u->time)
svg_text(b, u->ixt, y, "%s (%s)",
u->name, format_timespan(ts, sizeof(ts), u->time, USEC_PER_MSEC));
@@ -587,19 +592,19 @@ static int analyze_plot(DBusConnection *bus) {
/* Legend */
y++;
svg_bar("activating", 0, 300000, y);
- svg_text("right", 400000, y, "Activating");
+ svg_text(true, 400000, y, "Activating");
y++;
svg_bar("active", 0, 300000, y);
- svg_text("right", 400000, y, "Active");
+ svg_text(true, 400000, y, "Active");
y++;
svg_bar("deactivating", 0, 300000, y);
- svg_text("right", 400000, y, "Deactivating");
+ svg_text(true, 400000, y, "Deactivating");
y++;
svg_bar("generators", 0, 300000, y);
- svg_text("right", 400000, y, "Generators");
+ svg_text(true, 400000, y, "Generators");
y++;
svg_bar("unitsload", 0, 300000, y);
- svg_text("right", 400000, y, "Loading unit files");
+ svg_text(true, 400000, y, "Loading unit files");
y++;
svg("</g>\n\n");

View File

@ -0,0 +1,32 @@
From 855359a615a6002ac601a778f12e60970f18c64f Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Sat, 2 Nov 2013 00:01:32 +0100
Subject: [PATCH] detect_virtualization() returns NULL; pass empty string to
dbus
---
src/core/dbus-manager.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 8f4d017..536f2ea 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -466,7 +466,7 @@ static int bus_manager_append_progress(DBusMessageIter *i, const char *property,
static int bus_manager_append_virt(DBusMessageIter *i, const char *property, void *data) {
Manager *m = data;
- const char *id = "";
+ const char *id = NULL;
assert(i);
assert(property);
@@ -474,6 +474,8 @@ static int bus_manager_append_virt(DBusMessageIter *i, const char *property, voi
detect_virtualization(&id);
+ if (!id)
+ id = "";
if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &id))
return -ENOMEM;

View File

@ -0,0 +1,44 @@
From 0af3aeb44697533df2bc79d0985b65bca6b8cd86 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Sun, 3 Nov 2013 13:01:20 +0100
Subject: [PATCH] rules: load path_id on DRM devices
The path_id-builtin provides useful unique aliases for DRM devices. If we
want to configure DRM render-nodes for compositors, we want to avoid
storing the whole sys-path in configuration files. Hence, allow users to
store the short PATH_ID instead.
Load path_id-builtin unconditionally on DRM devices now to always provide
this alias.
---
Makefile.am | 1 +
rules/60-drm.rules | 8 ++++++++
2 files changed, 9 insertions(+)
create mode 100644 rules/60-drm.rules
diff --git a/Makefile.am b/Makefile.am
index 7ab345a..34de7f2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2209,6 +2209,7 @@ dist_udevrules_DATA += \
rules/99-systemd.rules \
rules/42-usb-hid-pm.rules \
rules/50-udev-default.rules \
+ rules/60-drm.rules \
rules/60-keyboard.rules \
rules/60-persistent-storage-tape.rules \
rules/60-persistent-serial.rules \
diff --git a/rules/60-drm.rules b/rules/60-drm.rules
new file mode 100644
index 0000000..de038c1
--- /dev/null
+++ b/rules/60-drm.rules
@@ -0,0 +1,8 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION=="remove", GOTO="drm_end"
+SUBSYSTEM!="drm", GOTO="drm_end"
+
+SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id"
+
+LABEL="drm_end"

View File

@ -0,0 +1,24 @@
From 5700379e437756e1e7a2508b238c8220367292bc Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Sun, 3 Nov 2013 16:17:14 +0100
Subject: [PATCH] rules: simply 60-drm.rules
We don't need any GOTO, if we merge all matches into a single line.
---
rules/60-drm.rules | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/rules/60-drm.rules b/rules/60-drm.rules
index de038c1..1ed3e44 100644
--- a/rules/60-drm.rules
+++ b/rules/60-drm.rules
@@ -1,8 +1,3 @@
# do not edit this file, it will be overwritten on update
-ACTION=="remove", GOTO="drm_end"
-SUBSYSTEM!="drm", GOTO="drm_end"
-
-SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id"
-
-LABEL="drm_end"
+ACTION!="remove", SUBSYSTEM=="drm", SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id"

View File

@ -0,0 +1,31 @@
From 4f0d2ef232fe578576a2bec5076fda19de15ff27 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinpitt@gnome.org>
Date: Mon, 4 Nov 2013 07:25:45 +0100
Subject: [PATCH] udev-builtin-keyboard: Fix large scan codes on 32 bit
architectures
Use strtoul(), as scan codes are always positive. On 32 bit architectures
strtol gives wrong results:
strtol("fffffff0", &endptr, 16)
returns 2147483647 instead of 4294967280.
https://launchpad.net/bugs/1247676
---
src/udev/udev-builtin-keyboard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
index ddd8535..8f457ab 100644
--- a/src/udev/udev-builtin-keyboard.c
+++ b/src/udev/udev-builtin-keyboard.c
@@ -88,7 +88,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
continue;
/* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
- scancode = strtol(key + 13, &endptr, 16);
+ scancode = strtoul(key + 13, &endptr, 16);
if (endptr[0] != '\0') {
log_error("Error, unable to parse scan code from '%s'\n", key);
continue;

View File

@ -0,0 +1,37 @@
From 30304d0fd69e703992c62ab3bcabcc6239f5fe1c Mon Sep 17 00:00:00 2001
From: Djalal Harouni <tixxdz@opendz.org>
Date: Tue, 5 Nov 2013 15:26:37 +0100
Subject: [PATCH] nspawn: log out of memory errors
---
src/nspawn/nspawn.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 9616dbf..db47fbd 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -224,6 +224,9 @@ static int parse_argv(int argc, char *argv[]) {
case 'S':
arg_slice = strdup(optarg);
+ if (!arg_slice)
+ return log_oom();
+
break;
case 'M':
@@ -315,11 +318,11 @@ static int parse_argv(int argc, char *argv[]) {
r = strv_extend(x, a);
if (r < 0)
- return r;
+ return log_oom();
r = strv_extend(x, b);
if (r < 0)
- return r;
+ return log_oom();
break;
}

View File

@ -0,0 +1,293 @@
From f9d232e896bec3301a20a33a38a87b102f0172bc Mon Sep 17 00:00:00 2001
From: Oleksii Shevchuk <alxchk@gmail.com>
Date: Mon, 4 Nov 2013 18:47:43 +0200
Subject: [PATCH] Configurable Timeouts/Restarts default values
https://bugs.freedesktop.org/show_bug.cgi?id=71132
Patch adds DefaultTimeoutStartSec, DefaultTimeoutStopSec, DefaultRestartSec
configuration options to manager configuration file.
---
man/systemd-system.conf.xml | 24 +++++++++++++++++++++++-
man/systemd.mount.xml | 4 ++--
man/systemd.service.xml | 6 ++++--
man/systemd.socket.xml | 4 ++--
man/systemd.swap.xml | 4 ++--
src/core/device.c | 2 +-
src/core/main.c | 9 +++++++++
src/core/manager.h | 3 +++
src/core/mount.c | 2 +-
src/core/scope.c | 2 +-
src/core/service.c | 6 +++---
src/core/socket.c | 2 +-
src/core/swap.c | 2 +-
src/core/system.conf | 3 +++
src/core/user.conf | 3 +++
15 files changed, 59 insertions(+), 17 deletions(-)
diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml
index e8cf8a9..c1f2648 100644
--- a/man/systemd-system.conf.xml
+++ b/man/systemd-system.conf.xml
@@ -61,7 +61,6 @@
otherwise <filename>user.conf</filename>. These
configuration files contain a few settings controlling
basic manager operations.</para>
-
</refsect1>
<refsect1>
@@ -95,6 +94,29 @@
</varlistentry>
<varlistentry>
+ <term><varname>DefaultTimeoutStartSec=</varname></term>
+ <term><varname>DefaultTimeoutStopSec=</varname></term>
+ <term><varname>DefaultRestartSec=</varname></term>
+
+ <listitem><para>Configures the default
+ time-outs for starting and stopping of
+ units, as well as the default time to
+ sleep between automatic restarts of a
+ units, as configured per-unit in
+ <varname>TimeoutStartSec=</varname>,
+ <varname>TimeoutStopSec=</varname> and
+ <varname>RestartSec=</varname> (for
+ service units see
+ <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details on the per-unit
+ settings). For non-service units
+ <varname>DefaultTimeoutStartSec=</varname>
+ sets the default
+ <varname>TimeoutSec=</varname> value.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><varname>CPUAffinity=</varname></term>
<listitem><para>Configures the initial
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 48af1ca..71a5736 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -260,8 +260,8 @@
Takes a unit-less value in seconds, or
a time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to
- 90s.</para></listitem>
+ logic. Default value is setted up in manager configuration
+ file via <term><varname>DefaultTimeoutStart=</varname></term>.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 5e1ddf7..df04048 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -524,7 +524,8 @@
Takes a unit-less value in seconds, or a
time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to 90s, except when
+ logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ manager configuration file, except when
<varname>Type=oneshot</varname> is
used in which case the timeout
is disabled by default.
@@ -545,7 +546,8 @@
Takes a unit-less value in seconds, or a
time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to 90s.
+ logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ manager configuration file.
</para></listitem>
</varlistentry>
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 8c88d9f..1c78562 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -679,8 +679,8 @@
Takes a unit-less value in seconds, or
a time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to
- 90s.</para></listitem>
+ logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ manager configuration file.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml
index 813ae6c..13f6c84 100644
--- a/man/systemd.swap.xml
+++ b/man/systemd.swap.xml
@@ -186,8 +186,8 @@
Takes a unit-less value in seconds, or
a time span value such as "5min
20s". Pass 0 to disable the timeout
- logic. Defaults to
- 90s.</para></listitem>
+ logic. Defaults to <varname>TimeoutStartSec=</varname> in
+ manager configuration file.</para></listitem>
</varlistentry>
</variablelist>
diff --git a/src/core/device.c b/src/core/device.c
index 9fca82a..5397bd6 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -70,7 +70,7 @@ static void device_init(Unit *u) {
* indefinitely for plugged in devices, something which cannot
* happen for the other units since their operations time out
* anyway. */
- UNIT(d)->job_timeout = DEFAULT_TIMEOUT_USEC;
+ UNIT(d)->job_timeout = u->manager->default_timeout_start_usec;
UNIT(d)->ignore_on_isolate = true;
UNIT(d)->ignore_on_snapshot = true;
diff --git a/src/core/main.c b/src/core/main.c
index fe291f8..937994c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -90,6 +90,9 @@ static bool arg_switched_root = false;
static char ***arg_join_controllers = NULL;
static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
+static usec_t arg_default_restart_usec = DEFAULT_RESTART_USEC;
+static usec_t arg_default_timeout_start_usec = DEFAULT_TIMEOUT_USEC;
+static usec_t arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
static usec_t arg_runtime_watchdog = 0;
static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
static char **arg_default_environment = NULL;
@@ -636,6 +639,9 @@ static int parse_config_file(void) {
{ "Manager", "CPUAffinity", config_parse_cpu_affinity2, 0, NULL },
{ "Manager", "DefaultStandardOutput", config_parse_output, 0, &arg_default_std_output },
{ "Manager", "DefaultStandardError", config_parse_output, 0, &arg_default_std_error },
+ { "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec },
+ { "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec },
+ { "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec },
{ "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers },
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
@@ -1542,6 +1548,9 @@ int main(int argc, char *argv[]) {
m->confirm_spawn = arg_confirm_spawn;
m->default_std_output = arg_default_std_output;
m->default_std_error = arg_default_std_error;
+ m->default_restart_usec = arg_default_restart_usec;
+ m->default_timeout_start_usec = arg_default_timeout_start_usec;
+ m->default_timeout_stop_usec = arg_default_timeout_stop_usec;
m->runtime_watchdog = arg_runtime_watchdog;
m->shutdown_watchdog = arg_shutdown_watchdog;
m->userspace_timestamp = userspace_timestamp;
diff --git a/src/core/manager.h b/src/core/manager.h
index a3049b5..e74c609 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -230,6 +230,9 @@ struct Manager {
ExecOutput default_std_output, default_std_error;
+ usec_t default_restart_usec, default_timeout_start_usec,
+ default_timeout_stop_usec;
+
struct rlimit *rlimit[RLIMIT_NLIMITS];
/* non-zero if we are reloading or reexecuting, */
diff --git a/src/core/mount.c b/src/core/mount.c
index 70cd372..c0445a6 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -131,7 +131,7 @@ static void mount_init(Unit *u) {
assert(u);
assert(u->load_state == UNIT_STUB);
- m->timeout_usec = DEFAULT_TIMEOUT_USEC;
+ m->timeout_usec = u->manager->default_timeout_start_usec;
m->directory_mode = 0755;
exec_context_init(&m->exec_context);
diff --git a/src/core/scope.c b/src/core/scope.c
index 50e5dba..41da3b9 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -46,7 +46,7 @@ static void scope_init(Unit *u) {
assert(u);
assert(u->load_state == UNIT_STUB);
- s->timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
+ s->timeout_stop_usec = u->manager->default_timeout_stop_usec;
watch_init(&s->timer_watch);
diff --git a/src/core/service.c b/src/core/service.c
index 96ed2d3..e81aa1f 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -124,9 +124,9 @@ static void service_init(Unit *u) {
assert(u);
assert(u->load_state == UNIT_STUB);
- s->timeout_start_usec = DEFAULT_TIMEOUT_USEC;
- s->timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
- s->restart_usec = DEFAULT_RESTART_USEC;
+ s->timeout_start_usec = u->manager->default_timeout_start_usec;
+ s->timeout_stop_usec = u->manager->default_timeout_stop_usec;
+ s->restart_usec = u->manager->default_restart_usec;
s->type = _SERVICE_TYPE_INVALID;
watch_init(&s->watchdog_watch);
diff --git a/src/core/socket.c b/src/core/socket.c
index 6c0ac1a..d368f7e 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -73,7 +73,7 @@ static void socket_init(Unit *u) {
assert(u->load_state == UNIT_STUB);
s->backlog = SOMAXCONN;
- s->timeout_usec = DEFAULT_TIMEOUT_USEC;
+ s->timeout_usec = u->manager->default_timeout_start_usec;
s->directory_mode = 0755;
s->socket_mode = 0666;
diff --git a/src/core/swap.c b/src/core/swap.c
index a68ab7c..147f710 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -86,7 +86,7 @@ static void swap_init(Unit *u) {
assert(s);
assert(UNIT(s)->load_state == UNIT_STUB);
- s->timeout_usec = DEFAULT_TIMEOUT_USEC;
+ s->timeout_usec = u->manager->default_timeout_start_usec;
exec_context_init(&s->exec_context);
s->exec_context.std_output = u->manager->default_std_output;
diff --git a/src/core/system.conf b/src/core/system.conf
index 7b03c87..3c6cc03 100644
--- a/src/core/system.conf
+++ b/src/core/system.conf
@@ -24,6 +24,9 @@
#ShutdownWatchdogSec=10min
#CapabilityBoundingSet=
#TimerSlackNSec=
+#DefaultTimeoutStartSec=90s
+#DefaultTimeoutStopSec=90s
+#DefaultRestartSec=100ms
#DefaultEnvironment=
#DefaultLimitCPU=
#DefaultLimitFSIZE=
diff --git a/src/core/user.conf b/src/core/user.conf
index 4a0129a..b030701 100644
--- a/src/core/user.conf
+++ b/src/core/user.conf
@@ -14,3 +14,6 @@
#LogLocation=no
#DefaultStandardOutput=inherit
#DefaultStandardError=inherit
+#DefaultTimeoutStartSec=90s
+#DefaultTimeoutStopSec=90s
+#DefaultRestartSec=100ms

22
0070-man-fix-typo.patch Normal file
View File

@ -0,0 +1,22 @@
From 6f0949daa0b7f4928a7abb8e26ded604988f8efc Mon Sep 17 00:00:00 2001
From: Ronny Chevalier <chevalier.ronny@gmail.com>
Date: Sun, 3 Nov 2013 15:07:31 +0100
Subject: [PATCH] man: fix typo
---
man/systemd-run.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/systemd-run.xml b/man/systemd-run.xml
index e76a402..252335b 100644
--- a/man/systemd-run.xml
+++ b/man/systemd-run.xml
@@ -60,7 +60,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<refsect1>
<title>Description</title>
- <para><command>systemd-run</command> may be used create and start
+ <para><command>systemd-run</command> may be used to create and start
a transient <filename>.service</filename> or a
<filename>.scope</filename> unit and run the specified
<replaceable>COMMAND</replaceable> in it.</para>

View File

@ -0,0 +1,23 @@
From 6547d848002537063bf0d5457e56ebd15ed947b0 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Tue, 5 Nov 2013 21:34:50 +0100
Subject: [PATCH] man: do not use <term> in <para>
Element term in namespace '' encountered in para, but no template matches.
---
man/systemd.mount.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 71a5736..df5a79e 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -261,7 +261,7 @@
a time span value such as "5min
20s". Pass 0 to disable the timeout
logic. Default value is setted up in manager configuration
- file via <term><varname>DefaultTimeoutStart=</varname></term>.</para></listitem>
+ file via <varname>DefaultTimeoutStart=</varname>.</para></listitem>
</varlistentry>
</variablelist>

View File

@ -0,0 +1,61 @@
From 298f884a265c1c4b30cce7467650cc4a165a284e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 5 Nov 2013 22:14:52 +0100
Subject: [PATCH] cgroup: run PID 1 in the root cgroup
This way cleaning up the cgroup tree on shutdown is a lot easier since
we are in the root dir. Also PID 1 was previously artificially placed in
system.slice, even though our rule actually was not to have processes in
slices. The root slice otoh is magic anyway, so having PID 1 in there
sounds less surprising.
Of course, this means that PID is scheduled against the three top-level
slices.
---
src/core/cgroup.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 8bf4d89..42c0b3f 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -589,8 +589,8 @@ pid_t unit_search_main_pid(Unit *u) {
int manager_setup_cgroup(Manager *m) {
_cleanup_free_ char *path = NULL;
+ char *e;
int r;
- char *e, *a;
assert(m);
@@ -610,9 +610,13 @@ int manager_setup_cgroup(Manager *m) {
return r;
}
- /* Already in /system.slice? If so, let's cut this off again */
+ /* LEGACY: Already in /system.slice? If so, let's cut this
+ * off. This is to support live upgrades from older systemd
+ * versions where PID 1 was moved there. */
if (m->running_as == SYSTEMD_SYSTEM) {
e = endswith(m->cgroup_root, "/" SPECIAL_SYSTEM_SLICE);
+ if (!e)
+ e = endswith(m->cgroup_root, "/system");
if (e)
*e = 0;
}
@@ -643,12 +647,8 @@ int manager_setup_cgroup(Manager *m) {
log_debug("Release agent already installed.");
}
- /* 4. Realize the system slice and put us in there */
- if (m->running_as == SYSTEMD_SYSTEM) {
- a = strappenda(m->cgroup_root, "/" SPECIAL_SYSTEM_SLICE);
- r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, a, 0);
- } else
- r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0);
+ /* 4. Make sure we are in the root cgroup */
+ r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0);
if (r < 0) {
log_error("Failed to create root cgroup hierarchy: %s", strerror(-r));
return r;

View File

@ -0,0 +1,65 @@
From db296e9f3e78b9694464dbde956d04f6621125ed Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 5 Nov 2013 22:17:03 +0100
Subject: [PATCH] shutdown: trim the cgroup tree on loop iteration
This way we leave the cgroup empty before exiting in a container which
makes sure the container manager will get cgroup notification event
https://bugs.freedesktop.org/show_bug.cgi?id=68370
https://bugzilla.redhat.com/show_bug.cgi?id=988883
---
src/core/shutdown.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 4709746..ea02b60 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -46,6 +46,7 @@
#include "virt.h"
#include "watchdog.h"
#include "killall.h"
+#include "cgroup-util.h"
#define FINALIZE_ATTEMPTS 50
@@ -131,12 +132,12 @@ static int pivot_to_new_root(void) {
}
int main(int argc, char *argv[]) {
- _cleanup_free_ char *line = NULL;
- int cmd, r;
- unsigned retries;
bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true;
bool in_container, use_watchdog = false;
+ _cleanup_free_ char *line = NULL, *cgroup = NULL;
char *arguments[3];
+ unsigned retries;
+ int cmd, r;
/* suppress shutdown status output if 'quiet' is used */
r = read_one_line_file("/proc/cmdline", &line);
@@ -186,6 +187,8 @@ int main(int argc, char *argv[]) {
goto error;
}
+ cg_get_root_path(&cgroup);
+
use_watchdog = !!getenv("WATCHDOG_USEC");
/* lock us into memory */
@@ -210,6 +213,13 @@ int main(int argc, char *argv[]) {
if (use_watchdog)
watchdog_ping();
+ /* Let's trim the cgroup tree on each iteration so
+ that we leave an empty cgroup tree around, so that
+ container managers get a nice notify event when we
+ are down */
+ if (cgroup)
+ cg_trim(SYSTEMD_CGROUP_CONTROLLER, cgroup, false);
+
if (need_umount) {
log_info("Unmounting file systems.");
r = umount_all(&changed);

View File

@ -0,0 +1,593 @@
From f1b1f3bab4764964d12a62aba1cdbd71ec6415ae Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 30 Oct 2013 18:58:59 +0100
Subject: [PATCH] nspawn: split out pty forwaring logic into ptyfwd.c
Conflicts:
Makefile.am
src/nspawn/nspawn.c
---
Makefile.am | 4 +-
src/nspawn/nspawn.c | 245 +-------------------------------------------------
src/shared/ptyfwd.c | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++
src/shared/ptyfwd.h | 27 ++++++
4 files changed, 284 insertions(+), 244 deletions(-)
create mode 100644 src/shared/ptyfwd.c
create mode 100644 src/shared/ptyfwd.h
diff --git a/Makefile.am b/Makefile.am
index 34de7f2..b4fc33b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -724,7 +724,9 @@ libsystemd_shared_la_SOURCES = \
src/shared/boot-timestamps.c \
src/shared/refcnt.h \
src/shared/mkdir.c \
- src/shared/mkdir.h
+ src/shared/mkdir.h \
+ src/shared/ptyfwd.c \
+ src/shared/ptyfwd.h
#-------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index db47fbd..cda6c82 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -63,6 +63,7 @@
#include "fileio.h"
#include "bus-internal.h"
#include "bus-message.h"
+#include "ptyfwd.h"
#ifndef TTY_GID
#define TTY_GID 5
@@ -937,248 +938,6 @@ static int drop_capabilities(void) {
return capability_bounding_set_drop(~arg_retain, false);
}
-static int process_pty(int master, pid_t pid, sigset_t *mask) {
-
- char in_buffer[LINE_MAX], out_buffer[LINE_MAX];
- size_t in_buffer_full = 0, out_buffer_full = 0;
- struct epoll_event stdin_ev, stdout_ev, master_ev, signal_ev;
- bool stdin_readable = false, stdout_writable = false, master_readable = false, master_writable = false;
- int ep = -1, signal_fd = -1, r;
- bool tried_orderly_shutdown = false;
-
- assert(master >= 0);
- assert(pid > 0);
- assert(mask);
-
- fd_nonblock(STDIN_FILENO, 1);
- fd_nonblock(STDOUT_FILENO, 1);
- fd_nonblock(master, 1);
-
- signal_fd = signalfd(-1, mask, SFD_NONBLOCK|SFD_CLOEXEC);
- if (signal_fd < 0) {
- log_error("signalfd(): %m");
- r = -errno;
- goto finish;
- }
-
- ep = epoll_create1(EPOLL_CLOEXEC);
- if (ep < 0) {
- log_error("Failed to create epoll: %m");
- r = -errno;
- goto finish;
- }
-
- /* We read from STDIN only if this is actually a TTY,
- * otherwise we assume non-interactivity. */
- if (isatty(STDIN_FILENO)) {
- zero(stdin_ev);
- stdin_ev.events = EPOLLIN|EPOLLET;
- stdin_ev.data.fd = STDIN_FILENO;
-
- if (epoll_ctl(ep, EPOLL_CTL_ADD, STDIN_FILENO, &stdin_ev) < 0) {
- log_error("Failed to register STDIN in epoll: %m");
- r = -errno;
- goto finish;
- }
- }
-
- zero(stdout_ev);
- stdout_ev.events = EPOLLOUT|EPOLLET;
- stdout_ev.data.fd = STDOUT_FILENO;
-
- zero(master_ev);
- master_ev.events = EPOLLIN|EPOLLOUT|EPOLLET;
- master_ev.data.fd = master;
-
- zero(signal_ev);
- signal_ev.events = EPOLLIN;
- signal_ev.data.fd = signal_fd;
-
- if (epoll_ctl(ep, EPOLL_CTL_ADD, STDOUT_FILENO, &stdout_ev) < 0) {
- if (errno != EPERM) {
- log_error("Failed to register stdout in epoll: %m");
- r = -errno;
- goto finish;
- }
- /* stdout without epoll support. Likely redirected to regular file. */
- stdout_writable = true;
- }
-
- if (epoll_ctl(ep, EPOLL_CTL_ADD, master, &master_ev) < 0 ||
- epoll_ctl(ep, EPOLL_CTL_ADD, signal_fd, &signal_ev) < 0) {
- log_error("Failed to register fds in epoll: %m");
- r = -errno;
- goto finish;
- }
-
- for (;;) {
- struct epoll_event ev[16];
- ssize_t k;
- int i, nfds;
-
- nfds = epoll_wait(ep, ev, ELEMENTSOF(ev), -1);
- if (nfds < 0) {
-
- if (errno == EINTR || errno == EAGAIN)
- continue;
-
- log_error("epoll_wait(): %m");
- r = -errno;
- goto finish;
- }
-
- assert(nfds >= 1);
-
- for (i = 0; i < nfds; i++) {
- if (ev[i].data.fd == STDIN_FILENO) {
-
- if (ev[i].events & (EPOLLIN|EPOLLHUP))
- stdin_readable = true;
-
- } else if (ev[i].data.fd == STDOUT_FILENO) {
-
- if (ev[i].events & (EPOLLOUT|EPOLLHUP))
- stdout_writable = true;
-
- } else if (ev[i].data.fd == master) {
-
- if (ev[i].events & (EPOLLIN|EPOLLHUP))
- master_readable = true;
-
- if (ev[i].events & (EPOLLOUT|EPOLLHUP))
- master_writable = true;
-
- } else if (ev[i].data.fd == signal_fd) {
- struct signalfd_siginfo sfsi;
- ssize_t n;
-
- n = read(signal_fd, &sfsi, sizeof(sfsi));
- if (n != sizeof(sfsi)) {
-
- if (n >= 0) {
- log_error("Failed to read from signalfd: invalid block size");
- r = -EIO;
- goto finish;
- }
-
- if (errno != EINTR && errno != EAGAIN) {
- log_error("Failed to read from signalfd: %m");
- r = -errno;
- goto finish;
- }
- } else {
-
- if (sfsi.ssi_signo == SIGWINCH) {
- struct winsize ws;
-
- /* The window size changed, let's forward that. */
- if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) >= 0)
- ioctl(master, TIOCSWINSZ, &ws);
- } else if (sfsi.ssi_signo == SIGTERM && arg_boot && !tried_orderly_shutdown) {
-
- log_info("Trying to halt container. Send SIGTERM again to trigger immediate termination.");
-
- /* This only works for systemd... */
- tried_orderly_shutdown = true;
- kill(pid, SIGRTMIN+3);
-
- } else {
- r = 0;
- goto finish;
- }
- }
- }
- }
-
- while ((stdin_readable && in_buffer_full <= 0) ||
- (master_writable && in_buffer_full > 0) ||
- (master_readable && out_buffer_full <= 0) ||
- (stdout_writable && out_buffer_full > 0)) {
-
- if (stdin_readable && in_buffer_full < LINE_MAX) {
-
- k = read(STDIN_FILENO, in_buffer + in_buffer_full, LINE_MAX - in_buffer_full);
- if (k < 0) {
-
- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
- stdin_readable = false;
- else {
- log_error("read(): %m");
- r = -errno;
- goto finish;
- }
- } else
- in_buffer_full += (size_t) k;
- }
-
- if (master_writable && in_buffer_full > 0) {
-
- k = write(master, in_buffer, in_buffer_full);
- if (k < 0) {
-
- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
- master_writable = false;
- else {
- log_error("write(): %m");
- r = -errno;
- goto finish;
- }
-
- } else {
- assert(in_buffer_full >= (size_t) k);
- memmove(in_buffer, in_buffer + k, in_buffer_full - k);
- in_buffer_full -= k;
- }
- }
-
- if (master_readable && out_buffer_full < LINE_MAX) {
-
- k = read(master, out_buffer + out_buffer_full, LINE_MAX - out_buffer_full);
- if (k < 0) {
-
- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
- master_readable = false;
- else {
- log_error("read(): %m");
- r = -errno;
- goto finish;
- }
- } else
- out_buffer_full += (size_t) k;
- }
-
- if (stdout_writable && out_buffer_full > 0) {
-
- k = write(STDOUT_FILENO, out_buffer, out_buffer_full);
- if (k < 0) {
-
- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
- stdout_writable = false;
- else {
- log_error("write(): %m");
- r = -errno;
- goto finish;
- }
-
- } else {
- assert(out_buffer_full >= (size_t) k);
- memmove(out_buffer, out_buffer + k, out_buffer_full - k);
- out_buffer_full -= k;
- }
- }
- }
- }
-
-finish:
- if (ep >= 0)
- close_nointr_nofail(ep);
-
- if (signal_fd >= 0)
- close_nointr_nofail(signal_fd);
-
- return r;
-}
-
static int register_machine(void) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_unref_ sd_bus *bus = NULL;
@@ -1683,7 +1442,7 @@ int main(int argc, char *argv[]) {
fdset_free(fds);
fds = NULL;
- if (process_pty(master, pid, &mask) < 0)
+ if (process_pty(master, &mask, arg_boot ? pid : 0, SIGRTMIN+3) < 0)
goto finish;
if (saved_attr_valid)
diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c
new file mode 100644
index 0000000..1e2852b
--- /dev/null
+++ b/src/shared/ptyfwd.c
@@ -0,0 +1,252 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010-2013 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 <sys/epoll.h>
+#include <sys/signalfd.h>
+#include <sys/ioctl.h>
+#include <limits.h>
+#include <termios.h>
+
+#include "util.h"
+#include "ptyfwd.h"
+
+int process_pty(int master, sigset_t *mask, pid_t kill_pid, int signo) {
+ char in_buffer[LINE_MAX], out_buffer[LINE_MAX];
+ size_t in_buffer_full = 0, out_buffer_full = 0;
+ struct epoll_event stdin_ev, stdout_ev, master_ev, signal_ev;
+ bool stdin_readable = false, stdout_writable = false, master_readable = false, master_writable = false;
+ bool tried_orderly_shutdown = false;
+ _cleanup_close_ int ep = -1, signal_fd = -1;
+
+ assert(master >= 0);
+ assert(mask);
+ assert(kill_pid == 0 || kill_pid > 1);
+ assert(signo >= 0 && signo < _NSIG);
+
+ fd_nonblock(STDIN_FILENO, 1);
+ fd_nonblock(STDOUT_FILENO, 1);
+ fd_nonblock(master, 1);
+
+ signal_fd = signalfd(-1, mask, SFD_NONBLOCK|SFD_CLOEXEC);
+ if (signal_fd < 0) {
+ log_error("signalfd(): %m");
+ return -errno;
+ }
+
+ ep = epoll_create1(EPOLL_CLOEXEC);
+ if (ep < 0) {
+ log_error("Failed to create epoll: %m");
+ return -errno;
+ }
+
+ /* We read from STDIN only if this is actually a TTY,
+ * otherwise we assume non-interactivity. */
+ if (isatty(STDIN_FILENO)) {
+ zero(stdin_ev);
+ stdin_ev.events = EPOLLIN|EPOLLET;
+ stdin_ev.data.fd = STDIN_FILENO;
+
+ if (epoll_ctl(ep, EPOLL_CTL_ADD, STDIN_FILENO, &stdin_ev) < 0) {
+ log_error("Failed to register STDIN in epoll: %m");
+ return -errno;
+ }
+ }
+
+ zero(stdout_ev);
+ stdout_ev.events = EPOLLOUT|EPOLLET;
+ stdout_ev.data.fd = STDOUT_FILENO;
+
+ zero(master_ev);
+ master_ev.events = EPOLLIN|EPOLLOUT|EPOLLET;
+ master_ev.data.fd = master;
+
+ zero(signal_ev);
+ signal_ev.events = EPOLLIN;
+ signal_ev.data.fd = signal_fd;
+
+ if (epoll_ctl(ep, EPOLL_CTL_ADD, STDOUT_FILENO, &stdout_ev) < 0) {
+ if (errno != EPERM) {
+ log_error("Failed to register stdout in epoll: %m");
+ return -errno;
+ }
+
+ /* stdout without epoll support. Likely redirected to regular file. */
+ stdout_writable = true;
+ }
+
+ if (epoll_ctl(ep, EPOLL_CTL_ADD, master, &master_ev) < 0 ||
+ epoll_ctl(ep, EPOLL_CTL_ADD, signal_fd, &signal_ev) < 0) {
+ log_error("Failed to register fds in epoll: %m");
+ return -errno;
+ }
+
+ for (;;) {
+ struct epoll_event ev[16];
+ ssize_t k;
+ int i, nfds;
+
+ nfds = epoll_wait(ep, ev, ELEMENTSOF(ev), -1);
+ if (nfds < 0) {
+
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+
+ log_error("epoll_wait(): %m");
+ return -errno;
+ }
+
+ assert(nfds >= 1);
+
+ for (i = 0; i < nfds; i++) {
+ if (ev[i].data.fd == STDIN_FILENO) {
+
+ if (ev[i].events & (EPOLLIN|EPOLLHUP))
+ stdin_readable = true;
+
+ } else if (ev[i].data.fd == STDOUT_FILENO) {
+
+ if (ev[i].events & (EPOLLOUT|EPOLLHUP))
+ stdout_writable = true;
+
+ } else if (ev[i].data.fd == master) {
+
+ if (ev[i].events & (EPOLLIN|EPOLLHUP))
+ master_readable = true;
+
+ if (ev[i].events & (EPOLLOUT|EPOLLHUP))
+ master_writable = true;
+
+ } else if (ev[i].data.fd == signal_fd) {
+ struct signalfd_siginfo sfsi;
+ ssize_t n;
+
+ n = read(signal_fd, &sfsi, sizeof(sfsi));
+ if (n != sizeof(sfsi)) {
+
+ if (n >= 0) {
+ log_error("Failed to read from signalfd: invalid block size");
+ return -EIO;
+ }
+
+ if (errno != EINTR && errno != EAGAIN) {
+ log_error("Failed to read from signalfd: %m");
+ return -errno;
+ }
+ } else {
+
+ if (sfsi.ssi_signo == SIGWINCH) {
+ struct winsize ws;
+
+ /* The window size changed, let's forward that. */
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) >= 0)
+ ioctl(master, TIOCSWINSZ, &ws);
+
+ } else if (sfsi.ssi_signo == SIGTERM && kill_pid > 0 && signo > 0 && !tried_orderly_shutdown) {
+
+ if (kill(kill_pid, signo) < 0)
+ return 0;
+
+ log_info("Trying to halt container. Send SIGTERM again to trigger immediate termination.");
+
+ /* This only works for systemd... */
+ tried_orderly_shutdown = true;
+
+ } else
+ return 0;
+ }
+ }
+ }
+
+ while ((stdin_readable && in_buffer_full <= 0) ||
+ (master_writable && in_buffer_full > 0) ||
+ (master_readable && out_buffer_full <= 0) ||
+ (stdout_writable && out_buffer_full > 0)) {
+
+ if (stdin_readable && in_buffer_full < LINE_MAX) {
+
+ k = read(STDIN_FILENO, in_buffer + in_buffer_full, LINE_MAX - in_buffer_full);
+ if (k < 0) {
+
+ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
+ stdin_readable = false;
+ else {
+ log_error("read(): %m");
+ return -errno;
+ }
+ } else
+ in_buffer_full += (size_t) k;
+ }
+
+ if (master_writable && in_buffer_full > 0) {
+
+ k = write(master, in_buffer, in_buffer_full);
+ if (k < 0) {
+
+ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
+ master_writable = false;
+ else {
+ log_error("write(): %m");
+ return -errno;
+ }
+
+ } else {
+ assert(in_buffer_full >= (size_t) k);
+ memmove(in_buffer, in_buffer + k, in_buffer_full - k);
+ in_buffer_full -= k;
+ }
+ }
+
+ if (master_readable && out_buffer_full < LINE_MAX) {
+
+ k = read(master, out_buffer + out_buffer_full, LINE_MAX - out_buffer_full);
+ if (k < 0) {
+
+ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
+ master_readable = false;
+ else {
+ log_error("read(): %m");
+ return -errno;
+ }
+ } else
+ out_buffer_full += (size_t) k;
+ }
+
+ if (stdout_writable && out_buffer_full > 0) {
+
+ k = write(STDOUT_FILENO, out_buffer, out_buffer_full);
+ if (k < 0) {
+
+ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO)
+ stdout_writable = false;
+ else {
+ log_error("write(): %m");
+ return -errno;
+ }
+
+ } else {
+ assert(out_buffer_full >= (size_t) k);
+ memmove(out_buffer, out_buffer + k, out_buffer_full - k);
+ out_buffer_full -= k;
+ }
+ }
+ }
+ }
+}
diff --git a/src/shared/ptyfwd.h b/src/shared/ptyfwd.h
new file mode 100644
index 0000000..8b65702
--- /dev/null
+++ b/src/shared/ptyfwd.h
@@ -0,0 +1,27 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010-2013 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 <sys/types.h>
+#include <signal.h>
+
+int process_pty(int master, sigset_t *mask, pid_t kill_pid, int signo);

View File

@ -0,0 +1,125 @@
From 546f518baf5c1cb083030fe2b3de751f160e5eea Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 6 Nov 2013 02:05:06 +0100
Subject: [PATCH] nspawn: explicitly terminate machines when we exit nspawn
https://bugs.freedesktop.org/show_bug.cgi?id=68370
https://bugzilla.redhat.com/show_bug.cgi?id=988883
Conflicts:
src/nspawn/nspawn.c
---
src/nspawn/nspawn.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 65 insertions(+), 5 deletions(-)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index cda6c82..85bbadf 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -43,9 +43,9 @@
#include <sys/socket.h>
#include <linux/netlink.h>
-#include <systemd/sd-daemon.h>
-#include <systemd/sd-bus.h>
-
+#include "sd-daemon.h"
+#include "sd-bus.h"
+#include "sd-id128.h"
#include "log.h"
#include "util.h"
#include "mkdir.h"
@@ -56,13 +56,13 @@
#include "strv.h"
#include "path-util.h"
#include "loopback-setup.h"
-#include "sd-id128.h"
#include "dev-setup.h"
#include "fdset.h"
#include "build.h"
#include "fileio.h"
#include "bus-internal.h"
#include "bus-message.h"
+#include "bus-error.h"
#include "ptyfwd.h"
#ifndef TTY_GID
@@ -966,10 +966,64 @@ static int register_machine(void) {
strempty(arg_directory),
!isempty(arg_slice), "Slice", "s", arg_slice);
if (r < 0) {
- log_error("Failed to register machine: %s", error.message ? error.message : strerror(-r));
+ log_error("Failed to register machine: %s", bus_error_message(&error, r));
+ return r;
+ }
+
+ return 0;
+}
+
+static int terminate_machine(pid_t pid) {
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
+ _cleanup_bus_unref_ sd_bus *bus = NULL;
+ const char *path;
+ int r;
+
+ r = sd_bus_open_system(&bus);
+ if (r < 0) {
+ log_error("Failed to open system bus: %s", strerror(-r));
+ return r;
+ }
+
+ r = sd_bus_call_method(
+ bus,
+ "org.freedesktop.machine1",
+ "/org/freedesktop/machine1",
+ "org.freedesktop.machine1.Manager",
+ "GetMachineByPID",
+ &error,
+ &reply,
+ "u",
+ (uint32_t) pid);
+ if (r < 0) {
+ /* Note that the machine might already have been
+ * cleaned up automatically, hence don't consider it a
+ * failure if we cannot get the machine object. */
+ log_debug("Failed to get machine: %s", bus_error_message(&error, r));
+ return 0;
+ }
+
+ r = sd_bus_message_read(reply, "o", &path);
+ if (r < 0) {
+ log_error("Failed to parse GetMachineByPID() reply: %s", bus_error_message(&error, r));
return r;
}
+ r = sd_bus_call_method(
+ bus,
+ "org.freedesktop.machine1",
+ path,
+ "org.freedesktop.machine1.Machine",
+ "Terminate",
+ &error,
+ NULL,
+ NULL);
+ if (r < 0) {
+ log_debug("Failed to terminate machine: %s", bus_error_message(&error, r));
+ return 0;
+ }
+
return 0;
}
@@ -1448,6 +1502,12 @@ int main(int argc, char *argv[]) {
if (saved_attr_valid)
tcsetattr(STDIN_FILENO, TCSANOW, &saved_attr);
+ /* Kill if it is not dead yet anyway */
+ terminate_machine(pid);
+
+ /* Redundant, but better safe than sorry */
+ kill(pid, SIGKILL);
+
k = wait_for_terminate(pid, &status);
if (k < 0) {
r = EXIT_FAILURE;

View File

@ -0,0 +1,112 @@
From 9888a5919971d6eacd1ca025c1d4197248022319 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 6 Nov 2013 17:31:20 +0100
Subject: [PATCH] run: support --system to match other commands, even if
redundant
Conflicts:
man/systemd-run.xml
src/run/run.c
---
man/systemd-run.xml | 9 +++++++++
src/run/run.c | 20 +++++++++++++-------
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/man/systemd-run.xml b/man/systemd-run.xml
index 252335b..48a0715 100644
--- a/man/systemd-run.xml
+++ b/man/systemd-run.xml
@@ -113,6 +113,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
+ <term><option>--system</option></term>
+
+ <listitem>
+ <para>Talk to the service manager of the system. This is the
+ implied default.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--scope</option></term>
<listitem>
diff --git a/src/run/run.c b/src/run/run.c
index 18a4920..a6abead 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -61,6 +61,7 @@ static int parse_argv(int argc, char *argv[]) {
enum {
ARG_VERSION = 0x100,
ARG_USER,
+ ARG_SYSTEM,
ARG_SCOPE,
ARG_UNIT,
ARG_DESCRIPTION,
@@ -72,6 +73,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "user", no_argument, NULL, ARG_USER },
+ { "system", no_argument, NULL, ARG_SYSTEM },
{ "scope", no_argument, NULL, ARG_SCOPE },
{ "unit", required_argument, NULL, ARG_UNIT },
{ "description", required_argument, NULL, ARG_DESCRIPTION },
@@ -103,6 +105,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_user = true;
break;
+ case ARG_SYSTEM:
+ arg_user = false;
+ break;
+
case ARG_SCOPE:
arg_scope = true;
break;
@@ -333,12 +339,12 @@ int main(int argc, char* argv[]) {
r = parse_argv(argc, argv);
if (r <= 0)
- goto fail;
+ goto finish;
r = find_binary(argv[optind], &command);
if (r < 0) {
log_error("Failed to find executable %s: %s", argv[optind], strerror(-r));
- goto fail;
+ goto finish;
}
argv[optind] = command;
@@ -346,7 +352,7 @@ int main(int argc, char* argv[]) {
description = strv_join(argv + optind, " ");
if (!description) {
r = log_oom();
- goto fail;
+ goto finish;
}
arg_description = description;
@@ -357,8 +363,8 @@ int main(int argc, char* argv[]) {
else
r = sd_bus_open_system(&bus);
if (r < 0) {
- log_error("Failed to create new bus connection: %s", strerror(-r));
- goto fail;
+ log_error("Failed to create bus connection: %s", strerror(-r));
+ goto finish;
}
if (arg_scope)
@@ -368,9 +374,9 @@ int main(int argc, char* argv[]) {
if (r < 0) {
log_error("Failed start transient unit: %s", error.message ? error.message : strerror(-r));
sd_bus_error_free(&error);
- goto fail;
+ goto finish;
}
-fail:
+finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}

View File

@ -0,0 +1,23 @@
From 98f6a4dfe1d6e601ddd2b59c42e8fc16193d187b Mon Sep 17 00:00:00 2001
From: Pavel Holica <conscript89@gmail.com>
Date: Wed, 6 Nov 2013 23:24:16 +0100
Subject: [PATCH] acpi-fpdt: break on zero or negative length read
https://bugzilla.redhat.com/show_bug.cgi?id=1027478
---
src/shared/acpi-fpdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index 75648b4..7bae47f 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -109,6 +109,8 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
for (rec = (struct acpi_fpdt_header *)(buf + sizeof(struct acpi_table_header));
(char *)rec < buf + l;
rec = (struct acpi_fpdt_header *)((char *)rec + rec->length)) {
+ if (rec->length <= 0)
+ break;
if (rec->type != ACPI_FPDT_TYPE_BOOT)
continue;
if (rec->length != sizeof(struct acpi_fpdt_header))

View File

@ -0,0 +1,28 @@
From 85f85783569c4a662262c7b7579fb130d25ccd42 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Thu, 7 Nov 2013 01:17:49 +0100
Subject: [PATCH] man: add rationale into systemd-halt(8)
The explanation is from
http://people.debian.org/~stapelberg/docs/systemd-dependencies.html
---
man/systemd-halt.service.xml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/man/systemd-halt.service.xml b/man/systemd-halt.service.xml
index 812281e..90b443f 100644
--- a/man/systemd-halt.service.xml
+++ b/man/systemd-halt.service.xml
@@ -83,6 +83,12 @@
remaining swap devices, detach all remaining storage
devices and kill all remaining processes.</para>
+ <para>It is necessary to have this code in a separate binary
+ because otherwise rebooting after an upgrade might be broken 
+ the running PID 1 could still depend on libraries which are not
+ available any more, thus keeping the filesystem busy, which
+ then cannot be re-mounted read-only.</para>
+
<para>Immediately before executing the actual system
halt/poweroff/reboot/kexec
<filename>systemd-shutdown</filename> will run all

View File

@ -0,0 +1,27 @@
From 044615d3520fe1884b6d1c410b99c26c0b02d41a Mon Sep 17 00:00:00 2001
From: Richard Marko <rmarko@fedoraproject.org>
Date: Tue, 5 Nov 2013 15:41:20 +0100
Subject: [PATCH] systemd-python: convert keyword value to string
Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT)
Before this commit this results in
TypeError: cannot concatenate 'str' and 'int' objects
and requires passing PRIORITY value as string to work.
---
src/python-systemd/journal.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py
index d0bcd24..9c7e004 100644
--- a/src/python-systemd/journal.py
+++ b/src/python-systemd/journal.py
@@ -352,6 +352,8 @@ def get_catalog(mid):
def _make_line(field, value):
if isinstance(value, bytes):
return field.encode('utf-8') + b'=' + value
+ elif isinstance(value, int):
+ return field + '=' + str(value)
else:
return field + '=' + value

View File

@ -0,0 +1,65 @@
From 4beb4dc09a06e36a5831530115f1a14beeaa436a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Mon, 4 Nov 2013 23:01:17 +0200
Subject: [PATCH] systemctl: make LOAD column width dynamic
Otherwise 'not-found' overflows into the ACTIVE column.
---
src/systemctl/systemctl.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 36040db..906982a 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -287,14 +287,16 @@ static bool output_show_unit(const struct unit_info *u) {
}
static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
- unsigned id_len, max_id_len, active_len, sub_len, job_len, desc_len, n_shown = 0;
+ unsigned id_len, max_id_len, load_len, active_len, sub_len, job_len, desc_len;
+ unsigned n_shown = 0;
const struct unit_info *u;
int job_count = 0;
- max_id_len = sizeof("UNIT")-1;
- active_len = sizeof("ACTIVE")-1;
- sub_len = sizeof("SUB")-1;
- job_len = sizeof("JOB")-1;
+ max_id_len = strlen("UNIT");
+ load_len = strlen("LOAD");
+ active_len = strlen("ACTIVE");
+ sub_len = strlen("SUB");
+ job_len = strlen("JOB");
desc_len = 0;
for (u = unit_infos; u < unit_infos + c; u++) {
@@ -302,6 +304,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
continue;
max_id_len = MAX(max_id_len, strlen(u->id));
+ load_len = MAX(load_len, strlen(u->load_state));
active_len = MAX(active_len, strlen(u->active_state));
sub_len = MAX(sub_len, strlen(u->sub_state));
if (u->job_id != 0) {
@@ -344,7 +347,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
continue;
if (!n_shown && !arg_no_legend) {
- printf("%-*s %-6s %-*s %-*s ", id_len, "UNIT", "LOAD",
+ printf("%-*s %-*s %-*s %-*s ", id_len, "UNIT", load_len, "LOAD",
active_len, "ACTIVE", sub_len, "SUB");
if (job_count)
printf("%-*s ", job_len, "JOB");
@@ -371,9 +374,9 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
e = arg_full ? NULL : ellipsize(u->id, id_len, 33);
- printf("%s%-*s%s %s%-6s%s %s%-*s %-*s%s %-*s",
+ printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
on, id_len, e ? e : u->id, off,
- on_loaded, u->load_state, off_loaded,
+ on_loaded, load_len, u->load_state, off_loaded,
on_active, active_len, u->active_state,
sub_len, u->sub_state, off_active,
job_count ? job_len + 1 : 0, u->job_id ? u->job_type : "");

View File

@ -0,0 +1,25 @@
From a5fd1d54d63e9e5861113fd30911949a148921e1 Mon Sep 17 00:00:00 2001
From: Jan Janssen <medhefgo@web.de>
Date: Thu, 31 Oct 2013 17:22:03 +0100
Subject: [PATCH] Make hibernation test work for swap files
Suspend to disk works for swap files too (even if it is located
on an ecrypted file system):
https://www.kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt
---
src/shared/sleep-config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index d068bfc..2bb0493 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -206,7 +206,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
if (!d)
return -ENOMEM;
- if (!streq(type, "partition")) {
+ if (!streq(type, "partition") && !streq(type, "file")) {
log_debug("Partition %s has type %s, ignoring.", d, type);
continue;
}

View File

@ -0,0 +1,134 @@
From 82e54a15fa202a67c9a9d2e53aad660f8a5ff36c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 7 Nov 2013 17:51:09 +0100
Subject: [PATCH] man: add docs for sd_is_special() and some man page symlinks
Conflicts:
Makefile.am
---
Makefile-man.am | 15 +++++++++++++++
man/sd_is_fifo.xml | 17 +++++++++++++++++
man/sd_seat_get_active.xml | 2 ++
3 files changed, 34 insertions(+)
diff --git a/Makefile-man.am b/Makefile-man.am
index c8a4342..b8c8acc 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -138,6 +138,7 @@ MANPAGES_ALIAS += \
man/sd_is_socket.3 \
man/sd_is_socket_inet.3 \
man/sd_is_socket_unix.3 \
+ man/sd_is_special.3 \
man/sd_journal.3 \
man/sd_journal_add_conjunction.3 \
man/sd_journal_add_disjunction.3 \
@@ -238,6 +239,7 @@ man/sd_is_mq.3: man/sd_is_fifo.3
man/sd_is_socket.3: man/sd_is_fifo.3
man/sd_is_socket_inet.3: man/sd_is_fifo.3
man/sd_is_socket_unix.3: man/sd_is_fifo.3
+man/sd_is_special.3: man/sd_is_fifo.3
man/sd_journal.3: man/sd_journal_open.3
man/sd_journal_add_conjunction.3: man/sd_journal_add_match.3
man/sd_journal_add_disjunction.3: man/sd_journal_add_match.3
@@ -410,6 +412,9 @@ man/sd_is_socket_inet.html: man/sd_is_fifo.html
man/sd_is_socket_unix.html: man/sd_is_fifo.html
$(html-alias)
+man/sd_is_special.html: man/sd_is_fifo.html
+ $(html-alias)
+
man/sd_journal.html: man/sd_journal_open.html
$(html-alias)
@@ -844,7 +849,9 @@ MANPAGES_ALIAS += \
man/sd_pid_get_slice.3 \
man/sd_pid_get_unit.3 \
man/sd_pid_get_user_unit.3 \
+ man/sd_seat_can_graphical.3 \
man/sd_seat_can_multi_session.3 \
+ man/sd_seat_can_tty.3 \
man/sd_seat_get_sessions.3 \
man/sd_session_get_class.3 \
man/sd_session_get_display.3 \
@@ -873,7 +880,9 @@ man/sd_pid_get_owner_uid.3: man/sd_pid_get_session.3
man/sd_pid_get_slice.3: man/sd_pid_get_session.3
man/sd_pid_get_unit.3: man/sd_pid_get_session.3
man/sd_pid_get_user_unit.3: man/sd_pid_get_session.3
+man/sd_seat_can_graphical.3: man/sd_seat_get_active.3
man/sd_seat_can_multi_session.3: man/sd_seat_get_active.3
+man/sd_seat_can_tty.3: man/sd_seat_get_active.3
man/sd_seat_get_sessions.3: man/sd_seat_get_active.3
man/sd_session_get_class.3: man/sd_session_is_active.3
man/sd_session_get_display.3: man/sd_session_is_active.3
@@ -930,9 +939,15 @@ man/sd_pid_get_unit.html: man/sd_pid_get_session.html
man/sd_pid_get_user_unit.html: man/sd_pid_get_session.html
$(html-alias)
+man/sd_seat_can_graphical.html: man/sd_seat_get_active.html
+ $(html-alias)
+
man/sd_seat_can_multi_session.html: man/sd_seat_get_active.html
$(html-alias)
+man/sd_seat_can_tty.html: man/sd_seat_get_active.html
+ $(html-alias)
+
man/sd_seat_get_sessions.html: man/sd_seat_get_active.html
$(html-alias)
diff --git a/man/sd_is_fifo.xml b/man/sd_is_fifo.xml
index 2bc860c..4d9cd79 100644
--- a/man/sd_is_fifo.xml
+++ b/man/sd_is_fifo.xml
@@ -48,6 +48,7 @@
<refname>sd_is_socket_inet</refname>
<refname>sd_is_socket_unix</refname>
<refname>sd_is_mq</refname>
+ <refname>sd_is_special</refname>
<refpurpose>Check the type of a file descriptor</refpurpose>
</refnamediv>
@@ -93,6 +94,12 @@
<paramdef>const char *<parameter>path</parameter></paramdef>
</funcprototype>
+ <funcprototype>
+ <funcdef>int <function>sd_is_special</function></funcdef>
+ <paramdef>int <parameter>fd</parameter></paramdef>
+ <paramdef>const char *<parameter>path</parameter></paramdef>
+ </funcprototype>
+
</funcsynopsis>
</refsynopsisdiv>
@@ -153,6 +160,16 @@
<parameter>path</parameter> parameter is not
<constant>NULL</constant>, it is checked whether the
message queue is bound to the specified name.</para>
+
+ <para><function>sd_is_special()</function> may be
+ called to check whether the specified file descriptor
+ refers to a special file. If the
+ <parameter>path</parameter> parameter is not
+ <constant>NULL</constant>, it is checked whether file
+ descriptor is bound to the specified file
+ name. Special files in this context are character
+ device nodes and files in <filename>/proc</filename>
+ or <filename>/sys</filename>.</para>
</refsect1>
<refsect1>
diff --git a/man/sd_seat_get_active.xml b/man/sd_seat_get_active.xml
index 1610d3e..cd87696 100644
--- a/man/sd_seat_get_active.xml
+++ b/man/sd_seat_get_active.xml
@@ -46,6 +46,8 @@
<refname>sd_seat_get_active</refname>
<refname>sd_seat_get_sessions</refname>
<refname>sd_seat_can_multi_session</refname>
+ <refname>sd_seat_can_tty</refname>
+ <refname>sd_seat_can_graphical</refname>
<refpurpose>Determine state of a specific seat</refpurpose>
</refnamediv>

View File

@ -0,0 +1,22 @@
From 94c73ca7e22de4355f8ef32ea30ddf1ef8dae662 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 6 Nov 2013 11:18:02 +0100
Subject: [PATCH] systemctl: return r instead of always returning 0
---
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 906982a..db584b2 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1365,7 +1365,7 @@ static int list_jobs(DBusConnection *bus, char **args) {
}
free(jobs);
- return 0;
+ return r;
}
static int cancel_job(DBusConnection *bus, char **args) {

View File

@ -0,0 +1,22 @@
From e46b85ec8f333d1bdd0e66b99530965c7781110b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 8 Nov 2013 13:53:25 +0100
Subject: [PATCH] journal: fix minor memory leak
---
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 7700d6c..9676f0f 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1276,7 +1276,7 @@ static void check_network(sd_journal *j, int fd) {
static bool file_has_type_prefix(const char *prefix, const char *filename) {
const char *full, *tilded, *atted;
- full = strappend(prefix, ".journal");
+ full = strappenda(prefix, ".journal");
tilded = strappenda(full, "~");
atted = strappenda(prefix, "@");

View File

@ -0,0 +1,161 @@
From 9e694cd271f7bce2ad7a77de03b66d493ca5dd61 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 8 Nov 2013 16:01:22 +0100
Subject: [PATCH] manager: configurable StartLimit default values
https://bugzilla.redhat.com/show_bug.cgi?id=821723
---
man/systemd-system.conf.xml | 13 +++++++++++++
man/systemd.service.xml | 9 ++++++---
src/core/main.c | 6 ++++++
src/core/manager.h | 3 +++
src/core/service.c | 4 +++-
src/core/system.conf | 2 ++
src/core/user.conf | 2 ++
src/shared/def.h | 3 +++
8 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml
index c1f2648..9a1a99f 100644
--- a/man/systemd-system.conf.xml
+++ b/man/systemd-system.conf.xml
@@ -115,6 +115,19 @@
<varname>TimeoutSec=</varname> value.
</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>DefaultStartLimitInterval=</varname></term>
+ <term><varname>DefaultStartLimitBurst=</varname></term>
+
+ <listitem><para>Configure the default start rate
+ limiting, as configured per-service by
+ <varname>StartLimitInterval=</varname> and
+ <varname>StartLimitBurst=</varname>. See
+ <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details on the per-service
+ settings).
+ </para></listitem>
+ </varlistentry>
<varlistentry>
<term><varname>CPUAffinity=</varname></term>
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index df04048..3f31c11 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -863,12 +863,15 @@
these two options, this rate limiting
may be modified. Use
<varname>StartLimitInterval=</varname>
- to configure the checking interval
- (defaults to 10s, set to 0 to disable
+ to configure the checking interval (defaults to
+ <varname>DefaultStartLimitInterval=</varname> in
+ manager configuration file, set to 0 to disable
any kind of rate limiting). Use
<varname>StartLimitBurst=</varname> to
configure how many starts per interval
- are allowed (defaults to 5). These
+ are allowed (defaults to
+ <varname>DefaultStartLimitBurst=</varname> in
+ manager configuration file). These
configuration options are particularly
useful in conjunction with
<varname>Restart=</varname>, however
diff --git a/src/core/main.c b/src/core/main.c
index 937994c..00fd394 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -93,6 +93,8 @@ static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
static usec_t arg_default_restart_usec = DEFAULT_RESTART_USEC;
static usec_t arg_default_timeout_start_usec = DEFAULT_TIMEOUT_USEC;
static usec_t arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
+static usec_t arg_default_start_limit_interval = DEFAULT_START_LIMIT_INTERVAL;
+static unsigned arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST;
static usec_t arg_runtime_watchdog = 0;
static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
static char **arg_default_environment = NULL;
@@ -642,6 +644,8 @@ static int parse_config_file(void) {
{ "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec },
{ "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec },
{ "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec },
+ { "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval },
+ { "Manager", "DefaultStartLimitBurst", config_parse_unsigned, 0, &arg_default_start_limit_burst },
{ "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers },
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
@@ -1551,6 +1555,8 @@ int main(int argc, char *argv[]) {
m->default_restart_usec = arg_default_restart_usec;
m->default_timeout_start_usec = arg_default_timeout_start_usec;
m->default_timeout_stop_usec = arg_default_timeout_stop_usec;
+ m->default_start_limit_interval = arg_default_start_limit_interval;
+ m->default_start_limit_burst = arg_default_start_limit_burst;
m->runtime_watchdog = arg_runtime_watchdog;
m->shutdown_watchdog = arg_shutdown_watchdog;
m->userspace_timestamp = userspace_timestamp;
diff --git a/src/core/manager.h b/src/core/manager.h
index e74c609..ee42c5e 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -233,6 +233,9 @@ struct Manager {
usec_t default_restart_usec, default_timeout_start_usec,
default_timeout_stop_usec;
+ usec_t default_start_limit_interval;
+ unsigned default_start_limit_burst;
+
struct rlimit *rlimit[RLIMIT_NLIMITS];
/* non-zero if we are reloading or reexecuting, */
diff --git a/src/core/service.c b/src/core/service.c
index e81aa1f..5662180 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -143,7 +143,9 @@ static void service_init(Unit *u) {
kill_context_init(&s->kill_context);
cgroup_context_init(&s->cgroup_context);
- RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5);
+ RATELIMIT_INIT(s->start_limit,
+ u->manager->default_start_limit_interval,
+ u->manager->default_start_limit_burst);
s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID;
}
diff --git a/src/core/system.conf b/src/core/system.conf
index 3c6cc03..38bbca5 100644
--- a/src/core/system.conf
+++ b/src/core/system.conf
@@ -27,6 +27,8 @@
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultRestartSec=100ms
+#DefaultStartLimitInterval=10s
+#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultLimitCPU=
#DefaultLimitFSIZE=
diff --git a/src/core/user.conf b/src/core/user.conf
index b030701..923ca66 100644
--- a/src/core/user.conf
+++ b/src/core/user.conf
@@ -17,3 +17,5 @@
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultRestartSec=100ms
+#DefaultStartLimitInterval=10s
+#DefaultStartLimitBurst=5
diff --git a/src/shared/def.h b/src/shared/def.h
index edd0bcf..e4ef735 100644
--- a/src/shared/def.h
+++ b/src/shared/def.h
@@ -27,6 +27,9 @@
#define DEFAULT_RESTART_USEC (100*USEC_PER_MSEC)
#define DEFAULT_CONFIRM_USEC (30*USEC_PER_SEC)
+#define DEFAULT_START_LIMIT_INTERVAL (10*USEC_PER_SEC)
+#define DEFAULT_START_LIMIT_BURST 5
+
#define DEFAULT_EXIT_USEC (5*USEC_PER_MINUTE)
#define SYSTEMD_CGROUP_CONTROLLER "name=systemd"

View File

@ -0,0 +1,57 @@
From 4108d06603404e70b93747e156213eb59ed8bc27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 7 Nov 2013 23:57:19 -0500
Subject: [PATCH] man,units: fix installation of systemd-nspawn@.service and
add example
---
TODO | 1 +
man/systemd-nspawn.xml | 12 ++++++++++++
units/systemd-nspawn@.service.in | 2 +-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/TODO b/TODO
index 425f673..42ba030 100644
--- a/TODO
+++ b/TODO
@@ -491,6 +491,7 @@ Features:
- nspawn: maybe add a way to drop additional caps, in addition to add additional caps
- nspawn: maybe explicitly reset loginuid?
- nspawn: make it work for dwalsh and shared /usr containers -- tmpfs mounts as command line parameters, selinux exec context
+ - refuses to boot containers without /etc/machine-id (OK?), and with empty /etc/machine-id (not OK).
* cryptsetup:
- cryptsetup-generator: allow specification of passwords in crypttab itself
diff --git a/man/systemd-nspawn.xml b/man/systemd-nspawn.xml
index 7d450f9..ba9e516 100644
--- a/man/systemd-nspawn.xml
+++ b/man/systemd-nspawn.xml
@@ -428,6 +428,18 @@
</refsect1>
<refsect1>
+ <title>Example 4</title>
+
+ <programlisting># mv ~/arch-tree /var/lib/container/arch
+# systemctl enable systemd-nspawn@arch.service
+# systemctl start systemd-nspawn@arch.service</programlisting>
+
+ <para>This makes the Arch Linux container part of the
+ <filename>multi-user.target</filename> on the host.
+ </para>
+ </refsect1>
+
+ <refsect1>
<title>Exit status</title>
<para>The exit code of the program executed in the
diff --git a/units/systemd-nspawn@.service.in b/units/systemd-nspawn@.service.in
index eca62e3..8e00736 100644
--- a/units/systemd-nspawn@.service.in
+++ b/units/systemd-nspawn@.service.in
@@ -14,4 +14,4 @@ ExecStart=@bindir@/systemd-nspawn -bjD /var/lib/container/%i
Type=notify
[Install]
-Also=multi-user.target
+WantedBy=multi-user.target

View File

@ -0,0 +1,65 @@
From 7930484abfb17a9c72efdd93ebfc4637ad2be738 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 8 Nov 2013 08:41:13 -0500
Subject: [PATCH] systemd: fix memory leak in cgroup code
If the unit already was in the hashmap, path would be leaked.
---
src/core/cgroup.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 42c0b3f..32e2599 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -376,23 +376,23 @@ static CGroupControllerMask unit_get_siblings_mask(Unit *u) {
}
static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) {
- char *path = NULL;
+ _cleanup_free_ char *path;
int r;
- bool is_in_hash = false;
+ bool was_in_hash = false;
assert(u);
path = unit_default_cgroup_path(u);
if (!path)
- return -ENOMEM;
+ return log_oom();
r = hashmap_put(u->manager->cgroup_unit, path, u);
if (r == 0)
- is_in_hash = true;
-
- if (r < 0) {
- log_error("cgroup %s exists already: %s", path, strerror(-r));
- free(path);
+ was_in_hash = true;
+ else if (r < 0) {
+ log_error(r == -EEXIST ?
+ "cgroup %s exists already: %s" : "hashmap_put failed for %s: %s",
+ path, strerror(-r));
return r;
}
@@ -405,13 +405,15 @@ static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) {
if (u->cgroup_path) {
r = cg_migrate_everywhere(u->manager->cgroup_supported, u->cgroup_path, path);
if (r < 0)
- log_error("Failed to migrate cgroup %s: %s", path, strerror(-r));
+ log_error("Failed to migrate cgroup from %s to %s: %s",
+ u->cgroup_path, path, strerror(-r));
}
- if (!is_in_hash) {
- /* And remember the new data */
+ if (!was_in_hash) {
+ /* Remember the new data */
free(u->cgroup_path);
u->cgroup_path = path;
+ path = NULL;
}
u->cgroup_realized = true;

View File

@ -0,0 +1,22 @@
From 12a195707153882b1df1b1503b51703a81c85de6 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sun, 10 Nov 2013 23:05:08 +0100
Subject: [PATCH] button: don't exit if we cannot handle a button press
---
src/login/logind-button.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index ea45c28..4f456d2 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -172,7 +172,7 @@ static int button_handle(
* execute another one until the lid is opened/closed again */
b->lid_close_queued = false;
- return r;
+ return 0;
}
int button_process(Button *b) {

View File

@ -0,0 +1,120 @@
From d5910017f2cfaea144f766a3fb772b53f8d9dcbf Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 11 Nov 2013 03:02:52 +0100
Subject: [PATCH] timer: properly format relative timestamps in the future
---
src/shared/time-util.c | 69 ++++++++++++++++++++++++++++++++------------------
1 file changed, 44 insertions(+), 25 deletions(-)
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 860be61..b8a6bd7 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -191,55 +191,62 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t) {
}
char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
+ const char *s;
usec_t n, d;
n = now(CLOCK_REALTIME);
- if (t <= 0 || t > n || t + USEC_PER_DAY*7 <= t)
+ if (t <= 0 || (t == (usec_t) -1))
return NULL;
- d = n - t;
+ if (n > t) {
+ d = n - t;
+ s = "ago";
+ } else {
+ d = t - n;
+ s = "left";
+ }
if (d >= USEC_PER_YEAR)
- snprintf(buf, l, "%llu years %llu months ago",
+ snprintf(buf, l, "%llu years %llu months %s",
(unsigned long long) (d / USEC_PER_YEAR),
- (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH));
+ (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH), s);
else if (d >= USEC_PER_MONTH)
- snprintf(buf, l, "%llu months %llu days ago",
+ snprintf(buf, l, "%llu months %llu days %s",
(unsigned long long) (d / USEC_PER_MONTH),
- (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY));
+ (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY), s);
else if (d >= USEC_PER_WEEK)
- snprintf(buf, l, "%llu weeks %llu days ago",
+ snprintf(buf, l, "%llu weeks %llu days %s",
(unsigned long long) (d / USEC_PER_WEEK),
- (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY));
+ (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY), s);
else if (d >= 2*USEC_PER_DAY)
- snprintf(buf, l, "%llu days ago", (unsigned long long) (d / USEC_PER_DAY));
+ snprintf(buf, l, "%llu days %s", (unsigned long long) (d / USEC_PER_DAY), s);
else if (d >= 25*USEC_PER_HOUR)
- snprintf(buf, l, "1 day %lluh ago",
- (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR));
+ snprintf(buf, l, "1 day %lluh %s",
+ (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR), s);
else if (d >= 6*USEC_PER_HOUR)
- snprintf(buf, l, "%lluh ago",
- (unsigned long long) (d / USEC_PER_HOUR));
+ snprintf(buf, l, "%lluh %s",
+ (unsigned long long) (d / USEC_PER_HOUR), s);
else if (d >= USEC_PER_HOUR)
- snprintf(buf, l, "%lluh %llumin ago",
+ snprintf(buf, l, "%lluh %llumin %s",
(unsigned long long) (d / USEC_PER_HOUR),
- (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE));
+ (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE), s);
else if (d >= 5*USEC_PER_MINUTE)
- snprintf(buf, l, "%llumin ago",
- (unsigned long long) (d / USEC_PER_MINUTE));
+ snprintf(buf, l, "%llumin %s",
+ (unsigned long long) (d / USEC_PER_MINUTE), s);
else if (d >= USEC_PER_MINUTE)
- snprintf(buf, l, "%llumin %llus ago",
+ snprintf(buf, l, "%llumin %llus %s",
(unsigned long long) (d / USEC_PER_MINUTE),
- (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC));
+ (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC), s);
else if (d >= USEC_PER_SEC)
- snprintf(buf, l, "%llus ago",
- (unsigned long long) (d / USEC_PER_SEC));
+ snprintf(buf, l, "%llus %s",
+ (unsigned long long) (d / USEC_PER_SEC), s);
else if (d >= USEC_PER_MSEC)
- snprintf(buf, l, "%llums ago",
- (unsigned long long) (d / USEC_PER_MSEC));
+ snprintf(buf, l, "%llums %s",
+ (unsigned long long) (d / USEC_PER_MSEC), s);
else if (d > 0)
- snprintf(buf, l, "%lluus ago",
- (unsigned long long) d);
+ snprintf(buf, l, "%lluus %s",
+ (unsigned long long) d, s);
else
snprintf(buf, l, "now");
@@ -479,6 +486,18 @@ int parse_timestamp(const char *t, usec_t *usec) {
return r;
goto finish;
+ } else if (endswith(t, " left")) {
+ _cleanup_free_ char *z;
+
+ z = strndup(t, strlen(t) - 4);
+ if (!z)
+ return -ENOMEM;
+
+ r = parse_sec(z, &plus);
+ if (r < 0)
+ return r;
+
+ goto finish;
}
for (i = 0; i < ELEMENTSOF(day_nr); i++) {

View File

@ -0,0 +1,48 @@
From a0598047e4bfd308a25b9a516529ab49074fa527 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 11 Nov 2013 03:03:17 +0100
Subject: [PATCH] timer: consider (usec_t) -1 an invalid timestamp
---
src/shared/time-util.c | 4 ++--
src/shared/time-util.h | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index b8a6bd7..81d4ede 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -157,7 +157,7 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
assert(buf);
assert(l > 0);
- if (t <= 0)
+ if (t <= 0 || t == (usec_t) -1)
return NULL;
sec = (time_t) (t / USEC_PER_SEC);
@@ -175,7 +175,7 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t) {
assert(buf);
assert(l > 0);
- if (t <= 0)
+ if (t <= 0 || t == (usec_t) -1)
return NULL;
sec = (time_t) (t / USEC_PER_SEC);
diff --git a/src/shared/time-util.h b/src/shared/time-util.h
index 7660fe1..bc10d22 100644
--- a/src/shared/time-util.h
+++ b/src/shared/time-util.h
@@ -64,7 +64,10 @@ dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
-#define dual_timestamp_is_set(ts) ((ts)->realtime > 0)
+static inline bool dual_timestamp_is_set(dual_timestamp *ts) {
+ return ((ts->realtime > 0 && ts->realtime != (usec_t) -1) ||
+ (ts->monotonic > 0 && ts->monotonic != (usec_t) -1));
+}
usec_t timespec_load(const struct timespec *ts) _pure_;
struct timespec *timespec_store(struct timespec *ts, usec_t u);

View File

@ -0,0 +1,38 @@
From 7583c92b266cd632712ced40be837f52a8de9715 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Fri, 11 Oct 2013 11:23:34 +0200
Subject: [PATCH] udev: usb_id - remove obsoleted bInterfaceSubClass == 5 match
bInterfaceSubClass == 5 is not a "floppy"; just identify the obsolete
QIC-157 interface as "generic".
---
src/udev/udev-builtin-usb_id.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c
index e3bbd05..3e2f43e 100644
--- a/src/udev/udev-builtin-usb_id.c
+++ b/src/udev/udev-builtin-usb_id.c
@@ -91,6 +91,9 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len
type_num = strtoul(from, &eptr, 0);
if (eptr != from) {
switch (type_num) {
+ case 1: /* RBC devices */
+ type = "rbc";
+ break;
case 2:
type = "atapi";
break;
@@ -98,12 +101,8 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len
type = "tape";
break;
case 4: /* UFI */
- case 5: /* SFF-8070i */
type = "floppy";
break;
- case 1: /* RBC devices */
- type = "rbc";
- break;
case 6: /* Transparent SPC-2 devices */
type = "scsi";
break;

View File

@ -0,0 +1,66 @@
From e7e2208e73ccc4a93dc87d1fc4624be0dbe3e747 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 11 Oct 2013 09:45:32 +0200
Subject: [PATCH] Add support for saving/restoring keyboard backlights
Piggy-backing on the display backlight code, this saves and restores
keyboard backlights on supported devices.
The detection code matches that of UPower:
http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c#n173
https://bugs.freedesktop.org/show_bug.cgi?id=70367
[tomegun: also work for devices named "{smc,samsung,asus}::kbd_backlight"]
Conflicts:
rules/99-systemd.rules.in
---
rules/99-systemd.rules.in | 4 +++-
src/backlight/backlight.c | 7 +++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index 307f18f..a00ffed 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -51,9 +51,11 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:
ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name --prefix=/proc/sys/net/ipv4/neigh/$name --prefix=/proc/sys/net/ipv6/conf/$name --prefix=/proc/sys/net/ipv6/neigh/$name"
-# Pull in backlight save/restore for all firmware backlight devices
+# Pull in backlight save/restore for all firmware backlight devices,
+# and keyboard backlights
SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service"
+SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service"
# Asynchronously mount file systems implemented by these modules as
# soon as they are loaded.
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index 9b2eada..f22deed 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -56,9 +56,11 @@ int main(int argc, char *argv[]) {
errno = 0;
device = udev_device_new_from_subsystem_sysname(udev, "backlight", argv[2]);
+ if (!device)
+ device = udev_device_new_from_subsystem_sysname(udev, "leds", argv[2]);
if (!device) {
if (errno != 0) {
- log_error("Failed to get backlight device: %m");
+ log_error("Failed to get backlight device '%s': %m", argv[2]);
r = -errno;
} else
r = log_oom();
@@ -66,7 +68,8 @@ int main(int argc, char *argv[]) {
goto finish;
}
- if (!streq_ptr(udev_device_get_subsystem(device), "backlight")) {
+ if (!streq_ptr(udev_device_get_subsystem(device), "backlight") &&
+ !streq_ptr(udev_device_get_subsystem(device), "leds")) {
log_error("Not a backlight device: %s", argv[2]);
r = -ENODEV;
goto finish;

View File

@ -0,0 +1,48 @@
From fada68e9f922a3a6a176092a7abdeec0b58408e8 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Thu, 17 Oct 2013 19:49:19 +0200
Subject: [PATCH] static-nodes: don't call mkdir
This is no longer necessary with kmod-15. Bump the requirement.
---
README | 2 +-
configure.ac | 2 +-
units/kmod-static-nodes.service.in | 1 -
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/README b/README
index b39cd37..cf0a18d 100644
--- a/README
+++ b/README
@@ -95,7 +95,7 @@ REQUIREMENTS:
dbus >= 1.4.0
libcap
libblkid >= 2.20 (from util-linux) (optional)
- libkmod >= 14 (optional)
+ libkmod >= 15 (optional)
PAM >= 1.1.2 (optional)
libcryptsetup (optional)
libaudit (optional)
diff --git a/configure.ac b/configure.ac
index 4f26092..5bc31c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,7 +269,7 @@ AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules s
if test "x$enable_kmod" != "xno"; then
PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
if test "x$have_kmod" = "xyes"; then
- PKG_CHECK_MODULES(KMOD, [ libkmod >= 14 ],
+ PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
[AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
AC_MSG_ERROR([*** kmod version >= 14 not found]))
fi
diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
index ff4017b..368f980 100644
--- a/units/kmod-static-nodes.service.in
+++ b/units/kmod-static-nodes.service.in
@@ -15,5 +15,4 @@ ConditionPathExists=/lib/modules/%v/modules.devname
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStartPre=@MKDIR_P@ /run/tmpfiles.d
ExecStart=@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf

View File

@ -0,0 +1,22 @@
From 6ff7db9dcee918b020f6c50e2785785b2b9ca854 Mon Sep 17 00:00:00 2001
From: David Strauss <david@davidstrauss.net>
Date: Thu, 17 Oct 2013 13:19:29 -0700
Subject: [PATCH] Fix kmod error message to have correct version requirement
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 5bc31c5..9904e25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -271,7 +271,7 @@ if test "x$enable_kmod" != "xno"; then
if test "x$have_kmod" = "xyes"; then
PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
[AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
- AC_MSG_ERROR([*** kmod version >= 14 not found]))
+ AC_MSG_ERROR([*** kmod version >= 15 not found]))
fi
if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
AC_MSG_ERROR([*** kmod support requested, but libraries not found])

View File

@ -0,0 +1,34 @@
From 57db3ee2c1aa714f6fc88a40043bf531f155843c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 11 Nov 2013 19:53:59 -0500
Subject: [PATCH] systemd-python: fix booted() and add two functions to docs
For some reason sphinx doesn't want to show inherited C functions.
---
src/python-systemd/_daemon.c | 2 +-
src/python-systemd/docs/daemon.rst | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c
index 6b84fb8..f0ab16f 100644
--- a/src/python-systemd/_daemon.c
+++ b/src/python-systemd/_daemon.c
@@ -51,7 +51,7 @@ static PyObject* booted(PyObject *self, PyObject *args) {
assert(args == NULL);
r = sd_booted();
- if (set_error(r, NULL, NULL))
+ if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
diff --git a/src/python-systemd/docs/daemon.rst b/src/python-systemd/docs/daemon.rst
index 72280ca..0ad11ed 100644
--- a/src/python-systemd/docs/daemon.rst
+++ b/src/python-systemd/docs/daemon.rst
@@ -14,3 +14,5 @@
.. autofunction:: _is_socket_unix
.. autofunction:: _is_socket_inet
.. autofunction:: _is_mq
+ .. autofunction:: notify
+ .. autofunction:: booted

View File

@ -0,0 +1,22 @@
From 8aa997f8e2e0ff3d801c1a3fe4065edc940c41f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Wed, 13 Nov 2013 13:36:17 +0200
Subject: [PATCH] activate: mention -E in the help text
---
src/activate/activate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/activate/activate.c b/src/activate/activate.c
index 83d25b1..fc581b9 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -316,6 +316,8 @@ static int help(void) {
" -l --listen=ADDR Listen for raw connections at ADDR\n"
" -a --accept Spawn separate child for each connection\n"
" -h --help Show this help and exit\n"
+ " -E --environment=NAME[=VALUE]\n"
+ " Pass an environment variable to children\n"
" --version Print version string and exit\n"
"\n"
"Note: file descriptors from sd_listen_fds() will be passed through.\n"

View File

@ -0,0 +1,23 @@
From 767d458826e99cc55aeccb65c469124be61851a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
Date: Wed, 13 Nov 2013 13:36:16 +0200
Subject: [PATCH] activate: fix crash when -s is passed
getopt_long() was told to accept -s which was never implemented.
---
src/activate/activate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/activate/activate.c b/src/activate/activate.c
index fc581b9..a9461bc 100644
--- a/src/activate/activate.c
+++ b/src/activate/activate.c
@@ -346,7 +346,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "+hl:saE:", options, NULL)) >= 0)
+ while ((c = getopt_long(argc, argv, "+hl:aE:", options, NULL)) >= 0)
switch(c) {
case 'h':
help();

View File

@ -0,0 +1,85 @@
From d787844df7f23a079c8bab893a8412550848bb6a Mon Sep 17 00:00:00 2001
From: Umut Tezduyar Lindskog <umut.tezduyar@axis.com>
Date: Wed, 13 Nov 2013 15:27:19 +0100
Subject: [PATCH] journal: timestamp support on console messages
journald mimics the kernel here: timestamps will be printed if
/sys/module/printk/parameters/time contains "Y".
---
src/journal/journald-console.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index be55f94..1ee3afe 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -19,13 +19,30 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
+#include "fileio.h"
#include "journald-server.h"
#include "journald-console.h"
+static bool prefix_timestamp(void) {
+
+ static int cached_printk_time = -1;
+
+ if (_unlikely_(cached_printk_time < 0)) {
+ _cleanup_free_ char *p = NULL;
+
+ cached_printk_time =
+ read_one_line_file("/sys/module/printk/parameters/time", &p) >= 0
+ && parse_boolean(p) > 0;
+ }
+
+ return cached_printk_time;
+}
+
void server_forward_console(
Server *s,
int priority,
@@ -33,8 +50,10 @@ void server_forward_console(
const char *message,
struct ucred *ucred) {
- struct iovec iovec[4];
+ struct iovec iovec[5];
char header_pid[16];
+ struct timespec ts;
+ char tbuf[4 + DECIMAL_STR_MAX(ts.tv_sec) + DECIMAL_STR_MAX(ts.tv_nsec)-3 + 1];
int n = 0, fd;
char *ident_buf = NULL;
const char *tty;
@@ -45,7 +64,16 @@ void server_forward_console(
if (LOG_PRI(priority) > s->max_level_console)
return;
- /* First: identifier and PID */
+ /* First: timestamp */
+ if (prefix_timestamp()) {
+ assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
+ snprintf(tbuf, sizeof(tbuf), "[%5llu.%06llu] ",
+ (unsigned long long) ts.tv_sec,
+ (unsigned long long) ts.tv_nsec / 1000);
+ IOVEC_SET_STRING(iovec[n++], tbuf);
+ }
+
+ /* Second: identifier and PID */
if (ucred) {
if (!identifier) {
get_process_comm(ucred->pid, &ident_buf);
@@ -64,7 +92,7 @@ void server_forward_console(
IOVEC_SET_STRING(iovec[n++], ": ");
}
- /* Third: message */
+ /* Fourth: message */
IOVEC_SET_STRING(iovec[n++], message);
IOVEC_SET_STRING(iovec[n++], "\n");

View File

@ -0,0 +1,163 @@
From 30712bf9c2baefc73ce110854c40be354a60bd78 Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@redhat.com>
Date: Wed, 13 Nov 2013 11:06:13 +0200
Subject: [PATCH] man: add bootctl(8)
https://bugzilla.redhat.com/show_bug.cgi?id=1014303
---
Makefile-man.am | 9 ++++
man/bootctl.xml | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 134 insertions(+)
create mode 100644 man/bootctl.xml
diff --git a/Makefile-man.am b/Makefile-man.am
index b8c8acc..3f626e8 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -650,6 +650,15 @@ MANPAGES_ALIAS += \
endif
+if ENABLE_EFI
+MANPAGES += \
+ man/bootctl.1
+MANPAGES_ALIAS += \
+ #
+
+
+endif
+
if ENABLE_HOSTNAMED
MANPAGES += \
man/hostnamectl.1 \
diff --git a/man/bootctl.xml b/man/bootctl.xml
new file mode 100644
index 0000000..28f1b92
--- /dev/null
+++ b/man/bootctl.xml
@@ -0,0 +1,125 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ 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/>.
+-->
+
+<refentry id="bootctl" conditional='ENABLE_EFI'>
+
+ <refentryinfo>
+ <title>bootctl</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Kay</firstname>
+ <surname>Sievers</surname>
+ <email>kay@vrfy.org</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>bootctl</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>bootctl</refname>
+ <refpurpose>Control the firmware and boot manager settings</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>bootctl</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="req">COMMAND</arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><command>bootctl</command> may be used to
+ query or (in the future) change the firmware and boot
+ manager settings.</para>
+
+ <para>Firmware information is available only on EFI
+ systems.</para>
+
+ <para>Currently, only the <citerefentry><refentrytitle>gummiboot</refentrytitle><manvolnum>8</manvolnum></citerefentry> boot
+ manager implements the required boot loader interface
+ to provide complete boot manager information.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+
+ <para>The following options are understood:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-h</option></term>
+ <term><option>--help</option></term>
+
+ <listitem><para>Prints a short help
+ text and exits.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--version</option></term>
+
+ <listitem><para>Prints a short version
+ string and exits.</para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>The following commands are understood:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><command>status</command></term>
+
+ <listitem><para>Show firmware and boot
+ manager information about the system,
+ including secure boot mode status and
+ selected firmware entry (where
+ available).</para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Exit status</title>
+
+ <para>On success, 0 is returned, a non-zero failure
+ code otherwise.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <ulink url="http://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface">Boot loader interface</ulink>,
+ <ulink url="http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec">Boot loader specification</ulink>,
+ <ulink url="http://www.freedesktop.org/wiki/Software/gummiboot/">gummiboot</ulink>
+ </para>
+ </refsect1>
+
+</refentry>

Some files were not shown because too many files have changed in this diff Show More