Remove old patches

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2014-02-19 19:37:28 -05:00
parent 4f13e0f0ca
commit 4287134c8d
266 changed files with 0 additions and 29894 deletions

View File

@ -1,22 +0,0 @@
From 3e4aca291a6ab914e08108acbd5d96600370c20d Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 2 Oct 2013 13:39:49 +0200
Subject: [PATCH] acpi-fptd: fix memory leak in acpi_get_boot_usec
---
src/shared/acpi-fpdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index b094f34..a7c83ed 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -81,7 +81,7 @@ struct acpi_fpdt_boot {
};
int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
- char *buf;
+ _cleanup_free_ char *buf;
struct acpi_table_header *tbl;
size_t l;
struct acpi_fpdt_header *rec;

View File

@ -1,51 +0,0 @@
From 80c0a135afe5d801903ac742c386a5468837175c Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Wed, 2 Oct 2013 07:46:24 -0400
Subject: [PATCH] fix lingering references to /var/lib/{backlight,random-seed}
This should have been part of ef5bfcf668e6029faa78534dfe.
---
man/systemd-backlight@.service.xml | 2 +-
man/systemd-random-seed.service.xml | 2 +-
units/systemd-backlight@.service.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/man/systemd-backlight@.service.xml b/man/systemd-backlight@.service.xml
index 2b73625..4318964 100644
--- a/man/systemd-backlight@.service.xml
+++ b/man/systemd-backlight@.service.xml
@@ -58,7 +58,7 @@
is a service that restores the display backlight
brightness at early-boot and saves it at shutdown. On
disk, the backlight brightness is stored in
- <filename>/var/lib/backlight/</filename>. Note that by
+ <filename>/var/lib/systemd/backlight/</filename>. Note that by
default, only firmware backlight devices are
saved/restored.</para>
</refsect1>
diff --git a/man/systemd-random-seed.service.xml b/man/systemd-random-seed.service.xml
index 8cd14b7..e5cd037 100644
--- a/man/systemd-random-seed.service.xml
+++ b/man/systemd-random-seed.service.xml
@@ -61,7 +61,7 @@
for details. Saving/restoring the random seed across
boots increases the amount of available entropy early
at boot. On disk the random seed is stored in
- <filename>/var/lib/random-seed</filename>.</para>
+ <filename>/var/lib/systemd/random-seed</filename>.</para>
</refsect1>
<refsect1>
diff --git a/units/systemd-backlight@.service.in b/units/systemd-backlight@.service.in
index b0e75db..5caa5d5 100644
--- a/units/systemd-backlight@.service.in
+++ b/units/systemd-backlight@.service.in
@@ -9,7 +9,7 @@
Description=Load/Save Screen Backlight Brightness of %I
Documentation=man:systemd-backlight@.service(8)
DefaultDependencies=no
-RequiresMountsFor=/var/lib/backlight
+RequiresMountsFor=/var/lib/systemd/backlight
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service
Before=sysinit.target shutdown.target

View File

@ -1,22 +0,0 @@
From 4294dcefec5bd85c17d671612fac3b4b8cd20eac Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 14:03:56 +0200
Subject: [PATCH] acpi: make sure we never free an uninitialized pointer
---
src/shared/acpi-fpdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index a7c83ed..af58c7c 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -81,7 +81,7 @@ struct acpi_fpdt_boot {
};
int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
- _cleanup_free_ char *buf;
+ _cleanup_free_ char *buf = NULL;
struct acpi_table_header *tbl;
size_t l;
struct acpi_fpdt_header *rec;

View File

@ -1,131 +0,0 @@
From 5103e16f5e12e1754a2dcfabafb7618eb15ccf98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Wed, 2 Oct 2013 16:42:42 +0200
Subject: [PATCH] systemctl: fix name mangling for sysv units
---
src/systemctl/systemctl.c | 45 ++++++++++++++++++---------------------------
1 file changed, 18 insertions(+), 27 deletions(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index bb7ada9..d75281f 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4218,11 +4218,10 @@ static int set_environment(DBusConnection *bus, char **args) {
return 0;
}
-static int enable_sysv_units(char **args) {
+static int enable_sysv_units(const char *verb, char **args) {
int r = 0;
#if defined(HAVE_SYSV_COMPAT) && defined(HAVE_CHKCONFIG)
- const char *verb = args[0];
unsigned f = 1, t = 1;
LookupPaths paths = {};
@@ -4242,7 +4241,7 @@ static int enable_sysv_units(char **args) {
return r;
r = 0;
- for (f = 1; args[f]; f++) {
+ for (f = 0; args[f]; f++) {
const char *name;
_cleanup_free_ char *p = NULL, *q = NULL;
bool found_native = false, found_sysv;
@@ -4365,7 +4364,7 @@ finish:
lookup_paths_free(&paths);
/* Drop all SysV units */
- for (f = 1, t = 1; args[f]; f++) {
+ for (f = 0, t = 0; args[f]; f++) {
if (isempty(args[f]))
continue;
@@ -4423,16 +4422,16 @@ static int enable_unit(DBusConnection *bus, char **args) {
dbus_error_init(&error);
- r = enable_sysv_units(args);
- if (r < 0)
- return r;
-
if (!args[1])
return 0;
r = mangle_names(args+1, &mangled_names);
if (r < 0)
- goto finish;
+ return r;
+
+ r = enable_sysv_units(verb, mangled_names);
+ if (r < 0)
+ return r;
if (!bus || avoid_bus()) {
if (streq(verb, "enable")) {
@@ -4624,11 +4623,15 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
bool enabled;
char **name;
- char *n;
+ _cleanup_strv_free_ char **mangled_names = NULL;
dbus_error_init(&error);
- r = enable_sysv_units(args);
+ r = mangle_names(args+1, &mangled_names);
+ if (r < 0)
+ return r;
+
+ r = enable_sysv_units(args[0], mangled_names);
if (r < 0)
return r;
@@ -4636,16 +4639,10 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
if (!bus || avoid_bus()) {
- STRV_FOREACH(name, args+1) {
+ STRV_FOREACH(name, mangled_names) {
UnitFileState state;
- n = unit_name_mangle(*name);
- if (!n)
- return log_oom();
-
- state = unit_file_get_state(arg_scope, arg_root, n);
-
- free(n);
+ state = unit_file_get_state(arg_scope, arg_root, *name);
if (state < 0)
return state;
@@ -4660,13 +4657,9 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
}
} else {
- STRV_FOREACH(name, args+1) {
+ STRV_FOREACH(name, mangled_names) {
const char *s;
- n = unit_name_mangle(*name);
- if (!n)
- return log_oom();
-
r = bus_method_call_with_reply (
bus,
"org.freedesktop.systemd1",
@@ -4675,11 +4668,9 @@ static int unit_is_enabled(DBusConnection *bus, char **args) {
"GetUnitFileState",
&reply,
NULL,
- DBUS_TYPE_STRING, &n,
+ DBUS_TYPE_STRING, name,
DBUS_TYPE_INVALID);
- free(n);
-
if (r)
return r;

View File

@ -1,45 +0,0 @@
From 0f1ed3485115fd6bc7217658412ea6d7be511b5a Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:36:28 +0200
Subject: [PATCH] cryptsetup: fix OOM handling when parsing mount options
---
src/cryptsetup/cryptsetup.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 22b5eea..769c3e4 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -74,7 +74,7 @@ static int parse_one_option(const char *option) {
t = strdup(option+7);
if (!t)
- return -ENOMEM;
+ return log_oom();
free(opt_cipher);
opt_cipher = t;
@@ -89,9 +89,10 @@ static int parse_one_option(const char *option) {
} else if (startswith(option, "tcrypt-keyfile=")) {
opt_type = CRYPT_TCRYPT;
- if (path_is_absolute(option+15))
- opt_tcrypt_keyfiles = strv_append(opt_tcrypt_keyfiles, strdup(option+15));
- else
+ if (path_is_absolute(option+15)) {
+ if (strv_extend(&opt_tcrypt_keyfiles, option + 15) < 0)
+ return log_oom();
+ } else
log_error("Key file path '%s' is not absolute. Ignoring.", option+15);
} else if (startswith(option, "keyfile-size=")) {
@@ -113,7 +114,7 @@ static int parse_one_option(const char *option) {
t = strdup(option+5);
if (!t)
- return -ENOMEM;
+ return log_oom();
free(opt_hash);
opt_hash = t;

View File

@ -1,22 +0,0 @@
From 71ff575fffcd22db42de59abbeaf150bcf6ac144 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:36:43 +0200
Subject: [PATCH] journald: add missing error check
---
src/journal/journal-file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 1236403..81c344f 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -907,6 +907,8 @@ static int journal_file_append_field(
osize = offsetof(Object, field.payload) + size;
r = journal_file_append_object(f, OBJECT_FIELD, osize, &o, &p);
+ if (r < 0)
+ return r;
o->field.hash = htole64(hash);
memcpy(o->field.payload, field, size);

View File

@ -1,31 +0,0 @@
From f20403c231e9c7f5446066f01f2f5245238d978c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:11 +0200
Subject: [PATCH] bus: fix potentially uninitialized memory access
---
src/libsystemd-bus/bus-internal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libsystemd-bus/bus-internal.c b/src/libsystemd-bus/bus-internal.c
index 0e66f3d..cac948e 100644
--- a/src/libsystemd-bus/bus-internal.c
+++ b/src/libsystemd-bus/bus-internal.c
@@ -63,7 +63,7 @@ bool object_path_is_valid(const char *p) {
bool interface_name_is_valid(const char *p) {
const char *q;
- bool dot, found_dot;
+ bool dot, found_dot = false;
if (isempty(p))
return false;
@@ -103,7 +103,7 @@ bool interface_name_is_valid(const char *p) {
bool service_name_is_valid(const char *p) {
const char *q;
- bool dot, found_dot, unique;
+ bool dot, found_dot = false, unique;
if (isempty(p))
return false;

View File

@ -1,27 +0,0 @@
From 27d066e733e369873328e7bc0b67d91f07687cb0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:30 +0200
Subject: [PATCH] dbus: fix return value of dispatch_rqueue()
---
src/libsystemd-bus/sd-bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 3f766fb..db0880f 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1215,11 +1215,11 @@ static int dispatch_rqueue(sd_bus *bus, sd_bus_message **m) {
if (r == 0)
return ret;
- r = 1;
+ ret = 1;
} while (!z);
*m = z;
- return 1;
+ return ret;
}
int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {

View File

@ -1,24 +0,0 @@
From 3afab028b6bdeadd32e2c87b6f5a64019945358f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:44 +0200
Subject: [PATCH] modules-load: fix error handling
---
src/modules-load/modules-load.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 7b19ee0..49ee420 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -302,8 +302,8 @@ int main(int argc, char *argv[]) {
STRV_FOREACH(i, arg_proc_cmdline_modules) {
k = load_module(ctx, *i);
- if (k < 0)
- r = EXIT_FAILURE;
+ if (k < 0 && r == 0)
+ r = k;
}
r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);

View File

@ -1,23 +0,0 @@
From e0cbed4dbb7c21798b5eecf3d326fb778c4d0be2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:09 +0200
Subject: [PATCH] efi: never call qsort on potentially NULL arrays
---
src/shared/efivars.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 1d5b6f9..c015b16 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -384,7 +384,8 @@ int efi_get_boot_options(uint16_t **options) {
list[count ++] = id;
}
- qsort(list, count, sizeof(uint16_t), cmp_uint16);
+ if (list)
+ qsort(list, count, sizeof(uint16_t), cmp_uint16);
*options = list;
return count;

View File

@ -1,24 +0,0 @@
From b430e6ff0580b962c0b36dd5817dac681c159a58 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:28 +0200
Subject: [PATCH] strv: don't access potentially NULL string arrays
---
src/shared/env-util.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index 5e29629..7976881 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -405,7 +405,9 @@ char **strv_env_clean_log(char **e, const char *message) {
e[k++] = *p;
}
- e[k] = NULL;
+ if (e)
+ e[k] = NULL;
+
return e;
}

View File

@ -1,22 +0,0 @@
From 77c2f8448bc13bb796b9b8dbc93c684428ab38c2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:52 +0200
Subject: [PATCH] mkdir: pass a proper function pointer to mkdir_safe_internal
---
src/shared/mkdir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c
index b7e5c6e..43c6ea6 100644
--- a/src/shared/mkdir.c
+++ b/src/shared/mkdir.c
@@ -53,7 +53,7 @@ int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkd
}
int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid) {
- return mkdir_safe_internal(path, mode, uid, gid, false);
+ return mkdir_safe_internal(path, mode, uid, gid, mkdir);
}
static int is_dir(const char* path) {

View File

@ -1,23 +0,0 @@
From 4e1d571d8564b6383ced03316f0d84b96e1299a4 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Wed, 2 Oct 2013 15:35:16 -0400
Subject: [PATCH] tmpfiles.d: include setgid perms for /run/log/journal
4608af4333d0f7f5 set permissions for journal storage on persistent disk
but not the volatile storage.
ref: https://bugs.archlinux.org/task/37170
---
tmpfiles.d/systemd.conf | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tmpfiles.d/systemd.conf b/tmpfiles.d/systemd.conf
index b630440..a05c657 100644
--- a/tmpfiles.d/systemd.conf
+++ b/tmpfiles.d/systemd.conf
@@ -26,3 +26,5 @@ F /run/nologin 0644 - - - "System is booting up. See pam_nologin(8)"
m /var/log/journal 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/%m 2755 root systemd-journal - -

View File

@ -1,166 +0,0 @@
From 0a1d15d3b802128cc9be10c849c29b76a8fae3ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 2 Oct 2013 13:23:10 +0200
Subject: [PATCH] execute.c: always set $SHELL
In e6dca81 $SHELL was added to user@.service. Let's
instead provide it to all units which have a user.
---
TODO | 2 --
man/systemd.exec.xml | 21 +++++++++++++++++--
src/core/execute.c | 56 +++++++++++++++++---------------------------------
units/user@.service.in | 1 -
4 files changed, 38 insertions(+), 42 deletions(-)
diff --git a/TODO b/TODO
index 07269f4..425f673 100644
--- a/TODO
+++ b/TODO
@@ -54,8 +54,6 @@ CGroup Rework Completion:
Features:
-* set $SHELL where we set $HOME and $USER when User= is set of a service, drop its manual setting from user@.service
-
* we probably should replace the left-over uses of strv_append() and replace them by strv_push() or strv_extend()
* move config_parse_path_strv() out of conf-parser.c
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index f50161f..e213ec4 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -1021,10 +1021,13 @@
<varlistentry>
<term><varname>$USER</varname></term>
+ <term><varname>$LOGNAME</varname></term>
<term><varname>$HOME</varname></term>
+ <term><varname>$SHELL</varname></term>
- <listitem><para>User name and home
- directory. Set for the units which
+ <listitem><para>User name (twice), home
+ directory, and the login shell.
+ Set for the units which
have <varname>User=</varname> set,
which includes user
<command>systemd</command> instances.
@@ -1080,6 +1083,20 @@
<citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>$TERM</varname></term>
+
+ <listitem><para>Terminal type, set
+ only for units connected to a terminal
+ (<varname>StandardInput=tty</varname>,
+ <varname>StandardOutput=tty</varname>,
+ or
+ <varname>StandardError=tty</varname>).
+ See
+ <citerefentry><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+ </para></listitem>
+ </varlistentry>
</variablelist>
<para>Additional variables may be configured by the
diff --git a/src/core/execute.c b/src/core/execute.c
index a53ef48..3979f35 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1094,7 +1094,7 @@ int exec_spawn(ExecCommand *command,
if (pid == 0) {
int i, err;
sigset_t ss;
- const char *username = NULL, *home = NULL;
+ const char *username = NULL, *home = NULL, *shell = NULL;
uid_t uid = (uid_t) -1;
gid_t gid = (gid_t) -1;
_cleanup_strv_free_ char **our_env = NULL, **pam_env = NULL,
@@ -1277,7 +1277,7 @@ int exec_spawn(ExecCommand *command,
if (context->user) {
username = context->user;
- err = get_user_creds(&username, &uid, &gid, &home, NULL);
+ err = get_user_creds(&username, &uid, &gid, &home, &shell);
if (err < 0) {
r = EXIT_USER;
goto fail_child;
@@ -1462,46 +1462,28 @@ int exec_spawn(ExecCommand *command,
}
}
- our_env = new0(char*, 7);
- if (!our_env) {
+ our_env = new(char*, 8);
+ if (!our_env ||
+ (n_fds > 0 && (
+ asprintf(our_env + n_env++, "LISTEN_PID=%lu", (unsigned long) getpid()) < 0 ||
+ asprintf(our_env + n_env++, "LISTEN_FDS=%u", n_fds) < 0)) ||
+ (home && asprintf(our_env + n_env++, "HOME=%s", home) < 0) ||
+ (username && (
+ asprintf(our_env + n_env++, "LOGNAME=%s", username) < 0 ||
+ asprintf(our_env + n_env++, "USER=%s", username) < 0)) ||
+ (shell && asprintf(our_env + n_env++, "SHELL=%s", shell) < 0) ||
+ ((is_terminal_input(context->std_input) ||
+ context->std_output == EXEC_OUTPUT_TTY ||
+ context->std_error == EXEC_OUTPUT_TTY) && (
+ !(our_env[n_env++] = strdup(default_term_for_tty(tty_path(context))))))) {
+
err = -ENOMEM;
r = EXIT_MEMORY;
goto fail_child;
}
- if (n_fds > 0)
- if (asprintf(our_env + n_env++, "LISTEN_PID=%lu", (unsigned long) getpid()) < 0 ||
- asprintf(our_env + n_env++, "LISTEN_FDS=%u", n_fds) < 0) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- if (home)
- if (asprintf(our_env + n_env++, "HOME=%s", home) < 0) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- if (username)
- if (asprintf(our_env + n_env++, "LOGNAME=%s", username) < 0 ||
- asprintf(our_env + n_env++, "USER=%s", username) < 0) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- if (is_terminal_input(context->std_input) ||
- context->std_output == EXEC_OUTPUT_TTY ||
- context->std_error == EXEC_OUTPUT_TTY)
- if (!(our_env[n_env++] = strdup(default_term_for_tty(tty_path(context))))) {
- err = -ENOMEM;
- r = EXIT_MEMORY;
- goto fail_child;
- }
-
- assert(n_env <= 7);
+ our_env[n_env++] = NULL;
+ assert(n_env <= 8);
final_env = strv_env_merge(5,
environment,
diff --git a/units/user@.service.in b/units/user@.service.in
index 3718a57..3f8b59d 100644
--- a/units/user@.service.in
+++ b/units/user@.service.in
@@ -13,7 +13,6 @@ After=systemd-user-sessions.service
User=%I
PAMName=systemd-user
Type=notify
-Environment=SHELL=%s
ExecStart=-@rootlibexecdir@/systemd --user
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket
Slice=user-%i.slice

View File

@ -1,42 +0,0 @@
From f4c2f322509191d38f6e94fac06607d1dd99b4ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Thu, 3 Oct 2013 15:47:26 +0200
Subject: [PATCH] man: Improve the description of parameter X in tmpfiles.d
page
---
man/tmpfiles.d.xml | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml
index 9fc4b7c..e8b630d 100644
--- a/man/tmpfiles.d.xml
+++ b/man/tmpfiles.d.xml
@@ -184,15 +184,18 @@ L /tmp/foobar - - - - /dev/null</programlisting>
<varlistentry>
<term><varname>X</varname></term>
<listitem><para>Ignore a path
- during cleanup. Use this type
- to prevent path removal as
- controlled with the Age parameter.
- Note that if path is a directory,
- content of a directory is not
- excluded from clean-up, only
- directory itself. Lines of this
- type accept shell-style globs
- in place of normal path
+ during cleaning. Use this type
+ to exclude paths from clean-up
+ as controlled with the Age
+ parameter. Unlike x this
+ parameter will not exclude the
+ content if path is a directory,
+ but only directory itself.
+ Note that lines of this type do
+ not influence the effect of r
+ or R lines. Lines of this type
+ accept shell-style globs in
+ place of normal path
names.</para></listitem>
</varlistentry>

View File

@ -1,121 +0,0 @@
From 669ac5ee25f166bdf688b06f96e8e8fd3cf9f43c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 28 Aug 2013 08:01:30 -0400
Subject: [PATCH] execute: more debugging messages
---
src/core/execute.c | 35 +++++++++++++++++++++--------------
src/login/pam-module.c | 3 ++-
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/src/core/execute.c b/src/core/execute.c
index 3979f35..3f7ca52 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -317,12 +317,12 @@ static int setup_input(const ExecContext *context, int socket_fd, bool apply_tty
case EXEC_INPUT_TTY_FAIL: {
int fd, r;
- if ((fd = acquire_terminal(
- tty_path(context),
- i == EXEC_INPUT_TTY_FAIL,
- i == EXEC_INPUT_TTY_FORCE,
- false,
- (usec_t) -1)) < 0)
+ fd = acquire_terminal(tty_path(context),
+ i == EXEC_INPUT_TTY_FAIL,
+ i == EXEC_INPUT_TTY_FORCE,
+ false,
+ (usec_t) -1);
+ if (fd < 0)
return fd;
if (fd != STDIN_FILENO) {
@@ -748,6 +748,7 @@ static int setup_pam(
char **e = NULL;
bool close_session = false;
pid_t pam_pid = 0, parent_pid;
+ int flags = 0;
assert(name);
assert(user);
@@ -760,6 +761,9 @@ static int setup_pam(
* daemon. We do things this way to ensure that the main PID
* of the daemon is the one we initially fork()ed. */
+ if (log_get_max_level() < LOG_PRI(LOG_DEBUG))
+ flags |= PAM_SILENT;
+
pam_code = pam_start(name, user, &conv, &handle);
if (pam_code != PAM_SUCCESS) {
handle = NULL;
@@ -772,11 +776,11 @@ static int setup_pam(
goto fail;
}
- pam_code = pam_acct_mgmt(handle, PAM_SILENT);
+ pam_code = pam_acct_mgmt(handle, flags);
if (pam_code != PAM_SUCCESS)
goto fail;
- pam_code = pam_open_session(handle, PAM_SILENT);
+ pam_code = pam_open_session(handle, flags);
if (pam_code != PAM_SUCCESS)
goto fail;
@@ -850,7 +854,7 @@ static int setup_pam(
/* If our parent died we'll end the session */
if (getppid() != parent_pid) {
- pam_code = pam_close_session(handle, PAM_DATA_SILENT);
+ pam_code = pam_close_session(handle, flags);
if (pam_code != PAM_SUCCESS)
goto child_finish;
}
@@ -858,7 +862,7 @@ static int setup_pam(
r = 0;
child_finish:
- pam_end(handle, pam_code | PAM_DATA_SILENT);
+ pam_end(handle, pam_code | flags);
_exit(r);
}
@@ -880,16 +884,19 @@ static int setup_pam(
return 0;
fail:
- if (pam_code != PAM_SUCCESS)
+ if (pam_code != PAM_SUCCESS) {
+ log_error("PAM failed: %s", pam_strerror(handle, pam_code));
err = -EPERM; /* PAM errors do not map to errno */
- else
+ } else {
+ log_error("PAM failed: %m");
err = -errno;
+ }
if (handle) {
if (close_session)
- pam_code = pam_close_session(handle, PAM_DATA_SILENT);
+ pam_code = pam_close_session(handle, flags);
- pam_end(handle, pam_code | PAM_DATA_SILENT);
+ pam_end(handle, pam_code | flags);
}
strv_free(e);
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 49296b5..973daf7 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -199,7 +199,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
dbus_error_init(&error);
- /* pam_syslog(handle, LOG_INFO, "pam-systemd initializing"); */
+ if (debug)
+ pam_syslog(handle, LOG_INFO, "pam-systemd initializing");
/* Make this a NOP on non-logind systems */
if (!logind_running())

View File

@ -1,37 +0,0 @@
From d25cc648fed1d6902d07c74afd71458f971ab314 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 3 Oct 2013 22:13:01 -0400
Subject: [PATCH] gpt-auto-generator: exit immediately if in container
Otherwise we get an ugly warning when running systemd in
a container.
---
src/gpt-auto-generator/gpt-auto-generator.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index ca54925..d2b4213 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -38,6 +38,7 @@
#include "libudev.h"
#include "special.h"
#include "unit-name.h"
+#include "virt.h"
/* TODO:
*
@@ -481,6 +482,13 @@ int main(int argc, char *argv[]) {
umask(0022);
if (in_initrd()) {
+ log_debug("In initrd, exiting.");
+ r = 0;
+ goto finish;
+ }
+
+ if (detect_container(NULL) > 0) {
+ log_debug("In a container, exiting.");
r = 0;
goto finish;
}

View File

@ -1,38 +0,0 @@
From 095da7cd7cdb33cd5efe7a53c77862aa677045d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 3 Oct 2013 22:15:08 -0400
Subject: [PATCH] systemd: order remote mounts from mountinfo before
remote-fs.target
Usually the network is stopped before filesystems are umounted.
Ordering network filesystems before remote-fs.target means that their
unmounting will be performed earlier, and can terminate sucessfully.
https://bugs.freedesktop.org/show_bug.cgi?id=70002
---
src/core/mount.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 3d46557..93bfa99 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1440,6 +1440,9 @@ static int mount_add_one(
u = manager_get_unit(m, e);
if (!u) {
+ const char* const target =
+ fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+
delete = true;
u = unit_new(m, sizeof(Mount));
@@ -1466,7 +1469,7 @@ static int mount_add_one(
goto fail;
}
- r = unit_add_dependency_by_name(u, UNIT_BEFORE, SPECIAL_LOCAL_FS_TARGET, NULL, true);
+ r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
if (r < 0)
goto fail;

View File

@ -1,42 +0,0 @@
From 8f84713d297fcba39b65e7409ec114009896c3ff Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 4 Oct 2013 17:01:37 +0200
Subject: [PATCH] manager: when verifying whether clients may change
environment using selinux check for "reload" rather "reboot"
This appears to be a copy/paste error.
---
src/core/dbus-manager.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 676a07f..8f4d017 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1397,7 +1397,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
_cleanup_strv_free_ char **l = NULL;
char **e = NULL;
- SELINUX_ACCESS_CHECK(connection, message, "reboot");
+ SELINUX_ACCESS_CHECK(connection, message, "reload");
r = bus_parse_strv(message, &l);
if (r == -ENOMEM)
@@ -1424,7 +1424,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
_cleanup_strv_free_ char **l = NULL;
char **e = NULL;
- SELINUX_ACCESS_CHECK(connection, message, "reboot");
+ SELINUX_ACCESS_CHECK(connection, message, "reload");
r = bus_parse_strv(message, &l);
if (r == -ENOMEM)
@@ -1452,7 +1452,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
char **f = NULL;
DBusMessageIter iter;
- SELINUX_ACCESS_CHECK(connection, message, "reboot");
+ SELINUX_ACCESS_CHECK(connection, message, "reload");
if (!dbus_message_iter_init(message, &iter))
goto oom;

View File

@ -1,22 +0,0 @@
From e25723afe5ebc4b05d5330a935bb654904eaf2f0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 4 Oct 2013 21:16:40 +0200
Subject: [PATCH] logind: fix bus introspection data for TakeControl()
---
src/login/logind-session-dbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
index 5f6bafb..be4e01c 100644
--- a/src/login/logind-session-dbus.c
+++ b/src/login/logind-session-dbus.c
@@ -41,7 +41,7 @@
" <arg name=\"who\" type=\"s\"/>\n" \
" <arg name=\"signal\" type=\"s\"/>\n" \
" </method>\n" \
- " <method name=\"TakeControl\"/>\n" \
+ " <method name=\"TakeControl\">\n" \
" <arg name=\"force\" type=\"b\"/>\n" \
" </method>\n" \
" <method name=\"ReleaseControl\"/>\n" \

View File

@ -1,26 +0,0 @@
From 61ccd1762fa0f9a8ec9285a8a7367fc03bcc5982 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Fri, 4 Oct 2013 18:22:40 -0400
Subject: [PATCH] mount: check for NULL before reading pm->what
Since a57f7e2c828b85, a mount unit with garbage in it would cause
systemd to crash on loading it.
ref: https://bugs.freedesktop.org/show_bug.cgi?id=70148
---
src/core/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 93bfa99..db055f0 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -182,7 +182,7 @@ static int mount_add_mount_links(Mount *m) {
* for the source path (if this is a bind mount) to be
* available. */
pm = get_mount_parameters_fragment(m);
- if (pm && path_is_absolute(pm->what)) {
+ if (pm && pm->what && path_is_absolute(pm->what)) {
r = unit_require_mounts_for(UNIT(m), pm->what);
if (r < 0)
return r;

View File

@ -1,178 +0,0 @@
From 47c666095e4ed827bbb15b6e58b760dc5dcd97ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 5 Oct 2013 13:09:43 -0400
Subject: [PATCH] core: do not add "what" to RequiresMountsFor for network
mounts
For cifs mount like //server/share, we would get
RequiresMountsFor=/server/share, which probably isn't
harmful, but quite confusing.
Unfortunately a bunch of static functions had to be moved
up, but patch is really one line.
---
src/core/mount.c | 137 ++++++++++++++++++++++++++++---------------------------
1 file changed, 70 insertions(+), 67 deletions(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index db055f0..70cd372 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -59,6 +59,72 @@ static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
[MOUNT_FAILED] = UNIT_FAILED
};
+static char* mount_test_option(const char *haystack, const char *needle) {
+ struct mntent me = { .mnt_opts = (char*) haystack };
+
+ assert(needle);
+
+ /* Like glibc's hasmntopt(), but works on a string, not a
+ * struct mntent */
+
+ if (!haystack)
+ return NULL;
+
+ return hasmntopt(&me, needle);
+}
+
+static bool mount_is_network(MountParameters *p) {
+ assert(p);
+
+ if (mount_test_option(p->options, "_netdev"))
+ return true;
+
+ if (p->fstype && fstype_is_network(p->fstype))
+ return true;
+
+ return false;
+}
+
+static bool mount_is_bind(MountParameters *p) {
+ assert(p);
+
+ if (mount_test_option(p->options, "bind"))
+ return true;
+
+ if (p->fstype && streq(p->fstype, "bind"))
+ return true;
+
+ if (mount_test_option(p->options, "rbind"))
+ return true;
+
+ if (p->fstype && streq(p->fstype, "rbind"))
+ return true;
+
+ return false;
+}
+
+static bool mount_is_auto(MountParameters *p) {
+ assert(p);
+
+ return !mount_test_option(p->options, "noauto");
+}
+
+static bool needs_quota(MountParameters *p) {
+ assert(p);
+
+ if (mount_is_network(p))
+ return false;
+
+ if (mount_is_bind(p))
+ return false;
+
+ return mount_test_option(p->options, "usrquota") ||
+ mount_test_option(p->options, "grpquota") ||
+ mount_test_option(p->options, "quota") ||
+ mount_test_option(p->options, "usrjquota") ||
+ mount_test_option(p->options, "grpjquota");
+}
+
static void mount_init(Unit *u) {
Mount *m = MOUNT(u);
@@ -182,7 +248,10 @@ static int mount_add_mount_links(Mount *m) {
* for the source path (if this is a bind mount) to be
* available. */
pm = get_mount_parameters_fragment(m);
- if (pm && pm->what && path_is_absolute(pm->what)) {
+ if (pm && pm->what &&
+ path_is_absolute(pm->what) &&
+ !mount_is_network(pm)) {
+
r = unit_require_mounts_for(UNIT(m), pm->what);
if (r < 0)
return r;
@@ -214,72 +283,6 @@ static int mount_add_mount_links(Mount *m) {
return 0;
}
-static char* mount_test_option(const char *haystack, const char *needle) {
- struct mntent me = { .mnt_opts = (char*) haystack };
-
- assert(needle);
-
- /* Like glibc's hasmntopt(), but works on a string, not a
- * struct mntent */
-
- if (!haystack)
- return NULL;
-
- return hasmntopt(&me, needle);
-}
-
-static bool mount_is_network(MountParameters *p) {
- assert(p);
-
- if (mount_test_option(p->options, "_netdev"))
- return true;
-
- if (p->fstype && fstype_is_network(p->fstype))
- return true;
-
- return false;
-}
-
-static bool mount_is_bind(MountParameters *p) {
- assert(p);
-
- if (mount_test_option(p->options, "bind"))
- return true;
-
- if (p->fstype && streq(p->fstype, "bind"))
- return true;
-
- if (mount_test_option(p->options, "rbind"))
- return true;
-
- if (p->fstype && streq(p->fstype, "rbind"))
- return true;
-
- return false;
-}
-
-static bool mount_is_auto(MountParameters *p) {
- assert(p);
-
- return !mount_test_option(p->options, "noauto");
-}
-
-static bool needs_quota(MountParameters *p) {
- assert(p);
-
- if (mount_is_network(p))
- return false;
-
- if (mount_is_bind(p))
- return false;
-
- return mount_test_option(p->options, "usrquota") ||
- mount_test_option(p->options, "grpquota") ||
- mount_test_option(p->options, "quota") ||
- mount_test_option(p->options, "usrjquota") ||
- mount_test_option(p->options, "grpjquota");
-}
-
static int mount_add_device_links(Mount *m) {
MountParameters *p;
bool device_wants_mount = false;

View File

@ -1,44 +0,0 @@
From 5b5f505ab485dd60fb608ffb2eecd755537f039f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 5 Oct 2013 22:47:52 -0400
Subject: [PATCH] utf8: fix utf8_is_printable
---
src/shared/utf8.c | 5 +++--
src/test/test-utf8.c | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/shared/utf8.c b/src/shared/utf8.c
index a8e28ac..31120af 100644
--- a/src/shared/utf8.c
+++ b/src/shared/utf8.c
@@ -141,14 +141,15 @@ bool utf8_is_printable(const char* str, size_t length) {
assert(str);
- for (p = (const uint8_t*) str; length; p++) {
+ for (p = (const uint8_t*) str; length;) {
int encoded_len = utf8_encoded_valid_unichar((const char *)p);
- int32_t val = utf8_encoded_to_unichar((const char*)p);
+ int val = utf8_encoded_to_unichar((const char*)p);
if (encoded_len < 0 || val < 0 || is_unicode_control(val))
return false;
length -= encoded_len;
+ p += encoded_len;
}
return true;
diff --git a/src/test/test-utf8.c b/src/test/test-utf8.c
index 7bd0db1..f0182ee 100644
--- a/src/test/test-utf8.c
+++ b/src/test/test-utf8.c
@@ -26,6 +26,7 @@ static void test_utf8_is_printable(void) {
assert_se(utf8_is_printable("ascii is valid\tunicode", 22));
assert_se(utf8_is_printable("\342\204\242", 3));
assert_se(!utf8_is_printable("\341\204", 2));
+ assert_se(utf8_is_printable("ąę", 4));
}
static void test_utf8_is_valid(void) {

View File

@ -1,47 +0,0 @@
From c3d2db4dd65bf5127cbddec2edd931399ce5ebce Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sun, 6 Oct 2013 18:26:23 -0400
Subject: [PATCH] shared/util: fix off-by-one error in tag_to_udev_node
Triggered false negatives when encoding a string which needed every
character to be escaped, e.g. "LABEL=/".
---
src/shared/util.c | 2 +-
src/test/test-device-nodes.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 9be6acf..748f1bb 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3527,7 +3527,7 @@ static char *tag_to_udev_node(const char *tagvalue, const char *by) {
if (u == NULL)
return NULL;
- enc_len = strlen(u) * 4;
+ enc_len = strlen(u) * 4 + 1;
t = new(char, enc_len);
if (t == NULL)
return NULL;
diff --git a/src/test/test-device-nodes.c b/src/test/test-device-nodes.c
index 2f3dedb..59ba4be 100644
--- a/src/test/test-device-nodes.c
+++ b/src/test/test-device-nodes.c
@@ -26,7 +26,7 @@
/* helpers for test_encode_devnode_name */
static char *do_encode_string(const char *in) {
- size_t out_len = strlen(in) * 4;
+ size_t out_len = strlen(in) * 4 + 1;
char *out = malloc(out_len);
assert_se(out);
@@ -46,6 +46,8 @@ static void test_encode_devnode_name(void) {
assert_se(expect_encoded_as("pinkiepie", "pinkiepie"));
assert_se(expect_encoded_as("valíd\\ųtf8", "valíd\\x5cųtf8"));
assert_se(expect_encoded_as("s/ash/ng", "s\\x2fash\\x2fng"));
+ assert_se(expect_encoded_as("/", "\\x2f"));
+ assert_se(expect_encoded_as("!", "\\x21"));
}
int main(int argc, char *argv[]) {

View File

@ -1,48 +0,0 @@
From adb4105cf7f0018d05696f96a1058041037c9243 Mon Sep 17 00:00:00 2001
From: Sylvia Else <sylviabz1@cryogenic.net>
Date: Sun, 6 Oct 2013 23:06:35 -0400
Subject: [PATCH] systemd: serialize/deserialize forbid_restart value
The Service type's forbid_restart field was not preserved by
serialization/deserialization, so the fact that the service should not
be restarted after stopping was lost.
If a systemctl stop foo command has been given, but the foo service
has not yet stopped, and then the systemctl --system daemon-reload was
given, then when the foo service eventually stopped, systemd would
restart it.
https://bugs.freedesktop.org/show_bug.cgi?id=69800
---
src/core/service.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/core/service.c b/src/core/service.c
index 6792024..98b1599 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2651,6 +2651,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
if (s->exec_context.var_tmp_dir)
unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir);
+ if (s->forbid_restart)
+ unit_serialize_item(u, f, "forbid_restart", yes_no(s->forbid_restart));
+
return 0;
}
@@ -2787,6 +2790,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
return log_oom();
s->exec_context.var_tmp_dir = t;
+ } else if (streq(key, "forbid_restart")) {
+ int b;
+
+ b = parse_boolean(value);
+ if (b < 0)
+ log_debug_unit(u->id, "Failed to parse forbid_restart value %s", value);
+ else
+ s->forbid_restart = b;
} else
log_debug_unit(u->id, "Unknown serialization key '%s'", key);

View File

@ -1,37 +0,0 @@
From 7d1f35a5838363c2d1981fc62f5bbcb43cbdc57c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 9 Oct 2013 00:13:55 +0200
Subject: [PATCH] core: unify the way we denote serialization attributes
---
src/core/service.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 98b1599..96ed2d3 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2652,7 +2652,7 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir);
if (s->forbid_restart)
- unit_serialize_item(u, f, "forbid_restart", yes_no(s->forbid_restart));
+ unit_serialize_item(u, f, "forbid-restart", yes_no(s->forbid_restart));
return 0;
}
@@ -2790,12 +2790,12 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
return log_oom();
s->exec_context.var_tmp_dir = t;
- } else if (streq(key, "forbid_restart")) {
+ } else if (streq(key, "forbid-restart")) {
int b;
b = parse_boolean(value);
if (b < 0)
- log_debug_unit(u->id, "Failed to parse forbid_restart value %s", value);
+ log_debug_unit(u->id, "Failed to parse forbid-restart value %s", value);
else
s->forbid_restart = b;
} else

View File

@ -1,22 +0,0 @@
From 85f4505eab750835fdfe022012bf7d33123bc940 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 9 Oct 2013 04:03:45 +0200
Subject: [PATCH] journald: fix minor memory leak
---
src/journal/journal-vacuum.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index c73ad8f..8d5effb 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -278,6 +278,8 @@ int journal_directory_vacuum(
} else if (errno != ENOENT)
log_warning("Failed to delete %s/%s: %m", directory, p);
+ free(p);
+
continue;
}

View File

@ -1,39 +0,0 @@
From 6381c0c4adc2d637ad53dd81cfeb73d7b4a2cbcb Mon Sep 17 00:00:00 2001
From: Martin Pitt <martinpitt@gnome.org>
Date: Wed, 9 Oct 2013 16:05:15 +0200
Subject: [PATCH] keymap: Fix Samsung 900X[34]C
It appears that it's not really the 900 vs. 940 or the X3 vs X4, but the
A/B/C/D suffix after that which makes the difference between the keymaps. On a
NP900X3C-A04RU you get
MODALIAS=dmi:bvn*:bvr*:bd*:svnSAMSUNGELECTRONICSCO.,LTD.:pn900X3C/900X3D/900X4C/900X4D:*
So change the matches to use AB vs. CDG as the differentiator.
Thanks to Anatoly Markov for reporting and testing!
---
hwdb/60-keyboard.hwdb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
index 20d398f..b497f92 100644
--- a/hwdb/60-keyboard.hwdb
+++ b/hwdb/60-keyboard.hwdb
@@ -904,6 +904,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*550P*:pvr*
KEYBOARD_KEY_a9=! # Fn Lock - Function lock off
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*700Z*:pvr*
+keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][CDG]*:pvr*
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr*
KEYBOARD_KEY_ce=!prog1 # Fn+F1 launch settings
KEYBOARD_KEY_a0=!mute # Fn+F6 mute
@@ -915,7 +916,7 @@ keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*940X3G*:pvr*
# Series 9
keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*90X3A*:pvr*
-keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34]*:pvr*
+keyboard:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn*900X[34][AB]*:pvr*
KEYBOARD_KEY_ce=! # Fn+F8 keyboard backlight up
KEYBOARD_KEY_8d=! # Fn+F7 keyboard backlight down
KEYBOARD_KEY_96=! # Fn+F1 performance mode (?)

View File

@ -1,30 +0,0 @@
From 44d7510b31f3e9331a2c6b5518438697404655c6 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 10 Oct 2013 01:38:11 +0200
Subject: [PATCH] do not accept "garbage" from acpi firmware performance data
(FPDT)
00000000 46 42 50 54 38 00 00 00 02 00 30 02 00 00 00 00 |FBPT8.....0.....|
00000010 23 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |#E..............|
00000020 f5 6a 51 00 00 00 00 00 00 00 00 00 00 00 00 00 |.jQ.............|
00000030 00 00 00 00 00 00 00 00 70 74 61 6c 58 00 00 00 |........ptalX...|
---
src/shared/acpi-fpdt.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index af58c7c..75648b4 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -146,6 +146,11 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
if (brec.type != ACPI_FPDT_BOOT_REC)
return -EINVAL;
+ if (brec.startup_start == 0 || brec.exit_services_exit < brec.startup_start)
+ return -EINVAL;
+ if (brec.exit_services_exit > NSEC_PER_HOUR)
+ return -EINVAL;
+
if (loader_start)
*loader_start = brec.startup_start / 1000;
if (loader_exit)

View File

@ -1,36 +0,0 @@
From c9cceff90794d452b16a5dd8d1c53cdb44f4a002 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 9 Oct 2013 22:13:13 -0400
Subject: [PATCH] journald: remove rotated file from hashmap when rotation
fails
Before, when the user journal file was rotated, journal_file_rotate
could close the old file and fail to open the new file. In that
case, we would leave the old (deallocated) file in the hashmap.
On subsequent accesses, we could retrieve this stale entry, leading
to a segfault.
When journal_file_rotate fails with the file pointer set to 0,
old file is certainly gone, and cannot be used anymore.
https://bugzilla.redhat.com/show_bug.cgi?id=890463
---
src/journal/journald-server.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 4f47eb1..e03e413 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -321,8 +321,10 @@ void server_rotate(Server *s) {
if (r < 0)
if (f)
log_error("Failed to rotate %s: %s", f->path, strerror(-r));
- else
+ else {
log_error("Failed to create user journal: %s", strerror(-r));
+ hashmap_remove(s->user_journals, k);
+ }
else {
hashmap_replace(s->user_journals, k, f);
server_fix_perms(s, f, PTR_TO_UINT32(k));

View File

@ -1,24 +0,0 @@
From a72c398b5af558d231decbbf12c7990dbd38c682 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Thu, 10 Oct 2013 13:09:37 +0200
Subject: [PATCH] login: fix invalid free() in sd_session_get_vt()
We need to clear variables markes as _cleanup_free_. Otherwise, our
error-paths might corrupt random memory.
---
src/login/sd-login.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index 71d8c29..6c27dfe 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -350,7 +350,7 @@ _public_ int sd_session_get_tty(const char *session, char **tty) {
}
_public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
- _cleanup_free_ char *vtnr_string;
+ _cleanup_free_ char *vtnr_string = NULL;
unsigned u;
int r;

View File

@ -1,24 +0,0 @@
From 88a16dc6bd64267e4a0fbe58f2e8d273c096f1e5 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Thu, 10 Oct 2013 13:11:27 +0200
Subject: [PATCH] login: make sd_session_get_vt() actually work
We use VTNR, not VTNr as key. Until now sd_session_get_vt() just returns
an error.
---
src/login/sd-login.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index 6c27dfe..7e25041 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -354,7 +354,7 @@ _public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
unsigned u;
int r;
- r = session_get_string(session, "VTNr", &vtnr_string);
+ r = session_get_string(session, "VTNR", &vtnr_string);
if (r < 0)
return r;

View File

@ -1,31 +0,0 @@
From 2ef8bf3f6b44d2860b149ad09cf8aea3a4f1bd42 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sun, 13 Oct 2013 17:42:51 -0400
Subject: [PATCH] udevadm.xml: document --resolve-names option for test
And remove documentation of the --subsystem flag which doesn't actually
exist.
---
man/udevadm.xml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/man/udevadm.xml b/man/udevadm.xml
index d0b257d..b959216 100644
--- a/man/udevadm.xml
+++ b/man/udevadm.xml
@@ -462,9 +462,13 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--subsystem=<replaceable>string</replaceable></option></term>
+ <term><option>--resolve-names=<replaceable>early|late|never</replaceable></option></term>
<listitem>
- <para>The subsystem string.</para>
+ <para>Specify when udevadm should resolve names of users and groups.
+ When set to early (the default) names will be resolved when the
+ rules are parsed. When set to late names will be resolved for
+ every event. When set to never names will never be resolved and
+ all devices will be owned by root.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -1,382 +0,0 @@
From 88bef035149080be5a83f90d91d5b13cec9749e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:13 -0400
Subject: [PATCH] Never call qsort on potentially NULL arrays
This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.
---
src/analyze/systemd-analyze.c | 2 +-
src/cgtop/cgtop.c | 2 +-
src/core/namespace.c | 38 ++++++++++++++++++++------------------
src/journal/catalog.c | 2 +-
src/journal/journal-file.c | 2 +-
src/journal/journal-vacuum.c | 3 +--
src/journal/journalctl.c | 2 +-
src/libsystemd-bus/bus-match.c | 2 +-
src/libudev/libudev-enumerate.c | 2 +-
src/nss-myhostname/netlink.c | 3 ++-
src/readahead/readahead-collect.c | 39 ++++++++++++++++++++++-----------------
src/shared/cgroup-show.c | 2 ++
src/shared/conf-files.c | 2 +-
src/shared/efivars.c | 3 +--
src/shared/fileio.c | 1 +
src/shared/util.h | 12 ++++++++++++
src/systemctl/systemctl.c | 10 +++++-----
17 files changed, 74 insertions(+), 53 deletions(-)
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 27d063c..a4f15eb 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -768,7 +768,7 @@ static int list_dependencies_one(DBusConnection *bus, const char *name, unsigned
if (r < 0)
return r;
- qsort(deps, strv_length(deps), sizeof (char*), list_dependencies_compare);
+ qsort_safe(deps, strv_length(deps), sizeof (char*), list_dependencies_compare);
r = acquire_boot_times(bus, &boot);
if (r < 0)
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index cacf705..293a211 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -461,7 +461,7 @@ static int display(Hashmap *a) {
if (g->n_tasks_valid || g->cpu_valid || g->memory_valid || g->io_valid)
array[n++] = g;
- qsort(array, n, sizeof(Group*), group_compare);
+ qsort_safe(array, n, sizeof(Group*), group_compare);
/* Find the longest names in one run */
for (j = 0; j < n; j++) {
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 16b132b..936f368 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -222,7 +222,7 @@ int setup_namespace(char** read_write_dirs,
strv_length(read_only_dirs) +
strv_length(inaccessible_dirs) +
(private_tmp ? 2 : 0);
- BindMount *m, *mounts;
+ BindMount *m, *mounts = NULL;
int r = 0;
if (!mount_flags)
@@ -231,27 +231,29 @@ int setup_namespace(char** read_write_dirs,
if (unshare(CLONE_NEWNS) < 0)
return -errno;
- m = mounts = (BindMount *) alloca(n * sizeof(BindMount));
- if ((r = append_mounts(&m, read_write_dirs, READWRITE)) < 0 ||
- (r = append_mounts(&m, read_only_dirs, READONLY)) < 0 ||
- (r = append_mounts(&m, inaccessible_dirs, INACCESSIBLE)) < 0)
- return r;
+ if (n) {
+ m = mounts = (BindMount *) alloca(n * sizeof(BindMount));
+ if ((r = append_mounts(&m, read_write_dirs, READWRITE)) < 0 ||
+ (r = append_mounts(&m, read_only_dirs, READONLY)) < 0 ||
+ (r = append_mounts(&m, inaccessible_dirs, INACCESSIBLE)) < 0)
+ return r;
+
+ if (private_tmp) {
+ m->path = "/tmp";
+ m->mode = PRIVATE_TMP;
+ m++;
+
+ m->path = "/var/tmp";
+ m->mode = PRIVATE_VAR_TMP;
+ m++;
+ }
- if (private_tmp) {
- m->path = "/tmp";
- m->mode = PRIVATE_TMP;
- m++;
+ assert(mounts + n == m);
- m->path = "/var/tmp";
- m->mode = PRIVATE_VAR_TMP;
- m++;
+ qsort(mounts, n, sizeof(BindMount), mount_path_compare);
+ drop_duplicates(mounts, &n);
}
- assert(mounts + n == m);
-
- qsort(mounts, n, sizeof(BindMount), mount_path_compare);
- drop_duplicates(mounts, &n);
-
/* Remount / as SLAVE so that nothing now mounted in the namespace
shows up in the parent */
if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL) < 0)
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index 7738d24..90ca008 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -399,7 +399,7 @@ int catalog_update(const char* database, const char* root, const char* const* di
}
assert(n == hashmap_size(h));
- qsort(items, n, sizeof(CatalogItem), catalog_compare_func);
+ qsort_safe(items, n, sizeof(CatalogItem), catalog_compare_func);
r = write_catalog(database, h, sb, items, n);
if (r < 0)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 81c344f..425e38a 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1344,7 +1344,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
/* Order by the position on disk, in order to improve seek
* times for rotating media. */
- qsort(items, n_iovec, sizeof(EntryItem), entry_item_cmp);
+ qsort_safe(items, n_iovec, sizeof(EntryItem), entry_item_cmp);
r = journal_file_append_entry_internal(f, ts, xor_hash, items, n_iovec, seqnum, ret, offset);
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 8d5effb..d4a1c6c 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -299,8 +299,7 @@ int journal_directory_vacuum(
n_list ++;
}
- if (n_list > 0)
- qsort(list, n_list, sizeof(struct vacuum_info), vacuum_compare);
+ qsort_safe(list, n_list, sizeof(struct vacuum_info), vacuum_compare);
for (i = 0; i < n_list; i++) {
struct statvfs ss;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 9a2d255..0876ee6 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -755,7 +755,7 @@ static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative
sd_journal_flush_matches(j);
}
- qsort(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
+ qsort_safe(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
if (sd_id128_equal(*boot_id, SD_ID128_NULL)) {
if (relative > (int) count || relative <= -(int)count)
diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c
index 1411167..916682a 100644
--- a/src/libsystemd-bus/bus-match.c
+++ b/src/libsystemd-bus/bus-match.c
@@ -768,7 +768,7 @@ int bus_match_parse(
}
/* Order the whole thing, so that we always generate the same tree */
- qsort(components, n_components, sizeof(struct bus_match_component), match_component_compare);
+ qsort_safe(components, n_components, sizeof(struct bus_match_component), match_component_compare);
/* Check for duplicates */
for (i = 0; i+1 < n_components; i++)
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index 8146f27..e71d766 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -276,7 +276,7 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume
size_t move_later_prefix = 0;
udev_list_cleanup(&udev_enumerate->devices_list);
- qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp);
+ qsort_safe(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp);
max = udev_enumerate->devices_cur;
for (i = 0; i < max; i++) {
diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c
index b1ef912..47a41f5 100644
--- a/src/nss-myhostname/netlink.c
+++ b/src/nss-myhostname/netlink.c
@@ -197,7 +197,8 @@ finish:
return r;
}
- qsort(list, n_list, sizeof(struct address), address_compare);
+ if (n_list)
+ qsort(list, n_list, sizeof(struct address), address_compare);
*_list = list;
*_n_list = n_list;
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 32888ad..6b74866 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -536,8 +536,7 @@ done:
HASHMAP_FOREACH_KEY(q, p, files, i)
pack_file(pack, p, on_btrfs);
} else {
- struct item *ordered, *j;
- unsigned k, n;
+ unsigned n;
/* On rotating media, order things by the block
* numbers */
@@ -545,25 +544,31 @@ done:
log_debug("Ordering...");
n = hashmap_size(files);
- if (!(ordered = new(struct item, n))) {
- r = log_oom();
- goto finish;
- }
-
- j = ordered;
- HASHMAP_FOREACH_KEY(q, p, files, i) {
- memcpy(j, q, sizeof(struct item));
- j++;
- }
+ if (n) {
+ _cleanup_free_ struct item *ordered;
+ struct item *j;
+ unsigned k;
+
+ ordered = new(struct item, n);
+ if (!ordered) {
+ r = log_oom();
+ goto finish;
+ }
- assert(ordered + n == j);
+ j = ordered;
+ HASHMAP_FOREACH_KEY(q, p, files, i) {
+ memcpy(j, q, sizeof(struct item));
+ j++;
+ }
- qsort(ordered, n, sizeof(struct item), qsort_compare);
+ assert(ordered + n == j);
- for (k = 0; k < n; k++)
- pack_file(pack, ordered[k].path, on_btrfs);
+ qsort(ordered, n, sizeof(struct item), qsort_compare);
- free(ordered);
+ for (k = 0; k < n; k++)
+ pack_file(pack, ordered[k].path, on_btrfs);
+ } else
+ log_warning("No pack files");
}
log_debug("Finalizing...");
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index e971f36..cc44ab4 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -44,6 +44,8 @@ static void show_pid_array(int pids[], unsigned n_pids, const char *prefix, unsi
unsigned i, m, pid_width;
pid_t biggest = 0;
+ assert(n_pids > 0);
+
/* Filter duplicates */
m = 0;
for (i = 0; i < n_pids; i++) {
diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 6d99739..ed4070c 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -127,7 +127,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
return -ENOMEM;
}
- qsort(files, hashmap_size(fh), sizeof(char *), base_cmp);
+ qsort_safe(files, hashmap_size(fh), sizeof(char *), base_cmp);
*strv = files;
hashmap_free(fh);
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index c015b16..f3eb6a6 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -384,8 +384,7 @@ int efi_get_boot_options(uint16_t **options) {
list[count ++] = id;
}
- if (list)
- qsort(list, count, sizeof(uint16_t), cmp_uint16);
+ qsort_safe(list, count, sizeof(uint16_t), cmp_uint16);
*options = list;
return count;
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 603a1c7..733b320 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -662,6 +662,7 @@ int get_status_field(const char *filename, const char *pattern, char **field) {
int r;
assert(filename);
+ assert(pattern);
assert(field);
r = read_full_file(filename, &status, NULL);
diff --git a/src/shared/util.h b/src/shared/util.h
index 1b845b3..222abe0 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -764,3 +764,15 @@ bool id128_is_valid(const char *s) _pure_;
void parse_user_at_host(char *arg, char **user, char **host);
int split_pair(const char *s, const char *sep, char **l, char **r);
+
+/**
+ * Normal qsort requires base to be nonnull. Here were require
+ * that only if nmemb > 0.
+ */
+static inline void qsort_safe(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *)) {
+ if (nmemb) {
+ assert(base);
+ qsort(base, nmemb, size, compar);
+ }
+}
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index d75281f..036828b 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -471,7 +471,7 @@ static int list_units(DBusConnection *bus, char **args) {
if (r < 0)
return r;
- qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
+ qsort_safe(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
output_units_list(unit_infos, c);
@@ -733,8 +733,8 @@ static int list_sockets(DBusConnection *bus, char **args) {
listen = triggered = NULL; /* avoid cleanup */
}
- qsort(socket_infos, cs, sizeof(struct socket_info),
- (__compar_fn_t) socket_info_compare);
+ qsort_safe(socket_infos, cs, sizeof(struct socket_info),
+ (__compar_fn_t) socket_info_compare);
output_sockets_list(socket_infos, cs);
@@ -1108,7 +1108,7 @@ static int list_dependencies_one(DBusConnection *bus, const char *name, int leve
if (r < 0)
return r;
- qsort(deps, strv_length(deps), sizeof (char*), list_dependencies_compare);
+ qsort_safe(deps, strv_length(deps), sizeof (char*), list_dependencies_compare);
STRV_FOREACH(c, deps) {
if (strv_contains(u, *c)) {
@@ -3532,7 +3532,7 @@ static int show_all(const char* verb,
if (r < 0)
return r;
- qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
+ qsort_safe(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
for (u = unit_infos; u < unit_infos + c; u++) {
_cleanup_free_ char *p = NULL;

View File

@ -1,68 +0,0 @@
From 65f2e8e1f7a86e62630fd36e34609dc7fc09b474 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:20 -0400
Subject: [PATCH] dbus-common: avoid leak in error path
src/shared/dbus-common.c:968:33: warning: Potential leak of memory pointed to by 'l'
return -EINVAL;
^~~~~~
---
src/shared/dbus-common.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index c727cae..3ba2d87 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -934,7 +934,7 @@ int bus_parse_strv_iter(DBusMessageIter *iter, char ***_l) {
int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
DBusMessageIter sub, sub2;
unsigned n = 0, i = 0;
- char **l;
+ _cleanup_strv_free_ char **l = NULL;
assert(iter);
assert(_l);
@@ -953,6 +953,7 @@ int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
l = new(char*, n*2+1);
if (!l)
return -ENOMEM;
+ l[0] = NULL; /* make sure that l is properly terminated at all times */
dbus_message_iter_recurse(iter, &sub);
@@ -968,26 +969,25 @@ int bus_parse_strv_pairs_iter(DBusMessageIter *iter, char ***_l) {
return -EINVAL;
l[i] = strdup(a);
- if (!l[i]) {
- strv_free(l);
+ if (!l[i])
return -ENOMEM;
- }
+ i++;
- l[++i] = strdup(b);
- if (!l[i]) {
- strv_free(l);
+ l[i] = strdup(b);
+ if (!l[i])
return -ENOMEM;
- }
-
i++;
+
dbus_message_iter_next(&sub);
}
assert(i == n*2);
l[i] = NULL;
- if (_l)
+ if (_l) {
*_l = l;
+ l = NULL; /* avoid freeing */
+ }
return 0;
}

View File

@ -1,26 +0,0 @@
From 187ff3e80b8d6b447e584708d88a1858e154a348 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 11 Oct 2013 19:33:36 -0400
Subject: [PATCH] drop-ins: check return value
If the function failed, nothing serious would happen
because unlink would probably return EFAULT, but this
would obscure the real error and is a bit sloppy.
---
src/core/unit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/core/unit.c b/src/core/unit.c
index 4b97710..1db7d06 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2908,6 +2908,9 @@ int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name) {
return 0;
r = drop_in_file(u, mode, name, &p, &q);
+ if (r < 0)
+ return r;
+
if (unlink(q) < 0)
r = errno == ENOENT ? 0 : -errno;
else

View File

@ -1,27 +0,0 @@
From bb653097a1e0c5c2228cafda144814c42cd05da2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 12 Oct 2013 13:43:07 -0400
Subject: [PATCH] Make sure that we don't dereference NULL
The code was actually safe, because b should
never be null, because if rvalue is empty, a different
branch is taken. But we *do* check for NULL in the
loop above, so it's better to also check here for symmetry.
---
src/core/load-fragment.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 44920d6..f01843d 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1860,7 +1860,8 @@ int config_parse_documentation(const char *unit,
free(*a);
}
}
- *b = NULL;
+ if (b)
+ *b = NULL;
return r;
}

View File

@ -1,21 +0,0 @@
From 8d2f7d0ecc3b949f7f15934f3adb73e812866c59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 12 Oct 2013 19:50:54 -0400
Subject: [PATCH] gitignore: ignore clang --analyze output
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 5b38c0b..56e10a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -162,6 +162,7 @@
*.la
*.lo
*.o
+*.plist
*.stamp
*.pyc
__pycache__/

View File

@ -1,94 +0,0 @@
From 83a4e0160b3756222b0c8e8d220c5cc07cc76a40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 13 Oct 2013 19:43:19 -0400
Subject: [PATCH] man: add more markup to udevadm(8)
---
man/udevadm.xml | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/man/udevadm.xml b/man/udevadm.xml
index b959216..a1ffe42 100644
--- a/man/udevadm.xml
+++ b/man/udevadm.xml
@@ -61,9 +61,10 @@
</refsynopsisdiv>
<refsect1><title>Description</title>
- <para>udevadm expects a command and command specific options. It
- controls the runtime behavior of udev, requests kernel events,
- manages the event queue, and provides simple debugging mechanisms.</para>
+ <para><command>udevadm</command> expects a command and command
+ specific options. It controls the runtime behavior of
+ <command>systemd-udevd</command>, requests kernel events, manages
+ the event queue, and provides simple debugging mechanisms.</para>
</refsect1>
<refsect1><title>OPTIONS</title>
@@ -97,23 +98,37 @@
<varlistentry>
<term><option>--query=<replaceable>type</replaceable></option></term>
<listitem>
- <para>Query the database for specified type of device data. It needs the
- <option>--path</option> or <option>--name</option> to identify the specified
- device. Valid queries are:
- <command>name</command>, <command>symlink</command>, <command>path</command>,
- <command>property</command>, <command>all</command>.</para>
+ <para>Query the database for specified type of device
+ data. It needs the <option>--path</option> or
+ <option>--name</option> to identify the specified
+ device. Valid queries are: <constant>name</constant>,
+ <constant>symlink</constant>, <constant>path</constant>,
+ <constant>property</constant>,
+ <constant>all</constant>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--path=<replaceable>devpath</replaceable></option></term>
<listitem>
- <para>The devpath of the device to query.</para>
+ <para>The <filename>/sys</filename> path of the device to
+ query, e.g.
+ <filename><optional>/sys</optional>/class/block/sda</filename>.
+ Note that this option usually isn't very useful, since
+ <command>udev</command> can guess the type of the
+ argument, so <command>udevadm
+ --devpath=/class/block/sda</command> is equivalent to
+ <command>udevadm /sys/class/block/sda</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--name=<replaceable>file</replaceable></option></term>
<listitem>
- <para>The name of the device node or a symlink to query</para>
+ <para>The name of the device node or a symlink to query,
+ e.g. <filename><optional>/dev</optional>/sda</filename>.
+ Note that this option usually isn't very useful, since
+ <command>udev</command> can guess the type of the
+ argument, so <command>udevadm --name=sda</command> is
+ equivalent to <command>udevadm /dev/sda</command>.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -462,13 +477,15 @@
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--resolve-names=<replaceable>early|late|never</replaceable></option></term>
+ <term><option>--resolve-names=<constant>early</constant>|<constant>late</constant>|<constant>never</constant></option></term>
<listitem>
- <para>Specify when udevadm should resolve names of users and groups.
- When set to early (the default) names will be resolved when the
- rules are parsed. When set to late names will be resolved for
- every event. When set to never names will never be resolved and
- all devices will be owned by root.</para>
+ <para>Specify when udevadm should resolve names of users
+ and groups. When set to <constant>early</constant> (the
+ default) names will be resolved when the rules are
+ parsed. When set to <constant>late</constant> names will
+ be resolved for every event. When set to
+ <constant>never</constant> names will never be resolved
+ and all devices will be owned by root.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -1,25 +0,0 @@
From 4d2a7145666c91f0ba63dd5c6937b15339b42b0c Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 14 Oct 2013 08:15:51 +0200
Subject: [PATCH] shared/util: Fix glob_extend() argument
glob_extend() would completely fail to work, or return incorrect
data if it wasn't being passed the current getopt "optarg" variable
as it used the global variable, instead of the passed parameters.
---
src/shared/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/shared/util.c b/src/shared/util.c
index 748f1bb..6c88040 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4391,7 +4391,7 @@ int glob_extend(char ***strv, const char *path) {
char **p;
errno = 0;
- k = glob(optarg, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
+ k = glob(path, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
if (k == GLOB_NOMATCH)
return -ENOENT;

View File

@ -1,35 +0,0 @@
From ce626319c273383a8f8d1a7d9f549f4d487699ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 14 Oct 2013 19:15:24 -0400
Subject: [PATCH] Fix bad assert in show_pid_array
This function should get the same treatment as other qsort uses
did in 7ff7394 "Never call qsort on potentially NULL arrays".
Reported-by: Oleksii Shevchuk <alxchk@gmail.com>
---
src/shared/cgroup-show.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index cc44ab4..aa0f017 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -44,8 +44,6 @@ static void show_pid_array(int pids[], unsigned n_pids, const char *prefix, unsi
unsigned i, m, pid_width;
pid_t biggest = 0;
- assert(n_pids > 0);
-
/* Filter duplicates */
m = 0;
for (i = 0; i < n_pids; i++) {
@@ -65,7 +63,7 @@ static void show_pid_array(int pids[], unsigned n_pids, const char *prefix, unsi
pid_width = DECIMAL_STR_WIDTH(biggest);
/* And sort */
- qsort(pids, n_pids, sizeof(pid_t), compare);
+ qsort_safe(pids, n_pids, sizeof(pid_t), compare);
if(flags & OUTPUT_FULL_WIDTH)
n_columns = 0;

View File

@ -1,31 +0,0 @@
From cd1338b7abe6d300ce66051f3490f35c8b4d1443 Mon Sep 17 00:00:00 2001
From: Igor Zhbanov <i.zhbanov@samsung.com>
Date: Tue, 15 Oct 2013 14:35:13 +0400
Subject: [PATCH] Fix for SIGSEGV in systemd-bootchart on short-living
processes
The function svg_ps_bars() dereferencess NULL pointer in the line
endtime = ps->last->sampledata->sampletime;
because of partially initialized ps_struct (ps->last == NULL).
If some process terminates between scaning /proc directory in the log_sample()
function and reading additional information from /proc/PID/... files,
the files couldn't be read, the loop will be continued and partially
initialized structure returned.
---
src/bootchart/store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index f8c97c2..7f86cfe 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -275,7 +275,7 @@ schedstat_next:
pscount++;
/* mark our first sample */
- ps->first = ps->sample;
+ ps->first = ps->last = ps->sample;
ps->sample->runtime = atoll(rt);
ps->sample->waittime = atoll(wt);

View File

@ -1,34 +0,0 @@
From 3dca881397af86883639ab25f27dfb605acc2a2c Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Tue, 15 Oct 2013 08:58:50 +0200
Subject: [PATCH] man: document the -b special boot option
---
man/kernel-command-line.xml | 1 +
man/systemd.xml | 1 +
2 files changed, 2 insertions(+)
diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index cc267a3..abe68e5 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -123,6 +123,7 @@
</varlistentry>
<varlistentry>
+ <term><varname>-b</varname></term>
<term><varname>emergency</varname></term>
<term><varname>single</varname></term>
<term><varname>s</varname></term>
diff --git a/man/systemd.xml b/man/systemd.xml
index fe6e331..85c06d3 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -1149,6 +1149,7 @@
</varlistentry>
<varlistentry>
+ <term><varname>-b</varname></term>
<term><varname>emergency</varname></term>
<listitem><para>Boot into emergency

View File

@ -1,46 +0,0 @@
From 6d3e661d97dd6157381ca1dd52b839e2049b86b5 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Tue, 15 Oct 2013 21:13:39 +0200
Subject: [PATCH] logind: allow unprivileged session-device access
The session-device/control API was introduced for unprivileged device
access from within a session. Add the required dbus policy to the default
logind policies.
Note: logind validates that only root and the user of a session can
use the API. Furthermore, only a single API user gets access at a time.
---
src/login/org.freedesktop.login1.conf | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/login/org.freedesktop.login1.conf b/src/login/org.freedesktop.login1.conf
index 0407609..04e735e 100644
--- a/src/login/org.freedesktop.login1.conf
+++ b/src/login/org.freedesktop.login1.conf
@@ -148,6 +148,26 @@
send_interface="org.freedesktop.login1.Session"
send_member="SetIdleHint"/>
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
+ send_member="TakeControl"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
+ send_member="ReleaseControl"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
+ send_member="TakeDevice"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
+ send_member="ReleaseDevice"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Session"
+ send_member="PauseDeviceComplete"/>
+
<allow receive_sender="org.freedesktop.login1"/>
</policy>

View File

@ -1,32 +0,0 @@
From 78846d19d3569cf637d2e37c10e75395ebcf9d06 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 16 Oct 2013 02:49:54 +0200
Subject: [PATCH] rules: expose loop block devices to systemd
Since the kernel no longer exposes a large number of "dead" loop devices
it is OK to expose them now in systemd, so let's do that. This has the
benefit that mount dependencies on loop devices start to work.
---
rules/99-systemd.rules.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index bbb7d0c..3c99475 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -11,12 +11,12 @@ SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*", TAG+="systemd"
KERNEL=="vport*", TAG+="systemd"
-SUBSYSTEM=="block", KERNEL!="ram*|loop*", TAG+="systemd"
-SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
+SUBSYSTEM=="block", KERNEL!="ram*", TAG+="systemd"
+SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
# Ignore encrypted devices with no identified superblock on it, since
# we are probably still calling mke2fs or mkswap on it.
-SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
+SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
# 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"

View File

@ -1,35 +0,0 @@
From 9a3296571683a6a3eaee44d18db91ca113841da6 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 16 Oct 2013 02:51:24 +0200
Subject: [PATCH] rules: don't limit some of the rules to the "add" action
Devices should show up in systemd regardless whether the user invoked
"udevadm trigger" or not. Before this change some devices might have
suddenly disappeared due issuing that command.
Conflicts:
rules/99-systemd.rules.in
---
rules/99-systemd.rules.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index 3c99475..307f18f 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -53,12 +53,12 @@ ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sy
# Pull in backlight save/restore for all firmware backlight devices
-ACTION=="add", SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service"
+SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service"
# Asynchronously mount file systems implemented by these modules as
# soon as they are loaded.
-SUBSYSTEM=="module", KERNEL=="fuse", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
-SUBSYSTEM=="module", KERNEL=="configfs", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
+SUBSYSTEM=="module", KERNEL=="fuse", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
+SUBSYSTEM=="module", KERNEL=="configfs", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount"
LABEL="systemd_end"

View File

@ -1,34 +0,0 @@
From bc3ae365890fa52f9beca1a67744a0fcbdcb5f82 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Thu, 17 Oct 2013 03:20:46 +0200
Subject: [PATCH] tmpfiles: log unaccessible FUSE mount points only as debug
message
---
src/tmpfiles/tmpfiles.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 8122d6a..239e56b 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -275,12 +275,15 @@ static int dir_cleanup(
continue;
if (fstatat(dirfd(d), dent->d_name, &s, AT_SYMLINK_NOFOLLOW) < 0) {
+ if (errno == ENOENT)
+ continue;
- if (errno != ENOENT) {
+ /* FUSE, NFS mounts, SELinux might return EACCES */
+ if (errno == EACCES)
+ log_debug("stat(%s/%s) failed: %m", p, dent->d_name);
+ else
log_error("stat(%s/%s) failed: %m", p, dent->d_name);
- r = -errno;
- }
-
+ r = -errno;
continue;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
From 431e477b8e66ddbaba28a9f59fb8ae2e16d59cb5 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Mon, 21 Oct 2013 03:49:03 +0200
Subject: [PATCH] rules: remove pointless MODE= settings
Changing the default MODE= for the group accessi, but not specifying
a GROUP= does not provide anything.
It disables the default logic that the mode switches to 0660 as soon
as a GROUP= is specifed, which make custom rules uneccesarily complicated.
https://bugs.freedesktop.org/show_bug.cgi?id=70665
---
rules/50-udev-default.rules | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/rules/50-udev-default.rules b/rules/50-udev-default.rules
index f764789..679dfdf 100644
--- a/rules/50-udev-default.rules
+++ b/rules/50-udev-default.rules
@@ -20,9 +20,7 @@ KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP=
SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
-SUBSYSTEM=="input", KERNEL=="mouse*|mice|event*", MODE="0640"
-SUBSYSTEM=="input", KERNEL=="ts[0-9]*|uinput", MODE="0640"
-SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0644"
+SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664"
SUBSYSTEM=="video4linux", GROUP="video"
SUBSYSTEM=="misc", KERNEL=="agpgart", GROUP="video"
@@ -63,7 +61,7 @@ SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk"
SUBSYSTEM=="aoe", GROUP="disk", MODE="0220"
SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
-KERNEL=="rfkill", MODE="0644"
+KERNEL=="rfkill", MODE="0664"
KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"

View File

@ -1,33 +0,0 @@
From ff86c42c8614828be77810a50202e1f771b35ff3 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Mon, 21 Oct 2013 21:29:23 +0200
Subject: [PATCH] analyze: set white backgound
In programs like eog and gimp the transparant background did not
look very good.
https://bugs.freedesktop.org/show_bug.cgi?id=70720
---
src/analyze/systemd-analyze.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index a4f15eb..9a69795 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -507,6 +507,7 @@ static int analyze_plot(DBusConnection *bus) {
/* style sheet */
svg("<defs>\n <style type=\"text/css\">\n <![CDATA[\n"
" rect { stroke-width: 1; stroke-opacity: 0; }\n"
+ " rect.background { fill: rgb(255,255,255); }\n"
" rect.activating { fill: rgb(255,0,0); fill-opacity: 0.7; }\n"
" rect.active { fill: rgb(200,150,150); fill-opacity: 0.7; }\n"
" rect.deactivating { fill: rgb(150,100,100); fill-opacity: 0.7; }\n"
@@ -528,6 +529,7 @@ static int analyze_plot(DBusConnection *bus) {
" text.sec { font-size: 10px; }\n"
" ]]>\n </style>\n</defs>\n\n");
+ svg("<rect class=\"background\" width=\"100%%\" height=\"100%%\" />\n");
svg("<text x=\"20\" y=\"50\">%s</text>", pretty_times);
svg("<text x=\"20\" y=\"30\">%s %s (%s %s) %s</text>",
isempty(osname) ? "Linux" : osname,

View File

@ -1,81 +0,0 @@
From 8ee1b98e2f4d4d36d9fccc776aa3fb124d05ac9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 21 Oct 2013 18:53:57 -0400
Subject: [PATCH] shell-completion: dump has moved to systemd-analyze
Rename NO_OPTION to STANDALONE for consistency with other files.
---
shell-completion/bash/systemctl | 2 +-
shell-completion/bash/systemd-analyze | 4 ++--
shell-completion/zsh/_systemctl | 3 +--
shell-completion/zsh/_systemd-analyze | 1 +
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/shell-completion/bash/systemctl b/shell-completion/bash/systemctl
index e335ee8..eea4b6d 100644
--- a/shell-completion/bash/systemctl
+++ b/shell-completion/bash/systemctl
@@ -137,7 +137,7 @@ _systemctl () {
[JOBS]='cancel'
[SNAPSHOTS]='delete'
[ENVS]='set-environment unset-environment'
- [STANDALONE]='daemon-reexec daemon-reload default dump
+ [STANDALONE]='daemon-reexec daemon-reload default
emergency exit halt hibernate hybrid-sleep kexec list-jobs
list-sockets list-units list-unit-files poweroff reboot rescue
show-environment suspend get-default'
diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze
index 5bd6768..b65466b 100644
--- a/shell-completion/bash/systemd-analyze
+++ b/shell-completion/bash/systemd-analyze
@@ -31,7 +31,7 @@ _systemd_analyze() {
local OPTS='--help --version --system --user --from-pattern --to-pattern --order --require'
local -A VERBS=(
- [NO_OPTION]='time blame plot'
+ [STANDALONE]='time blame plot dump'
[CRITICAL_CHAIN]='critical-chain'
[DOT]='dot'
[LOG_LEVEL]='set-log-level'
@@ -55,7 +55,7 @@ _systemd_analyze() {
if [[ -z $verb ]]; then
comps=${VERBS[*]}
- elif __contains_word "$verb" ${VERBS[NO_OPTION]}; then
+ elif __contains_word "$verb" ${VERBS[STANDALONE]}; then
if [[ $cur = -* ]]; then
comps='--help --version --system --user'
fi
diff --git a/shell-completion/zsh/_systemctl b/shell-completion/zsh/_systemctl
index 298e97e..3959cd5 100644
--- a/shell-completion/zsh/_systemctl
+++ b/shell-completion/zsh/_systemctl
@@ -38,7 +38,6 @@
"is-enabled:Check whether unit files are enabled"
"list-jobs:List jobs"
"cancel:Cancel all, one, or more jobs"
- "dump:Dump server status"
"snapshot:Create a snapshot"
"delete:Remove one or more snapshots"
"show-environment:Dump environment"
@@ -264,7 +263,7 @@ done
(( $+functions[_systemctl_link] )) || _systemctl_link() { _files }
# no systemctl completion for:
-# [STANDALONE]='daemon-reexec daemon-reload default dump
+# [STANDALONE]='daemon-reexec daemon-reload default
# emergency exit halt kexec list-jobs list-units
# list-unit-files poweroff reboot rescue show-environment'
# [NAME]='snapshot load'
diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze
index 37c60f5..2eda5fe 100644
--- a/shell-completion/zsh/_systemd-analyze
+++ b/shell-completion/zsh/_systemd-analyze
@@ -15,6 +15,7 @@ _systemd_analyze_command(){
'critical-chain:Print a tree of the time critical chain of units'
'plot:Output SVG graphic showing service initialization'
'dot:Dump dependency graph (in dot(1) format)'
+ 'dump:Dump server status'
'set-log-level:Set systemd log threshold'
)

View File

@ -1,174 +0,0 @@
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

@ -1,89 +0,0 @@
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

@ -1,239 +0,0 @@
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

@ -1,47 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,60 +0,0 @@
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

@ -1,33 +0,0 @@
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

@ -1,298 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,91 +0,0 @@
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

@ -1,32 +0,0 @@
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

@ -1,44 +0,0 @@
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

@ -1,24 +0,0 @@
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

@ -1,31 +0,0 @@
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

@ -1,37 +0,0 @@
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

@ -1,293 +0,0 @@
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

View File

@ -1,22 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,61 +0,0 @@
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

@ -1,65 +0,0 @@
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

@ -1,593 +0,0 @@
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

@ -1,125 +0,0 @@
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

@ -1,112 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,27 +0,0 @@
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

@ -1,65 +0,0 @@
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

@ -1,25 +0,0 @@
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

@ -1,134 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,161 +0,0 @@
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

@ -1,57 +0,0 @@
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

@ -1,65 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,120 +0,0 @@
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

@ -1,48 +0,0 @@
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

@ -1,38 +0,0 @@
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

@ -1,66 +0,0 @@
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

@ -1,48 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,24 +0,0 @@
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);

View File

@ -1,22 +0,0 @@
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

@ -1,23 +0,0 @@
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

@ -1,85 +0,0 @@
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

@ -1,163 +0,0 @@
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>

View File

@ -1,57 +0,0 @@
From 99f96571a3a7667ab6f3a46944c267bcc7c980e6 Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@redhat.com>
Date: Wed, 13 Nov 2013 23:02:23 -0500
Subject: [PATCH] zsh-completion: add bootctl
---
Makefile.am | 4 ++++
shell-completion/zsh/_bootctl | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
create mode 100644 shell-completion/zsh/_bootctl
diff --git a/Makefile.am b/Makefile.am
index b4fc33b..efe5aa3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1743,6 +1743,10 @@ bootctl_LDADD = \
bin_PROGRAMS += \
bootctl
+
+dist_zshcompletion_DATA += \
+ shell-completion/zsh/_bootctl
+
endif
# ------------------------------------------------------------------------------
diff --git a/shell-completion/zsh/_bootctl b/shell-completion/zsh/_bootctl
new file mode 100644
index 0000000..7d2453c
--- /dev/null
+++ b/shell-completion/zsh/_bootctl
@@ -0,0 +1,25 @@
+#compdef bootctl
+
+(( $+functions[_bootctl_command] )) || _bootctl_command()
+{
+ local -a _bootctl_cmds
+ _bootctl_cmds=(
+ "status:Show current firmware and boot settings"
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+ cmd="${${_bootctl_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $+functions[_bootctl_$cmd] )); then
+ _bootctl_$cmd
+ else
+ _message "no more options"
+ fi
+ fi
+}
+
+_arguments \
+ {-h,--help}'[Prints a short help text and exits.]' \
+ '--version[Prints a short version string and exits.]' \
+ '*::bootctl command:_bootctl_command'

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