Accepting request 225408 from Base:System

- Add or port upstream bugfix patches: 
  0001-Fix-systemd-stdio-bridge-symlink.patch
  0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch
  0003-Do-not-print-invalid-UTF-8-in-error-messages.patch
  0004-man-document-missing-options-of-systemd-run.patch
  0005-systemd-run-add-some-extra-safety-checks.patch
  0006-journal-assume-that-next-entry-is-after-previous-ent.patch
  0007-journal-forget-file-after-encountering-an-error.patch
  0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch
  0009-logind-fix-reference-to-systemd-user-sessions.servic.patch
  0010-man-update-link-to-LSB.patch
  0011-man-systemd-bootchart-fix-spacing-in-command.patch
  0012-man-add-missing-comma.patch
  0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch

- Add linker scripts as place holder of the old systemd shared
  libraries now all included in libsystemd.so  (bnc#867128)

- Make patch 1006-udev-always-rename-network.patch work again
  and add it again. 

- address missing owner functionality in systemd-tmpfiles (fate#314974)
  1022-systemd-tmpfiles-ownerkeep.patch

- Generate the bash completion files on the fly for the case of
  not having the package bash-completion around 
- Add or port upstream bugfix patches:
  0001-nspawn-fix-detection-of-missing-proc-self-loginuid.patch
  0002-cdrom_id-use-the-old-MMC-fallback.patch
  0003-journalctl-refuse-extra-arguments-with-verify-and-si.patch

OBS-URL: https://build.opensuse.org/request/show/225408
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=177
This commit is contained in:
Stephan Kulow 2014-03-11 08:24:11 +00:00 committed by Git OBS Bridge
commit 051c574d1e
123 changed files with 3697 additions and 5117 deletions

View File

@ -1,35 +0,0 @@
From a0551d26ab5c6e0d5089b42a6319baef0e28ad92 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(-)
Index: systemd-208/src/shared/cgroup-show.c
===================================================================
--- systemd-208.orig/src/shared/cgroup-show.c
+++ systemd-208/src/shared/cgroup-show.c
@@ -44,8 +44,6 @@ static void show_pid_array(int pids[], u
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[], u
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

@ -0,0 +1,28 @@
From 8100c1a8f58b2fb5d97e156420a7e16562e93bc4 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Sun, 2 Mar 2014 23:37:39 -0500
Subject: [PATCH] Fix systemd-stdio-bridge symlink
The symlink is created in bindir (/usr/bin), and points to a binary
which lives in rootlibexecdir (/lib/systemd or /usr/lib/systemd). A
relative symlink does not work here.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git Makefile.am Makefile.am
index 38445fb..e7134a2 100644
--- Makefile.am
+++ Makefile.am
@@ -1978,7 +1978,7 @@ systemd_bus_proxyd_LDADD = \
bus-proxyd-install-hook:
$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
- $(AM_V_LN)$(LN_S) -f ../lib/systemd/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge
+ $(AM_V_LN)$(LN_S) -f $(rootlibexecdir)/systemd-bus-proxyd $(DESTDIR)$(bindir)/systemd-stdio-bridge
bus-proxyd-uninstall-hook:
rm -f $(DESTDIR)$(bindir)/systemd-stdio-bridge
--
1.7.9.2

View File

@ -1,385 +0,0 @@
From 7ff7394d9e4e9189c30fd018235e6b1728c6f2d0 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 78b937b..901e71b 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 2f8be1b..275458c 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -761,7 +761,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 26af5b3..09e556d 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -772,3 +772,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;
--
1.8.4

View File

@ -10,7 +10,7 @@
ACTION=="remove", GOTO="systemd_end" ACTION=="remove", GOTO="systemd_end"
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*", TAG+="systemd" -SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*", TAG+="systemd"
+SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty*", TAG+="systemd" +SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty*", TAG+="systemd"
KERNEL=="vport*", TAG+="systemd" KERNEL=="vport*", TAG+="systemd"
@ -108,16 +108,3 @@
return cached_on_tty; return cached_on_tty;
} }
--- systemd-208/src/getty-generator/getty-generator.c
+++ systemd-208/src/getty-generator/getty-generator.c 2014-02-05 10:41:29.502245927 +0000
@@ -149,9 +149,9 @@ int main(int argc, char *argv[]) {
* only for non-VC terminals. */
k = add_serial_getty(tty);
+ free(tty);
if (k < 0) {
- free(tty);
free(active);
r = EXIT_FAILURE;
goto finish;

View File

@ -1,25 +0,0 @@
From 7e326fb5b2c1a839bbe7f879c7efa2af2ed33420 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Wed, 2 Oct 2013 13:39:49 +0200
Subject: [PATCH 01/15] 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;
--
1.8.4

View File

@ -5,65 +5,57 @@ use the system halt as gfallback if poweroff fails for both the direct poweroff
systemctl command as well as for the systemd-shutdown utility. systemctl command as well as for the systemd-shutdown utility.
--- ---
Makefile.am | 2 Makefile.am | 11 +
Makefile.in | 7 src/core/hdflush.c | 365 ++++++++++++++++++++++++++++++++++++++++++++++
src/core/shutdown.c | 8 - src/core/hdflush.h | 25 +++
src/shared/hdflush.c | 365 ++++++++++++++++++++++++++++++++++++++++++++++ src/core/shutdown.c | 12 +
src/shared/hdflush.h | 25 +++ src/systemctl/systemctl.c | 25 ++-
src/systemctl/systemctl.c | 17 +- 5 files changed, 429 insertions(+), 9 deletions(-)
6 files changed, 416 insertions(+), 8 deletions(-)
--- systemd-208/Makefile.am --- systemd-209/Makefile.am
+++ systemd-208/Makefile.am 2014-01-28 11:06:55.638238060 +0000 +++ systemd-209/Makefile.am 2014-01-28 11:06:56.000000000 +0000
@@ -680,6 +680,8 @@ libsystemd_shared_la_SOURCES = \ @@ -1004,7 +1004,9 @@ libsystemd_core_la_SOURCES = \
src/shared/strbuf.h \ src/core/audit-fd.c \
src/shared/strxcpyx.c \ src/core/audit-fd.h \
src/shared/strxcpyx.h \ src/core/async.c \
+ src/shared/hdflush.c \ - src/core/async.h
+ src/shared/hdflush.h \ + src/core/async.h \
src/shared/conf-parser.c \ + src/core/hdflush.c \
src/shared/conf-parser.h \ + src/core/hdflush.h
src/shared/log.c \
--- systemd-208/Makefile.in if HAVE_KMOD
+++ systemd-208/Makefile.in 2014-01-28 11:06:33.942246196 +0000 libsystemd_core_la_SOURCES += \
@@ -1509,7 +1509,7 @@ am_libsystemd_shared_la_OBJECTS = src/sh @@ -1522,6 +1524,8 @@ systemd_shutdown_SOURCES = \
src/shared/hashmap.lo src/shared/set.lo src/shared/fdset.lo \ src/core/shutdown.c \
src/shared/prioq.lo src/shared/sleep-config.lo \ src/core/mount-setup.c \
src/shared/strv.lo src/shared/env-util.lo src/shared/strbuf.lo \ src/core/mount-setup.h \
- src/shared/strxcpyx.lo src/shared/conf-parser.lo \ + src/core/hdflush.c \
+ src/shared/strxcpyx.lo src/shared/hdflush.lo src/shared/conf-parser.lo \ + src/core/hdflush.h \
src/shared/log.lo src/shared/ratelimit.lo \ src/core/killall.h \
src/shared/exit-status.lo src/shared/utf8.lo \ src/core/killall.c
src/shared/pager.lo src/shared/socket-util.lo \
@@ -4137,6 +4137,8 @@ libsystemd_shared_la_SOURCES = \ @@ -1818,7 +1822,9 @@ systemd_cgroups_agent_LDADD = \
src/shared/strbuf.h \
src/shared/strxcpyx.c \ # ------------------------------------------------------------------------------
src/shared/strxcpyx.h \ systemctl_SOURCES = \
+ src/shared/hdflush.c \ - src/systemctl/systemctl.c
+ src/shared/hdflush.h \ + src/systemctl/systemctl.c \
src/shared/conf-parser.c \ + src/core/hdflush.c \
src/shared/conf-parser.h \ + src/core/hdflush.h
src/shared/log.c \
@@ -7073,6 +7075,8 @@ src/shared/strbuf.lo: src/shared/$(am__d systemctl_LDADD = \
src/shared/$(DEPDIR)/$(am__dirstamp) libsystemd-units.la \
src/shared/strxcpyx.lo: src/shared/$(am__dirstamp) \ @@ -1826,6 +1832,7 @@ systemctl_LDADD = \
src/shared/$(DEPDIR)/$(am__dirstamp) libsystemd-internal.la \
+src/shared/hdflush.lo: src/shared/$(am__dirstamp) \ libsystemd-logs.la \
+ src/shared/$(DEPDIR)/$(am__dirstamp) libsystemd-journal-internal.la \
src/shared/conf-parser.lo: src/shared/$(am__dirstamp) \ + libudev-internal.la \
src/shared/$(DEPDIR)/$(am__dirstamp) libsystemd-shared.la
src/shared/log.lo: src/shared/$(am__dirstamp) \
@@ -9236,6 +9240,7 @@ distclean-compile: # ------------------------------------------------------------------------------
@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/strbuf.Plo@am__quote@ --- systemd-209/src/core/hdflush.c
@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/strv.Plo@am__quote@ +++ systemd-209/src/core/hdflush.c 2014-01-28 10:58:56.000000000 +0000
@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/strxcpyx.Plo@am__quote@ @@ -0,0 +1,367 @@
+@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/hdflush.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/time-dst.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/time-util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/shared/$(DEPDIR)/unit-name.Plo@am__quote@
--- systemd-208/src/shared/hdflush.c
+++ systemd-208/src/shared/hdflush.c 2014-01-28 10:58:56.490735704 +0000
@@ -0,0 +1,365 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+ +
+/*** +/***
@ -111,6 +103,8 @@ systemctl command as well as for the systemd-shutdown utility.
+# include <byteswap.h> +# include <byteswap.h>
+#endif +#endif
+ +
+#include "hdflush.h"
+
+/* Used in flush_cache_ext(), compare with <linux/hdreg.h> */ +/* Used in flush_cache_ext(), compare with <linux/hdreg.h> */
+#define IDBYTES 512 +#define IDBYTES 512
+#define MASK_EXT 0xE000 /* Bit 15 shall be zero, bit 14 shall be one, bit 13 flush cache ext */ +#define MASK_EXT 0xE000 /* Bit 15 shall be zero, bit 14 shall be one, bit 13 flush cache ext */
@ -429,8 +423,8 @@ systemctl command as well as for the systemd-shutdown utility.
+ close_sysfs(sysfs); + close_sysfs(sysfs);
+} +}
+#endif +#endif
--- systemd-208/src/shared/hdflush.h --- systemd-209/src/core/hdflush.h
+++ systemd-208/src/shared/hdflush.h 2014-01-28 11:00:08.286235696 +0000 +++ systemd-209/src/core/hdflush.h 2014-01-28 11:00:08.000000000 +0000
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+ +
@ -457,8 +451,8 @@ systemctl command as well as for the systemd-shutdown utility.
+ +
+void hdflush(void); +void hdflush(void);
+void hddown(void); +void hddown(void);
--- systemd-208/src/core/shutdown.c --- systemd-209/src/core/shutdown.c
+++ systemd-208/src/core/shutdown.c 2014-01-28 11:14:15.722235591 +0000 +++ systemd-209/src/core/shutdown.c 2014-02-28 11:17:22.000000000 +0000
@@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
#include "missing.h" #include "missing.h"
#include "log.h" #include "log.h"
@ -467,7 +461,17 @@ systemctl command as well as for the systemd-shutdown utility.
#include "umount.h" #include "umount.h"
#include "util.h" #include "util.h"
#include "mkdir.h" #include "mkdir.h"
@@ -302,8 +303,13 @@ int main(int argc, char *argv[]) { @@ -225,7 +226,8 @@ int main(int argc, char *argv[]) {
_cleanup_free_ char *cgroup = NULL;
char *arguments[3];
unsigned retries;
- int cmd, r;
+ unsigned cmd;
+ int r;
log_parse_environment();
r = parse_argv(argc, argv);
@@ -388,8 +390,13 @@ int main(int argc, char *argv[]) {
* on reboot(), but the file systems need to be synce'd * on reboot(), but the file systems need to be synce'd
* explicitly in advance. So let's do this here, but not * explicitly in advance. So let's do this here, but not
* needlessly slow down containers. */ * needlessly slow down containers. */
@ -480,11 +484,30 @@ systemctl command as well as for the systemd-shutdown utility.
+ hdflush(); + hdflush();
+ } + }
if (cmd == LINUX_REBOOT_CMD_KEXEC) { switch (cmd) {
--- systemd-208/src/systemctl/systemctl.c @@ -449,6 +456,10 @@ int main(int argc, char *argv[]) {
+++ systemd-208/src/systemctl/systemctl.c 2014-01-28 11:31:27.150735613 +0000 }
@@ -87,6 +87,7 @@ static bool arg_no_pager = false;
reboot(cmd);
+
+ if (cmd == RB_POWER_OFF)
+ reboot(RB_HALT_SYSTEM);
+
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
* CAP_SYS_BOOT just exit, this will kill our
--- systemd-209/src/systemctl/systemctl.c
+++ systemd-209/src/systemctl/systemctl.c 2014-02-28 11:19:35.000000000 +0000
@@ -67,6 +67,7 @@
#include "logs-show.h"
#include "socket-util.h"
#include "fileio.h"
+#include "hdflush.h"
#include "env-util.h"
#include "bus-util.h"
#include "bus-message.h"
@@ -93,6 +94,7 @@ static bool arg_no_pager = false;
static bool arg_no_wtmp = false; static bool arg_no_wtmp = false;
static bool arg_no_wall = false; static bool arg_no_wall = false;
static bool arg_no_reload = false; static bool arg_no_reload = false;
@ -492,15 +515,15 @@ systemctl command as well as for the systemd-shutdown utility.
static bool arg_show_types = false; static bool arg_show_types = false;
static bool arg_ignore_inhibitors = false; static bool arg_ignore_inhibitors = false;
static bool arg_dry = false; static bool arg_dry = false;
@@ -5272,6 +5273,7 @@ static int halt_parse_argv(int argc, cha @@ -5566,6 +5568,7 @@ static int halt_parse_argv(int argc, cha
{ "reboot", no_argument, NULL, ARG_REBOOT }, { "reboot", no_argument, NULL, ARG_REBOOT },
{ "force", no_argument, NULL, 'f' }, { "force", no_argument, NULL, 'f' },
{ "wtmp-only", no_argument, NULL, 'w' }, { "wtmp-only", no_argument, NULL, 'w' },
+ { "no-sync", no_argument, NULL, 'n' }, + { "no-sync", no_argument, NULL, 'n' },
{ "no-wtmp", no_argument, NULL, 'd' }, { "no-wtmp", no_argument, NULL, 'd' },
{ "no-wall", no_argument, NULL, ARG_NO_WALL }, { "no-wall", no_argument, NULL, ARG_NO_WALL },
{ NULL, 0, NULL, 0 } {}
@@ -5324,10 +5326,13 @@ static int halt_parse_argv(int argc, cha @@ -5617,10 +5620,13 @@ static int halt_parse_argv(int argc, cha
case 'i': case 'i':
case 'h': case 'h':
@ -515,15 +538,25 @@ systemctl command as well as for the systemd-shutdown utility.
case '?': case '?':
return -EINVAL; return -EINVAL;
@@ -5981,14 +5986,14 @@ static int halt_now(enum action a) { @@ -6266,16 +6272,24 @@ static int halt_now(enum action a) {
* point on... */
reboot(RB_ENABLE_CAD);
switch (a) { - switch (a) {
+ if (!arg_no_sync)
+ sync();
- case ACTION_HALT: - case ACTION_HALT:
- log_info("Halting."); - log_info("Halting.");
- reboot(RB_HALT_SYSTEM); - reboot(RB_HALT_SYSTEM);
- return -errno; - return -errno;
- + if (a == ACTION_POWEROFF || a == ACTION_HALT)
+ hddown();
+ else
+ hdflush();
+
+ switch (a) {
case ACTION_POWEROFF: case ACTION_POWEROFF:
log_info("Powering off."); log_info("Powering off.");
reboot(RB_POWER_OFF); reboot(RB_POWER_OFF);
@ -534,4 +567,4 @@ systemctl command as well as for the systemd-shutdown utility.
+ reboot(RB_HALT_SYSTEM); + reboot(RB_HALT_SYSTEM);
return -errno; return -errno;
case ACTION_REBOOT: case ACTION_REBOOT: {

View File

@ -0,0 +1,318 @@
Avoid possible race on NFS shares in which may that the network devices disappears
before the associated NFS share becomes unmounted (bug #861489).
To do this make sure that sys-subsystem-net-devices-<iface>.device used for the
NFS share is added as "After=" dependency to the <nfs-share-mount-point>.mount.
---
Makefile.am | 2
src/core/mount-iface.c | 173 +++++++++++++++++++++++++++++++++++++++++++++++++
src/core/mount-iface.h | 25 +++++++
src/core/mount.c | 35 +++++++++
src/shared/util.c | 1
5 files changed, 234 insertions(+), 2 deletions(-)
--- systemd-210/Makefile.am
+++ systemd-210/Makefile.am 2014-02-26 12:44:20.000000000 +0000
@@ -994,6 +994,8 @@ libsystemd_core_la_SOURCES = \
src/core/machine-id-setup.h \
src/core/mount-setup.c \
src/core/mount-setup.h \
+ src/core/mount-iface.c \
+ src/core/mount-iface.h \
src/core/loopback-setup.h \
src/core/loopback-setup.c \
src/core/condition.c \
--- systemd-210/src/core/mount-iface.c
+++ systemd-210/src/core/mount-iface.c 2014-02-26 10:18:36.000000000 +0000
@@ -0,0 +1,173 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2014 Werner Fink
+
+ 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/>.
+***/
+
+/*
+ * Find the name of the network interface to which a IP address belongs to.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <assert.h>
+
+#include "log.h"
+#include "def.h"
+#include "mount-iface.h"
+
+static struct ifaddrs *ifa_list;
+
+_pure_ static unsigned int mask2prefix(const void* ipv6)
+{
+ unsigned int nippels = 0;
+ unsigned int i;
+
+ assert(ipv6);
+
+ for (i = 0; i < sizeof(struct in6_addr); i++) {
+ uint8_t byte = ((const uint8_t*)ipv6)[i];
+ if (byte == 0xFF) {
+ nippels += sizeof(uint8_t);
+ continue;
+ }
+ while (byte & 0x80) {
+ nippels++;
+ byte <<= 1;
+ }
+ break;
+ }
+
+ return nippels;
+}
+
+static void netmask(unsigned int prefix, const void* in6, void* out6)
+{
+ unsigned int nippels;
+ unsigned int i;
+
+ assert(in6);
+ assert(out6);
+
+ for (i = 0; i < sizeof(struct in6_addr); i++) {
+ nippels = (prefix < sizeof(uint8_t)) ? prefix : sizeof(uint8_t);
+ ((uint8_t*)out6)[i] = ((const uint8_t*)in6)[i] & (0xFF00>>nippels);
+ prefix -= nippels;
+ }
+}
+
+char *host2iface(const char *ip)
+{
+ const struct ifaddrs *ifa;
+ uint32_t ip4 = 0;
+ char *ret = NULL;
+ struct search {
+ union {
+ struct in_addr addr;
+ struct in6_addr addr6;
+ };
+ int family;
+ } host;
+ int r;
+
+ if (!ifa_list && (getifaddrs(&ifa_list) < 0)) {
+ log_oom();
+ goto err;
+ }
+
+ if (strchr(ip, ':')) {
+ r = inet_pton(AF_INET6, ip, &host.addr6);
+ host.family = AF_INET6;
+ } else {
+ r = inet_pton(AF_INET, ip, &host.addr);
+ host.family = AF_INET;
+ }
+
+ if (r < 0) {
+ log_error("Failed to convert IP address %s from text to binary: %m", ip);
+ goto err;
+ }
+
+ for (ifa = ifa_list; ifa != NULL; ifa = ifa->ifa_next) {
+
+ if (!ifa->ifa_addr)
+ continue;
+ if (ifa->ifa_flags & IFF_POINTOPOINT)
+ continue;
+ if (!ifa->ifa_addr)
+ continue;
+ if (!ifa->ifa_netmask)
+ continue;
+
+ if (ifa->ifa_addr->sa_family == AF_INET) {
+ uint32_t addr, dest, mask;
+
+ if (host.family != AF_INET)
+ continue;
+ if (!ifa->ifa_broadaddr)
+ continue;
+
+ if (!ip4)
+ ip4 = (uint32_t)ntohl(host.addr.s_addr);
+
+ addr = (uint32_t)ntohl(((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr);
+ if ((addr & 0xFF000000) == 0x7F000000) /* IPV4 loopback */
+ continue;
+
+ mask = (uint32_t)ntohl(((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr.s_addr);
+ dest = (uint32_t)ntohl(((struct sockaddr_in*)ifa->ifa_broadaddr)->sin_addr.s_addr);
+ if ((ip4 & mask) != (dest & mask))
+ continue;
+
+ ret = ifa->ifa_name;
+ break;
+ } else if (ifa->ifa_addr->sa_family == AF_INET6) {
+ struct in6_addr *addr, *mask, dest, ip6;
+ unsigned int prefix;
+
+ if (host.family != AF_INET6)
+ continue;
+
+ addr = &((struct sockaddr_in6*)ifa->ifa_addr)->sin6_addr;
+ mask = &((struct sockaddr_in6*)ifa->ifa_netmask)->sin6_addr;
+ prefix = mask2prefix(mask);
+
+ netmask(prefix, addr, &dest);
+ netmask(prefix, &host.addr6, &ip6);
+
+ if (memcmp(&dest, &ip6, sizeof(struct in6_addr)) != 0)
+ continue;
+
+ ret = ifa->ifa_name;
+ break;
+ }
+ }
+err:
+ return ret;
+}
+
+void freeroutes(void)
+{
+ if (ifa_list)
+ freeifaddrs(ifa_list);
+ ifa_list = NULL;
+}
--- systemd-210/src/core/mount-iface.h
+++ systemd-210/src/core/mount-iface.h 2014-02-26 10:08:20.000000000 +0000
@@ -0,0 +1,25 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2014 Werner Fink
+
+ 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/>.
+***/
+
+char *host2iface(const char *ip);
+void freeroutes(void);
--- systemd-210/src/core/mount.c
+++ systemd-210/src/core/mount.c 2014-03-03 12:13:23.406246117 +0000
@@ -36,6 +36,7 @@
#include "mkdir.h"
#include "path-util.h"
#include "mount-setup.h"
+#include "mount-iface.h"
#include "unit-name.h"
#include "dbus-mount.h"
#include "special.h"
@@ -1388,8 +1389,9 @@ static int mount_add_one(
_cleanup_free_ char *e = NULL, *w = NULL, *o = NULL, *f = NULL;
bool load_extras = false;
MountParameters *p;
- bool delete, changed = false;
+ bool delete, changed = false, isnetwork;
Unit *u;
+ char *c;
int r;
assert(m);
@@ -1414,6 +1416,8 @@ static int mount_add_one(
if (!e)
return -ENOMEM;
+ isnetwork = fstype_is_network(fstype);
+
u = manager_get_unit(m, e);
if (!u) {
delete = true;
@@ -1442,7 +1446,7 @@ static int mount_add_one(
if (m->running_as == SYSTEMD_SYSTEM) {
const char* target;
- target = fstype_is_network(fstype) ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
+ target = isnetwork ? SPECIAL_REMOTE_FS_TARGET : SPECIAL_LOCAL_FS_TARGET;
r = unit_add_dependency_by_name(u, UNIT_BEFORE, target, NULL, true);
if (r < 0)
@@ -1519,6 +1523,32 @@ static int mount_add_one(
goto fail;
}
+ if (isnetwork && (c = strrchr(p->what, ':')) && *(c+1) == '/') {
+ _cleanup_free_ char *opt = strdup(p->options);
+ char *addr;
+
+ if (opt && (addr = strstr(opt, ",addr="))) {
+ char *colon, *iface;
+
+ addr += 6;
+ if ((colon = strchr(addr, ',')))
+ *colon = '\0';
+
+ iface = host2iface(addr);
+ if (iface) {
+ _cleanup_free_ char* target = NULL;
+ if (asprintf(&target, "sys-subsystem-net-devices-%s.device", iface) < 0)
+ log_oom();
+ else {
+ r = unit_add_dependency_by_name(u, UNIT_AFTER, target, NULL, true);
+ if (r < 0)
+ log_error_unit(u->id, "Failed to add dependency on %s, ignoring: %s",
+ target, strerror(-r));
+ }
+ }
+ }
+ }
+
if (changed)
unit_add_to_dbus_queue(u);
@@ -1583,6 +1613,7 @@ static int mount_load_proc_self_mountinf
if (k < 0)
r = k;
}
+ freeroutes(); /* Just in case of using the routing table with host2iface() */
return r;
}
--- systemd-210/src/shared/util.c
+++ systemd-210/src/shared/util.c 2014-02-24 15:17:42.000000000 +0000
@@ -1502,6 +1502,7 @@ bool fstype_is_network(const char *fstyp
"ncp\0"
"nfs\0"
"nfs4\0"
+ "afs\0"
"gfs\0"
"gfs2\0";

View File

@ -1,90 +0,0 @@
From 95168f7d55181475946ad93db30255c4d709df03 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Fri, 01 Nov 2013 21:57:47 +0000
Subject: 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.
---
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 6bfe13d..8730723 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -509,7 +509,7 @@ static int analyze_plot(sd_bus *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) {
@@ -517,10 +517,14 @@ static int analyze_plot(sd_bus *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)
@@ -608,7 +612,7 @@ static int analyze_plot(sd_bus *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++) {
@@ -622,7 +626,8 @@ static int analyze_plot(sd_bus *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));
@@ -634,19 +639,19 @@ static int analyze_plot(sd_bus *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");
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,32 +0,0 @@
From 418e37506e6a419a808a82081ca1616caa03a206 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Mon, 21 Oct 2013 19:29:23 +0000
Subject: 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
---
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 26769d6..0cc4de7 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,
--
cgit v0.9.0.2-2-gbebe

View File

@ -0,0 +1,15 @@
--- systemd-209/src/login/logind-session.c
+++ systemd-209/src/login/logind-session.c 2014-02-28 12:12:14.762736079 +0000
@@ -525,6 +525,12 @@ int session_start(Session *s) {
if (r < 0)
return r;
+ if (!s->user->slice) {
+ if (errno)
+ return -errno;
+ return -ESTALE;
+ }
+
/* Create cgroup */
r = session_start_scope(s);
if (r < 0)

View File

@ -1,225 +0,0 @@
From 6fa7e1a944a2dbb89e794ad0f9da5d0fda5dc4a9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Jan 2014 13:38:55 +0100
Subject: [PATCH 1/3] core: introduce new KillMode=mixed which sends SIGTERM
only to the main process, but SIGKILL to all daemon processes
This should fix some race with terminating systemd --user, where the
system systemd instance might race against the user systemd instance
when sending SIGTERM.
---
man/systemd.kill.xml | 77 +++++++++++++++++++++++++++++++++-----------------
src/core/kill.c | 1 +
src/core/kill.h | 1 +
src/core/unit.c | 3 +-
units/user@.service.in | 1 +
5 files changed, 56 insertions(+), 27 deletions(-)
diff --git a/man/systemd.kill.xml b/man/systemd.kill.xml
index 1b10fba..a4009aa 100644
--- a/man/systemd.kill.xml
+++ b/man/systemd.kill.xml
@@ -44,39 +44,44 @@
<refnamediv>
<refname>systemd.kill</refname>
- <refpurpose>Kill environment configuration</refpurpose>
+ <refpurpose>Process killing procedure
+ configuration</refpurpose>
</refnamediv>
<refsynopsisdiv>
<para><filename><replaceable>service</replaceable>.service</filename>,
<filename><replaceable>socket</replaceable>.socket</filename>,
<filename><replaceable>mount</replaceable>.mount</filename>,
- <filename><replaceable>swap</replaceable>.swap</filename></para>
+ <filename><replaceable>swap</replaceable>.swap</filename>,
+ <filename><replaceable>scope</replaceable>.scope</filename></para>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>Unit configuration files for services, sockets,
- mount points and swap devices share a subset of
- configuration options which define the process killing
- parameters of spawned processes.</para>
+ mount points, swap devices and scopes share a subset
+ of configuration options which define the
+ killing procedure of processes belonging to the unit.</para>
<para>This man page lists the configuration options
- shared by these four unit types. See
+ shared by these five unit types. See
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- for the common options of all unit configuration
- files, and
+ for the common options shared by all unit
+ configuration files, and
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- and
+ <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- for more information on the specific unit
- configuration files. The execution specific
+ and
+ <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for more information on the configuration file options
+ specific to each unit type.</para>
+
+ <para>The kill procedure
configuration options are configured in the [Service],
- [Socket], [Mount], or [Swap] section, depending on the unit
- type.</para>
+ [Socket], [Mount] or [Swap] section, depending on the
+ unit type.</para>
</refsect1>
<refsect1>
@@ -87,32 +92,40 @@
<varlistentry>
<term><varname>KillMode=</varname></term>
<listitem><para>Specifies how
- processes of this service shall be
+ processes of this unit shall be
killed. One of
<option>control-group</option>,
<option>process</option>,
+ <option>mixed</option>,
<option>none</option>.</para>
<para>If set to
<option>control-group</option>, all
remaining processes in the control
- group of this unit will be terminated
- on unit stop (for services: after the
+ group of this unit will be killed on
+ unit stop (for services: after the
stop command is executed, as
configured with
<varname>ExecStop=</varname>). If set
to <option>process</option>, only the
main process itself is killed. If set
- to <option>none</option>, no process is
+ to <option>mixed</option> the
+ <constant>SIGTERM</constant> signal
+ (see below) is sent to the main
+ process while the subsequent
+ <constant>SIGKILL</constant> signal
+ (see below) is sent to all remaining
+ processes of the unit's control
+ group. If set to
+ <option>none</option>, no process is
killed. In this case only the stop
- command will be executed on unit
- stop, but no process be killed
+ command will be executed on unit stop,
+ but no process be killed
otherwise. Processes remaining alive
after stop are left in their control
group and the control group continues
to exist after stop unless it is
- empty. Defaults to
- <option>control-group</option>.</para>
+ empty.</para>
<para>Processes will first be
terminated via
@@ -133,14 +146,24 @@
option). See
<citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry>
for more
- information.</para></listitem>
+ information.</para>
+
+ <para>Defaults to
+ <option>control-group</option>.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>KillSignal=</varname></term>
<listitem><para>Specifies which signal
- to use when killing a
- service. Defaults to <constant>SIGTERM</constant>.
+ to use when killing a service. This
+ controls the signal that is sent as
+ first step of shutting down a unit
+ (see above), and is usually followed
+ by <constant>SIGKILL</constant> (see
+ above and below). For a list of valid
+ signals, see
+ <citerefentry><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry>. Defaults
+ to <constant>SIGTERM</constant>.
</para></listitem>
</varlistentry>
@@ -184,7 +207,9 @@
<citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>signal</refentrytitle><manvolnum>7</manvolnum></citerefentry>
</para>
</refsect1>
diff --git a/src/core/kill.c b/src/core/kill.c
index ea947c2..4271346 100644
--- a/src/core/kill.c
+++ b/src/core/kill.c
@@ -52,6 +52,7 @@ void kill_context_dump(KillContext *c, FILE *f, const char *prefix) {
static const char* const kill_mode_table[_KILL_MODE_MAX] = {
[KILL_CONTROL_GROUP] = "control-group",
[KILL_PROCESS] = "process",
+ [KILL_MIXED] = "mixed",
[KILL_NONE] = "none"
};
diff --git a/src/core/kill.h b/src/core/kill.h
index 41773f0..d5f125f 100644
--- a/src/core/kill.h
+++ b/src/core/kill.h
@@ -32,6 +32,7 @@ typedef enum KillMode {
/* The kill mode is a property of a unit. */
KILL_CONTROL_GROUP = 0,
KILL_PROCESS,
+ KILL_MIXED,
KILL_NONE,
_KILL_MODE_MAX,
_KILL_MODE_INVALID = -1
diff --git a/src/core/unit.c b/src/core/unit.c
index 4b97710..0b10e57 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -3007,7 +3007,7 @@ int unit_kill_context(
}
}
- if (c->kill_mode == KILL_CONTROL_GROUP && u->cgroup_path) {
+ if ((c->kill_mode == KILL_CONTROL_GROUP || (c->kill_mode == KILL_MIXED && sigkill)) && u->cgroup_path) {
_cleanup_set_free_ Set *pid_set = NULL;
/* Exclude the main/control pids from being killed via the cgroup */
@@ -3021,6 +3021,7 @@ int unit_kill_context(
log_warning_unit(u->id, "Failed to kill control group: %s", strerror(-r));
} else if (r > 0) {
wait_for_exit = true;
+
if (c->send_sighup) {
set_free(pid_set);
diff --git a/units/user@.service.in b/units/user@.service.in
index 3718a57..3bb8696 100644
--- a/units/user@.service.in
+++ b/units/user@.service.in
@@ -17,3 +17,4 @@ 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
+KillMode=mixed
--
1.8.4

View File

@ -1,329 +0,0 @@
From d420282b28f50720e233ccb1c02547c562195653 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 26 Nov 2013 01:39:53 +0100
Subject: [PATCH] core: replace OnFailureIsolate= setting by a more generic
OnFailureJobMode= setting and make use of it where applicable
---
man/systemd.unit.xml | 40 +++++++++++++++++++++++++----------
src/core/dbus-unit.c | 3 ++-
src/core/job.h | 3 +--
src/core/load-fragment-gperf.gperf.m4 | 3 ++-
src/core/load-fragment.c | 31 +++++++++++++++++++++++++++
src/core/load-fragment.h | 2 ++
src/core/unit.c | 11 +++++-----
src/core/unit.h | 4 ++--
units/initrd-cleanup.service.in | 1 +
units/initrd-fs.target | 2 +-
units/initrd-parse-etc.service.in | 1 +
units/initrd-root-fs.target | 2 +-
units/initrd-switch-root.service.in | 1 +
units/initrd.target | 2 +-
units/local-fs.target | 2 +-
15 files changed, 82 insertions(+), 26 deletions(-)
Index: systemd-208/man/systemd.unit.xml
===================================================================
--- systemd-208.orig/man/systemd.unit.xml
+++ systemd-208/man/systemd.unit.xml
@@ -669,19 +669,37 @@
</varlistentry>
<varlistentry>
- <term><varname>OnFailureIsolate=</varname></term>
+ <term><varname>OnFailureJobMode=</varname></term>
- <listitem><para>Takes a boolean
- argument. If <option>true</option>, the
- unit listed in
+ <listitem><para>Takes a value of
+ <literal>fail</literal>,
+ <literal>replace</literal>,
+ <literal>replace-irreversibly</literal>
+ or
+ <literal>isolate</literal>. Defaults
+ to
+ <literal>replace</literal>. Specifies
+ how the units listed in
<varname>OnFailure=</varname> will be
- enqueued in isolation mode, i.e. all
- units that are not its dependency will
- be stopped. If this is set, only a
+ enqueued. If set to
+ <literal>fail</literal> and
+ contradicting jobs are already queued,
+ cause the activation to fail. If set
+ to <literal>replace</literal> and
+ contradicting jobs area already
+ queued, replace
+ those. <literal>replace-irreversibly</literal>
+ is similar to
+ <literal>replace</literal>, however,
+ creates jobs that cannot be reversed
+ unless they finished or are explicitly
+ canceled. <literal>isolate</literal>
+ may be used to terminate all other
+ units but the specified one. If
+ this is set to
+ <literal>isolate</literal>, only a
single unit may be listed in
- <varname>OnFailure=</varname>. Defaults
- to
- <option>false</option>.</para></listitem>
+ <varname>OnFailure=</varname>..</para></listitem>
</varlistentry>
<varlistentry>
Index: systemd-208/src/core/dbus-unit.c
===================================================================
--- systemd-208.orig/src/core/dbus-unit.c
+++ systemd-208/src/core/dbus-unit.c
@@ -133,6 +133,7 @@ static int bus_unit_append_description(D
}
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_unit_append_load_state, unit_load_state, UnitLoadState);
+static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_unit_append_job_mode, job_mode, JobMode);
static int bus_unit_append_active_state(DBusMessageIter *i, const char *property, void *data) {
Unit *u = data;
@@ -1079,7 +1080,7 @@ const BusProperty bus_unit_properties[]
{ "RefuseManualStop", bus_property_append_bool, "b", offsetof(Unit, refuse_manual_stop) },
{ "AllowIsolate", bus_property_append_bool, "b", offsetof(Unit, allow_isolate) },
{ "DefaultDependencies", bus_property_append_bool, "b", offsetof(Unit, default_dependencies) },
- { "OnFailureIsolate", bus_property_append_bool, "b", offsetof(Unit, on_failure_isolate) },
+ { "OnFailureJobMode", bus_unit_append_job_mode, "s", offsetof(Unit, on_failure_job_mode) },
{ "IgnoreOnIsolate", bus_property_append_bool, "b", offsetof(Unit, ignore_on_isolate) },
{ "IgnoreOnSnapshot", bus_property_append_bool, "b", offsetof(Unit, ignore_on_snapshot) },
{ "NeedDaemonReload", bus_unit_append_need_daemon_reload, "b", 0 },
Index: systemd-208/src/core/job.h
===================================================================
--- systemd-208.orig/src/core/job.h
+++ systemd-208/src/core/job.h
@@ -83,7 +83,7 @@ enum JobState {
enum JobMode {
JOB_FAIL, /* Fail if a conflicting job is already queued */
JOB_REPLACE, /* Replace an existing conflicting job */
- JOB_REPLACE_IRREVERSIBLY, /* Like JOB_REPLACE + produce irreversible jobs */
+ JOB_REPLACE_IRREVERSIBLY,/* Like JOB_REPLACE + produce irreversible jobs */
JOB_ISOLATE, /* Start a unit, and stop all others */
JOB_IGNORE_DEPENDENCIES, /* Ignore both requirement and ordering dependencies */
JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
Index: systemd-208/src/core/load-fragment-gperf.gperf.m4
===================================================================
--- systemd-208.orig/src/core/load-fragment-gperf.gperf.m4
+++ systemd-208/src/core/load-fragment-gperf.gperf.m4
@@ -122,7 +122,8 @@ Unit.RefuseManualStart, config_
Unit.RefuseManualStop, config_parse_bool, 0, offsetof(Unit, refuse_manual_stop)
Unit.AllowIsolate, config_parse_bool, 0, offsetof(Unit, allow_isolate)
Unit.DefaultDependencies, config_parse_bool, 0, offsetof(Unit, default_dependencies)
-Unit.OnFailureIsolate, config_parse_bool, 0, offsetof(Unit, on_failure_isolate)
+Unit.OnFailureJobMode, config_parse_job_mode, 0, offsetof(Unit, on_failure_job_mode)
+Unit.OnFailureIsolate, config_parse_job_mode_isolate, 0, offsetof(Unit, on_failure_job_mode)
Unit.IgnoreOnIsolate, config_parse_bool, 0, offsetof(Unit, ignore_on_isolate)
Unit.IgnoreOnSnapshot, config_parse_bool, 0, offsetof(Unit, ignore_on_snapshot)
Unit.JobTimeoutSec, config_parse_sec, 0, offsetof(Unit, job_timeout)
Index: systemd-208/src/core/load-fragment.c
===================================================================
--- systemd-208.orig/src/core/load-fragment.c
+++ systemd-208/src/core/load-fragment.c
@@ -2314,6 +2314,36 @@ int config_parse_blockio_bandwidth(
return 0;
}
+DEFINE_CONFIG_PARSE_ENUM(config_parse_job_mode, job_mode, JobMode, "Failed to parse job mode");
+
+int config_parse_job_mode_isolate(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ JobMode *m = data;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ r = parse_boolean(rvalue);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse boolean, ignoring: %s", rvalue);
+ return 0;
+ }
+
+ *m = r ? JOB_ISOLATE : JOB_REPLACE;
+ return 0;
+}
+
#define FOLLOW_MAX 8
static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
Index: systemd-208/src/core/load-fragment.h
===================================================================
--- systemd-208.orig/src/core/load-fragment.h
+++ systemd-208/src/core/load-fragment.h
@@ -83,6 +83,8 @@ int config_parse_device_allow(const char
int config_parse_blockio_weight(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_blockio_device_weight(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_blockio_bandwidth(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_job_mode(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_job_mode_isolate(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
/* gperf prototypes */
const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, unsigned length);
Index: systemd-208/src/core/unit.c
===================================================================
--- systemd-208.orig/src/core/unit.c
+++ systemd-208/src/core/unit.c
@@ -85,6 +85,7 @@ Unit *unit_new(Manager *m, size_t size)
u->deserialized_job = _JOB_TYPE_INVALID;
u->default_dependencies = true;
u->unit_file_state = _UNIT_FILE_STATE_INVALID;
+ u->on_failure_job_mode = JOB_REPLACE;
return u;
}
@@ -807,14 +808,14 @@ void unit_dump(Unit *u, FILE *f, const c
"%s\tRefuseManualStart: %s\n"
"%s\tRefuseManualStop: %s\n"
"%s\tDefaultDependencies: %s\n"
- "%s\tOnFailureIsolate: %s\n"
+ "%s\tOnFailureJobMode: %s\n"
"%s\tIgnoreOnIsolate: %s\n"
"%s\tIgnoreOnSnapshot: %s\n",
prefix, yes_no(u->stop_when_unneeded),
prefix, yes_no(u->refuse_manual_start),
prefix, yes_no(u->refuse_manual_stop),
prefix, yes_no(u->default_dependencies),
- prefix, yes_no(u->on_failure_isolate),
+ prefix, job_mode_to_string(u->on_failure_job_mode),
prefix, yes_no(u->ignore_on_isolate),
prefix, yes_no(u->ignore_on_snapshot));
@@ -985,11 +986,11 @@ int unit_load(Unit *u) {
if (r < 0)
goto fail;
- if (u->on_failure_isolate &&
+ if (u->on_failure_job_mode == JOB_ISOLATE &&
set_size(u->dependencies[UNIT_ON_FAILURE]) > 1) {
log_error_unit(u->id,
- "More than one OnFailure= dependencies specified for %s but OnFailureIsolate= enabled. Refusing.", u->id);
+ "More than one OnFailure= dependencies specified for %s but OnFailureJobMode=isolate set. Refusing.", u->id);
r = -EINVAL;
goto fail;
@@ -1394,7 +1395,7 @@ void unit_start_on_failure(Unit *u) {
SET_FOREACH(other, u->dependencies[UNIT_ON_FAILURE], i) {
int r;
- r = manager_add_job(u->manager, JOB_START, other, u->on_failure_isolate ? JOB_ISOLATE : JOB_REPLACE, true, NULL, NULL);
+ r = manager_add_job(u->manager, JOB_START, other, u->on_failure_job_mode, true, NULL, NULL);
if (r < 0)
log_error_unit(u->id, "Failed to enqueue OnFailure= job: %s", strerror(-r));
}
Index: systemd-208/src/core/unit.h
===================================================================
--- systemd-208.orig/src/core/unit.h
+++ systemd-208/src/core/unit.h
@@ -228,8 +228,8 @@ struct Unit {
/* Allow isolation requests */
bool allow_isolate;
- /* Isolate OnFailure unit */
- bool on_failure_isolate;
+ /* How to start OnFailure units */
+ JobMode on_failure_job_mode;
/* Ignore this unit when isolating */
bool ignore_on_isolate;
Index: systemd-208/units/initrd-cleanup.service.in
===================================================================
--- systemd-208.orig/units/initrd-cleanup.service.in
+++ systemd-208/units/initrd-cleanup.service.in
@@ -10,6 +10,7 @@ Description=Cleaning Up and Shutting Dow
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
After=initrd-root-fs.target initrd-fs.target initrd.target
[Service]
Index: systemd-208/units/initrd-fs.target
===================================================================
--- systemd-208.orig/units/initrd-fs.target
+++ systemd-208/units/initrd-fs.target
@@ -9,7 +9,7 @@
Description=Initrd File Systems
Documentation=man:systemd.special(7)
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureJobMode=replace-irreversibly
ConditionPathExists=/etc/initrd-release
After=initrd-parse-etc.service
DefaultDependencies=no
Index: systemd-208/units/initrd-parse-etc.service.in
===================================================================
--- systemd-208.orig/units/initrd-parse-etc.service.in
+++ systemd-208/units/initrd-parse-etc.service.in
@@ -11,6 +11,7 @@ DefaultDependencies=no
Requires=initrd-root-fs.target
After=initrd-root-fs.target
OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
ConditionPathExists=/etc/initrd-release
[Service]
Index: systemd-208/units/initrd-root-fs.target
===================================================================
--- systemd-208.orig/units/initrd-root-fs.target
+++ systemd-208/units/initrd-root-fs.target
@@ -10,6 +10,6 @@ Description=Initrd Root File System
Documentation=man:systemd.special(7)
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureJobMode=replace-irreversibly
DefaultDependencies=no
Conflicts=shutdown.target
Index: systemd-208/units/initrd-switch-root.service.in
===================================================================
--- systemd-208.orig/units/initrd-switch-root.service.in
+++ systemd-208/units/initrd-switch-root.service.in
@@ -10,6 +10,7 @@ Description=Switch Root
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
AllowIsolate=yes
[Service]
Index: systemd-208/units/initrd.target
===================================================================
--- systemd-208.orig/units/initrd.target
+++ systemd-208/units/initrd.target
@@ -9,7 +9,7 @@
Description=Initrd Default Target
Documentation=man:systemd.special(7)
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureJobMode=replace-irreversibly
ConditionPathExists=/etc/initrd-release
Requires=basic.target
Wants=initrd-root-fs.target initrd-fs.target initrd-parse-etc.service
Index: systemd-208/units/local-fs.target
===================================================================
--- systemd-208.orig/units/local-fs.target
+++ systemd-208/units/local-fs.target
@@ -12,4 +12,4 @@ After=local-fs-pre.target
DefaultDependencies=no
Conflicts=shutdown.target
OnFailure=emergency.target
-OnFailureIsolate=no
+OnFailureJobMode=replace-irreversibly

View File

@ -1,40 +0,0 @@
From 8d1a28020409ee4afea6ef8c1c4d3522a209284e 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
--
1.8.4

View File

@ -1,71 +0,0 @@
From 74dcc2df7b2a340c3e1fe9e61e5c8deb324c83d7 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;
}
--
1.8.4

View File

@ -1,33 +0,0 @@
From 6c7980093c4e39d07bf06484f96f489e236c7c29 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)
--
1.8.4

View File

@ -1,29 +0,0 @@
From 6891529fe1176c046ece579807ff48e3191692f3 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
--
1.8.4

View File

@ -1,40 +0,0 @@
From 9a5cb1371b6d8b0a04bd08665bcf9b06cb40c64c 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;
}
--
1.8.4

View File

@ -1,25 +0,0 @@
From 2ee0591d12b9e725c4585502285fd91cde682d9b 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;
}
--
1.8.4

View File

@ -1,39 +0,0 @@
From 2b98f75a63e6022bf74a7d678c47faa5208c794f 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));
--
1.8.4

View File

@ -1,27 +0,0 @@
From 3f4fee033bf0f623de74f3e8a14c42b8ff81c36e 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;
--
1.8.4

View File

@ -0,0 +1,52 @@
From a1937e679f76758635d295287398abe526de2522 Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Tue, 25 Feb 2014 12:20:25 +0100
Subject: [PATCH] login: fix pos-array allocation
GREEDY_REALLOC takes a pointer to the real size, not the array-width as
argument. Therefore, our array is currently way to small to keep the seat
positions.
Introduce GREEDY_REALLOC0_T() as typed version of GREEDY_REALLOC and store
the array-width instead of array-size.
---
src/login/logind-seat.c | 2 +-
src/shared/util.h | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git src/login/logind-seat.c src/login/logind-seat.c
index 631be5f..36ec7ed 100644
--- src/login/logind-seat.c
+++ src/login/logind-seat.c
@@ -475,7 +475,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
if (seat_has_vts(s))
pos = session->vtnr;
- if (!GREEDY_REALLOC0(s->positions, s->position_count, pos + 1))
+ if (!GREEDY_REALLOC0_T(s->positions, s->position_count, pos + 1))
return;
seat_evict_position(s, session);
diff --git src/shared/util.h src/shared/util.h
index 9913fce..78b1444 100644
--- src/shared/util.h
+++ src/shared/util.h
@@ -723,6 +723,15 @@ void* greedy_realloc0(void **p, size_t *allocated, size_t need);
#define GREEDY_REALLOC0(array, allocated, need) \
greedy_realloc0((void**) &(array), &(allocated), sizeof((array)[0]) * (need))
+#define GREEDY_REALLOC0_T(array, count, need) \
+ ({ \
+ size_t _size = (count) * sizeof((array)[0]); \
+ void *_ptr = GREEDY_REALLOC0((array), _size, (need)); \
+ if (_ptr) \
+ (count) = _size / sizeof((array)[0]); \
+ _ptr; \
+ })
+
static inline void _reset_errno_(int *saved_errno) {
errno = *saved_errno;
}
--
1.7.9.2

View File

@ -1,27 +0,0 @@
From 0581dac2c146cef0f55841a4c136dc48409c8eaa 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;
--
1.8.4

View File

@ -1,25 +0,0 @@
From 660ea9620f7b8f99d08a2770d4e81acfd8aea02e 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" \
--
1.8.4

View File

@ -1,28 +0,0 @@
From 63966da86d8e71b1f3f2b57d5448770d526421f9 Mon Sep 17 00:00:00 2001
From: Thomas Bächler <thomas@archlinux.org>
Date: Sun, 15 Dec 2013 11:06:37 +0000
Subject: login: Don't stop a running user manager from garbage-collecting the user.
With the current logic, a user will never be garbage-collected, since its
manager will always be around. Change the logic such that a user is
garbage-collected when it has no sessions and linger is disabled.
---
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index 6ba8d98..441e086 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -629,12 +629,6 @@ int user_check_gc(User *u, bool drop_not
if (u->slice_job || u->service_job)
return 1;
- if (u->slice && manager_unit_is_active(u->manager, u->slice) != 0)
- return 1;
-
- if (u->service && manager_unit_is_active(u->manager, u->service) != 0)
- return 1;
-
return 0;
}
--
cgit v0.9.0.2-2-gbebe

View File

@ -0,0 +1,79 @@
--- systemd-209/units/kmod-static-nodes.service.in
+++ systemd-209/units/kmod-static-nodes.service.in 2014-02-27 15:04:30.378236539 +0000
@@ -15,4 +15,5 @@ ConditionPathExists=/lib/modules/%v/modu
[Service]
Type=oneshot
RemainAfterExit=yes
+ExecStartPre=@MKDIR_P@ /run/tmpfiles.d
ExecStart=@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
--- systemd-209/configure.ac
+++ systemd-209/configure.ac 2014-02-28 17:14:14.866235643 +0000
@@ -300,9 +300,9 @@ AC_ARG_ENABLE(kmod, AS_HELP_STRING([--di
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 >= 15 ],
+ PKG_CHECK_MODULES(KMOD, [ libkmod >= 14 ],
[AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
- AC_MSG_ERROR([*** kmod version >= 15 not found]))
+ AC_MSG_ERROR([*** kmod version >= 14 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])
--- systemd-209/configure
+++ systemd-209/configure 2014-02-28 17:13:50.770735397 +0000
@@ -15999,12 +15999,12 @@ if test -n "$KMOD_CFLAGS"; then
pkg_cv_KMOD_CFLAGS="$KMOD_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 15 \""; } >&5
- ($PKG_CONFIG --exists --print-errors " libkmod >= 15 ") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 14 \""; } >&5
+ ($PKG_CONFIG --exists --print-errors " libkmod >= 14 ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_KMOD_CFLAGS=`$PKG_CONFIG --cflags " libkmod >= 15 " 2>/dev/null`
+ pkg_cv_KMOD_CFLAGS=`$PKG_CONFIG --cflags " libkmod >= 14 " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -16016,12 +16016,12 @@ if test -n "$KMOD_LIBS"; then
pkg_cv_KMOD_LIBS="$KMOD_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 15 \""; } >&5
- ($PKG_CONFIG --exists --print-errors " libkmod >= 15 ") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libkmod >= 14 \""; } >&5
+ ($PKG_CONFIG --exists --print-errors " libkmod >= 14 ") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_KMOD_LIBS=`$PKG_CONFIG --libs " libkmod >= 15 " 2>/dev/null`
+ pkg_cv_KMOD_LIBS=`$PKG_CONFIG --libs " libkmod >= 14 " 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -16042,18 +16042,18 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- KMOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libkmod >= 15 " 2>&1`
+ KMOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libkmod >= 14 " 2>&1`
else
- KMOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libkmod >= 15 " 2>&1`
+ KMOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libkmod >= 14 " 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$KMOD_PKG_ERRORS" >&5
- as_fn_error $? "*** kmod version >= 15 not found" "$LINENO" 5
+ as_fn_error $? "*** kmod version >= 14 not found" "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- as_fn_error $? "*** kmod version >= 15 not found" "$LINENO" 5
+ as_fn_error $? "*** kmod version >= 14 not found" "$LINENO" 5
else
KMOD_CFLAGS=$pkg_cv_KMOD_CFLAGS
KMOD_LIBS=$pkg_cv_KMOD_LIBS

View File

@ -0,0 +1,55 @@
--- systemd-209/src/libsystemd/sd-bus/sd-bus.c
+++ systemd-209/src/libsystemd/sd-bus/sd-bus.c 2014-02-28 11:08:21.354235373 +0000
@@ -2548,7 +2548,7 @@ static int bus_poll(sd_bus *bus, bool ne
n = 2;
}
- r = ppoll(p, n, m == (uint64_t) -1 ? NULL : timespec_store(&ts, m), NULL);
+ r = __ppoll_alias(p, n, m == (uint64_t) -1 ? NULL : timespec_store(&ts, m), NULL);
if (r < 0)
return -errno;
--- systemd-209/src/core/hostname-setup.c
+++ systemd-209/src/core/hostname-setup.c 2014-02-28 11:14:51.594832792 +0000
@@ -50,8 +50,8 @@ static int read_and_strip_hostname(const
}
/* strip any leftover of a domain name */
- if (domain = strchr(s, '.')) {
- *domain = NULL;
+ if ((domain = strchr(s, '.'))) {
+ *domain = '\0';
}
*hn = s;
--- systemd-209/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ systemd-209/src/tty-ask-password-agent/tty-ask-password-agent.c 2014-02-28 11:41:42.254735820 +0000
@@ -142,7 +142,7 @@ static int ask_password_plymouth(
goto finish;
}
- if ((j = poll(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
+ if ((j = __poll_alias(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
if (errno == EINTR)
continue;
@@ -595,7 +595,7 @@ static int watch_passwords(void) {
if ((r = show_passwords()) < 0)
log_error("Failed to show password: %s", strerror(-r));
- if (poll(pollfd, _FD_MAX, -1) < 0) {
+ if (__poll_alias(pollfd, _FD_MAX, -1) < 0) {
if (errno == EINTR)
continue;
--- systemd-209/src/shared/ask-password-api.c
+++ systemd-209/src/shared/ask-password-api.c 2014-02-28 11:47:21.754234675 +0000
@@ -138,7 +138,7 @@ int ask_password_tty(
goto finish;
}
- if ((k = poll(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
+ if ((k = __poll_alias(pollfd, notify > 0 ? 2 : 1, sleep_for)) < 0) {
if (errno == EINTR)
continue;

View File

@ -1,45 +0,0 @@
From a316932f5a627c1ef78f568fd5dfa579f12e76b2 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;
--
1.8.4

View File

@ -1,29 +0,0 @@
From 9c03872bc8fb2a381eafe7301ef9811b641686dd 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;
--
1.8.4

View File

@ -0,0 +1,41 @@
From: Werner Fink <werner@suse.de>
Date: Wed Feb 26 14:36:27 UTC 2014
Subject: Do not clobber XDG_RUNTIME_DIR if su command preserve environment
Make sure that even if a su command without option -l or with option -m
is used, the XDG_RUNTIME_DIR will not be clobbered by the new uid.
This belongs to BNC#852015 and also to BNC#855160
---
pam-module.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
--- systemd-209/src/login/pam-module.c
+++ systemd-209/src/login/pam-module.c 2014-02-26 14:31:30.158235525 +0000
@@ -447,6 +447,25 @@ _public_ PAM_EXTERN int pam_sm_open_sess
r = export_legacy_dbus_address(handle, pw->pw_uid, runtime_path);
if (r != PAM_SUCCESS)
return r;
+ } else if (getenv("XDG_RUNTIME_DIR")) {
+ _cleanup_free_ char *p = NULL;
+
+ /* Make sure that after running YaST2 or the xdg-su scripts
+ * the runtime directory is not clobbered. Even a normal su
+ * command without -l or with -m may clobber. */
+
+ if ((r = asprintf(&p, "/run/user/%lu", (unsigned long)pw->pw_uid)) < 0)
+ return PAM_BUF_ERR;
+
+ r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", p, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
+ return r;
+ }
+
+ r = export_legacy_dbus_address(handle, pw->pw_uid, p);
+ if (r != PAM_SUCCESS)
+ return r;
}
if (!isempty(seat)) {

View File

@ -1,28 +0,0 @@
From a8ccacf5344c4434b1d5ff3837307acb8fcf93d2 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 54dbace..1822770 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4461,7 +4461,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;
--
1.8.4

View File

@ -1,50 +0,0 @@
From 1d5989fd803d2019de0f6aaaf3cfb1cb2bbc3cdb 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 82f4221..31cea79 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[]) {
--
1.8.4

View File

@ -0,0 +1,42 @@
Process 1 (aka init) needs to be started with an empty signal mask. That
includes the process 1 that's started after the initrd is finished. When the
initrd is using systemd (as it does with dracut based initrds) then it is
systemd that calls the real init. Normally this is systemd again, except
when the user uses for instance "init=/bin/bash" on the kernel command line.
---
main.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- src/core/main.c
+++ src/core/main.c 2014-02-27 13:54:21.922236495 +0000
@@ -1780,6 +1780,7 @@ finish:
if (reexecute) {
const char **args;
unsigned i, args_size;
+ sigset_t ss, o_ss;
/* Close and disarm the watchdog, so that the new
* instance can reinitialize it, but doesn't get
@@ -1863,6 +1864,11 @@ finish:
args[i++] = NULL;
assert(i <= args_size);
+ /* reenable any blocked signals, especially important
+ * if we switch from initial ramdisk to init=... */
+ sigemptyset(&ss);
+ sigprocmask(SIG_SETMASK,&ss,&o_ss);
+
if (switch_root_init) {
args[0] = switch_root_init;
execv(args[0], (char* const*) args);
@@ -1881,6 +1887,9 @@ finish:
log_error("Failed to execute /bin/sh, giving up: %m");
} else
log_warning("Failed to execute /sbin/init, giving up: %m");
+
+ /* back to saved state if reexec failed */
+ sigprocmask(SIG_SETMASK,&o_ss,NULL);
}
if (arg_serialization) {

View File

@ -1,41 +0,0 @@
From 77009452cfd25208509b14ea985e81fdf9f7d40e 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;
--
1.8.4

View File

@ -1,51 +0,0 @@
From 6aca9a587d4ad40b1c044f99e3714022201b9fd4 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);
--
1.8.4

View File

@ -1,85 +0,0 @@
--- systemd-208/src/core/shutdown.c
+++ systemd-208/src/core/shutdown.c 2014-01-27 11:31:38.486235816 +0000
@@ -329,6 +329,9 @@ int main(int argc, char *argv[]) {
reboot(cmd);
+ if (cmd == RB_POWER_OFF)
+ reboot(RB_HALT_SYSTEM);
+
if (errno == EPERM && in_container) {
/* If we are in a container, and we lacked
* CAP_SYS_BOOT just exit, this will kill our
--- systemd-208/src/systemctl/systemctl.c
+++ systemd-208/src/systemctl/systemctl.c 2014-01-27 11:05:18.298236035 +0000
@@ -138,7 +138,7 @@ static bool arg_plain = false;
static bool private_bus = false;
static int daemon_reload(DBusConnection *bus, char **args);
-static void halt_now(enum action a);
+static int halt_now(enum action a);
static void pager_open_if_enabled(void) {
@@ -2227,7 +2227,7 @@ static int start_special(DBusConnection
(a == ACTION_HALT ||
a == ACTION_POWEROFF ||
a == ACTION_REBOOT))
- halt_now(a);
+ return halt_now(a);
if (arg_force >= 1 &&
(a == ACTION_HALT ||
@@ -5973,7 +5973,7 @@ done:
return 0;
}
-static _noreturn_ void halt_now(enum action a) {
+static int halt_now(enum action a) {
/* Make sure C-A-D is handled by the kernel from this
* point on... */
@@ -5984,23 +5984,22 @@ static _noreturn_ void halt_now(enum act
case ACTION_HALT:
log_info("Halting.");
reboot(RB_HALT_SYSTEM);
- break;
+ return -errno;
case ACTION_POWEROFF:
log_info("Powering off.");
reboot(RB_POWER_OFF);
- break;
+ return -errno;
case ACTION_REBOOT:
log_info("Rebooting.");
reboot(RB_AUTOBOOT);
- break;
+ return -errno;
default:
- assert_not_reached("Unknown halt action.");
+ assert_not_reached("Unknown action.");
+ return -ENOSYS;
}
-
- assert_not_reached("Uh? This shouldn't happen.");
}
static int halt_main(DBusConnection *bus) {
@@ -6069,9 +6068,10 @@ static int halt_main(DBusConnection *bus
if (arg_dry)
return 0;
- halt_now(arg_action);
- /* We should never reach this. */
- return -ENOSYS;
+ r = halt_now(arg_action);
+ log_error("Failed to reboot: %s", strerror(-r));
+
+ return r;
}
static int runlevel_main(void) {

View File

@ -0,0 +1,54 @@
From 98b47d54ce946ad3524f84eb38d2413498a333dc Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 3 Mar 2014 17:11:39 +0100
Subject: [PATCH] execute: free directory path if we fail to remove it because
we cannot allocate a thread
---
src/core/execute.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git src/core/execute.c src/core/execute.c
index 9de6e87..3312885 100644
--- src/core/execute.c
+++ src/core/execute.c
@@ -2713,6 +2713,8 @@ static void *remove_tmpdir_thread(void *p) {
}
void exec_runtime_destroy(ExecRuntime *rt) {
+ int r;
+
if (!rt)
return;
@@ -2722,13 +2724,25 @@ void exec_runtime_destroy(ExecRuntime *rt) {
if (rt->tmp_dir) {
log_debug("Spawning thread to nuke %s", rt->tmp_dir);
- asynchronous_job(remove_tmpdir_thread, rt->tmp_dir);
+
+ r = asynchronous_job(remove_tmpdir_thread, rt->tmp_dir);
+ if (r < 0) {
+ log_warning("Failed to nuke %s: %s", rt->tmp_dir, strerror(-r));
+ free(rt->tmp_dir);
+ }
+
rt->tmp_dir = NULL;
}
if (rt->var_tmp_dir) {
log_debug("Spawning thread to nuke %s", rt->var_tmp_dir);
- asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir);
+
+ r = asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir);
+ if (r < 0) {
+ log_warning("Failed to nuke %s: %s", rt->var_tmp_dir, strerror(-r));
+ free(rt->var_tmp_dir);
+ }
+
rt->var_tmp_dir = NULL;
}
--
1.7.9.2

View File

@ -1,55 +0,0 @@
From 6c8c92fef72cf6a7ef7109a424ef82dbdc4f6952 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Wed, 2 Oct 2013 07:46:24 -0400
Subject: [PATCH 02/15] 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
--
1.8.4

View File

@ -0,0 +1,52 @@
From 3e6b205f81e743c7354ccbc69eb45afbdbebe2dc Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Tue, 25 Feb 2014 13:08:24 +0100
Subject: [PATCH] login: set pos-slot to fallback on pos-eviction
If we evict a session position, we open the position slot for future
sessions. However, there might already be another session on the same
position if both were started on the same VT. This is currently done if
gdm spawns the session on its own Xserver.
Hence, look for such a session on pos-eviction and claim the new slot
immediately.
---
src/login/logind-seat.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git src/login/logind-seat.c src/login/logind-seat.c
index 36ec7ed..96cf08e 100644
--- src/login/logind-seat.c
+++ src/login/logind-seat.c
@@ -459,6 +459,7 @@ int seat_stop_sessions(Seat *s, bool force) {
}
void seat_evict_position(Seat *s, Session *session) {
+ Session *iter;
unsigned int pos = session->pos;
session->pos = 0;
@@ -466,8 +467,19 @@ void seat_evict_position(Seat *s, Session *session) {
if (!pos)
return;
- if (pos < s->position_count && s->positions[pos] == session)
+ if (pos < s->position_count && s->positions[pos] == session) {
s->positions[pos] = NULL;
+
+ /* There might be another session claiming the same
+ * position (eg., during gdm->session transition), so lets look
+ * for it and set it on the free slot. */
+ LIST_FOREACH(sessions_by_seat, iter, s->sessions) {
+ if (iter->pos == pos) {
+ s->positions[pos] = iter;
+ break;
+ }
+ }
+ }
}
void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
--
1.7.9.2

View File

@ -1,62 +0,0 @@
From 95d57e7b631a2d78b9b5d841125194052895470f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Jan 2014 13:49:54 +0100
Subject: [PATCH 2/3] service: allow KillMode=mixed in conjunction with
PAMName=
---
src/core/service.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/core/service.c b/src/core/service.c
index 6792024..e7f03e1 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1105,37 +1105,31 @@ static int service_verify(Service *s) {
return 0;
if (!s->exec_command[SERVICE_EXEC_START]) {
- log_error_unit(UNIT(s)->id,
- "%s lacks ExecStart setting. Refusing.", UNIT(s)->id);
+ log_error_unit(UNIT(s)->id, "%s lacks ExecStart setting. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type != SERVICE_ONESHOT &&
s->exec_command[SERVICE_EXEC_START]->command_next) {
- log_error_unit(UNIT(s)->id,
- "%s has more than one ExecStart setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
+ log_error_unit(UNIT(s)->id, "%s has more than one ExecStart setting, which is only allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type == SERVICE_ONESHOT && s->restart != SERVICE_RESTART_NO) {
- log_error_unit(UNIT(s)->id,
- "%s has Restart setting other than no, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
+ log_error_unit(UNIT(s)->id, "%s has Restart setting other than no, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->type == SERVICE_DBUS && !s->bus_name) {
- log_error_unit(UNIT(s)->id,
- "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id);
+ log_error_unit(UNIT(s)->id, "%s is of type D-Bus but no D-Bus service name has been specified. Refusing.", UNIT(s)->id);
return -EINVAL;
}
if (s->bus_name && s->type != SERVICE_DBUS)
- log_warning_unit(UNIT(s)->id,
- "%s has a D-Bus service name specified, but is not of type dbus. Ignoring.", UNIT(s)->id);
+ log_warning_unit(UNIT(s)->id, "%s has a D-Bus service name specified, but is not of type dbus. Ignoring.", UNIT(s)->id);
- if (s->exec_context.pam_name && s->kill_context.kill_mode != KILL_CONTROL_GROUP) {
- log_error_unit(UNIT(s)->id,
- "%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(s)->id);
+ if (s->exec_context.pam_name && !(s->kill_context.kill_mode == KILL_CONTROL_GROUP || s->kill_context.kill_mode == KILL_MIXED)) {
+ log_error_unit(UNIT(s)->id, "%s has PAM enabled. Kill mode must be set to 'control-group' or 'mixed'. Refusing.", UNIT(s)->id);
return -EINVAL;
}
--
1.8.4

View File

@ -0,0 +1,130 @@
From b5d742138f71e87312541a89aac5657015f50f48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 4 Mar 2014 09:50:26 -0500
Subject: [PATCH] Do not print invalid UTF-8 in error messages
Inexplicably, 550a40ec ('core: do not print invalid utf-8 in error
messages') only fixed two paths. Convert all of them now.
---
src/core/load-fragment.c | 13 ++++---------
src/shared/conf-parser.c | 7 +++----
src/shared/conf-parser.h | 6 ++++++
src/shared/fileio.c | 9 ++++++---
4 files changed, 19 insertions(+), 16 deletions(-)
diff --git src/core/load-fragment.c src/core/load-fragment.c
index d77bf5c..5628d8c 100644
--- src/core/load-fragment.c
+++ src/core/load-fragment.c
@@ -536,9 +536,7 @@ int config_parse_exec(const char *unit,
}
if (!utf8_is_valid(path)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s",
- rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
r = 0;
goto fail;
}
@@ -553,9 +551,7 @@ int config_parse_exec(const char *unit,
}
if (!utf8_is_valid(c)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s",
- rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
r = 0;
goto fail;
}
@@ -1960,8 +1956,7 @@ int config_parse_unit_requires_mounts_for(
return log_oom();
if (!utf8_is_valid(n)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
continue;
}
diff --git src/shared/conf-parser.c src/shared/conf-parser.c
index 0a87a71..d27b1b7 100644
--- src/shared/conf-parser.c
+++ src/shared/conf-parser.c
@@ -618,8 +618,7 @@ int config_parse_string(const char *unit
return log_oom();
if (!utf8_is_valid(n)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "String is not UTF-8 clean, ignoring assignment: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
free(n);
return 0;
}
@@ -656,8 +655,7 @@ int config_parse_path(const char *unit,
assert(data);
if (!utf8_is_valid(rvalue)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Path is not UTF-8 clean, ignoring assignment: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
return 0;
}
@@ -725,8 +723,7 @@ int config_parse_strv(const char *unit,
return log_oom();
if (!utf8_is_valid(n)) {
- log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "String is not UTF-8 clean, ignoring: %s", rvalue);
+ log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue);
continue;
}
diff --git src/shared/conf-parser.h src/shared/conf-parser.h
index e1c7ab4..ba0e58d 100644
--- src/shared/conf-parser.h
+++ src/shared/conf-parser.h
@@ -121,6 +121,12 @@ int log_syntax_internal(const char *unit, int level,
config_file, config_line, \
error, __VA_ARGS__)
+#define log_invalid_utf8(unit, level, config_file, config_line, error, rvalue) { \
+ _cleanup_free_ char *__p = utf8_escape_invalid(rvalue); \
+ log_syntax(unit, level, config_file, config_line, error, \
+ "String is not UTF-8 clean, ignoring assignment: %s", __p); \
+ }
+
#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
int function(const char *unit, \
const char *filename, \
diff --git src/shared/fileio.c src/shared/fileio.c
index d591567..f101269 100644
--- src/shared/fileio.c
+++ src/shared/fileio.c
@@ -598,15 +598,18 @@ static int load_env_file_push(const char *filename, unsigned line,
int r;
if (!utf8_is_valid(key)) {
+ _cleanup_free_ char *t = utf8_escape_invalid(key);
+
log_error("%s:%u: invalid UTF-8 for key '%s', ignoring.",
- filename, line, key);
+ filename, line, t);
return -EINVAL;
}
if (value && !utf8_is_valid(value)) {
- /* FIXME: filter UTF-8 */
+ _cleanup_free_ char *t = utf8_escape_invalid(value);
+
log_error("%s:%u: invalid UTF-8 value for key %s: '%s', ignoring.",
- filename, line, key, value);
+ filename, line, key, t);
return -EINVAL;
}
--
1.7.9.2

View File

@ -1,25 +0,0 @@
From 2c64a8d0caf84254e38f2e76528f2034d37da520 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 14:03:56 +0200
Subject: [PATCH 03/15] 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;
--
1.8.4

View File

@ -1,128 +0,0 @@
From b2ffdc8da536cd88a305f97517f356e2c5383a52 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 29 Jan 2014 14:58:04 +0100
Subject: [PATCH 3/3] core: make sure to always go through both SIGTERM and
SIGKILL states of units
Given that we now have KillMode=mixed where SIGTERM might kill a smaller
set than SIGKILL we need to make sure to always go explicitly throught
the SIGKILL state to get the right end result.
---
src/core/mount.c | 8 +++++++-
src/core/scope.c | 4 +++-
src/core/service.c | 10 +++++++---
src/core/socket.c | 6 +++++-
src/core/swap.c | 6 +++++-
5 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/core/mount.c b/src/core/mount.c
index 3d46557..e418d09 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -854,8 +854,14 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
goto fail;
mount_set_state(m, state);
- } else if (state == MOUNT_REMOUNTING_SIGTERM || state == MOUNT_REMOUNTING_SIGKILL)
+ } else if (state == MOUNT_REMOUNTING_SIGTERM)
+ mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_SUCCESS);
+ else if (state == MOUNT_REMOUNTING_SIGKILL)
mount_enter_mounted(m, MOUNT_SUCCESS);
+ else if (state == MOUNT_MOUNTING_SIGTERM)
+ mount_enter_signal(m, MOUNT_MOUNTING_SIGKILL, MOUNT_SUCCESS);
+ else if (state == MOUNT_UNMOUNTING_SIGTERM)
+ mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_SUCCESS);
else
mount_enter_dead(m, MOUNT_SUCCESS);
diff --git a/src/core/scope.c b/src/core/scope.c
index 50e5dba..3a5c95e 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -221,7 +221,9 @@ static void scope_enter_signal(Scope *s, ScopeState state, ScopeResult f) {
}
scope_set_state(s, state);
- } else
+ } else if (state == SCOPE_STOP_SIGTERM)
+ scope_enter_signal(s, SCOPE_STOP_SIGKILL, SCOPE_SUCCESS);
+ else
scope_enter_dead(s, SCOPE_SUCCESS);
return;
diff --git a/src/core/service.c b/src/core/service.c
index e7f03e1..4b481c2 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1964,10 +1964,9 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
if (r < 0)
goto fail;
-
service_set_state(s, SERVICE_STOP_POST);
} else
- service_enter_dead(s, SERVICE_SUCCESS, true);
+ service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_SUCCESS);
return;
@@ -1993,6 +1992,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
s->main_pid,
s->control_pid,
s->main_pid_alien);
+
if (r < 0)
goto fail;
@@ -2005,8 +2005,12 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
}
service_set_state(s, state);
- } else if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL)
+ } else if (state == SERVICE_STOP_SIGTERM)
+ service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_SUCCESS);
+ else if (state == SERVICE_STOP_SIGKILL)
service_enter_stop_post(s, SERVICE_SUCCESS);
+ else if (state == SERVICE_FINAL_SIGTERM)
+ service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_SUCCESS);
else
service_enter_dead(s, SERVICE_SUCCESS, true);
diff --git a/src/core/socket.c b/src/core/socket.c
index 6c0ac1a..831876f 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1298,8 +1298,12 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) {
goto fail;
socket_set_state(s, state);
- } else if (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_STOP_PRE_SIGKILL)
+ } else if (state == SOCKET_STOP_PRE_SIGTERM)
+ socket_enter_signal(s, SOCKET_STOP_PRE_SIGKILL, SOCKET_SUCCESS);
+ else if (state == SOCKET_STOP_PRE_SIGKILL)
socket_enter_stop_post(s, SOCKET_SUCCESS);
+ else if (state == SOCKET_FINAL_SIGTERM)
+ socket_enter_signal(s, SOCKET_FINAL_SIGKILL, SOCKET_SUCCESS);
else
socket_enter_dead(s, SOCKET_SUCCESS);
diff --git a/src/core/swap.c b/src/core/swap.c
index a68ab7c..8886fe8 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -655,7 +655,11 @@ static void swap_enter_signal(Swap *s, SwapState state, SwapResult f) {
goto fail;
swap_set_state(s, state);
- } else
+ } else if (state == SWAP_ACTIVATING_SIGTERM)
+ swap_enter_signal(s, SWAP_ACTIVATING_SIGKILL, SWAP_SUCCESS);
+ else if (state == SWAP_DEACTIVATING_SIGTERM)
+ swap_enter_signal(s, SWAP_DEACTIVATING_SIGKILL, SWAP_SUCCESS);
+ else
swap_enter_dead(s, SWAP_SUCCESS);
return;
--
1.8.4

View File

@ -0,0 +1,35 @@
From 9c413373d2112055a0142ef522bf95af9b491b4a Mon Sep 17 00:00:00 2001
From: "Jasper St. Pierre" <jstpierre@mecheye.net>
Date: Fri, 21 Feb 2014 18:23:17 -0500
Subject: [PATCH] login: Allow calling org.freedesktop.login1.Seat.SwitchTo
---
src/login/org.freedesktop.login1.conf | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git src/login/org.freedesktop.login1.conf src/login/org.freedesktop.login1.conf
index d677f61..1318328 100644
--- src/login/org.freedesktop.login1.conf
+++ src/login/org.freedesktop.login1.conf
@@ -141,6 +141,18 @@
send_member="ActivateSession"/>
<allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Seat"
+ send_member="SwitchTo"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Seat"
+ send_member="SwitchToPrevious"/>
+
+ <allow send_destination="org.freedesktop.login1"
+ send_interface="org.freedesktop.login1.Seat"
+ send_member="SwitchToNext"/>
+
+ <allow send_destination="org.freedesktop.login1"
send_interface="org.freedesktop.login1.Session"
send_member="Activate"/>
--
1.7.9.2

View File

@ -0,0 +1,22 @@
From b3e4387351c835766f96796a20d94971afea7d3b Mon Sep 17 00:00:00 2001
From: Tomasz Torcz <tomek@pipebreaker.pl>
Date: Tue, 25 Feb 2014 12:43:55 +0100
Subject: [PATCH] fix typo in iDRAC network interface name: irdac->idrac
---
hwdb/20-net-ifname.hwdb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git hwdb/20-net-ifname.hwdb hwdb/20-net-ifname.hwdb
index 29d2633..2408dc1 100644
--- hwdb/20-net-ifname.hwdb
+++ hwdb/20-net-ifname.hwdb
@@ -2,4 +2,4 @@
# Dell iDRAC Virtual USB NIC
usb:v413CpA102*
- ID_NET_NAME_FROM_DATABASE=irdac
+ ID_NET_NAME_FROM_DATABASE=idrac
--
1.7.9.2

View File

@ -0,0 +1,113 @@
From 981ee551945f4e00de52fcbb7780fd7476bcd47e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 5 Mar 2014 03:37:48 +0100
Subject: [PATCH] man: document missing options of systemd-run
---
man/systemd-run.xml | 71 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 60 insertions(+), 11 deletions(-)
diff --git man/systemd-run.xml man/systemd-run.xml
index 95c1cb7..81d41dc 100644
--- man/systemd-run.xml
+++ man/systemd-run.xml
@@ -121,9 +121,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>--description=</option></term>
- <listitem><para>Provide description for the unit. If not
- specified, the command itself will be used as a description.
- See <varname>Description=</varname> in
+ <listitem><para>Provide description for the service or scope
+ unit. If not specified, the command itself will be used as a
+ description. See <varname>Description=</varname> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>
@@ -140,10 +140,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>--remain-after-exit</option></term>
- <listitem><para>After the service's process has terminated, keep
- the service around until it is explicitly stopped. This is
- useful to collect runtime information about the service after
- it finished running. Also see
+ <listitem><para>After the service or scope process has
+ terminated, keep the service around until it is explicitly
+ stopped. This is useful to collect runtime information about
+ the service after it finished running. Also see
<varname>RemainAfterExit=</varname> in
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
@@ -153,15 +153,64 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<varlistentry>
<term><option>--send-sighup</option></term>
- <listitem><para>When terminating the scope unit, send a SIGHUP
- immediately after SIGTERM. This is useful to indicate to
- shells and shell-like processes that the connection has been
- severed. Also see <varname>SendSIGHUP=</varname> in
+ <listitem><para>When terminating the scope or service unit,
+ send a SIGHUP immediately after SIGTERM. This is useful to
+ indicate to shells and shell-like processes that the
+ connection has been severed. Also see
+ <varname>SendSIGHUP=</varname> in
<citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--service-type=</option></term>
+
+ <listitem><para>Sets the service type. Also see
+ <varname>Type=</varname> in
+ <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>. Defaults to
+ <constant>simple</constant>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--uid=</option></term>
+ <term><option>--gid=</option></term>
+
+ <listitem><para>Runs the service process under the UNIX user
+ and group. Also see <varname>User=</varname> and
+ <varname>Group=</varname> in
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--nice=</option></term>
+
+ <listitem><para>Runs the service process with the specified
+ nice level. Also see <varname>Nice=</varname> in
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--setenv=</option></term>
+
+ <listitem><para>Runs the service process with the specified
+ environment variables set. Also see
+ <varname>Environment=</varname> in
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
+ option has no effect in conjunction with
+ <option>--scope</option>.</para>
+ </listitem>
+ </varlistentry>
+
<xi:include href="user-system-options.xml" xpointer="user" />
<xi:include href="user-system-options.xml" xpointer="system" />
<xi:include href="user-system-options.xml" xpointer="host" />
--
1.7.9.2

View File

@ -1,134 +0,0 @@
From cbb13b2a538ece1c7ec3b210e2b36b47df2a13ea 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 04/15] 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;
--
1.8.4

View File

@ -0,0 +1,89 @@
From 41a55c46ab8fb4ef6727434227071321fc762cce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 25 Feb 2014 20:11:04 -0500
Subject: [PATCH] Replace /var/run with /run in remaining places
/run was already used almost everywhere, fix the remaining places
for consistency.
---
man/daemon.xml | 2 +-
man/runlevel.xml | 2 +-
man/tmpfiles.d.xml | 4 ++--
src/libsystemd/sd-bus/sd-bus.c | 4 ++--
src/systemctl/systemctl.c | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git man/daemon.xml man/daemon.xml
index 88dd082..fd29ba7 100644
--- man/daemon.xml
+++ man/daemon.xml
@@ -149,7 +149,7 @@
write the daemon PID (as returned by
<function>getpid()</function>) to a
PID file, for example
- <filename>/var/run/foobar.pid</filename>
+ <filename>/run/foobar.pid</filename>
(for a hypothetical daemon "foobar")
to ensure that the daemon cannot be
started more than once. This must be
diff --git man/runlevel.xml man/runlevel.xml
index 976753a..4db06dc 100644
--- man/runlevel.xml
+++ man/runlevel.xml
@@ -124,7 +124,7 @@
<variablelist>
<varlistentry>
- <term><filename>/var/run/utmp</filename></term>
+ <term><filename>/run/utmp</filename></term>
<listitem><para>The utmp database
<command>runlevel</command> reads the
diff --git man/tmpfiles.d.xml man/tmpfiles.d.xml
index 812129f..0a006d1 100644
--- man/tmpfiles.d.xml
+++ man/tmpfiles.d.xml
@@ -441,8 +441,8 @@ r! /tmp/.X[0-9]*-lock</programlisting>
<title>/etc/tmpfiles.d/screen.conf example</title>
<para><command>screen</command> needs two directories created at boot with specific modes and ownership.</para>
- <programlisting>d /var/run/screens 1777 root root 10d
-d /var/run/uscreens 0755 root root 10d12h</programlisting>
+ <programlisting>d /run/screens 1777 root root 10d
+d /run/uscreens 0755 root root 10d12h</programlisting>
</example>
<example>
<title>/etc/tmpfiles.d/abrt.conf example</title>
diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c
index 20f540d..1318272 100644
--- src/libsystemd/sd-bus/sd-bus.c
+++ src/libsystemd/sd-bus/sd-bus.c
@@ -794,8 +794,8 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid)
machine = NULL;
b->sockaddr.un.sun_family = AF_UNIX;
- strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
- b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + sizeof("/var/run/dbus/system_bus_socket") - 1;
+ strncpy(b->sockaddr.un.sun_path, "/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
+ b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/run/dbus/system_bus_socket");
return 0;
}
diff --git src/systemctl/systemctl.c src/systemctl/systemctl.c
index 34d7079..8692716 100644
--- src/systemctl/systemctl.c
+++ src/systemctl/systemctl.c
@@ -3758,8 +3758,8 @@ static int show_one(
streq(verb, "status")) {
/* According to LSB: "program not running" */
/* 0: program is running or service is OK
- * 1: program is dead and /var/run pid file exists
- * 2: program is dead and /var/lock lock file exists
+ * 1: program is dead and /run PID file exists
+ * 2: program is dead and /run/lock lock file exists
* 3: program is not running
* 4: program or service status is unknown
*/
--
1.7.9.2

View File

@ -1,48 +0,0 @@
From 4b93637fd7dddb0a1518f35171998b2c7cd5c5bd Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:36:28 +0200
Subject: [PATCH 05/15] 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;
--
1.8.4

View File

@ -0,0 +1,34 @@
From 1ac67edb7c4d31a287fa98c0b554ae98bd34e71b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 5 Mar 2014 03:38:36 +0100
Subject: [PATCH] systemd-run: add some extra safety checks
---
src/run/run.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git src/run/run.c src/run/run.c
index 81763c9..e71ca7d 100644
--- src/run/run.c
+++ src/run/run.c
@@ -37,7 +37,7 @@ static const char *arg_description = NULL;
static const char *arg_slice = NULL;
static bool arg_send_sighup = false;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
-static char *arg_host = NULL;
+static const char *arg_host = NULL;
static bool arg_user = false;
static const char *arg_service_type = NULL;
static const char *arg_exec_user = NULL;
@@ -186,7 +186,7 @@ static int parse_argv(int argc, char *argv[]) {
case ARG_NICE:
r = safe_atoi(optarg, &arg_nice);
- if (r < 0) {
+ if (r < 0 || arg_nice < PRIO_MIN || arg_nice >= PRIO_MAX) {
log_error("Failed to parse nice value");
return -EINVAL;
}
--
1.7.9.2

View File

@ -0,0 +1,60 @@
From df1e02046144f41176c32ed011369fd8dba36b76 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 26 Feb 2014 02:47:43 +0100
Subject: [PATCH] Revert back to /var/run at a couple of problems
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This partially reverts 41a55c46ab8fb4ef6727434227071321fc762cce
Some specifications we want to stay compatibility actually document
/var/run, not /run, and we should stay compatible with that. In order to
make sure our D-Bus implementation works on any system, regardless if
running systemd or not, we should always use /var/run which is the
only path mandated by the D-Bus spec.
Similar, glibc hardcodes the utmp location to /var/run, and this is
exposed in _UTMP_PATH in limits.h, hence let's stay in sync with this
public API, too.
We simply do not support systems where /var/run is not a symlink → /run.
Hence both are equivalent. Staying compatible with upstream
specifications hence weighs more than cleaning up superficial
appearance.
---
man/runlevel.xml | 2 +-
src/libsystemd/sd-bus/sd-bus.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git man/runlevel.xml man/runlevel.xml
index 4db06dc..976753a 100644
--- man/runlevel.xml
+++ man/runlevel.xml
@@ -124,7 +124,7 @@
<variablelist>
<varlistentry>
- <term><filename>/run/utmp</filename></term>
+ <term><filename>/var/run/utmp</filename></term>
<listitem><para>The utmp database
<command>runlevel</command> reads the
diff --git src/libsystemd/sd-bus/sd-bus.c src/libsystemd/sd-bus/sd-bus.c
index 1318272..636715f 100644
--- src/libsystemd/sd-bus/sd-bus.c
+++ src/libsystemd/sd-bus/sd-bus.c
@@ -794,8 +794,8 @@ static int parse_container_unix_address(sd_bus *b, const char **p, char **guid)
machine = NULL;
b->sockaddr.un.sun_family = AF_UNIX;
- strncpy(b->sockaddr.un.sun_path, "/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
- b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/run/dbus/system_bus_socket");
+ strncpy(b->sockaddr.un.sun_path, "/var/run/dbus/system_bus_socket", sizeof(b->sockaddr.un.sun_path));
+ b->sockaddr_size = offsetof(struct sockaddr_un, sun_path) + strlen("/var/run/dbus/system_bus_socket");
return 0;
}
--
1.7.9.2

View File

@ -0,0 +1,70 @@
From fb099c8d2af6620db2709e826a258089d10cdfe8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 27 Feb 2014 00:07:29 -0500
Subject: [PATCH] journal: assume that next entry is after previous entry
With a corrupted file, we can get in a situation where two entries
in the entry array point to the same object. Then journal_file_next_entry
will find the first one using generic_arrray_bisect, and try to move to
the second one, but since the address is the same, generic_array_get will
return the first one. journal_file_next_entry ends up in an infinite loop.
https://bugzilla.redhat.com/show_bug.cgi?id=1047039
---
src/journal/journal-file.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 5876733..0e1fc7f 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -1359,7 +1359,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
}
typedef struct ChainCacheItem {
- uint64_t first; /* the array at the begin of the chain */
+ uint64_t first; /* the array at the beginning of the chain */
uint64_t array; /* the cached array */
uint64_t begin; /* the first item in the cached array */
uint64_t total; /* the total number of items in all arrays before this one in the chain */
@@ -1945,7 +1945,7 @@ int journal_file_next_entry(
direction_t direction,
Object **ret, uint64_t *offset) {
- uint64_t i, n;
+ uint64_t i, n, ofs;
int r;
assert(f);
@@ -1986,10 +1986,24 @@ int journal_file_next_entry(
}
/* And jump to it */
- return generic_array_get(f,
- le64toh(f->header->entry_array_offset),
- i,
- ret, offset);
+ r = generic_array_get(f,
+ le64toh(f->header->entry_array_offset),
+ i,
+ ret, &ofs);
+ if (r <= 0)
+ return r;
+
+ if (p > 0 &&
+ (direction == DIRECTION_DOWN ? ofs <= p : ofs >= p)) {
+ log_debug("%s: entry array corrupted at entry %"PRIu64,
+ f->path, i);
+ return -EBADMSG;
+ }
+
+ if (offset)
+ *offset = ofs;
+
+ return 1;
}
int journal_file_skip_entry(
--
1.7.9.2

View File

@ -1,25 +0,0 @@
From 8c92d4bbc7a538ada11d7e85016cce141beb0e6c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:36:43 +0200
Subject: [PATCH 06/15] 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);
--
1.8.4

View File

@ -0,0 +1,30 @@
From 47bc23c18cbc87471dc832534c8565625e4a9d16 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 26 Feb 2014 02:54:37 +0100
Subject: [PATCH] =?UTF-8?q?README:=20document=20that=20/var/run=20must=20be=20?=
=?UTF-8?q?a=20symlink=20=E2=86=92=20/run?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README | 3 +++
1 file changed, 3 insertions(+)
diff --git README README
index b918132..7a227e7 100644
--- README
+++ README
@@ -190,6 +190,9 @@ WARNINGS:
about this, since this kind of file system setup is not really
supported anymore by the basic set of Linux OS components.
+ systemd requires that the /run mount point exists. systemd also
+ requires that /var/run is a a symlink → /run.
+
For more information on this issue consult
http://freedesktop.org/wiki/Software/systemd/separate-usr-is-broken
--
1.7.9.2

View File

@ -1,34 +0,0 @@
From f5f6e41a9ee008e1632f79ab3fa20beef7c2b613 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:11 +0200
Subject: [PATCH 07/15] 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;
--
1.8.4

View File

@ -0,0 +1,74 @@
From a9a245c128af6c0418085062c60251bc51fa4a94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 27 Feb 2014 00:11:54 -0500
Subject: [PATCH] journal: forget file after encountering an error
If we encounter an inconsistency in a file, let's just
ignore it. Otherwise, after previous patch, we would try,
and fail, to use this file in every invocation of sd_journal_next
or sd_journal_previous that happens afterwards.
---
src/journal/sd-journal.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git src/journal/sd-journal.c src/journal/sd-journal.c
index ef455e9..b54bc21 100644
--- src/journal/sd-journal.c
+++ src/journal/sd-journal.c
@@ -51,6 +51,8 @@
#define DEFAULT_DATA_THRESHOLD (64*1024)
+static void remove_file_real(sd_journal *j, JournalFile *f);
+
static bool journal_pid_changed(sd_journal *j) {
assert(j);
@@ -885,6 +887,7 @@ static int real_journal_next(sd_journal *j, direction_t direction) {
r = next_beyond_location(j, f, direction, &o, &p);
if (r < 0) {
log_debug("Can't iterate through %s, ignoring: %s", f->path, strerror(-r));
+ remove_file_real(j, f);
continue;
} else if (r == 0)
continue;
@@ -1339,7 +1342,7 @@ static int add_file(sd_journal *j, const char *prefix, const char *filename) {
}
static int remove_file(sd_journal *j, const char *prefix, const char *filename) {
- char *path;
+ _cleanup_free_ char *path;
JournalFile *f;
assert(j);
@@ -1351,10 +1354,17 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
return -ENOMEM;
f = hashmap_get(j->files, path);
- free(path);
if (!f)
return 0;
+ remove_file_real(j, f);
+ return 0;
+}
+
+static void remove_file_real(sd_journal *j, JournalFile *f) {
+ assert(j);
+ assert(f);
+
hashmap_remove(j->files, f->path);
log_debug("File %s removed.", f->path);
@@ -1372,8 +1382,6 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
journal_file_close(f);
j->current_invalidate_counter ++;
-
- return 0;
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
--
1.7.9.2

View File

@ -0,0 +1,51 @@
From 1ae383a8a3ae4824453e297352fda603d2d3fd5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Tue, 25 Feb 2014 21:26:31 -0500
Subject: [PATCH] Use /var/run/dbus/system_bus_socket for the D-Bus socket
---
man/systemd-bus-proxyd@.service.xml | 2 +-
src/shared/def.h | 2 +-
units/systemd-bus-proxyd.socket | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git man/systemd-bus-proxyd@.service.xml man/systemd-bus-proxyd@.service.xml
index 75a3c8b..3a5930d 100644
--- man/systemd-bus-proxyd@.service.xml
+++ man/systemd-bus-proxyd@.service.xml
@@ -59,7 +59,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
<para><filename>systemd-bus-proxyd.socket</filename> will launch
<filename>systemd-bus-proxyd@.service</filename> for connections
to the classic D-Bus socket in
- <filename>/run/dbus/system_bus_socket</filename>.</para>
+ <filename>/var/run/dbus/system_bus_socket</filename>.</para>
<para><filename>systemd-bus-proxyd@.service</filename> is launched
for an existing D-Bus connection and will use
diff --git src/shared/def.h src/shared/def.h
index 7777756..aa489d8 100644
--- src/shared/def.h
+++ src/shared/def.h
@@ -61,7 +61,7 @@
"/usr/lib/kbd/keymaps/\0"
#endif
-#define UNIX_SYSTEM_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
+#define UNIX_SYSTEM_BUS_PATH "unix:path=/var/run/dbus/system_bus_socket"
#define KERNEL_SYSTEM_BUS_PATH "kernel:path=/dev/kdbus/0-system/bus"
#ifdef ENABLE_KDBUS
diff --git units/systemd-bus-proxyd.socket units/systemd-bus-proxyd.socket
index 406e15b..6c42d38 100644
--- units/systemd-bus-proxyd.socket
+++ units/systemd-bus-proxyd.socket
@@ -9,5 +9,5 @@
Description=Legacy D-Bus Protocol Compatibility Socket
[Socket]
-ListenStream=/run/dbus/system_bus_socket
+ListenStream=/var/run/dbus/system_bus_socket
Accept=yes
--
1.7.9.2

View File

@ -0,0 +1,102 @@
From bd44e61b0480712ec5585ff7b0295362a5f9dd36 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 6 Mar 2014 02:19:42 +0100
Subject: [PATCH] core: correctly unregister PIDs from PID hashtables
---
src/core/unit.c | 42 ++++++++++++++++++------------------------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git src/core/unit.c src/core/unit.c
index 2437ee3..85250ca 100644
--- src/core/unit.c
+++ src/core/unit.c
@@ -1704,11 +1704,11 @@ int unit_watch_pid(Unit *u, pid_t pid) {
/* Watch a specific PID. We only support one or two units
* watching each PID for now, not more. */
- r = hashmap_ensure_allocated(&u->manager->watch_pids1, trivial_hash_func, trivial_compare_func);
+ r = set_ensure_allocated(&u->pids, trivial_hash_func, trivial_compare_func);
if (r < 0)
return r;
- r = set_ensure_allocated(&u->pids, trivial_hash_func, trivial_compare_func);
+ r = hashmap_ensure_allocated(&u->manager->watch_pids1, trivial_hash_func, trivial_compare_func);
if (r < 0)
return r;
@@ -1737,7 +1737,17 @@ void unit_unwatch_pid(Unit *u, pid_t pid) {
set_remove(u->pids, LONG_TO_PTR(pid));
}
-static int watch_pids_in_path(Unit *u, const char *path) {
+void unit_unwatch_all_pids(Unit *u) {
+ assert(u);
+
+ while (!set_isempty(u->pids))
+ unit_unwatch_pid(u, PTR_TO_LONG(set_first(u->pids)));
+
+ set_free(u->pids);
+ u->pids = NULL;
+}
+
+static int unit_watch_pids_in_path(Unit *u, const char *path) {
_cleanup_closedir_ DIR *d = NULL;
_cleanup_fclose_ FILE *f = NULL;
int ret = 0, r;
@@ -1775,7 +1785,7 @@ static int watch_pids_in_path(Unit *u, const char *path) {
if (!p)
return -ENOMEM;
- r = watch_pids_in_path(u, p);
+ r = unit_watch_pids_in_path(u, p);
if (r < 0 && ret >= 0)
ret = r;
}
@@ -1788,31 +1798,15 @@ static int watch_pids_in_path(Unit *u, const char *path) {
return ret;
}
-
int unit_watch_all_pids(Unit *u) {
assert(u);
- if (!u->cgroup_path)
- return -ENOENT;
-
/* Adds all PIDs from our cgroup to the set of PIDs we watch */
- return watch_pids_in_path(u, u->cgroup_path);
-}
-
-void unit_unwatch_all_pids(Unit *u) {
- Iterator i;
- void *e;
-
- assert(u);
-
- SET_FOREACH(e, u->pids, i) {
- hashmap_remove_value(u->manager->watch_pids1, e, u);
- hashmap_remove_value(u->manager->watch_pids2, e, u);
- }
+ if (!u->cgroup_path)
+ return -ENOENT;
- set_free(u->pids);
- u->pids = NULL;
+ return unit_watch_pids_in_path(u, u->cgroup_path);
}
void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) {
@@ -1830,7 +1824,7 @@ void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2) {
continue;
if (!pid_is_unwaited(pid))
- set_remove(u->pids, e);
+ unit_unwatch_pid(u, pid);
}
}
--
1.7.9.2

View File

@ -1,30 +0,0 @@
From 2e8d788c2f90d062f208f8c57a97e7b33cb29f7d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:30 +0200
Subject: [PATCH 08/15] 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) {
--
1.8.4

View File

@ -0,0 +1,25 @@
From 646e392e10924454576f10b072f78d7676422816 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 6 Mar 2014 04:52:31 +0100
Subject: [PATCH] logind: fix reference to systemd-user-sessions.service
---
src/login/logind-session.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/login/logind-session.c src/login/logind-session.c
index 548f049..3700522 100644
--- src/login/logind-session.c
+++ src/login/logind-session.c
@@ -490,7 +490,7 @@ static int session_start_scope(Session *s) {
if (!scope)
return log_oom();
- r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-session.service", &error, &job);
+ r = manager_start_scope(s->manager, scope, s->leader, s->user->slice, description, "systemd-logind.service", "systemd-user-sessions.service", &error, &job);
if (r < 0) {
log_error("Failed to start session scope %s: %s %s",
scope, bus_error_message(&error, r), error.name);
--
1.7.9.2

View File

@ -1,27 +0,0 @@
From b857193b1def5172e3641ca1d5bc9e08ae81aac4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:37:44 +0200
Subject: [PATCH 09/15] 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);
--
1.8.4

View File

@ -0,0 +1,70 @@
From ff5f34d08c191c326c41a083745522383ac86cae Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 26 Feb 2014 04:27:50 +0100
Subject: [PATCH] mount: don't send out PropertiesChanged message if actually
nothing got changed
---
src/core/mount.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git src/core/mount.c src/core/mount.c
index b35e507..98812c9 100644
--- src/core/mount.c
+++ src/core/mount.c
@@ -1390,7 +1390,7 @@ static int mount_add_one(
_cleanup_free_ char *e = NULL, *w = NULL, *o = NULL, *f = NULL;
bool load_extras = false;
MountParameters *p;
- bool delete;
+ bool delete, changed = false;
Unit *u;
int r;
@@ -1458,6 +1458,7 @@ static int mount_add_one(
}
unit_add_to_load_queue(u);
+ changed = true;
} else {
delete = false;
@@ -1476,6 +1477,7 @@ static int mount_add_one(
/* Load in the extras later on, after we
* finished initialization of the unit */
load_extras = true;
+ changed = true;
}
}
@@ -1488,10 +1490,16 @@ static int mount_add_one(
}
p = &MOUNT(u)->parameters_proc_self_mountinfo;
+
+ changed = changed ||
+ !streq_ptr(p->options, options) ||
+ !streq_ptr(p->what, what) ||
+ !streq_ptr(p->fstype, fstype);
+
if (set_flags) {
MOUNT(u)->is_mounted = true;
MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo;
- MOUNT(u)->just_changed = !streq_ptr(p->options, o);
+ MOUNT(u)->just_changed = changed;
}
MOUNT(u)->from_proc_self_mountinfo = true;
@@ -1514,7 +1522,8 @@ static int mount_add_one(
goto fail;
}
- unit_add_to_dbus_queue(u);
+ if (changed)
+ unit_add_to_dbus_queue(u);
return 0;
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From 62678deda2dcd43954bf02f783da01e48c7f8fce Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:09 +0200
Subject: [PATCH 10/15] 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;
--
1.8.4

View File

@ -0,0 +1,35 @@
From 27d14fb331ba8144f99f4da2d13f15cf5c8b8a9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Mar 2014 08:10:19 -0500
Subject: [PATCH] man: update link to LSB
https://bugzilla.redhat.com/show_bug.cgi?id=1073402
---
man/daemon.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git man/daemon.xml man/daemon.xml
index fd29ba7..ab58d08 100644
--- man/daemon.xml
+++ man/daemon.xml
@@ -252,7 +252,7 @@
detect service errors and problems. It
is recommended to follow the exit code
scheme as defined in the <ulink
- url="http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
+ url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
recommendations for SysV init
scripts</ulink>.</para></listitem>
@@ -395,7 +395,7 @@
exclusively on boot (and manually by the
administrator) via SysV init scripts, as
detailed in the <ulink
- url="http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
+ url="http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html">LSB
Linux Standard Base Core
Specification</ulink>. This method of
activation is supported ubiquitously on Linux
--
1.7.9.2

View File

@ -0,0 +1,51 @@
From aef831369cd2a7a1bd4a58dd96ff8628ed6a85f9 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 26 Feb 2014 04:28:37 +0100
Subject: [PATCH] mount: don't fire PropertiesChanged signals for mounts that
are stopped
---
src/core/mount.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git src/core/mount.c src/core/mount.c
index 98812c9..7a92e1c 100644
--- src/core/mount.c
+++ src/core/mount.c
@@ -1679,20 +1679,20 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
Mount *mount = MOUNT(u);
if (!mount->is_mounted) {
- /* This has just been unmounted. */
mount->from_proc_self_mountinfo = false;
switch (mount->state) {
case MOUNT_MOUNTED:
+ /* This has just been unmounted by
+ * somebody else, follow the state
+ * change. */
mount_enter_dead(mount, MOUNT_SUCCESS);
break;
default:
- mount_set_state(mount, mount->state);
break;
-
}
} else if (mount->just_mounted || mount->just_changed) {
@@ -1703,6 +1703,9 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
case MOUNT_DEAD:
case MOUNT_FAILED:
+ /* This has just been mounted by
+ * somebody else, follow the state
+ * change. */
mount_enter_mounted(mount, MOUNT_SUCCESS);
break;
--
1.7.9.2

View File

@ -0,0 +1,41 @@
From 47d80904a1f72d559962cc5ad32fffd46672a34a Mon Sep 17 00:00:00 2001
From: Uoti Urpala <uoti.urpala@pp1.inet.fi>
Date: Thu, 20 Feb 2014 03:00:09 +0200
Subject: [PATCH] logs-show: fix corrupt output with empty messages
If a message had zero length, journalctl would print no newline, and
two output lines would be concatenated. Fix. The problem was
introduced in commit 31f7bf199452 ("logs-show: print multiline
messages"). Affected short and verbose output modes.
Before fix:
Feb 09 21:16:17 glyph dhclient[1323]: Feb 09 21:16:17 glyph NetworkManager[788]: <info> (enp4s2): DHCPv4 state changed nbi -> preinit
after:
Feb 09 21:16:17 glyph dhclient[1323]:
Feb 09 21:16:17 glyph NetworkManager[788]: <info> (enp4s2): DHCPv4 state changed nbi -> preinit
---
src/shared/logs-show.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git src/shared/logs-show.c src/shared/logs-show.c
index 61c3652..12d4a1c 100644
--- src/shared/logs-show.c
+++ src/shared/logs-show.c
@@ -124,6 +124,11 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
}
}
+ /* A special case: make sure that we print a newline when
+ the message is empty. */
+ if (message_len == 0)
+ fputs("\n", f);
+
for (pos = message;
pos < message + message_len;
pos = end + 1, line++) {
--
1.7.9.2

View File

@ -0,0 +1,28 @@
From 82ed60080d327d7301fcd55f5a1f8511f894b9d5 Mon Sep 17 00:00:00 2001
From: Zachary Cook <zachcook1991@gmail.com>
Date: Thu, 6 Mar 2014 03:49:49 -0500
Subject: [PATCH] man: systemd-bootchart - fix spacing in command
Use the same formatting as the systemd-analyze man page, so that man shows a space.
---
man/systemd-bootchart.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git man/systemd-bootchart.xml man/systemd-bootchart.xml
index d0adaad..1715d5d 100644
--- man/systemd-bootchart.xml
+++ man/systemd-bootchart.xml
@@ -78,8 +78,8 @@
in which order, and where possible problems
exist in the startup sequence of the system.
It is essentially a more detailed version of
- the <command>systemd-analyze</command>
- <command>plot</command> function.
+ the <command>systemd-analyze plot</command>
+ function.
</para>
<para>
Of course, bootchart can also be used at any
--
1.7.9.2

View File

@ -1,27 +0,0 @@
From 5b4fb02d890d5c9777e9a6e798e0b8922a8a9fd8 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:28 +0200
Subject: [PATCH 11/15] 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;
}
--
1.8.4

View File

@ -0,0 +1,30 @@
From 0b6b7c2004317da48e5bbd3078c5662d8f0061b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 26 Feb 2014 23:01:43 -0500
Subject: [PATCH] journalctl: refuse extra arguments with --verify and similar
Positional arguments only make sense with the default action.
For other actions, complain instead of ignoring them silently.
---
src/journal/journalctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git src/journal/journalctl.c src/journal/journalctl.c
index a328ba1..0619b25 100644
--- src/journal/journalctl.c
+++ src/journal/journalctl.c
@@ -658,6 +658,11 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
+ if (arg_action != ACTION_SHOW && optind < argc) {
+ log_error("Extraneous arguments starting with '%s'", argv[optind]);
+ return -EINVAL;
+ }
+
return 1;
}
--
1.7.9.2

View File

@ -0,0 +1,26 @@
From 7d06ef0a5cd2f0a4e021d3d12f3841cce529e0f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 6 Mar 2014 23:54:13 -0500
Subject: [PATCH] man: add missing comma
marcosf0> missing comma in udevadm "see also" section
---
man/udevadm.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git man/udevadm.xml man/udevadm.xml
index a3f8d54..21d1443 100644
--- man/udevadm.xml
+++ man/udevadm.xml
@@ -594,7 +594,7 @@
<title>See Also</title>
<para><citerefentry>
<refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
- </citerefentry>
+ </citerefentry>,
<citerefentry>
<refentrytitle>systemd-udevd.service</refentrytitle><manvolnum>8</manvolnum>
</citerefentry></para>
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From 69c2b6be8fc607412a13cd0ea03a629b4965c816 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 2 Oct 2013 19:38:52 +0200
Subject: [PATCH 12/15] 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) {
--
1.8.4

View File

@ -0,0 +1,54 @@
From a14f14976094650e17d39f3a7d15a1c68c93c333 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 27 Feb 2014 11:06:37 +0100
Subject: [PATCH] cdrom_id: use the old MMC fallback
https://bugzilla.redhat.com/show_bug.cgi?id=1038015
The problem seems to be that the your virtual DVD is emulating a really
old DVD device, and doing it kind of strangely.
> dracut:# /lib/udev/cdrom_id --debug /dev/sr0
> probing: '/dev/sr0'
> INQUIRY: [IMM ][Virtual CD/DVD ][0316]
> GET CONFIGURATION failed with SK=5h/ASC=24h/ACQ=00h
So your virtual drive rejects the GET CONFIGURATION command as illegal.
Other pre-MMC2 drives that don't accept this command usually return the
error
SK=5h,ASC=20h (invalid/unsupported command code), in which case cdrom_id
tries an older method, and then ID_CDROM_MEDIA_TRACK_COUNT_DATA gets set
and all the /dev/disk/by-label (etc) links get set up.
The virtual drive returns the error SK=5h,ASC=24h (invalid field in
Command Descriptor Block), which cdrom_id doesn't handle, so it gives up
and the links never get made.
The ideal solution would be to make the IMM to emulate a device that's
less than 15 years old, but I'm not going to hold my breath waiting for
that.
So probably cdrom_id should also use the old MMC fallback when the error
is SK=5h,ASC=24h, and then all of this would work as expected.
Suggested-by:Luca Miccini <lmiccini@redhat.com>
---
src/udev/cdrom_id/cdrom_id.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/udev/cdrom_id/cdrom_id.c src/udev/cdrom_id/cdrom_id.c
index 93467c2..33b2bc3 100644
--- src/udev/cdrom_id/cdrom_id.c
+++ src/udev/cdrom_id/cdrom_id.c
@@ -556,7 +556,7 @@ static int cd_profiles(struct udev *udev, int fd)
if ((err != 0)) {
info_scsi_cmd_err(udev, "GET CONFIGURATION", err);
/* handle pre-MMC2 drives which do not support GET CONFIGURATION */
- if (SK(err) == 0x5 && ASC(err) == 0x20) {
+ if (SK(err) == 0x5 && (ASC(err) == 0x20 || ASC(err) == 0x24)) {
log_debug("drive is pre-MMC2 and does not support 46h get configuration command");
log_debug("trying to work around the problem");
ret = cd_profiles_old_mmc(udev, fd);
--
1.7.9.2

View File

@ -0,0 +1,38 @@
From 6c49212741253dae05b89d22374186f092ef1e5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas@archlinux.org>
Date: Fri, 7 Mar 2014 01:50:34 +0100
Subject: [PATCH] units: Do not unescape instance name in
systemd-backlight@.service
The instance name is never escaped in the udev rule, but unescaped in the unit.
This results in the following error message on Asus boards:
Failed to get backlight or LED device 'backlight:eeepc/wmi': No such file or directory
---
units/systemd-backlight@.service.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git units/systemd-backlight@.service.in units/systemd-backlight@.service.in
index 5caa5d5..e945d87 100644
--- units/systemd-backlight@.service.in
+++ units/systemd-backlight@.service.in
@@ -6,7 +6,7 @@
# (at your option) any later version.
[Unit]
-Description=Load/Save Screen Backlight Brightness of %I
+Description=Load/Save Screen Backlight Brightness of %i
Documentation=man:systemd-backlight@.service(8)
DefaultDependencies=no
RequiresMountsFor=/var/lib/systemd/backlight
@@ -17,5 +17,5 @@ Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=@rootlibexecdir@/systemd-backlight load %I
-ExecStop=@rootlibexecdir@/systemd-backlight save %I
+ExecStart=@rootlibexecdir@/systemd-backlight load %i
+ExecStop=@rootlibexecdir@/systemd-backlight save %i
--
1.7.9.2

View File

@ -0,0 +1,31 @@
From 13e8ceb84e56907d73b6b07418deb37faaf0e66d Mon Sep 17 00:00:00 2001
From: Tero Roponen <tero.roponen@gmail.com>
Date: Tue, 25 Feb 2014 17:19:35 +0200
Subject: [PATCH] nspawn: fix detection of missing /proc/self/loginuid
Running 'systemd-nspawn -D /srv/Fedora/' gave me this error:
Failed to read /proc/self/loginuid: No such file or directory
Container Fedora failed with error code 1.
This patch fixes the problem.
---
src/nspawn/nspawn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/nspawn/nspawn.c src/nspawn/nspawn.c
index 1fe641b..92b6728 100644
--- src/nspawn/nspawn.c
+++ src/nspawn/nspawn.c
@@ -1349,7 +1349,7 @@ static int reset_audit_loginuid(void) {
return 0;
r = read_one_line_file("/proc/self/loginuid", &p);
- if (r == -EEXIST)
+ if (r == -ENOENT)
return 0;
if (r < 0) {
log_error("Failed to read /proc/self/loginuid: %s", strerror(-r));
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From 7074fecf6747c9a6ad872cc87701481e8bece8b0 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Wed, 2 Oct 2013 15:35:16 -0400
Subject: [PATCH 14/15] 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 - -
--
1.8.4

View File

@ -1,181 +0,0 @@
From fc676b00a7545743429e0c9b12a0f0707b1059aa 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 src/core/mount.c src/core/mount.c
index db055f0..70cd372 100644
--- src/core/mount.c
+++ 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;
--
1.7.9.2

View File

@ -1,34 +0,0 @@
From 14a9283eb38a93ec384c322ccbe06352c86a25f8 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 man/udevadm.xml man/udevadm.xml
index d0b257d..b959216 100644
--- man/udevadm.xml
+++ 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>
--
1.7.9.2

View File

@ -1,34 +0,0 @@
From 306e6650221d88b29831bcdcef94447afb65df5c 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 src/bootchart/store.c src/bootchart/store.c
index f8c97c2..7f86cfe 100644
--- src/bootchart/store.c
+++ 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);
--
1.7.9.2

View File

@ -1,37 +0,0 @@
From 775657712d0f6d14b70a0fe947a95a9ecc212440 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 man/kernel-command-line.xml man/kernel-command-line.xml
index cc267a3..abe68e5 100644
--- man/kernel-command-line.xml
+++ 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 man/systemd.xml man/systemd.xml
index fe6e331..85c06d3 100644
--- man/systemd.xml
+++ man/systemd.xml
@@ -1149,6 +1149,7 @@
</varlistentry>
<varlistentry>
+ <term><varname>-b</varname></term>
<term><varname>emergency</varname></term>
<listitem><para>Boot into emergency
--
1.7.9.2

View File

@ -1,81 +0,0 @@
Patch based on
From e0d856dd48d640f3d95efe7b769edec02373cc74 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.
and also on
From 1a0464230c08506c3fd715ff7cc56660df3a85ca Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 11 Oct 2013 07:45:32 +0000
Subject: 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"]
---
rules/99-systemd.rules.in | 10 ++++++----
src/backlight/backlight.c | 7 +++++--
2 files changed, 11 insertions(+), 6 deletions(-)
--- rules/99-systemd.rules.in
+++ rules/99-systemd.rules.in 2014-02-14 14:46:48.358235397 +0000
@@ -51,14 +51,16 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_dev
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 backlight devices and
+# keyboard backlights
-ACTION=="add", SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service"
+SUBSYSTEM=="backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@backlight:$name.service"
+SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", IMPORT{builtin}="path_id", ENV{SYSTEMD_WANTS}+="systemd-backlight@leds:$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"
--- src/backlight/backlight.c
+++ src/backlight/backlight.c 2014-02-14 15:20:47.534298128 +0000
@@ -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,37 +0,0 @@
From ca2f4176fee7dd5f5664429988e7059163fddb2d 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 src/tmpfiles/tmpfiles.c src/tmpfiles/tmpfiles.c
index 3cc831a..e23847b 100644
--- src/tmpfiles/tmpfiles.c
+++ 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;
}
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From a23873387a6e722b711092c89a08ab3f3d19361c 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 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/python-systemd/_daemon.c src/python-systemd/_daemon.c
index 6b84fb8..f0ab16f 100644
--- src/python-systemd/_daemon.c
+++ 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);
--
1.7.9.2

View File

@ -1,25 +0,0 @@
From df49ccafc0d57c731a3da3014ad55d5bb9ed3e1b 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 src/activate/activate.c src/activate/activate.c
index 07e46b9..537626d 100644
--- src/activate/activate.c
+++ src/activate/activate.c
@@ -289,6 +289,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"
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From ed6556920c1a6cdfe0bb04e806bc1f54ea191545 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 src/activate/activate.c src/activate/activate.c
index 537626d..2639d1c 100644
--- src/activate/activate.c
+++ src/activate/activate.c
@@ -344,7 +344,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();
--
1.7.9.2

View File

@ -1,43 +0,0 @@
From 87267de89ddce9b1b812b720e1fc9a6cb554236e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 16 Nov 2013 17:29:28 -0500
Subject: [PATCH] tmpfiles: adjust excludes for the new per-service private
dirs
In d8c9d3a (systemd: use unit name in PrivateTmp directories)
I forgot to update the tmpfiles config.
---
tmpfiles.d/tmp.conf | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git tmpfiles.d/tmp.conf tmpfiles.d/tmp.conf
index 3b534a1..f0312ef 100644
--- tmpfiles.d/tmp.conf
+++ tmpfiles.d/tmp.conf
@@ -12,6 +12,23 @@ d /tmp 1777 root root 10d
d /var/tmp 1777 root root -
# Exclude namespace mountpoints created with PrivateTmp=yes
+x /tmp/systemd-*.service-*
+x /var/tmp/systemd-*.service-*
+X /tmp/systemd-*.service-*/tmp
+X /var/tmp/systemd-*.service-*/tmp
+x /tmp/systemd-*.socket-*
+x /var/tmp/systemd-*.socket-*
+X /tmp/systemd-*.socket-*/tmp
+X /var/tmp/systemd-*.socket-*/tmp
+x /tmp/systemd-*.mount-*
+x /var/tmp/systemd-*.mount-*
+X /tmp/systemd-*.mount-*/tmp
+X /var/tmp/systemd-*.mount-*/tmp
+x /tmp/systemd-*.swap-*
+x /var/tmp/systemd-*.swap-*
+X /tmp/systemd-*.swap-*/tmp
+X /var/tmp/systemd-*.swap-*/tmp
+# keep those for compatibility during upgrades
x /tmp/systemd-private-*
x /var/tmp/systemd-private-*
X /tmp/systemd-private-*/tmp
--
1.7.9.2

View File

@ -1,38 +0,0 @@
From f0511bd7e3d591383485a36ddcb764abe74b1939 Mon Sep 17 00:00:00 2001
From: Shawn Landden <shawn@churchofgit.com>
Date: Sat, 16 Nov 2013 13:18:13 -0800
Subject: [PATCH] core/socket: fix SO_REUSEPORT
---
src/core/load-fragment-gperf.gperf.m4 | 1 +
src/core/socket.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git src/core/load-fragment-gperf.gperf.m4 src/core/load-fragment-gperf.gperf.m4
index e3025d2..b64fdc9 100644
--- src/core/load-fragment-gperf.gperf.m4
+++ src/core/load-fragment-gperf.gperf.m4
@@ -210,6 +210,7 @@ Socket.Broadcast, config_parse_bool, 0,
Socket.PassCredentials, config_parse_bool, 0, offsetof(Socket, pass_cred)
Socket.PassSecurity, config_parse_bool, 0, offsetof(Socket, pass_sec)
Socket.TCPCongestion, config_parse_string, 0, offsetof(Socket, tcp_congestion)
+Socket.ReusePort, config_parse_bool, 0, offsetof(Socket, reuseport)
Socket.MessageQueueMaxMessages, config_parse_long, 0, offsetof(Socket, mq_maxmsg)
Socket.MessageQueueMessageSize, config_parse_long, 0, offsetof(Socket, mq_msgsize)
Socket.Service, config_parse_socket_service, 0, 0
diff --git src/core/socket.c src/core/socket.c
index f505e4f..751f20b 100644
--- src/core/socket.c
+++ src/core/socket.c
@@ -771,7 +771,7 @@ static void socket_apply_socket_options(Socket *s, int fd) {
if (s->reuseport) {
int b = s->reuseport;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)))
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &b, sizeof(b)) < 0)
log_warning_unit(UNIT(s)->id, "SO_REUSEPORT failed: %m");
}
--
1.7.9.2

View File

@ -1,80 +0,0 @@
From a676e66535e12458ea6d366a653f8dd60f982504 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 26 Nov 2013 18:39:42 +0100
Subject: [PATCH] journal: when appending to journal file, allocate larger
blocks at once
---
src/journal/journal-file.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index bc72fca..d606ada 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -68,6 +68,9 @@
/* How many entries to keep in the entry array chain cache at max */
#define CHAIN_CACHE_MAX 20
+/* How much to increase the journal file size at once each time we allocate something new. */
+#define FILE_SIZE_INCREASE (8ULL*1024ULL*1024ULL) /* 8MB */
+
int journal_file_set_online(JournalFile *f) {
assert(f);
@@ -218,8 +221,7 @@ static int journal_file_refresh_header(JournalFile *f) {
journal_file_set_online(f);
/* Sync the online state to disk */
- msync(f->header, PAGE_ALIGN(sizeof(Header)), MS_SYNC);
- fdatasync(f->fd);
+ fsync(f->fd);
return 0;
}
@@ -313,7 +315,7 @@ static int journal_file_verify_header(JournalFile *f) {
}
static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
- uint64_t old_size, new_size;
+ uint64_t old_size, new_size, file_size;
int r;
assert(f);
@@ -333,12 +335,10 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
if (new_size <= old_size)
return 0;
- if (f->metrics.max_size > 0 &&
- new_size > f->metrics.max_size)
+ if (f->metrics.max_size > 0 && new_size > f->metrics.max_size)
return -E2BIG;
- if (new_size > f->metrics.min_size &&
- f->metrics.keep_free > 0) {
+ if (new_size > f->metrics.min_size && f->metrics.keep_free > 0) {
struct statvfs svfs;
if (fstatvfs(f->fd, &svfs) >= 0) {
@@ -363,8 +363,16 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
if (r != 0)
return -r;
- if (fstat(f->fd, &f->last_stat) < 0)
- return -errno;
+ /* Increase the file size a bit further than this, so that we
+ * we can create larger memory maps to cache */
+ file_size = ((new_size+FILE_SIZE_INCREASE-1) / FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
+ if (file_size > (uint64_t) f->last_stat.st_size) {
+ if (file_size > new_size)
+ ftruncate(f->fd, file_size);
+
+ if (fstat(f->fd, &f->last_stat) < 0)
+ return -errno;
+ }
f->header->arena_size = htole64(new_size - le64toh(f->header->header_size));
--
1.7.9.2

View File

@ -1,247 +0,0 @@
From f268980d2cee694fa4118a71402a47c316af0425 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 26 Nov 2013 20:37:53 +0100
Subject: [PATCH] journal: optimize bisection logic a bit by caching the last
position
This way we can do a quick restart limiting a bit how wildly we need to
jump around during the bisection process.
---
src/journal/journal-file.c | 134 ++++++++++++++++++++++++++++++++------------
1 file changed, 99 insertions(+), 35 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 481c242..27cd16f 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -1366,6 +1366,7 @@ typedef struct ChainCacheItem {
uint64_t array; /* the cached array */
uint64_t begin; /* the first item in the cached array */
uint64_t total; /* the total number of items in all arrays before this one in the chain */
+ uint64_t last_index; /* the last index we looked at, to optimize locality when bisecting */
} ChainCacheItem;
static void chain_cache_put(
@@ -1374,7 +1375,8 @@ static void chain_cache_put(
uint64_t first,
uint64_t array,
uint64_t begin,
- uint64_t total) {
+ uint64_t total,
+ uint64_t last_index) {
if (!ci) {
/* If the chain item to cache for this chain is the
@@ -1402,12 +1404,14 @@ static void chain_cache_put(
ci->array = array;
ci->begin = begin;
ci->total = total;
+ ci->last_index = last_index;
}
-static int generic_array_get(JournalFile *f,
- uint64_t first,
- uint64_t i,
- Object **ret, uint64_t *offset) {
+static int generic_array_get(
+ JournalFile *f,
+ uint64_t first,
+ uint64_t i,
+ Object **ret, uint64_t *offset) {
Object *o;
uint64_t p = 0, a, t = 0;
@@ -1448,7 +1452,7 @@ static int generic_array_get(JournalFile *f,
found:
/* Let's cache this item for the next invocation */
- chain_cache_put(f->chain_cache, ci, first, a, o->entry_array.items[0], t);
+ chain_cache_put(f->chain_cache, ci, first, a, o->entry_array.items[0], t, i);
r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
if (r < 0)
@@ -1463,11 +1467,12 @@ found:
return 1;
}
-static int generic_array_get_plus_one(JournalFile *f,
- uint64_t extra,
- uint64_t first,
- uint64_t i,
- Object **ret, uint64_t *offset) {
+static int generic_array_get_plus_one(
+ JournalFile *f,
+ uint64_t extra,
+ uint64_t first,
+ uint64_t i,
+ Object **ret, uint64_t *offset) {
Object *o;
@@ -1498,17 +1503,18 @@ enum {
TEST_RIGHT
};
-static int generic_array_bisect(JournalFile *f,
- uint64_t first,
- uint64_t n,
- uint64_t needle,
- int (*test_object)(JournalFile *f, uint64_t p, uint64_t needle),
- direction_t direction,
- Object **ret,
- uint64_t *offset,
- uint64_t *idx) {
-
- uint64_t a, p, t = 0, i = 0, last_p = 0;
+static int generic_array_bisect(
+ JournalFile *f,
+ uint64_t first,
+ uint64_t n,
+ uint64_t needle,
+ int (*test_object)(JournalFile *f, uint64_t p, uint64_t needle),
+ direction_t direction,
+ Object **ret,
+ uint64_t *offset,
+ uint64_t *idx) {
+
+ uint64_t a, p, t = 0, i = 0, last_p = 0, last_index = (uint64_t) -1;
bool subtract_one = false;
Object *o, *array = NULL;
int r;
@@ -1533,7 +1539,7 @@ static int generic_array_bisect(JournalFile *f,
return r;
if (r == TEST_LEFT) {
- /* OK, what we are looking for is right of th
+ /* OK, what we are looking for is right of the
* begin of this EntryArray, so let's jump
* straight to previously cached array in the
* chain */
@@ -1541,6 +1547,7 @@ static int generic_array_bisect(JournalFile *f,
a = ci->array;
n -= ci->total;
t = ci->total;
+ last_index = ci->last_index;
}
}
@@ -1571,6 +1578,60 @@ static int generic_array_bisect(JournalFile *f,
if (r == TEST_RIGHT) {
left = 0;
right -= 1;
+
+ if (last_index != (uint64_t) -1) {
+ assert(last_index <= right);
+
+ /* If we cached the last index we
+ * looked at, let's try to not to jump
+ * too wildly around and see if we can
+ * limit the range to look at early to
+ * the immediate neighbors of the last
+ * index we looked at. */
+
+ if (last_index > 0) {
+ uint64_t x = last_index - 1;
+
+ p = le64toh(array->entry_array.items[x]);
+ if (p <= 0)
+ return -EBADMSG;
+
+ r = test_object(f, p, needle);
+ if (r < 0)
+ return r;
+
+ if (r == TEST_FOUND)
+ r = direction == DIRECTION_DOWN ? TEST_RIGHT : TEST_LEFT;
+
+ if (r == TEST_RIGHT)
+ right = x;
+ else
+ left = x + 1;
+ }
+
+ if (last_index < right) {
+ uint64_t y = last_index + 1;
+
+ p = le64toh(array->entry_array.items[y]);
+ if (p <= 0)
+ return -EBADMSG;
+
+ r = test_object(f, p, needle);
+ if (r < 0)
+ return r;
+
+ if (r == TEST_FOUND)
+ r = direction == DIRECTION_DOWN ? TEST_RIGHT : TEST_LEFT;
+
+ if (r == TEST_RIGHT)
+ right = y;
+ else
+ left = y + 1;
+ }
+
+ last_index = (uint64_t) -1;
+ }
+
for (;;) {
if (left == right) {
if (direction == DIRECTION_UP)
@@ -1581,8 +1642,8 @@ static int generic_array_bisect(JournalFile *f,
}
assert(left < right);
-
i = (left + right) / 2;
+
p = le64toh(array->entry_array.items[i]);
if (p <= 0)
return -EBADMSG;
@@ -1615,6 +1676,7 @@ static int generic_array_bisect(JournalFile *f,
n -= k;
t += k;
+ last_index = (uint64_t) -1;
a = le64toh(array->entry_array.next_entry_array_offset);
}
@@ -1625,7 +1687,7 @@ found:
return 0;
/* Let's cache this item for the next invocation */
- chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t);
+ chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t, i + (subtract_one ? -1 : 0));
if (subtract_one && i == 0)
p = last_p;
@@ -1650,16 +1712,18 @@ found:
return 1;
}
-static int generic_array_bisect_plus_one(JournalFile *f,
- uint64_t extra,
- uint64_t first,
- uint64_t n,
- uint64_t needle,
- int (*test_object)(JournalFile *f, uint64_t p, uint64_t needle),
- direction_t direction,
- Object **ret,
- uint64_t *offset,
- uint64_t *idx) {
+
+static int generic_array_bisect_plus_one(
+ JournalFile *f,
+ uint64_t extra,
+ uint64_t first,
+ uint64_t n,
+ uint64_t needle,
+ int (*test_object)(JournalFile *f, uint64_t p, uint64_t needle),
+ direction_t direction,
+ Object **ret,
+ uint64_t *offset,
+ uint64_t *idx) {
int r;
bool step_back = false;
--
1.7.9.2

View File

@ -1,26 +0,0 @@
From e5462cd80e5328a769137c261c93931ea0c27bab Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 27 Nov 2013 00:58:39 +0100
Subject: [PATCH] journal: fix iteration when we go backwards from the
beginning of an array chain element
---
src/journal/journal-file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 27cd16f..409be76 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -1687,7 +1687,7 @@ found:
return 0;
/* Let's cache this item for the next invocation */
- chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t, i + (subtract_one ? -1 : 0));
+ chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t, subtract_one ? (i > 0 ? i-1 : (uint64_t) -1) : i);
if (subtract_one && i == 0)
p = last_p;
--
1.7.9.2

View File

@ -1,28 +0,0 @@
From 248c78c79c5cca9b981800d816a77591e504066a Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 27 Nov 2013 00:59:07 +0100
Subject: [PATCH] journal: allow journal_file_copy_entry() to work on
non-local files
---
src/journal/journal-file.c | 4 ----
1 file changed, 4 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 409be76..14eae8f 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -2732,10 +2732,6 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
ts.monotonic = le64toh(o->entry.monotonic);
ts.realtime = le64toh(o->entry.realtime);
- if (to->tail_entry_monotonic_valid &&
- ts.monotonic < le64toh(to->header->tail_entry_monotonic))
- return -EINVAL;
-
n = journal_file_entry_n_items(o);
items = alloca(sizeof(EntryItem) * n);
--
1.7.9.2

View File

@ -1,61 +0,0 @@
From eda4b58b50509dc8ad0428a46e20f6c5cf516d58 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 27 Nov 2013 01:44:52 +0100
Subject: [PATCH] journal: simplify pre-allocation logic
let's just do a single fallocate() as far as possible, and don't
distuingish between allocated space and file size.
This way we can save a syscall for each append, which makes quite some
benefits.
---
src/journal/journal-file.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git src/journal/journal-file.c src/journal/journal-file.c
index 14eae8f..4009b29 100644
--- src/journal/journal-file.c
+++ src/journal/journal-file.c
@@ -315,7 +315,7 @@ static int journal_file_verify_header(JournalFile *f) {
}
static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
- uint64_t old_size, new_size, file_size;
+ uint64_t old_size, new_size;
int r;
assert(f);
@@ -356,6 +356,11 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
}
}
+ /* Increase by larger blocks at once */
+ new_size = ((new_size+FILE_SIZE_INCREASE-1) / FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
+ if (f->metrics.max_size > 0 && new_size > f->metrics.max_size)
+ new_size = f->metrics.max_size;
+
/* Note that the glibc fallocate() fallback is very
inefficient, hence we try to minimize the allocation area
as we can. */
@@ -363,16 +368,8 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
if (r != 0)
return -r;
- /* Increase the file size a bit further than this, so that we
- * we can create larger memory maps to cache */
- file_size = ((new_size+FILE_SIZE_INCREASE-1) / FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
- if (file_size > (uint64_t) f->last_stat.st_size) {
- if (file_size > new_size)
- ftruncate(f->fd, file_size);
-
- if (fstat(f->fd, &f->last_stat) < 0)
- return -errno;
- }
+ if (fstat(f->fd, &f->last_stat) < 0)
+ return -errno;
f->header->arena_size = htole64(new_size - le64toh(f->header->header_size));
--
1.7.9.2

View File

@ -1,58 +0,0 @@
From fbb634117d0b0ebd5b105e65b141e75ae9af7f8f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 27 Nov 2013 01:54:25 +0100
Subject: [PATCH] journald: mention how long we needed to flush to /var in the
logs
---
src/journal/journald-server.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git src/journal/journald-server.c src/journal/journald-server.c
index ce419d4..01e75b6 100644
--- src/journal/journald-server.c
+++ src/journal/journald-server.c
@@ -970,9 +970,12 @@ static int system_journal_open(Server *s) {
}
int server_flush_to_var(Server *s) {
- int r;
sd_id128_t machine;
sd_journal *j = NULL;
+ char ts[FORMAT_TIMESPAN_MAX];
+ usec_t start;
+ unsigned n = 0;
+ int r;
assert(s);
@@ -990,6 +993,8 @@ int server_flush_to_var(Server *s) {
log_debug("Flushing to /var...");
+ start = now(CLOCK_MONOTONIC);
+
r = sd_id128_get_machine(&machine);
if (r < 0)
return r;
@@ -1009,6 +1014,8 @@ int server_flush_to_var(Server *s) {
f = j->current_file;
assert(f && f->current_offset > 0);
+ n++;
+
r = journal_file_move_to_object(f, OBJECT_ENTRY, f->current_offset, &o);
if (r < 0) {
log_error("Can't read entry: %s", strerror(-r));
@@ -1052,6 +1059,8 @@ finish:
sd_journal_close(j);
+ server_driver_message(s, SD_ID128_NULL, "Time spent on flushing to /var is %s for %u entries.", format_timespan(ts, sizeof(ts), now(CLOCK_MONOTONIC) - start, 0), n);
+
return r;
}
--
1.7.9.2

View File

@ -1,31 +0,0 @@
From 27373e442747010dfc195296c0705f67e905a611 Mon Sep 17 00:00:00 2001
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Sat, 30 Nov 2013 23:45:31 +0100
Subject: [PATCH] util.c: check if return value from ttyname_r is > 0 instead
of != 0
We must return a negative error code from getttyname_malloc but
that would not be the case if ttyname_r returned a negative value.
ttyname_r should only return EBADF, ENOTTY, or ERANGE so it should
be safe to change.
---
src/shared/util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/shared/util.c src/shared/util.c
index 38134ae..206fc80 100644
--- src/shared/util.c
+++ src/shared/util.c
@@ -2501,7 +2501,7 @@ int getttyname_malloc(int fd, char **r) {
assert(r);
k = ttyname_r(fd, path, sizeof(path));
- if (k != 0)
+ if (k > 0)
return -k;
char_array_0(path);
--
1.7.9.2

View File

@ -1,41 +0,0 @@
From 572ce4f7832ffa7a91a582c4098f18cec5662666 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 30 Nov 2013 20:27:54 -0500
Subject: [PATCH] docs: remove unneeded the's in gudev docs
https://bugs.freedesktop.org/show_bug.cgi?id=72164
---
src/libudev/libudev-device.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git src/libudev/libudev-device.c src/libudev/libudev-device.c
index 059a590..9558ac3 100644
--- src/libudev/libudev-device.c
+++ src/libudev/libudev-device.c
@@ -982,9 +982,8 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic
* Find the next parent device, and fill in information from the sys
* device and the udev database entry.
*
- * The returned the device is not referenced. It is attached to the
- * child device, and will be cleaned up when the child device
- * is cleaned up.
+ * Returned device is not referenced. It is attached to the child
+ * device, and will be cleaned up when the child device is cleaned up.
*
* It is not necessarily just the upper level directory, empty or not
* recognized sys directories are ignored.
@@ -1018,9 +1017,8 @@ _public_ struct udev_device *udev_device_get_parent(struct udev_device *udev_dev
* If devtype is #NULL, only subsystem is checked, and any devtype will
* match.
*
- * The returned the device is not referenced. It is attached to the
- * child device, and will be cleaned up when the child device
- * is cleaned up.
+ * Returned device is not referenced. It is attached to the child
+ * device, and will be cleaned up when the child device is cleaned up.
*
* It can be called as many times as needed, without caring about
* references.
--
1.7.9.2

View File

@ -1,238 +0,0 @@
From 6a44e50f4c0938b0ba355fff21add6c067cd9837 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sat, 30 Nov 2013 21:23:01 -0500
Subject: [PATCH] man: explicitly say when multiple units can be specified
itistoday> how do you specify multiple dependencies in a unit file? i've been
googling and can't find this basic thing :-\
itistoday> do you use a comma, or use multiple After= statements?
---
man/systemd.unit.xml | 128 +++++++++++++++++++++++++++-----------------------
1 file changed, 70 insertions(+), 58 deletions(-)
diff --git man/systemd.unit.xml man/systemd.unit.xml
index 4dc427c..35dd4c7 100644
--- man/systemd.unit.xml
+++ man/systemd.unit.xml
@@ -410,10 +410,12 @@
of the other units gets deactivated or
its activation fails, this unit will
be deactivated. This option may be
- specified more than once, in which
- case requirement dependencies for all
- listed names are created. Note that
- requirement dependencies do not
+ specified more than once or multiple
+ space-separated units may be specified
+ in one option in which case
+ requirement dependencies for all
+ listed names will be created. Note
+ that requirement dependencies do not
influence the order in which services
are started or stopped. This has to be
configured independently with the
@@ -476,22 +478,23 @@
<term><varname>RequisiteOverridable=</varname></term>
<listitem><para>Similar to
- <varname>Requires=</varname>
- and <varname>RequiresOverridable=</varname>, respectively. However,
- if a unit listed here is not started
- already it will not be started and the
- transaction fails
- immediately.</para></listitem>
+ <varname>Requires=</varname> and
+ <varname>RequiresOverridable=</varname>,
+ respectively. However, if the units
+ listed here are not started already
+ they will not be started and the
+ transaction will fail immediately.
+ </para></listitem>
</varlistentry>
<varlistentry>
<term><varname>Wants=</varname></term>
<listitem><para>A weaker version of
- <varname>Requires=</varname>. A unit
+ <varname>Requires=</varname>. Units
listed in this option will be started
if the configuring unit is. However,
- if the listed unit fails to start up
+ if the listed units fail to start
or cannot be added to the transaction
this has no impact on the validity of
the transaction as a whole. This is
@@ -501,8 +504,8 @@
<para>Note that dependencies of this
type may also be configured outside of
- the unit configuration file by
- adding a symlink to a
+ the unit configuration file by adding
+ symlinks to a
<filename>.wants/</filename> directory
accompanying the unit file. For
details see above.</para></listitem>
@@ -534,7 +537,7 @@
of units. When systemd stops or restarts
the units listed here, the action is
propagated to this unit.
- Note that this is a one way dependency -
+ Note that this is a one way dependency —
changes to this unit do not affect the
listed units.
</para></listitem>
@@ -543,12 +546,12 @@
<varlistentry>
<term><varname>Conflicts=</varname></term>
- <listitem><para>Configures negative
+ <listitem><para>A space-separated list
+ of unit names. Configures negative
requirement dependencies. If a unit
- has a
- <varname>Conflicts=</varname> setting
- on another unit, starting the former
- will stop the latter and vice
+ has a <varname>Conflicts=</varname>
+ setting on another unit, starting the
+ former will stop the latter and vice
versa. Note that this setting is
independent of and orthogonal to the
<varname>After=</varname> and
@@ -575,7 +578,8 @@
<term><varname>Before=</varname></term>
<term><varname>After=</varname></term>
- <listitem><para>Configures ordering
+ <listitem><para>A space-separated list
+ of unit names. Configures ordering
dependencies between units. If a unit
<filename>foo.service</filename>
contains a setting
@@ -624,18 +628,18 @@
type <varname>After=</varname> or
<varname>Before=</varname>. If two
units have no ordering dependencies
- between them, they are shut down
- or started up simultaneously, and
- no ordering takes
+ between them, they are shut down or
+ started up simultaneously, and no
+ ordering takes
place. </para></listitem>
</varlistentry>
<varlistentry>
<term><varname>OnFailure=</varname></term>
- <listitem><para>Lists one or more
- units that are activated when this
- unit enters the
+ <listitem><para>A space-separated list
+ of one or more units that are
+ activated when this unit enters the
<literal>failed</literal>
state.</para></listitem>
</varlistentry>
@@ -644,16 +648,17 @@
<term><varname>PropagatesReloadTo=</varname></term>
<term><varname>ReloadPropagatedFrom=</varname></term>
- <listitem><para>Lists one or more
- units where reload requests on the
- unit will be propagated to/on the
- other unit will be propagated
- from. Issuing a reload request on a
- unit will automatically also enqueue a
- reload request on all units that the
- reload request shall be propagated to
- via these two
- settings.</para></listitem>
+ <listitem><para>A space-separated list
+ of one or more units where reload
+ requests on this unit will be
+ propagated to, or reload requests on
+ the other unit will be propagated to
+ this unit, respectively. Issuing a
+ reload request on a unit will
+ automatically also enqueue a reload
+ request on all units that the reload
+ request shall be propagated to via
+ these two settings.</para></listitem>
</varlistentry>
<varlistentry>
@@ -1130,32 +1135,34 @@
<varlistentry>
<term><varname>Alias=</varname></term>
- <listitem><para>Additional names this
- unit shall be installed under. The
- names listed here must have the same
- suffix (i.e. type) as the unit file
- name. This option may be specified
- more than once, in which case all
- listed names are used. At installation
- time,
- <command>systemctl enable</command>
- will create symlinks from these names
- to the unit filename.</para></listitem>
+ <listitem><para>A space-seperated list
+ of additional names this unit shall be
+ installed under. The names listed here
+ must have the same suffix (i.e. type)
+ as the unit file name. This option may
+ be specified more than once, in which
+ case all listed names are used. At
+ installation time, <command>systemctl
+ enable</command> will create symlinks
+ from these names to the unit
+ filename.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>WantedBy=</varname></term>
<term><varname>RequiredBy=</varname></term>
- <listitem><para>A symbolic link is
- created in the
- <filename>.wants/</filename> or
- <filename>.requires/</filename> directory
- of the listed unit when this unit is
- activated by <command>systemctl
- enable</command>. This has the effect
- that a dependency of type
- <varname>Wants=</varname> or
+ <listitem><para>This option may be
+ used more than once, or a
+ space-separated list of unit names may
+ be given. A symbolic link is created
+ in the <filename>.wants/</filename> or
+ <filename>.requires/</filename>
+ directory of each of the listed units
+ when this unit is installed by
+ <command>systemctl enable</command>.
+ This has the effect that a dependency
+ of type <varname>Wants=</varname> or
<varname>Requires=</varname> is added
from the listed unit to the current
unit. The primary result is that the
@@ -1201,7 +1208,12 @@
and <command>systemctl
disable</command> will automatically
install/uninstall units listed in this option as
- well.</para></listitem>
+ well.</para>
+
+ <para>This option may be used more
+ than once, or a space-separated list
+ of unit names may be
+ given.</para></listitem>
</varlistentry>
</variablelist>
--
1.7.9.2

View File

@ -1,93 +0,0 @@
From 6a371e23ee0e47827fb4e3aa469ed84da2599304 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 2 Dec 2013 21:52:51 -0500
Subject: [PATCH] systemd: treat reload failure as failure
systemctl reload "suceeded" on stopped units, but it is documented
to fail in this case.
https://bugzilla.redhat.com/show_bug.cgi?id=1036845
---
src/core/job.c | 11 +++++++----
src/core/job.h | 3 ++-
src/core/unit.c | 5 ++++-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git src/core/job.c src/core/job.c
index 557917a..ce97263 100644
--- src/core/job.c
+++ src/core/job.c
@@ -508,7 +508,7 @@ int job_run_and_invalidate(Job *j) {
else if (t == UNIT_ACTIVATING)
r = -EAGAIN;
else
- r = -ENOEXEC;
+ r = -EBADR;
break;
}
@@ -537,8 +537,10 @@ int job_run_and_invalidate(Job *j) {
if (j) {
if (r == -EALREADY)
r = job_finish_and_invalidate(j, JOB_DONE, true);
- else if (r == -ENOEXEC)
+ else if (r == -EBADR)
r = job_finish_and_invalidate(j, JOB_SKIPPED, true);
+ else if (r == -ENOEXEC)
+ r = job_finish_and_invalidate(j, JOB_INVALID, true);
else if (r == -EAGAIN) {
j->state = JOB_WAITING;
m->n_running_jobs--;
@@ -764,7 +766,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive) {
goto finish;
}
- if (result == JOB_FAILED)
+ if (result == JOB_FAILED || result == JOB_INVALID)
j->manager->n_failed_jobs ++;
job_uninstall(j);
@@ -1119,7 +1121,8 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = {
[JOB_TIMEOUT] = "timeout",
[JOB_FAILED] = "failed",
[JOB_DEPENDENCY] = "dependency",
- [JOB_SKIPPED] = "skipped"
+ [JOB_SKIPPED] = "skipped",
+ [JOB_INVALID] = "invalid",
};
DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);
diff --git src/core/job.h src/core/job.h
index c23a380..0500e12 100644
--- src/core/job.h
+++ src/core/job.h
@@ -97,7 +97,8 @@ enum JobResult {
JOB_TIMEOUT, /* JobTimeout elapsed */
JOB_FAILED, /* Job failed */
JOB_DEPENDENCY, /* A required dependency job did not result in JOB_DONE */
- JOB_SKIPPED, /* JOB_RELOAD of inactive unit; negative result of JOB_VERIFY_ACTIVE */
+ JOB_SKIPPED, /* Negative result of JOB_VERIFY_ACTIVE */
+ JOB_INVALID, /* JOB_RELOAD of inactive unit */
_JOB_RESULT_MAX,
_JOB_RESULT_INVALID = -1
};
diff --git src/core/unit.c src/core/unit.c
index 50db86c..81d2162 100644
--- src/core/unit.c
+++ src/core/unit.c
@@ -1239,8 +1239,11 @@ int unit_reload(Unit *u) {
if (state == UNIT_RELOADING)
return -EALREADY;
- if (state != UNIT_ACTIVE)
+ if (state != UNIT_ACTIVE) {
+ log_warning_unit(u->id, "Unit %s cannot be reloaded because it is inactive.",
+ u->id);
return -ENOEXEC;
+ }
if ((following = unit_following(u))) {
log_debug_unit(u->id, "Redirecting reload request from %s to %s.",
--
1.7.9.2

View File

@ -1,31 +0,0 @@
From 524147c1ef991edf4432aac51c880b363b4402df Mon Sep 17 00:00:00 2001
From: Marius Vollmer <mvollmer@redhat.com>
Date: Thu, 31 Oct 2013 15:55:07 +0200
Subject: [PATCH] logind: use correct "who" enum values with KillUnit.
---
src/login/logind-dbus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index bb85c7d..583d62e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -2799,7 +2799,7 @@ int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo
assert(manager);
assert(unit);
- w = who == KILL_LEADER ? "process" : "cgroup";
+ w = who == KILL_LEADER ? "control" : "all";
assert_cc(sizeof(signo) == sizeof(int32_t));
r = bus_method_call_with_reply(
@@ -2815,7 +2815,7 @@ int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo
DBUS_TYPE_INT32, &signo,
DBUS_TYPE_INVALID);
if (r < 0) {
- log_error("Failed to stop unit %s: %s", unit, bus_error(error, r));
+ log_error("Failed to kill unit %s: %s", unit, bus_error(error, r));
return r;
}

View File

@ -1,75 +1,63 @@
From: Robert Milasan <rmilasan@suse.com> From: Robert Milasan <rmilasan@suse.com>
Date: Thu, 28 Mar 2013 09:24:43 +0000 Cc: Werner Fink <werner@suse.de>
Subject: udev always rename network Subject: udev always rename network
udev: ensure that the network interfaces are renamed even if they exist Date: Thu, 28 Mar 2013 09:24:43 +0000
(bnc#809843). udev: ensure that the network interfaces are renamed even if they exist (bnc#809843).
Date: Tue, 4 Mar 2014 10:29:21 +0000
Port the patch of Robert to systemd v210 and test it out.
--- ---
src/udev/udev-event.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- udev-event.c | 40 ++++++++++++++++++++++++++++++++++++----
1 file changed, 43 insertions(+), 3 deletions(-) 1 file changed, 36 insertions(+), 4 deletions(-)
--- systemd-206.orig/src/udev/udev-event.c --- systemd-210/src/udev/udev-event.c
+++ systemd-206/src/udev/udev-event.c +++ systemd-210/src/udev/udev-event.c 2014-03-04 11:19:50.583710411 +0100
@@ -750,6 +750,7 @@ static int rename_netif(struct udev_even @@ -765,10 +765,42 @@ static int rename_netif(struct udev_even
struct udev_device *dev = event->dev; return r;
int sk;
struct ifreq ifr;
+ int loop;
int err;
log_debug("changing net interface name from '%s' to '%s'\n", r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name);
@@ -766,12 +767,51 @@ static int rename_netif(struct udev_even - if (r < 0)
strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); - log_error("error changing net interface name %s to %s: %s",
strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); - oldname, name, strerror(-r));
err = ioctl(sk, SIOCSIFNAME, &ifr); - else
- if (err >= 0) { + if (r < 0) {
+ if (err == 0) { + char interim[IFNAMSIZ], *ptr = &interim[0];
print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); + int loop = 90;
- } else {
+ goto out;
+ }
+ +
+ /* keep trying if the destination interface name already exists */ + /* keep trying if the destination interface name already exists */
+ err = -errno; + if (r != -EEXIST) {
+ if (err != -EEXIST) { + log_error("error changing net interface name %s to %s: %s",
+ goto out; + oldname, name, strerror(-r));
+ return r;
+ } + }
+ +
+ /* free our own name, another process may wait for us */ + /* free our own name, another process may wait for us */
+ snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); + strpcpyf(&ptr, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev));
+ err = ioctl(sk, SIOCSIFNAME, &ifr); +
+ if (err < 0) { + r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), interim);
err = -errno; + if (r < 0) {
- log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); + log_error("error changing net interface name %s to %s: %s",
+ goto out; + oldname, name, strerror(-r));
} + return r;
+ }
+ +
+ /* log temporary name */ + /* log temporary name */
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); + print_kmsg("renamed network interface %s to %s", oldname, interim);
+ + do {
+ /* wait a maximum of 90 seconds for our target to become available */ + r = rtnl_set_link_name(rtnl, udev_device_get_ifindex(dev), name);
+ strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); + if (r == 0) {
+ strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + print_kmsg("renamed network interface %s to %s", oldname, name);
+ loop = 90 * 20; + return r;
+ while (loop--) {
+ const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 };
+
+ log_debug("wait for netif '%s' to become free, loop=%i\n", event->name, (90 * 20) - loop);
+ nanosleep(&duration, NULL);
+
+ err = ioctl(sk, SIOCSIFNAME, &ifr);
+ if (err == 0) {
+ print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
+ break;
+ } + }
+ err = -errno; + if (r != -EEXIST) {
+ if (err != -EEXIST) + log_error("error changing net interface name %s to %s: %s",
+ break; + oldname, name, strerror(-r));
+ return r;
+ } + }
+ + } while (loop-- > 0);
+out: + } else
+ if (err < 0) print_kmsg("renamed network interface %s to %s", oldname, name);
+ log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
close(sk); return r;
return err;
}

View File

@ -1,62 +0,0 @@
From: Werner Fink <werner@suse.de>
Date: Thu, 21 Nov 2013 11:50:32 +0000
Subject: [PATCH] Avoid busy systemd-journald
Avoid a busy systemd-journald due polling a broken /dec/kmsg in lxc
environments.
---
journald-kmsg.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
Index: systemd-208/src/journal/journald-kmsg.c
===================================================================
--- systemd-208/src/journal/journald-kmsg.c
+++ systemd-208/src/journal/journald-kmsg.c 2013-12-20 11:34:39.762236175 +0000
@@ -377,15 +377,18 @@ int server_flush_dev_kmsg(Server *s) {
int server_open_dev_kmsg(Server *s) {
struct epoll_event ev;
+ int r;
assert(s);
s->dev_kmsg_fd = open("/dev/kmsg", O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (s->dev_kmsg_fd < 0) {
- log_warning("Failed to open /dev/kmsg, ignoring: %m");
+ log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Failed to open /dev/kmsg, ignoring: %m");
return 0;
}
+ r = 0;
zero(ev);
ev.events = EPOLLIN;
ev.data.fd = s->dev_kmsg_fd;
@@ -394,15 +397,24 @@ int server_open_dev_kmsg(Server *s) {
/* This will fail with EPERM on older kernels where
* /dev/kmsg is not readable. */
if (errno == EPERM)
- return 0;
+ goto fail;
log_error("Failed to add /dev/kmsg fd to epoll object: %m");
- return -errno;
+ r = -errno;
+ goto fail;
}
s->dev_kmsg_readable = true;
return 0;
+
+fail:
+ if (s->dev_kmsg_fd >= 0) {
+ close_nointr_nofail(s->dev_kmsg_fd);
+ s->dev_kmsg_fd = -1;
+ }
+
+ return r;
}
int server_open_kernel_seqnum(Server *s) {

View File

@ -1,168 +0,0 @@
Based on upstream baae0358f349870544884e405e82e4be7d8add9f
| From: Lennart Poettering <lennart@poettering.net>
| Date: Tue, 26 Nov 2013 04:05:00 +0000
| Subject: pam_systemd: do not set XDG_RUNTIME_DIR if the session's original user is not the same as the newly logged in one
| It's better not to set any XDG_RUNTIME_DIR at all rather than one of a
| different user. So let's do this.
--- systemd-208/src/login/logind-dbus.c
+++ systemd-208/src/login/logind-dbus.c 2013-11-26 13:37:05.730735774 +0000
@@ -523,6 +523,7 @@ static int bus_manager_create_session(Ma
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_STRING, &session->user->runtime_path,
DBUS_TYPE_UNIX_FD, &fifo_fd,
+ DBUS_TYPE_UINT32, &session->user->uid,
DBUS_TYPE_STRING, &cseat,
DBUS_TYPE_UINT32, &vtnr,
DBUS_TYPE_BOOLEAN, &exists,
--- systemd-208/src/login/logind-session-dbus.c
+++ systemd-208/src/login/logind-session-dbus.c 2013-11-26 13:36:07.478236401 +0000
@@ -755,6 +755,7 @@ int session_send_create_reply(Session *s
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_STRING, &s->user->runtime_path,
DBUS_TYPE_UNIX_FD, &fifo_fd,
+ DBUS_TYPE_UINT32, &s->user->uid,
DBUS_TYPE_STRING, &cseat,
DBUS_TYPE_UINT32, &vtnr,
DBUS_TYPE_BOOLEAN, &exists,
--- systemd-208/src/login/pam-module.c
+++ systemd-208/src/login/pam-module.c 2013-11-26 14:32:20.194235777 +0000
@@ -93,24 +93,18 @@ static int get_user_data(
assert(ret_username);
assert(ret_pw);
- r = audit_loginuid_from_pid(0, &uid);
- if (r >= 0)
- pw = pam_modutil_getpwuid(handle, uid);
- else {
- r = pam_get_user(handle, &username, NULL);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to get user name.");
- return r;
- }
-
- if (isempty(username)) {
- pam_syslog(handle, LOG_ERR, "User name not valid.");
- return PAM_AUTH_ERR;
- }
+ r = pam_get_user(handle, &username, NULL);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to get user name.");
+ return r;
+ }
- pw = pam_modutil_getpwnam(handle, username);
+ if (isempty(username)) {
+ pam_syslog(handle, LOG_ERR, "User name not valid.");
+ return PAM_AUTH_ERR;
}
+ pw = pam_modutil_getpwnam(handle, username);
if (!pw) {
pam_syslog(handle, LOG_ERR, "Failed to get user data.");
return PAM_USER_UNKNOWN;
@@ -123,16 +117,14 @@ static int get_user_data(
}
static int get_seat_from_display(const char *display, const char **seat, uint32_t *vtnr) {
- _cleanup_free_ char *p = NULL;
- int r;
- _cleanup_close_ int fd = -1;
union sockaddr_union sa = {
.un.sun_family = AF_UNIX,
};
+ _cleanup_free_ char *p = NULL, *tty = NULL;
+ _cleanup_close_ int fd = -1;
struct ucred ucred;
socklen_t l;
- _cleanup_free_ char *tty = NULL;
- int v;
+ int v, r;
assert(display);
assert(vtnr);
@@ -194,13 +186,12 @@ _public_ PAM_EXTERN int pam_sm_open_sess
dbus_bool_t remote, existing;
int r;
uint32_t vtnr = 0;
+ uid_t original_uid;
assert(handle);
dbus_error_init(&error);
- /* pam_syslog(handle, LOG_INFO, "pam-systemd initializing"); */
-
/* Make this a NOP on non-logind systems */
if (!logind_running())
return PAM_SUCCESS;
@@ -213,6 +204,9 @@ _public_ PAM_EXTERN int pam_sm_open_sess
goto finish;
}
+ if (debug)
+ pam_syslog(handle, LOG_INFO, "pam-systemd initializing");
+
r = get_user_data(handle, &username, &pw);
if (r != PAM_SUCCESS)
goto finish;
@@ -374,7 +368,11 @@ _public_ PAM_EXTERN int pam_sm_open_sess
if (debug)
pam_syslog(handle, LOG_DEBUG, "Asking logind to create session: "
"uid=%u pid=%u service=%s type=%s class=%s seat=%s vtnr=%u tty=%s display=%s remote=%s remote_user=%s remote_host=%s",
- uid, pid, service, type, class, seat, vtnr, tty, display, yes_no(remote), remote_user, remote_host);
+ pw->pw_uid, pid,
+ strempty(service),
+ type, class,
+ seat, vtnr, tty, display,
+ yes_no(remote), remote_user, remote_host);
reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
if (!reply) {
@@ -388,6 +386,7 @@ _public_ PAM_EXTERN int pam_sm_open_sess
DBUS_TYPE_OBJECT_PATH, &object_path,
DBUS_TYPE_STRING, &runtime_path,
DBUS_TYPE_UNIX_FD, &session_fd,
+ DBUS_TYPE_UINT32, &original_uid,
DBUS_TYPE_STRING, &seat,
DBUS_TYPE_UINT32, &vtnr,
DBUS_TYPE_BOOLEAN, &existing,
@@ -399,8 +398,8 @@ _public_ PAM_EXTERN int pam_sm_open_sess
if (debug)
pam_syslog(handle, LOG_DEBUG, "Reply from logind: "
- "id=%s object_path=%s runtime_path=%s session_fd=%d seat=%s vtnr=%u",
- id, object_path, runtime_path, session_fd, seat, vtnr);
+ "id=%s object_path=%s runtime_path=%s session_fd=%d seat=%s vtnr=%u original_uid=%u",
+ id, object_path, runtime_path, session_fd, seat, vtnr, original_uid);
r = pam_misc_setenv(handle, "XDG_SESSION_ID", id, 0);
if (r != PAM_SUCCESS) {
@@ -408,10 +407,24 @@ _public_ PAM_EXTERN int pam_sm_open_sess
goto finish;
}
- r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", runtime_path, 0);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
- goto finish;
+ if (original_uid == pw->pw_uid) {
+ /* Don't set $XDG_RUNTIME_DIR if the user we now
+ * authenticated for does not match the original user
+ * of the session. We do this in order not to result
+ * in privileged apps clobbering the runtime directory
+ * unnecessarily. */
+
+ r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", runtime_path, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
+ goto finish;
+ }
+ } else if (getenv("XDG_RUNTIME_DIR")) {
+ r = pam_putenv(handle, "XDG_RUNTIME_DIR");
+ if (r != PAM_SUCCESS && r != PAM_BAD_ITEM) {
+ pam_syslog(handle, LOG_ERR, "Failed to unset runtime dir.");
+ }
+ (void) unsetenv("XDG_RUNTIME_DIR");
}
if (!isempty(seat)) {

View File

@ -1,20 +0,0 @@
For bnc#818044
Based on http://cgit.freedesktop.org/systemd/systemd/patch/?id=67d6621059085963a2a908a3ea99ced3b0ca789e
---
systemctl.c | 5 +++++
1 file changed, 5 insertions(+)
--- systemd-208/src/systemctl/systemctl.c
+++ systemd-208/src/systemctl/systemctl.c 2014-01-21 13:00:52.910736187 +0000
@@ -4453,6 +4453,11 @@ static int enable_unit(DBusConnection *b
if (r < 0)
return r;
+ /* If the operation was fully executed by the SysV compat,
+ * let's finish early */
+ if (strv_isempty(mangled_names))
+ return 0;
+
if (!bus || avoid_bus()) {
if (streq(verb, "enable")) {
r = unit_file_enable(arg_scope, arg_runtime, arg_root, mangled_names, arg_force, &changes, &n_changes);

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