From 930e1b89bd081aede3c1ecfc9d24491a341b0eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 19 Nov 2013 17:28:44 -0500 Subject: [PATCH] Backport fixes and hwdb changes --- .gitignore | 1 + ...ix-memory-leak-in-acpi_get_boot_usec.patch | 3 - ...ferences-to-var-lib-backlight-random.patch | 3 - ...e-never-free-an-uninitialized-pointe.patch | 3 - ...ctl-fix-name-mangling-for-sysv-units.patch | 3 - ...OM-handling-when-parsing-mount-optio.patch | 3 - 0006-journald-add-missing-error-check.patch | 3 - ...entially-uninitialized-memory-access.patch | 3 - ...-fix-return-value-of-dispatch_rqueue.patch | 3 - 0009-modules-load-fix-error-handling.patch | 3 - ...all-qsort-on-potentially-NULL-arrays.patch | 3 - ...ccess-potentially-NULL-string-arrays.patch | 3 - ...per-function-pointer-to-mkdir_safe_i.patch | 3 - ...ude-setgid-perms-for-run-log-journal.patch | 3 - 0014-execute.c-always-set-SHELL.patch | 3 - ...description-of-parameter-X-in-tmpfil.patch | 3 - 0016-execute-more-debugging-messages.patch | 3 - ...tor-exit-immediately-if-in-container.patch | 3 - ...mote-mounts-from-mountinfo-before-re.patch | 3 - ...ifying-whether-clients-may-change-en.patch | 3 - ...s-introspection-data-for-TakeControl.patch | 3 - ...heck-for-NULL-before-reading-pm-what.patch | 3 - ...what-to-RequiresMountsFor-for-networ.patch | 3 - 0023-utf8-fix-utf8_is_printable.patch | 3 - ...off-by-one-error-in-tag_to_udev_node.patch | 3 - ...ize-deserialize-forbid_restart-value.patch | 3 - ...ay-we-denote-serialization-attribute.patch | 3 - 0027-journald-fix-minor-memory-leak.patch | 3 - 0028-keymap-Fix-Samsung-900X-34-C.patch | 3 - ...rbage-from-acpi-firmware-performance.patch | 3 - ...rotated-file-from-hashmap-when-rotat.patch | 3 - ...ix-invalid-free-in-sd_session_get_vt.patch | 3 - ...make-sd_session_get_vt-actually-work.patch | 3 - ...cument-resolve-names-option-for-test.patch | 3 - ...all-qsort-on-potentially-NULL-arrays.patch | 3 - ...dbus-common-avoid-leak-in-error-path.patch | 3 - 0036-drop-ins-check-return-value.patch | 3 - ...-sure-that-we-don-t-dereference-NULL.patch | 3 - ...itignore-ignore-clang-analyze-output.patch | 3 - 0039-man-add-more-markup-to-udevadm-8.patch | 3 - ...shared-util-Fix-glob_extend-argument.patch | 3 - 0041-Fix-bad-assert-in-show_pid_array.patch | 3 - ...in-systemd-bootchart-on-short-living.patch | 3 - ...n-document-the-b-special-boot-option.patch | 3 - ...w-unprivileged-session-device-access.patch | 3 - ...expose-loop-block-devices-to-systemd.patch | 3 - ...t-some-of-the-rules-to-the-add-actio.patch | 3 - ...ccessible-FUSE-mount-points-only-as-.patch | 3 - 0048-hwdb-update.patch | 3 - ...rules-remove-pointless-MODE-settings.patch | 3 - 0050-analyze-set-white-backgound.patch | 3 - ...on-dump-has-moved-to-systemd-analyze.patch | 3 - ...-unit-name-in-PrivateTmp-directories.patch | 174 +++ ...ove-links-to-non-existent-wiki-pages.patch | 89 ++ ...ist-boots-to-show-boot-IDs-and-times.patch | 239 ++++ ...tin-path_id-add-support-for-bcma-bus.patch | 47 + ...ev-ata_id-log-faling-ioctls-as-debug.patch | 22 + ...libudev-default-log_priority-to-INFO.patch | 23 + ...y-pass-in-slice-setting-if-it-is-set.patch | 22 + 0059-zsh-completion-add-systemd-run.patch | 60 + ...n-explain-NAME-in-systemctl-man-page.patch | 33 + ...g-of-virtualization-check-results-in.patch | 298 +++++ 0062-systemctl-fix-typo-in-help-text.patch | 22 + ...ce-the-text-on-the-side-with-most-sp.patch | 91 ++ ...ation-returns-NULL-pass-empty-string.patch | 32 + 0065-rules-load-path_id-on-DRM-devices.patch | 44 + 0066-rules-simply-60-drm.rules.patch | 24 + ...board-Fix-large-scan-codes-on-32-bit.patch | 31 + 0068-nspawn-log-out-of-memory-errors.patch | 37 + ...ble-Timeouts-Restarts-default-values.patch | 293 +++++ 0070-man-fix-typo.patch | 22 + 0071-man-do-not-use-term-in-para.patch | 23 + ...-cgroup-run-PID-1-in-the-root-cgroup.patch | 61 + ...im-the-cgroup-tree-on-loop-iteration.patch | 65 ++ ...ut-pty-forwaring-logic-into-ptyfwd.c.patch | 593 ++++++++++ ...y-terminate-machines-when-we-exit-ns.patch | 125 ++ ...em-to-match-other-commands-even-if-r.patch | 112 ++ ...reak-on-zero-or-negative-length-read.patch | 23 + ...an-add-rationale-into-systemd-halt-8.patch | 28 + ...thon-convert-keyword-value-to-string.patch | 27 + ...emctl-make-LOAD-column-width-dynamic.patch | 65 ++ ...hibernation-test-work-for-swap-files.patch | 25 + ...-sd_is_special-and-some-man-page-sym.patch | 134 +++ ...turn-r-instead-of-always-returning-0.patch | 22 + 0084-journal-fix-minor-memory-leak.patch | 22 + ...nfigurable-StartLimit-default-values.patch | 161 +++ ...stallation-of-systemd-nspawn-.servic.patch | 57 + ...stemd-fix-memory-leak-in-cgroup-code.patch | 65 ++ ...t-if-we-cannot-handle-a-button-press.patch | 22 + ...ormat-relative-timestamps-in-the-fut.patch | 120 ++ ...nsider-usec_t-1-an-invalid-timestamp.patch | 48 + ...ve-obsoleted-bInterfaceSubClass-5-ma.patch | 38 + ...saving-restoring-keyboard-backlights.patch | 66 ++ 0093-static-nodes-don-t-call-mkdir.patch | 48 + ...essage-to-have-correct-version-requi.patch | 22 + ...ix-booted-and-add-two-functions-to-d.patch | 34 + ...-activate-mention-E-in-the-help-text.patch | 22 + ...-activate-fix-crash-when-s-is-passed.patch | 23 + ...imestamp-support-on-console-messages.patch | 85 ++ 0099-man-add-bootctl-8.patch | 163 +++ 0100-zsh-completion-add-bootctl.patch | 57 + ...ole-to-the-active-tty-instead-of-jus.patch | 33 + ...put-on-console-during-boot-if-needed.patch | 37 + ...k-of-status-messages-on-shutdown-reb.patch | 26 + 0104-fsck-modernization.patch | 137 +++ ...roduce-udev-object-cleanup-functions.patch | 1040 +++++++++++++++++ ...ing-semicolons-on-define_trivial_cle.patch | 493 ++++++++ ...ator-be-lenient-about-missing-fsck.-.patch | 178 +++ ...use-RequiresOverridable-for-fsck-uni.patch | 37 + 0109-bash-completion-journalctl-file.patch | 33 + ...eed-improve-debugging-messages-a-bit.patch | 70 ++ ...xit-services-keeping-a-hold-on-conso.patch | 54 + ...excludes-for-the-new-per-service-pri.patch | 40 + 0113-core-socket-fix-SO_REUSEPORT.patch | 35 + ...atch-converted-keymaps-before-legacy.patch | 324 +++++ 0115-keymap-Add-Toshiba-Satellite-U940.patch | 28 + systemd.spec | 68 +- 117 files changed, 6591 insertions(+), 155 deletions(-) create mode 100644 0052-systemd-use-unit-name-in-PrivateTmp-directories.patch create mode 100644 0053-catalog-remove-links-to-non-existent-wiki-pages.patch create mode 100644 0054-journalctl-add-list-boots-to-show-boot-IDs-and-times.patch create mode 100644 0055-udev-builtin-path_id-add-support-for-bcma-bus.patch create mode 100644 0056-udev-ata_id-log-faling-ioctls-as-debug.patch create mode 100644 0057-libudev-default-log_priority-to-INFO.patch create mode 100644 0058-nspawn-only-pass-in-slice-setting-if-it-is-set.patch create mode 100644 0059-zsh-completion-add-systemd-run.patch create mode 100644 0060-man-explain-NAME-in-systemctl-man-page.patch create mode 100644 0061-virt-move-caching-of-virtualization-check-results-in.patch create mode 100644 0062-systemctl-fix-typo-in-help-text.patch create mode 100644 0063-analyze-plot-place-the-text-on-the-side-with-most-sp.patch create mode 100644 0064-detect_virtualization-returns-NULL-pass-empty-string.patch create mode 100644 0065-rules-load-path_id-on-DRM-devices.patch create mode 100644 0066-rules-simply-60-drm.rules.patch create mode 100644 0067-udev-builtin-keyboard-Fix-large-scan-codes-on-32-bit.patch create mode 100644 0068-nspawn-log-out-of-memory-errors.patch create mode 100644 0069-Configurable-Timeouts-Restarts-default-values.patch create mode 100644 0070-man-fix-typo.patch create mode 100644 0071-man-do-not-use-term-in-para.patch create mode 100644 0072-cgroup-run-PID-1-in-the-root-cgroup.patch create mode 100644 0073-shutdown-trim-the-cgroup-tree-on-loop-iteration.patch create mode 100644 0074-nspawn-split-out-pty-forwaring-logic-into-ptyfwd.c.patch create mode 100644 0075-nspawn-explicitly-terminate-machines-when-we-exit-ns.patch create mode 100644 0076-run-support-system-to-match-other-commands-even-if-r.patch create mode 100644 0077-acpi-fpdt-break-on-zero-or-negative-length-read.patch create mode 100644 0078-man-add-rationale-into-systemd-halt-8.patch create mode 100644 0079-systemd-python-convert-keyword-value-to-string.patch create mode 100644 0080-systemctl-make-LOAD-column-width-dynamic.patch create mode 100644 0081-Make-hibernation-test-work-for-swap-files.patch create mode 100644 0082-man-add-docs-for-sd_is_special-and-some-man-page-sym.patch create mode 100644 0083-systemctl-return-r-instead-of-always-returning-0.patch create mode 100644 0084-journal-fix-minor-memory-leak.patch create mode 100644 0085-manager-configurable-StartLimit-default-values.patch create mode 100644 0086-man-units-fix-installation-of-systemd-nspawn-.servic.patch create mode 100644 0087-systemd-fix-memory-leak-in-cgroup-code.patch create mode 100644 0088-button-don-t-exit-if-we-cannot-handle-a-button-press.patch create mode 100644 0089-timer-properly-format-relative-timestamps-in-the-fut.patch create mode 100644 0090-timer-consider-usec_t-1-an-invalid-timestamp.patch create mode 100644 0091-udev-usb_id-remove-obsoleted-bInterfaceSubClass-5-ma.patch create mode 100644 0092-Add-support-for-saving-restoring-keyboard-backlights.patch create mode 100644 0093-static-nodes-don-t-call-mkdir.patch create mode 100644 0094-Fix-kmod-error-message-to-have-correct-version-requi.patch create mode 100644 0095-systemd-python-fix-booted-and-add-two-functions-to-d.patch create mode 100644 0096-activate-mention-E-in-the-help-text.patch create mode 100644 0097-activate-fix-crash-when-s-is-passed.patch create mode 100644 0098-journal-timestamp-support-on-console-messages.patch create mode 100644 0099-man-add-bootctl-8.patch create mode 100644 0100-zsh-completion-add-bootctl.patch create mode 100644 0101-Resolve-dev-console-to-the-active-tty-instead-of-jus.patch create mode 100644 0102-Only-disable-output-on-console-during-boot-if-needed.patch create mode 100644 0103-Fix-possible-lack-of-status-messages-on-shutdown-reb.patch create mode 100644 0104-fsck-modernization.patch create mode 100644 0105-Introduce-udev-object-cleanup-functions.patch create mode 100644 0106-util-allow-trailing-semicolons-on-define_trivial_cle.patch create mode 100644 0107-fsck-fstab-generator-be-lenient-about-missing-fsck.-.patch create mode 100644 0108-fstab-generator-use-RequiresOverridable-for-fsck-uni.patch create mode 100644 0109-bash-completion-journalctl-file.patch create mode 100644 0110-random-seed-improve-debugging-messages-a-bit.patch create mode 100644 0111-Fix-RemainAfterExit-services-keeping-a-hold-on-conso.patch create mode 100644 0112-tmpfiles-adjust-excludes-for-the-new-per-service-pri.patch create mode 100644 0113-core-socket-fix-SO_REUSEPORT.patch create mode 100644 0114-localed-match-converted-keymaps-before-legacy.patch create mode 100644 0115-keymap-Add-Toshiba-Satellite-U940.patch diff --git a/.gitignore b/.gitignore index 7936d8f..fcb2b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /x86_64/ /systemd-*src.rpm /systemd-*.tar.xz +/*.rpm diff --git a/0001-acpi-fptd-fix-memory-leak-in-acpi_get_boot_usec.patch b/0001-acpi-fptd-fix-memory-leak-in-acpi_get_boot_usec.patch index 663137c..28c2835 100644 --- a/0001-acpi-fptd-fix-memory-leak-in-acpi_get_boot_usec.patch +++ b/0001-acpi-fptd-fix-memory-leak-in-acpi_get_boot_usec.patch @@ -20,6 +20,3 @@ index b094f34..a7c83ed 100644 struct acpi_table_header *tbl; size_t l; struct acpi_fpdt_header *rec; --- -1.8.4.652.g0d6e0ce - diff --git a/0002-fix-lingering-references-to-var-lib-backlight-random.patch b/0002-fix-lingering-references-to-var-lib-backlight-random.patch index a41186d..bbefb42 100644 --- a/0002-fix-lingering-references-to-var-lib-backlight-random.patch +++ b/0002-fix-lingering-references-to-var-lib-backlight-random.patch @@ -49,6 +49,3 @@ index b0e75db..5caa5d5 100644 Conflicts=shutdown.target After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service Before=sysinit.target shutdown.target --- -1.8.4.652.g0d6e0ce - diff --git a/0003-acpi-make-sure-we-never-free-an-uninitialized-pointe.patch b/0003-acpi-make-sure-we-never-free-an-uninitialized-pointe.patch index 77f212b..4be984a 100644 --- a/0003-acpi-make-sure-we-never-free-an-uninitialized-pointe.patch +++ b/0003-acpi-make-sure-we-never-free-an-uninitialized-pointe.patch @@ -20,6 +20,3 @@ index a7c83ed..af58c7c 100644 struct acpi_table_header *tbl; size_t l; struct acpi_fpdt_header *rec; --- -1.8.4.652.g0d6e0ce - diff --git a/0004-systemctl-fix-name-mangling-for-sysv-units.patch b/0004-systemctl-fix-name-mangling-for-sysv-units.patch index 9a8d7cf..9e5a25a 100644 --- a/0004-systemctl-fix-name-mangling-for-sysv-units.patch +++ b/0004-systemctl-fix-name-mangling-for-sysv-units.patch @@ -129,6 +129,3 @@ index bb7ada9..d75281f 100644 if (r) return r; --- -1.8.4.652.g0d6e0ce - diff --git a/0005-cryptsetup-fix-OOM-handling-when-parsing-mount-optio.patch b/0005-cryptsetup-fix-OOM-handling-when-parsing-mount-optio.patch index e7c40bb..559376e 100644 --- a/0005-cryptsetup-fix-OOM-handling-when-parsing-mount-optio.patch +++ b/0005-cryptsetup-fix-OOM-handling-when-parsing-mount-optio.patch @@ -43,6 +43,3 @@ index 22b5eea..769c3e4 100644 free(opt_hash); opt_hash = t; --- -1.8.4.652.g0d6e0ce - diff --git a/0006-journald-add-missing-error-check.patch b/0006-journald-add-missing-error-check.patch index 3e50b24..8ed0124 100644 --- a/0006-journald-add-missing-error-check.patch +++ b/0006-journald-add-missing-error-check.patch @@ -20,6 +20,3 @@ index 1236403..81c344f 100644 o->field.hash = htole64(hash); memcpy(o->field.payload, field, size); --- -1.8.4.652.g0d6e0ce - diff --git a/0007-bus-fix-potentially-uninitialized-memory-access.patch b/0007-bus-fix-potentially-uninitialized-memory-access.patch index aa55ecf..8807b85 100644 --- a/0007-bus-fix-potentially-uninitialized-memory-access.patch +++ b/0007-bus-fix-potentially-uninitialized-memory-access.patch @@ -29,6 +29,3 @@ index 0e66f3d..cac948e 100644 if (isempty(p)) return false; --- -1.8.4.652.g0d6e0ce - diff --git a/0008-dbus-fix-return-value-of-dispatch_rqueue.patch b/0008-dbus-fix-return-value-of-dispatch_rqueue.patch index 28c2fa3..3b4244b 100644 --- a/0008-dbus-fix-return-value-of-dispatch_rqueue.patch +++ b/0008-dbus-fix-return-value-of-dispatch_rqueue.patch @@ -25,6 +25,3 @@ index 3f766fb..db0880f 100644 } int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) { --- -1.8.4.652.g0d6e0ce - diff --git a/0009-modules-load-fix-error-handling.patch b/0009-modules-load-fix-error-handling.patch index c0447ef..9b8740e 100644 --- a/0009-modules-load-fix-error-handling.patch +++ b/0009-modules-load-fix-error-handling.patch @@ -22,6 +22,3 @@ index 7b19ee0..49ee420 100644 } r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs); --- -1.8.4.652.g0d6e0ce - diff --git a/0010-efi-never-call-qsort-on-potentially-NULL-arrays.patch b/0010-efi-never-call-qsort-on-potentially-NULL-arrays.patch index ba0827d..d320265 100644 --- a/0010-efi-never-call-qsort-on-potentially-NULL-arrays.patch +++ b/0010-efi-never-call-qsort-on-potentially-NULL-arrays.patch @@ -21,6 +21,3 @@ index 1d5b6f9..c015b16 100644 *options = list; return count; --- -1.8.4.652.g0d6e0ce - diff --git a/0011-strv-don-t-access-potentially-NULL-string-arrays.patch b/0011-strv-don-t-access-potentially-NULL-string-arrays.patch index d70fd49..e9d6b84 100644 --- a/0011-strv-don-t-access-potentially-NULL-string-arrays.patch +++ b/0011-strv-don-t-access-potentially-NULL-string-arrays.patch @@ -22,6 +22,3 @@ index 5e29629..7976881 100644 return e; } --- -1.8.4.652.g0d6e0ce - diff --git a/0012-mkdir-pass-a-proper-function-pointer-to-mkdir_safe_i.patch b/0012-mkdir-pass-a-proper-function-pointer-to-mkdir_safe_i.patch index 136547a..e591844 100644 --- a/0012-mkdir-pass-a-proper-function-pointer-to-mkdir_safe_i.patch +++ b/0012-mkdir-pass-a-proper-function-pointer-to-mkdir_safe_i.patch @@ -20,6 +20,3 @@ index b7e5c6e..43c6ea6 100644 } static int is_dir(const char* path) { --- -1.8.4.652.g0d6e0ce - diff --git a/0013-tmpfiles.d-include-setgid-perms-for-run-log-journal.patch b/0013-tmpfiles.d-include-setgid-perms-for-run-log-journal.patch index c014048..2aca9b7 100644 --- a/0013-tmpfiles.d-include-setgid-perms-for-run-log-journal.patch +++ b/0013-tmpfiles.d-include-setgid-perms-for-run-log-journal.patch @@ -21,6 +21,3 @@ index b630440..a05c657 100644 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.652.g0d6e0ce - diff --git a/0014-execute.c-always-set-SHELL.patch b/0014-execute.c-always-set-SHELL.patch index 3915c20..9c93c23 100644 --- a/0014-execute.c-always-set-SHELL.patch +++ b/0014-execute.c-always-set-SHELL.patch @@ -164,6 +164,3 @@ index 3718a57..3f8b59d 100644 ExecStart=-@rootlibexecdir@/systemd --user Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/dbus/user_bus_socket Slice=user-%i.slice --- -1.8.4.652.g0d6e0ce - diff --git a/0015-man-Improve-the-description-of-parameter-X-in-tmpfil.patch b/0015-man-Improve-the-description-of-parameter-X-in-tmpfil.patch index 7509d7f..9161601 100644 --- a/0015-man-Improve-the-description-of-parameter-X-in-tmpfil.patch +++ b/0015-man-Improve-the-description-of-parameter-X-in-tmpfil.patch @@ -40,6 +40,3 @@ index 9fc4b7c..e8b630d 100644 names. --- -1.8.4.652.g0d6e0ce - diff --git a/0016-execute-more-debugging-messages.patch b/0016-execute-more-debugging-messages.patch index 0bfc55a..c01d99f 100644 --- a/0016-execute-more-debugging-messages.patch +++ b/0016-execute-more-debugging-messages.patch @@ -119,6 +119,3 @@ index 49296b5..973daf7 100644 /* Make this a NOP on non-logind systems */ if (!logind_running()) --- -1.8.4.652.g0d6e0ce - diff --git a/0017-gpt-auto-generator-exit-immediately-if-in-container.patch b/0017-gpt-auto-generator-exit-immediately-if-in-container.patch index c168a2b..0ced77d 100644 --- a/0017-gpt-auto-generator-exit-immediately-if-in-container.patch +++ b/0017-gpt-auto-generator-exit-immediately-if-in-container.patch @@ -35,6 +35,3 @@ index ca54925..d2b4213 100644 r = 0; goto finish; } --- -1.8.4.652.g0d6e0ce - diff --git a/0018-systemd-order-remote-mounts-from-mountinfo-before-re.patch b/0018-systemd-order-remote-mounts-from-mountinfo-before-re.patch index b094173..df58924 100644 --- a/0018-systemd-order-remote-mounts-from-mountinfo-before-re.patch +++ b/0018-systemd-order-remote-mounts-from-mountinfo-before-re.patch @@ -36,6 +36,3 @@ index 3d46557..93bfa99 100644 if (r < 0) goto fail; --- -1.8.4.652.g0d6e0ce - diff --git a/0019-manager-when-verifying-whether-clients-may-change-en.patch b/0019-manager-when-verifying-whether-clients-may-change-en.patch index c9adff7..d445dac 100644 --- a/0019-manager-when-verifying-whether-clients-may-change-en.patch +++ b/0019-manager-when-verifying-whether-clients-may-change-en.patch @@ -40,6 +40,3 @@ index 676a07f..8f4d017 100644 if (!dbus_message_iter_init(message, &iter)) goto oom; --- -1.8.4.652.g0d6e0ce - diff --git a/0020-logind-fix-bus-introspection-data-for-TakeControl.patch b/0020-logind-fix-bus-introspection-data-for-TakeControl.patch index 7d7f65b..6f3db80 100644 --- a/0020-logind-fix-bus-introspection-data-for-TakeControl.patch +++ b/0020-logind-fix-bus-introspection-data-for-TakeControl.patch @@ -20,6 +20,3 @@ index 5f6bafb..be4e01c 100644 " \n" \ " \n" \ " \n" \ --- -1.8.4.652.g0d6e0ce - diff --git a/0021-mount-check-for-NULL-before-reading-pm-what.patch b/0021-mount-check-for-NULL-before-reading-pm-what.patch index 4c3e60e..10be17b 100644 --- a/0021-mount-check-for-NULL-before-reading-pm-what.patch +++ b/0021-mount-check-for-NULL-before-reading-pm-what.patch @@ -24,6 +24,3 @@ index 93bfa99..db055f0 100644 r = unit_require_mounts_for(UNIT(m), pm->what); if (r < 0) return r; --- -1.8.4.652.g0d6e0ce - diff --git a/0022-core-do-not-add-what-to-RequiresMountsFor-for-networ.patch b/0022-core-do-not-add-what-to-RequiresMountsFor-for-networ.patch index 0eb8435..d804be1 100644 --- a/0022-core-do-not-add-what-to-RequiresMountsFor-for-networ.patch +++ b/0022-core-do-not-add-what-to-RequiresMountsFor-for-networ.patch @@ -176,6 +176,3 @@ index db055f0..70cd372 100644 static int mount_add_device_links(Mount *m) { MountParameters *p; bool device_wants_mount = false; --- -1.8.4.652.g0d6e0ce - diff --git a/0023-utf8-fix-utf8_is_printable.patch b/0023-utf8-fix-utf8_is_printable.patch index a50d77d..fb88716 100644 --- a/0023-utf8-fix-utf8_is_printable.patch +++ b/0023-utf8-fix-utf8_is_printable.patch @@ -42,6 +42,3 @@ index 7bd0db1..f0182ee 100644 } static void test_utf8_is_valid(void) { --- -1.8.4.652.g0d6e0ce - diff --git a/0024-shared-util-fix-off-by-one-error-in-tag_to_udev_node.patch b/0024-shared-util-fix-off-by-one-error-in-tag_to_udev_node.patch index 191e85b..8e02bec 100644 --- a/0024-shared-util-fix-off-by-one-error-in-tag_to_udev_node.patch +++ b/0024-shared-util-fix-off-by-one-error-in-tag_to_udev_node.patch @@ -45,6 +45,3 @@ index 2f3dedb..59ba4be 100644 } int main(int argc, char *argv[]) { --- -1.8.4.652.g0d6e0ce - diff --git a/0025-systemd-serialize-deserialize-forbid_restart-value.patch b/0025-systemd-serialize-deserialize-forbid_restart-value.patch index 4507f7a..e306bce 100644 --- a/0025-systemd-serialize-deserialize-forbid_restart-value.patch +++ b/0025-systemd-serialize-deserialize-forbid_restart-value.patch @@ -46,6 +46,3 @@ index 6792024..98b1599 100644 } else log_debug_unit(u->id, "Unknown serialization key '%s'", key); --- -1.8.4.652.g0d6e0ce - diff --git a/0026-core-unify-the-way-we-denote-serialization-attribute.patch b/0026-core-unify-the-way-we-denote-serialization-attribute.patch index b02a9f1..b778da1 100644 --- a/0026-core-unify-the-way-we-denote-serialization-attribute.patch +++ b/0026-core-unify-the-way-we-denote-serialization-attribute.patch @@ -35,6 +35,3 @@ index 98b1599..96ed2d3 100644 else s->forbid_restart = b; } else --- -1.8.4.652.g0d6e0ce - diff --git a/0027-journald-fix-minor-memory-leak.patch b/0027-journald-fix-minor-memory-leak.patch index 260e634..995d65c 100644 --- a/0027-journald-fix-minor-memory-leak.patch +++ b/0027-journald-fix-minor-memory-leak.patch @@ -20,6 +20,3 @@ index c73ad8f..8d5effb 100644 continue; } --- -1.8.4.652.g0d6e0ce - diff --git a/0028-keymap-Fix-Samsung-900X-34-C.patch b/0028-keymap-Fix-Samsung-900X-34-C.patch index 433aabb..313d243 100644 --- a/0028-keymap-Fix-Samsung-900X-34-C.patch +++ b/0028-keymap-Fix-Samsung-900X-34-C.patch @@ -37,6 +37,3 @@ index 20d398f..b497f92 100644 KEYBOARD_KEY_ce=! # Fn+F8 keyboard backlight up KEYBOARD_KEY_8d=! # Fn+F7 keyboard backlight down KEYBOARD_KEY_96=! # Fn+F1 performance mode (?) --- -1.8.4.652.g0d6e0ce - diff --git a/0029-do-not-accept-garbage-from-acpi-firmware-performance.patch b/0029-do-not-accept-garbage-from-acpi-firmware-performance.patch index 3b64bd3..998ec91 100644 --- a/0029-do-not-accept-garbage-from-acpi-firmware-performance.patch +++ b/0029-do-not-accept-garbage-from-acpi-firmware-performance.patch @@ -28,6 +28,3 @@ index af58c7c..75648b4 100644 if (loader_start) *loader_start = brec.startup_start / 1000; if (loader_exit) --- -1.8.4.652.g0d6e0ce - diff --git a/0030-journald-remove-rotated-file-from-hashmap-when-rotat.patch b/0030-journald-remove-rotated-file-from-hashmap-when-rotat.patch index 53f5ade..d818c2d 100644 --- a/0030-journald-remove-rotated-file-from-hashmap-when-rotat.patch +++ b/0030-journald-remove-rotated-file-from-hashmap-when-rotat.patch @@ -34,6 +34,3 @@ index 4f47eb1..e03e413 100644 else { hashmap_replace(s->user_journals, k, f); server_fix_perms(s, f, PTR_TO_UINT32(k)); --- -1.8.4.652.g0d6e0ce - diff --git a/0031-login-fix-invalid-free-in-sd_session_get_vt.patch b/0031-login-fix-invalid-free-in-sd_session_get_vt.patch index cdb2aa0..92a964c 100644 --- a/0031-login-fix-invalid-free-in-sd_session_get_vt.patch +++ b/0031-login-fix-invalid-free-in-sd_session_get_vt.patch @@ -22,6 +22,3 @@ index 71d8c29..6c27dfe 100644 unsigned u; int r; --- -1.8.4.652.g0d6e0ce - diff --git a/0032-login-make-sd_session_get_vt-actually-work.patch b/0032-login-make-sd_session_get_vt-actually-work.patch index c2a4317..de3bd5c 100644 --- a/0032-login-make-sd_session_get_vt-actually-work.patch +++ b/0032-login-make-sd_session_get_vt-actually-work.patch @@ -22,6 +22,3 @@ index 6c27dfe..7e25041 100644 if (r < 0) return r; --- -1.8.4.652.g0d6e0ce - diff --git a/0033-udevadm.xml-document-resolve-names-option-for-test.patch b/0033-udevadm.xml-document-resolve-names-option-for-test.patch index 97c7b9a..dc42183 100644 --- a/0033-udevadm.xml-document-resolve-names-option-for-test.patch +++ b/0033-udevadm.xml-document-resolve-names-option-for-test.patch @@ -29,6 +29,3 @@ index d0b257d..b959216 100644 --- -1.8.4.652.g0d6e0ce - diff --git a/0034-Never-call-qsort-on-potentially-NULL-arrays.patch b/0034-Never-call-qsort-on-potentially-NULL-arrays.patch index a12a54a..5d2fd9b 100644 --- a/0034-Never-call-qsort-on-potentially-NULL-arrays.patch +++ b/0034-Never-call-qsort-on-potentially-NULL-arrays.patch @@ -380,6 +380,3 @@ index d75281f..036828b 100644 for (u = unit_infos; u < unit_infos + c; u++) { _cleanup_free_ char *p = NULL; --- -1.8.4.652.g0d6e0ce - diff --git a/0035-dbus-common-avoid-leak-in-error-path.patch b/0035-dbus-common-avoid-leak-in-error-path.patch index b7a76a5..906c9fe 100644 --- a/0035-dbus-common-avoid-leak-in-error-path.patch +++ b/0035-dbus-common-avoid-leak-in-error-path.patch @@ -66,6 +66,3 @@ index c727cae..3ba2d87 100644 return 0; } --- -1.8.4.652.g0d6e0ce - diff --git a/0036-drop-ins-check-return-value.patch b/0036-drop-ins-check-return-value.patch index 793697b..5193275 100644 --- a/0036-drop-ins-check-return-value.patch +++ b/0036-drop-ins-check-return-value.patch @@ -24,6 +24,3 @@ index 4b97710..1db7d06 100644 if (unlink(q) < 0) r = errno == ENOENT ? 0 : -errno; else --- -1.8.4.652.g0d6e0ce - diff --git a/0037-Make-sure-that-we-don-t-dereference-NULL.patch b/0037-Make-sure-that-we-don-t-dereference-NULL.patch index a5950e4..80c2231 100644 --- a/0037-Make-sure-that-we-don-t-dereference-NULL.patch +++ b/0037-Make-sure-that-we-don-t-dereference-NULL.patch @@ -25,6 +25,3 @@ index 44920d6..f01843d 100644 return r; } --- -1.8.4.652.g0d6e0ce - diff --git a/0038-gitignore-ignore-clang-analyze-output.patch b/0038-gitignore-ignore-clang-analyze-output.patch index d1a9be3..023ad3c 100644 --- a/0038-gitignore-ignore-clang-analyze-output.patch +++ b/0038-gitignore-ignore-clang-analyze-output.patch @@ -19,6 +19,3 @@ index 5b38c0b..56e10a6 100644 *.stamp *.pyc __pycache__/ --- -1.8.4.652.g0d6e0ce - diff --git a/0039-man-add-more-markup-to-udevadm-8.patch b/0039-man-add-more-markup-to-udevadm-8.patch index cd2b562..7c14c0b 100644 --- a/0039-man-add-more-markup-to-udevadm-8.patch +++ b/0039-man-add-more-markup-to-udevadm-8.patch @@ -92,6 +92,3 @@ index b959216..a1ffe42 100644 --- -1.8.4.652.g0d6e0ce - diff --git a/0040-shared-util-Fix-glob_extend-argument.patch b/0040-shared-util-Fix-glob_extend-argument.patch index 2d30a95..ff1837b 100644 --- a/0040-shared-util-Fix-glob_extend-argument.patch +++ b/0040-shared-util-Fix-glob_extend-argument.patch @@ -23,6 +23,3 @@ index 748f1bb..6c88040 100644 if (k == GLOB_NOMATCH) return -ENOENT; --- -1.8.4.652.g0d6e0ce - diff --git a/0041-Fix-bad-assert-in-show_pid_array.patch b/0041-Fix-bad-assert-in-show_pid_array.patch index a1a4398..4042ba6 100644 --- a/0041-Fix-bad-assert-in-show_pid_array.patch +++ b/0041-Fix-bad-assert-in-show_pid_array.patch @@ -33,6 +33,3 @@ index cc44ab4..aa0f017 100644 if(flags & OUTPUT_FULL_WIDTH) n_columns = 0; --- -1.8.4.652.g0d6e0ce - diff --git a/0042-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch b/0042-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch index ffe9b63..f9158e9 100644 --- a/0042-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch +++ b/0042-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch @@ -29,6 +29,3 @@ index f8c97c2..7f86cfe 100644 ps->sample->runtime = atoll(rt); ps->sample->waittime = atoll(wt); --- -1.8.4.652.g0d6e0ce - diff --git a/0043-man-document-the-b-special-boot-option.patch b/0043-man-document-the-b-special-boot-option.patch index 32ac2db..6cedef6 100644 --- a/0043-man-document-the-b-special-boot-option.patch +++ b/0043-man-document-the-b-special-boot-option.patch @@ -32,6 +32,3 @@ index fe6e331..85c06d3 100644 emergency Boot into emergency --- -1.8.4.652.g0d6e0ce - diff --git a/0044-logind-allow-unprivileged-session-device-access.patch b/0044-logind-allow-unprivileged-session-device-access.patch index ad52a04..39962fa 100644 --- a/0044-logind-allow-unprivileged-session-device-access.patch +++ b/0044-logind-allow-unprivileged-session-device-access.patch @@ -44,6 +44,3 @@ index 0407609..04e735e 100644 --- -1.8.4.652.g0d6e0ce - diff --git a/0045-rules-expose-loop-block-devices-to-systemd.patch b/0045-rules-expose-loop-block-devices-to-systemd.patch index 0b3a61b..6119d6e 100644 --- a/0045-rules-expose-loop-block-devices-to-systemd.patch +++ b/0045-rules-expose-loop-block-devices-to-systemd.patch @@ -30,6 +30,3 @@ index bbb7d0c..3c99475 100644 # Ignore raid devices that are not yet assembled and started SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0" --- -1.8.4.652.g0d6e0ce - diff --git a/0046-rules-don-t-limit-some-of-the-rules-to-the-add-actio.patch b/0046-rules-don-t-limit-some-of-the-rules-to-the-add-actio.patch index 7fe4937..9aea829 100644 --- a/0046-rules-don-t-limit-some-of-the-rules-to-the-add-actio.patch +++ b/0046-rules-don-t-limit-some-of-the-rules-to-the-add-actio.patch @@ -33,6 +33,3 @@ index 3c99475..307f18f 100644 +SUBSYSTEM=="module", KERNEL=="configfs", TAG+="systemd", ENV{SYSTEMD_WANTS}+="sys-kernel-config.mount" LABEL="systemd_end" --- -1.8.4.652.g0d6e0ce - diff --git a/0047-tmpfiles-log-unaccessible-FUSE-mount-points-only-as-.patch b/0047-tmpfiles-log-unaccessible-FUSE-mount-points-only-as-.patch index f1e91c9..a02d654 100644 --- a/0047-tmpfiles-log-unaccessible-FUSE-mount-points-only-as-.patch +++ b/0047-tmpfiles-log-unaccessible-FUSE-mount-points-only-as-.patch @@ -32,6 +32,3 @@ index 8122d6a..239e56b 100644 continue; } --- -1.8.4.652.g0d6e0ce - diff --git a/0048-hwdb-update.patch b/0048-hwdb-update.patch index 9e22ea1..6d8d820 100644 --- a/0048-hwdb-update.patch +++ b/0048-hwdb-update.patch @@ -1627,6 +1627,3 @@ index fdb534d..289f81c 100644 pci:v00009005d00000285sv0000108Esd00000287* ID_MODEL_FROM_DATABASE=STK RAID EXT --- -1.8.4.652.g0d6e0ce - diff --git a/0049-rules-remove-pointless-MODE-settings.patch b/0049-rules-remove-pointless-MODE-settings.patch index a1238e5..32aeb01 100644 --- a/0049-rules-remove-pointless-MODE-settings.patch +++ b/0049-rules-remove-pointless-MODE-settings.patch @@ -38,6 +38,3 @@ index f764789..679dfdf 100644 KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse" --- -1.8.4.652.g0d6e0ce - diff --git a/0050-analyze-set-white-backgound.patch b/0050-analyze-set-white-backgound.patch index 47399ca..f531a11 100644 --- a/0050-analyze-set-white-backgound.patch +++ b/0050-analyze-set-white-backgound.patch @@ -31,6 +31,3 @@ index a4f15eb..9a69795 100644 svg("%s", pretty_times); svg("%s %s (%s %s) %s", isempty(osname) ? "Linux" : osname, --- -1.8.4.652.g0d6e0ce - diff --git a/0051-shell-completion-dump-has-moved-to-systemd-analyze.patch b/0051-shell-completion-dump-has-moved-to-systemd-analyze.patch index a93c504..6603792 100644 --- a/0051-shell-completion-dump-has-moved-to-systemd-analyze.patch +++ b/0051-shell-completion-dump-has-moved-to-systemd-analyze.patch @@ -79,6 +79,3 @@ index 37c60f5..2eda5fe 100644 'set-log-level:Set systemd log threshold' ) --- -1.8.4.652.g0d6e0ce - diff --git a/0052-systemd-use-unit-name-in-PrivateTmp-directories.patch b/0052-systemd-use-unit-name-in-PrivateTmp-directories.patch new file mode 100644 index 0000000..8316ef2 --- /dev/null +++ b/0052-systemd-use-unit-name-in-PrivateTmp-directories.patch @@ -0,0 +1,174 @@ +From df3db39c105ff8a6ba409ae8e28216d8571dece7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 22 Oct 2013 20:39:18 -0400 +Subject: [PATCH] systemd: use unit name in PrivateTmp directories + +Unit name is used whole in the directory name, so that the unit name +can be easily extracted from it, e.g. "/tmp/systemd-abcd.service-DEDBIF1". + +https://bugzilla.redhat.com/show_bug.cgi?id=957439 +--- + Makefile.am | 7 ++++++ + src/core/execute.c | 2 +- + src/core/namespace.c | 15 ++++++++----- + src/core/namespace.h | 5 ++++- + src/test/test-namespace.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 77 insertions(+), 8 deletions(-) + create mode 100644 src/test/test-namespace.c + +diff --git a/Makefile.am b/Makefile.am +index 8d9c587..5e3e5d2 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1130,6 +1130,7 @@ tests += \ + test-unit-file \ + test-utf8 \ + test-util \ ++ test-namespace \ + test-date \ + test-sleep \ + test-replace-var \ +@@ -1256,6 +1257,12 @@ test_util_CFLAGS = \ + test_util_LDADD = \ + libsystemd-core.la + ++test_namespace_SOURCES = \ ++ src/test/test-namespace.c ++ ++test_namespace_LDADD = \ ++ libsystemd-core.la ++ + test_hashmap_SOURCES = \ + src/test/test-hashmap.c + +diff --git a/src/core/execute.c b/src/core/execute.c +index 3f7ca52..58be72a 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -1089,7 +1089,7 @@ int exec_spawn(ExecCommand *command, + free(line); + + if (context->private_tmp && !context->tmp_dir && !context->var_tmp_dir) { +- r = setup_tmpdirs(&context->tmp_dir, &context->var_tmp_dir); ++ r = setup_tmpdirs(unit_id, &context->tmp_dir, &context->var_tmp_dir); + if (r < 0) + return r; + } +diff --git a/src/core/namespace.c b/src/core/namespace.c +index 936f368..b453f8d 100644 +--- a/src/core/namespace.c ++++ b/src/core/namespace.c +@@ -184,26 +184,29 @@ static int make_read_only(BindMount *m) { + return 0; + } + +-int setup_tmpdirs(char **tmp_dir, ++int setup_tmpdirs(const char *unit_id, ++ char **tmp_dir, + char **var_tmp_dir) { + int r = 0; +- char tmp_dir_template[] = "/tmp/systemd-private-XXXXXX", +- var_tmp_dir_template[] = "/var/tmp/systemd-private-XXXXXX"; ++ _cleanup_free_ char *tmp = NULL, *var = NULL; + + assert(tmp_dir); + assert(var_tmp_dir); + +- r = create_tmp_dir(tmp_dir_template, tmp_dir); ++ tmp = strjoin("/tmp/systemd-", unit_id, "-XXXXXXX", NULL); ++ var = strjoin("/var/tmp/systemd-", unit_id, "-XXXXXXX", NULL); ++ ++ r = create_tmp_dir(tmp, tmp_dir); + if (r < 0) + return r; + +- r = create_tmp_dir(var_tmp_dir_template, var_tmp_dir); ++ r = create_tmp_dir(var, var_tmp_dir); + if (r == 0) + return 0; + + /* failure */ + rmdir(*tmp_dir); +- rmdir(tmp_dir_template); ++ rmdir(tmp); + free(*tmp_dir); + *tmp_dir = NULL; + +diff --git a/src/core/namespace.h b/src/core/namespace.h +index ddb5794..ee7416b 100644 +--- a/src/core/namespace.h ++++ b/src/core/namespace.h +@@ -23,7 +23,10 @@ + + #include + +-int setup_tmpdirs(char **tmp_dir, char **var_tmp_dir); ++int setup_tmpdirs(const char *unit_id, ++ char **tmp_dir, ++ char **var_tmp_dir); ++ + int setup_namespace(char **read_write_dirs, + char **read_only_dirs, + char **inaccessible_dirs, +diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c +new file mode 100644 +index 0000000..1c04676 +--- /dev/null ++++ b/src/test/test-namespace.c +@@ -0,0 +1,56 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2013 Zbigniew Jędrzejewski-Szmek ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include ++ ++#include "namespace.h" ++#include "util.h" ++ ++static void test_tmpdir(const char *id, const char *A, const char *B) { ++ _cleanup_free_ char *a, *b; ++ ++ assert_se(setup_tmpdirs(id, &a, &b) == 0); ++ assert(startswith(a, A)); ++ assert(startswith(b, B)); ++ assert(access(a, F_OK) == 0); ++ assert(access(b, F_OK) == 0); ++ ++ assert_se(rmdir(a) == 0); ++ assert_se(rmdir(b) == 0); ++ ++ assert(endswith(a, "/tmp")); ++ assert(endswith(b, "/tmp")); ++ ++ assert_se(rmdir(dirname(a)) == 0); ++ assert_se(rmdir(dirname(b)) == 0); ++} ++ ++int main(int argc, char *argv[]) { ++ test_tmpdir("abcd.service", ++ "/tmp/systemd-abcd.service-", ++ "/var/tmp/systemd-abcd.service-"); ++ ++ test_tmpdir("sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device", ++ "/tmp/systemd-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", ++ "/var/tmp/systemd-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-"); ++ ++ return 0; ++} diff --git a/0053-catalog-remove-links-to-non-existent-wiki-pages.patch b/0053-catalog-remove-links-to-non-existent-wiki-pages.patch new file mode 100644 index 0000000..71f5c18 --- /dev/null +++ b/0053-catalog-remove-links-to-non-existent-wiki-pages.patch @@ -0,0 +1,89 @@ +From 5048d22d69d889d17eaea99f223fd9369eadc919 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 24 Oct 2013 00:45:10 -0400 +Subject: [PATCH] catalog: remove links to non-existent wiki pages + +AFAIK, we don't have even one page with message explanations. +If/when we add them, we can add links. + +https://bugzilla.redhat.com/show_bug.cgi?id=1017161 +--- + catalog/systemd.catalog | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/catalog/systemd.catalog b/catalog/systemd.catalog +index 892b2ad..3c2fe64 100644 +--- a/catalog/systemd.catalog ++++ b/catalog/systemd.catalog +@@ -204,7 +204,6 @@ Unit @UNIT@ has begun shutting down. + Subject: Unit @UNIT@ has finished shutting down + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + Unit @UNIT@ has finished shutting down. + +@@ -212,7 +211,6 @@ Unit @UNIT@ has finished shutting down. + Subject: Unit @UNIT@ has failed + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + Unit @UNIT@ has failed. + +@@ -222,7 +220,6 @@ The result is @RESULT@. + Subject: Unit @UNIT@ has begun with reloading its configuration + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + Unit @UNIT@ has begun with reloading its configuration + +@@ -230,7 +227,6 @@ Unit @UNIT@ has begun with reloading its configuration + Subject: Unit @UNIT@ has finished reloading its configuration + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + Unit @UNIT@ has finished reloading its configuration + +@@ -240,7 +236,6 @@ The result is @RESULT@. + Subject: Process @EXECUTABLE@ could not be executed + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + The process @EXECUTABLE@ could not be executed and failed. + +@@ -250,7 +245,6 @@ The error number returned while executing this process is @ERRNO@. + Subject: One or more messages could not be forwarded to syslog + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + One or more messages could not be forwarded to the syslog service + running side-by-side with journald. This usually indicates that the +@@ -261,7 +255,6 @@ messages queued. + Subject: Mount point is not empty + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + The directory @WHERE@ is specified as the mount point (second field in + /etc/fstab or Where= field in systemd unit file) and is not empty. +@@ -274,7 +267,6 @@ location. + Subject: A virtual machine or container has been started + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + The virtual machine @NAME@ with its leader PID @LEADER@ has been + started is now ready to use. +@@ -283,7 +275,6 @@ started is now ready to use. + Subject: A virtual machine or container has been terminated + Defined-By: systemd + Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel +-Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/@MESSAGE_ID@ + + The virtual machine @NAME@ with its leader PID @LEADER@ has been + shut down. diff --git a/0054-journalctl-add-list-boots-to-show-boot-IDs-and-times.patch b/0054-journalctl-add-list-boots-to-show-boot-IDs-and-times.patch new file mode 100644 index 0000000..5e776ec --- /dev/null +++ b/0054-journalctl-add-list-boots-to-show-boot-IDs-and-times.patch @@ -0,0 +1,239 @@ +From e94957b964380c0c9b0f3264ba5e35166d543ca7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 28 Oct 2013 23:43:57 -0400 +Subject: [PATCH] journalctl: add --list-boots to show boot IDs and times + +Suggested by David Wilkins in +https://bugzilla.redhat.com/show_bug.cgi?id=967521: + +> [Specific boot ID is a] bit of a palaver to obtain. I consulted the +> verbose dump of the journal to discover the _BOOT_ID for the +> timestamp, and then generated the journal dump for that boot using +> journalctl _BOOT_ID=foo -o short-monotonic. +--- + man/journalctl.xml | 11 ++++ + shell-completion/bash/journalctl | 2 +- + shell-completion/zsh/_journalctl | 1 + + src/journal/journalctl.c | 105 +++++++++++++++++++++++++++++++++++++-- + 4 files changed, 113 insertions(+), 6 deletions(-) + +diff --git a/man/journalctl.xml b/man/journalctl.xml +index b5a0c53..c0cc96d 100644 +--- a/man/journalctl.xml ++++ b/man/journalctl.xml +@@ -478,6 +478,17 @@ + + + ++ ++ ++ Show a tabular list of ++ boot numbers (relative to current ++ boot), their IDs, and the timestamps ++ of the first and last message ++ pertaining to the boot. ++ ++ ++ ++ + + + +diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl +index 3c40d57..942a253 100644 +--- a/shell-completion/bash/journalctl ++++ b/shell-completion/bash/journalctl +@@ -42,7 +42,7 @@ _journalctl() { + --disk-usage -f --follow --header + -h --help -l --local --new-id128 -m --merge --no-pager + --no-tail -q --quiet --setup-keys --this-boot --verify +- --version --list-catalog --update-catalog' ++ --version --list-catalog --update-catalog --list-boots' + [ARG]='-b --boot --this-boot -D --directory -F --field + -o --output -u --unit --user-unit' + [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until +diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl +index 73646b5..29ff3e3 100644 +--- a/shell-completion/zsh/_journalctl ++++ b/shell-completion/zsh/_journalctl +@@ -70,6 +70,7 @@ _arguments -s \ + {-q,--quiet}"[Don't show privilege warning]" \ + {-m,--merge}'[Show entries from all available journals]' \ + {-b+,--boot=}'[Show data only from the specified boot or offset]:boot id or offset:_journal_boots' \ ++ '--list-boots[List boots ordered by time]' \ + {-k,--dmesg}'[Show only kernel messages, Implies -b]' \ + {-u+,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \ + '--user-unit=[Show data only from the specified user session unit]:units:_journal_fields USER_UNIT' \ +diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c +index 0876ee6..a5c4779 100644 +--- a/src/journal/journalctl.c ++++ b/src/journal/journalctl.c +@@ -104,12 +104,14 @@ static enum { + ACTION_DISK_USAGE, + ACTION_LIST_CATALOG, + ACTION_DUMP_CATALOG, +- ACTION_UPDATE_CATALOG ++ ACTION_UPDATE_CATALOG, ++ ACTION_LIST_BOOTS, + } arg_action = ACTION_SHOW; + + typedef struct boot_id_t { + sd_id128_t id; +- uint64_t timestamp; ++ uint64_t first; ++ uint64_t last; + } boot_id_t; + + static int help(void) { +@@ -125,6 +127,7 @@ static int help(void) { + " --after-cursor=CURSOR Start showing entries from specified cursor\n" + " --show-cursor Print the cursor after all the entries\n" + " -b --boot[=ID] Show data only from ID or current boot if unspecified\n" ++ " --list-boots Show terse information about recorded boots\n" + " -k --dmesg Show kernel message log from current boot\n" + " -u --unit=UNIT Show data only from the specified unit\n" + " --user-unit=UNIT Show data only from the specified user session unit\n" +@@ -177,6 +180,7 @@ static int parse_argv(int argc, char *argv[]) { + ARG_NO_PAGER, + ARG_NO_TAIL, + ARG_NEW_ID128, ++ ARG_LIST_BOOTS, + ARG_USER, + ARG_SYSTEM, + ARG_ROOT, +@@ -214,6 +218,7 @@ static int parse_argv(int argc, char *argv[]) { + { "quiet", no_argument, NULL, 'q' }, + { "merge", no_argument, NULL, 'm' }, + { "boot", optional_argument, NULL, 'b' }, ++ { "list-boots", no_argument, NULL, ARG_LIST_BOOTS }, + { "this-boot", optional_argument, NULL, 'b' }, /* deprecated */ + { "dmesg", no_argument, NULL, 'k' }, + { "system", no_argument, NULL, ARG_SYSTEM }, +@@ -364,6 +369,10 @@ static int parse_argv(int argc, char *argv[]) { + + break; + ++ case ARG_LIST_BOOTS: ++ arg_action = ACTION_LIST_BOOTS; ++ break; ++ + case 'k': + arg_boot = arg_dmesg = true; + break; +@@ -692,12 +701,93 @@ static int add_matches(sd_journal *j, char **args) { + static int boot_id_cmp(const void *a, const void *b) { + uint64_t _a, _b; + +- _a = ((const boot_id_t *)a)->timestamp; +- _b = ((const boot_id_t *)b)->timestamp; ++ _a = ((const boot_id_t *)a)->first; ++ _b = ((const boot_id_t *)b)->first; + + return _a < _b ? -1 : (_a > _b ? 1 : 0); + } + ++static int list_boots(sd_journal *j) { ++ int r; ++ const void *data; ++ unsigned int count = 0; ++ int w, i; ++ size_t length, allocated = 0; ++ boot_id_t *id; ++ _cleanup_free_ boot_id_t *all_ids = NULL; ++ ++ r = sd_journal_query_unique(j, "_BOOT_ID"); ++ if (r < 0) ++ return r; ++ ++ SD_JOURNAL_FOREACH_UNIQUE(j, data, length) { ++ if (length < strlen("_BOOT_ID=")) ++ continue; ++ ++ if (!GREEDY_REALLOC(all_ids, allocated, count + 1)) ++ return log_oom(); ++ ++ id = &all_ids[count]; ++ ++ r = sd_id128_from_string(((const char *)data) + strlen("_BOOT_ID="), &id->id); ++ if (r < 0) ++ continue; ++ ++ r = sd_journal_add_match(j, data, length); ++ if (r < 0) ++ return r; ++ ++ r = sd_journal_seek_head(j); ++ if (r < 0) ++ return r; ++ ++ r = sd_journal_next(j); ++ if (r < 0) ++ return r; ++ else if (r == 0) ++ goto flush; ++ ++ r = sd_journal_get_realtime_usec(j, &id->first); ++ if (r < 0) ++ return r; ++ ++ r = sd_journal_seek_tail(j); ++ if (r < 0) ++ return r; ++ ++ r = sd_journal_previous(j); ++ if (r < 0) ++ return r; ++ else if (r == 0) ++ goto flush; ++ ++ r = sd_journal_get_realtime_usec(j, &id->last); ++ if (r < 0) ++ return r; ++ ++ count++; ++ flush: ++ sd_journal_flush_matches(j); ++ } ++ ++ qsort_safe(all_ids, count, sizeof(boot_id_t), boot_id_cmp); ++ ++ /* numbers are one less, but we need an extra char for the sign */ ++ w = DECIMAL_STR_WIDTH(count - 1) + 1; ++ ++ for (id = all_ids, i = 0; id < all_ids + count; id++, i++) { ++ char a[FORMAT_TIMESTAMP_MAX], b[FORMAT_TIMESTAMP_MAX]; ++ ++ printf("% *i " SD_ID128_FORMAT_STR " %s—%s\n", ++ w, i - count + 1, ++ SD_ID128_FORMAT_VAL(id->id), ++ format_timestamp(a, sizeof(a), id->first), ++ format_timestamp(b, sizeof(b), id->last)); ++ } ++ ++ return 0; ++} ++ + static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative) { + int r; + const void *data; +@@ -743,7 +833,7 @@ static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative + else if (r == 0) + goto flush; + +- r = sd_journal_get_realtime_usec(j, &id->timestamp); ++ r = sd_journal_get_realtime_usec(j, &id->first); + if (r < 0) + return r; + +@@ -1403,6 +1493,11 @@ int main(int argc, char *argv[]) { + return EXIT_SUCCESS; + } + ++ if (arg_action == ACTION_LIST_BOOTS) { ++ r = list_boots(j); ++ goto finish; ++ } ++ + /* add_boot() must be called first! + * It may need to seek the journal to find parent boot IDs. */ + r = add_boot(j); diff --git a/0055-udev-builtin-path_id-add-support-for-bcma-bus.patch b/0055-udev-builtin-path_id-add-support-for-bcma-bus.patch new file mode 100644 index 0000000..ec7a3cb --- /dev/null +++ b/0055-udev-builtin-path_id-add-support-for-bcma-bus.patch @@ -0,0 +1,47 @@ +From d22ea78deff9fe2c87a3a90381ae2d4e8234d1ca Mon Sep 17 00:00:00 2001 +From: Tom Gundersen +Date: Sat, 26 Oct 2013 12:22:04 +0200 +Subject: [PATCH] udev-builtin: path_id - add support for bcma bus + +This matches the bcma support in the network device naming. + +Eventually wa want to make sure ID_PATH is equivalent to ID_NET_NAME_PATH, +so we never need to match on the latter. +--- + src/udev/udev-builtin-path_id.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c +index 0659967..763f3c3 100644 +--- a/src/udev/udev-builtin-path_id.c ++++ b/src/udev/udev-builtin-path_id.c +@@ -452,6 +452,19 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) + return parent; + } + ++static struct udev_device *handle_bcma(struct udev_device *parent, char **path) ++{ ++ const char *sysname; ++ unsigned int core; ++ ++ sysname = udev_device_get_sysname(parent); ++ if (sscanf(sysname, "bcma%*u:%u", &core) != 1) ++ return NULL; ++ ++ path_prepend(path, "bcma-%u", core); ++ return parent; ++} ++ + static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) + { + struct udev_device *scsi_dev; +@@ -509,6 +522,9 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool + } else if (streq(subsys, "usb")) { + parent = handle_usb(parent, &path); + some_transport = true; ++ } else if (streq(subsys, "bcma")) { ++ parent = handle_bcma(parent, &path); ++ some_transport = true; + } else if (streq(subsys, "serio")) { + path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); + parent = skip_subsystem(parent, "serio"); diff --git a/0056-udev-ata_id-log-faling-ioctls-as-debug.patch b/0056-udev-ata_id-log-faling-ioctls-as-debug.patch new file mode 100644 index 0000000..2011cb6 --- /dev/null +++ b/0056-udev-ata_id-log-faling-ioctls-as-debug.patch @@ -0,0 +1,22 @@ +From e323253480b01f0df71ee409cbf9aba88ec1a5e4 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Wed, 30 Oct 2013 14:34:58 +0100 +Subject: [PATCH] udev: ata_id: log faling ioctls as "debug" + +--- + src/udev/ata_id/ata_id.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c +index 68a06b9..d375d43 100644 +--- a/src/udev/ata_id/ata_id.c ++++ b/src/udev/ata_id/ata_id.c +@@ -501,7 +501,7 @@ int main(int argc, char *argv[]) + } else { + /* If this fails, then try HDIO_GET_IDENTITY */ + if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { +- log_info("HDIO_GET_IDENTITY failed for '%s': %m\n", node); ++ log_debug("HDIO_GET_IDENTITY failed for '%s': %m\n", node); + rc = 2; + goto close; + } diff --git a/0057-libudev-default-log_priority-to-INFO.patch b/0057-libudev-default-log_priority-to-INFO.patch new file mode 100644 index 0000000..3db1618 --- /dev/null +++ b/0057-libudev-default-log_priority-to-INFO.patch @@ -0,0 +1,23 @@ +From d0aeff58c118ae0be82d346ae0ce75bf9a20f02d Mon Sep 17 00:00:00 2001 +From: Tom Gundersen +Date: Wed, 30 Oct 2013 15:09:01 +0100 +Subject: [PATCH] libudev: default log_priority to INFO + +This brings it in sync with the default config file. +--- + src/libudev/libudev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c +index 208039a..bc73a5a 100644 +--- a/src/libudev/libudev.c ++++ b/src/libudev/libudev.c +@@ -125,7 +125,7 @@ _public_ struct udev *udev_new(void) + return NULL; + udev->refcount = 1; + udev->log_fn = log_stderr; +- udev->log_priority = LOG_ERR; ++ udev->log_priority = LOG_INFO; + udev_list_init(udev, &udev->properties_list, true); + + f = fopen("/etc/udev/udev.conf", "re"); diff --git a/0058-nspawn-only-pass-in-slice-setting-if-it-is-set.patch b/0058-nspawn-only-pass-in-slice-setting-if-it-is-set.patch new file mode 100644 index 0000000..8984b65 --- /dev/null +++ b/0058-nspawn-only-pass-in-slice-setting-if-it-is-set.patch @@ -0,0 +1,22 @@ +From 7aa2bfdb3b0c3babc6bb8c4a9534a328b8ac37ab Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 30 Oct 2013 18:40:21 +0100 +Subject: [PATCH] nspawn: only pass in slice setting if it is set + +--- + src/nspawn/nspawn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index eb9605c..9616dbf 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -1202,7 +1202,7 @@ static int register_machine(void) { + "container", + (uint32_t) 0, + strempty(arg_directory), +- 1, "Slice", "s", strempty(arg_slice)); ++ !isempty(arg_slice), "Slice", "s", arg_slice); + if (r < 0) { + log_error("Failed to register machine: %s", error.message ? error.message : strerror(-r)); + return r; diff --git a/0059-zsh-completion-add-systemd-run.patch b/0059-zsh-completion-add-systemd-run.patch new file mode 100644 index 0000000..471061e --- /dev/null +++ b/0059-zsh-completion-add-systemd-run.patch @@ -0,0 +1,60 @@ +From 0f25880b6e0feea046923d2d796e6e10abdd7c6a Mon Sep 17 00:00:00 2001 +From: Ronny Chevalier +Date: Wed, 30 Oct 2013 21:57:44 +0100 +Subject: [PATCH] zsh-completion: add systemd-run + +--- + Makefile.am | 1 + + shell-completion/zsh/_systemd-run | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 32 insertions(+) + create mode 100644 shell-completion/zsh/_systemd-run + +diff --git a/Makefile.am b/Makefile.am +index 5e3e5d2..7ab345a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -352,6 +352,7 @@ dist_zshcompletion_DATA = \ + shell-completion/zsh/_kernel-install \ + shell-completion/zsh/_systemd-nspawn \ + shell-completion/zsh/_systemd-analyze \ ++ shell-completion/zsh/_systemd-run \ + shell-completion/zsh/_sd_hosts_or_user_at_host \ + shell-completion/zsh/_systemd-delta \ + shell-completion/zsh/_systemd +diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run +new file mode 100644 +index 0000000..0c81c54 +--- /dev/null ++++ b/shell-completion/zsh/_systemd-run +@@ -0,0 +1,31 @@ ++#compdef systemd-run ++ ++__systemctl() { ++ local -a _modes ++ _modes=("--user" "--system") ++ systemctl ${words:*_modes} --full --no-legend --no-pager "$@" 2>/dev/null ++} ++ ++__get_slices () { ++ __systemctl list-units --all -t slice \ ++ | { while read -r a b; do echo $a; done; }; ++} ++ ++__slices () { ++ local -a _slices ++ _slices=(${(fo)"$(__get_slices)"}) ++ typeset -U _slices ++ _describe 'slices' _slices ++} ++ ++_arguments \ ++ {-h,--help}'[Show help message]' \ ++ '--version[Show package version]' \ ++ '--user[Run as user unit]' \ ++ '--scope[Run this as scope rather than service]' \ ++ '--unit=[Run under the specified unit name]:unit name' \ ++ '--description=[Description for unit]:description' \ ++ '--slice=[Run in the specified slice]:slices:__slices' \ ++ {-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \ ++ '--send-sighup[Send SIGHUP when terminating]' \ ++ '*::command:_command' diff --git a/0060-man-explain-NAME-in-systemctl-man-page.patch b/0060-man-explain-NAME-in-systemctl-man-page.patch new file mode 100644 index 0000000..face639 --- /dev/null +++ b/0060-man-explain-NAME-in-systemctl-man-page.patch @@ -0,0 +1,33 @@ +From 04547df8f2b71ec3fb4e18e9363da583264a3915 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= +Date: Thu, 31 Oct 2013 14:36:41 +0100 +Subject: [PATCH] man: explain NAME in systemctl man page + +--- + man/systemctl.xml | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/man/systemctl.xml b/man/systemctl.xml +index e789d4b..166282c 100644 +--- a/man/systemctl.xml ++++ b/man/systemctl.xml +@@ -63,6 +63,19 @@ along with systemd; If not, see . + introspect and control the state of the + systemd1 + system and service manager. ++ ++ For Unit Commands the NAME represents full name of unit. ++ ++systemctl start foo.service ++ ++ For Unit File Commands the NAME represents full name of the unit file, or absolute path to the unit file. ++ ++systemctl start /path/to/foo.service ++ ++ While working with services/service files, systemctl is able to append .service suffix when it is missing. ++ ++systemctl start foo ++ + + + diff --git a/0061-virt-move-caching-of-virtualization-check-results-in.patch b/0061-virt-move-caching-of-virtualization-check-results-in.patch new file mode 100644 index 0000000..eda77ac --- /dev/null +++ b/0061-virt-move-caching-of-virtualization-check-results-in.patch @@ -0,0 +1,298 @@ +From 48a66a7f6a23ee71bcf54da5bd0bbd69a0710582 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 31 Oct 2013 16:23:06 +0100 +Subject: [PATCH] virt: move caching of virtualization check results into + detect_vm() and detect_container() + +After all, we ended up calling detect_container() more often than +detect_virtualization(), hence the former one should cache the results, +since the latter is only a wrapper around the former. +--- + src/detect-virt/detect-virt.c | 2 +- + src/shared/virt.c | 180 ++++++++++++++++++++---------------------- + 2 files changed, 87 insertions(+), 95 deletions(-) + +diff --git a/src/detect-virt/detect-virt.c b/src/detect-virt/detect-virt.c +index bd3ee45..72ff2a8 100644 +--- a/src/detect-virt/detect-virt.c ++++ b/src/detect-virt/detect-virt.c +@@ -114,8 +114,8 @@ static int parse_argv(int argc, char *argv[]) { + + int main(int argc, char *argv[]) { + const char *id = NULL; +- int r; + int retval = EXIT_SUCCESS; ++ int r; + + /* This is mostly intended to be used for scripts which want + * to detect whether we are being run in a virtualized +diff --git a/src/shared/virt.c b/src/shared/virt.c +index 4f8134a..537ccda 100644 +--- a/src/shared/virt.c ++++ b/src/shared/virt.c +@@ -60,6 +60,9 @@ int detect_vm(const char **id) { + /* http://msdn.microsoft.com/en-us/library/ff542428.aspx */ + "Microsoft Hv\0" "microsoft\0"; + ++ static __thread int cached_found = -1; ++ static __thread const char *cached_id = NULL; ++ + uint32_t eax, ecx; + union { + uint32_t sig32[3]; +@@ -69,6 +72,15 @@ int detect_vm(const char **id) { + const char *j, *k; + bool hypervisor; + _cleanup_free_ char *hvtype = NULL; ++ const char *_id = NULL; ++ ++ if (_likely_(cached_found >= 0)) { ++ ++ if (id) ++ *id = cached_id; ++ ++ return cached_found; ++ } + + /* Try high-level hypervisor sysfs file first: + * +@@ -76,10 +88,9 @@ int detect_vm(const char **id) { + r = read_one_line_file("/sys/hypervisor/type", &hvtype); + if (r >= 0) { + if (streq(hvtype, "xen")) { +- if (id) +- *id = "xen"; +- +- return 1; ++ _id = "xen"; ++ r = 1; ++ goto finish; + } + } else if (r != -ENOENT) + return r; +@@ -125,17 +136,14 @@ int detect_vm(const char **id) { + + NULSTR_FOREACH_PAIR(j, k, cpuid_vendor_table) + if (streq(sig.text, j)) { +- +- if (id) +- *id = k; +- +- return 1; ++ _id = k; ++ r = 1; ++ goto finish; + } + } + + for (i = 0; i < ELEMENTSOF(dmi_vendors); i++) { + _cleanup_free_ char *s = NULL; +- const char *found = NULL; + + r = read_one_line_file(dmi_vendors[i], &s); + if (r < 0) { +@@ -146,22 +154,17 @@ int detect_vm(const char **id) { + } + + NULSTR_FOREACH_PAIR(j, k, dmi_vendor_table) +- if (startswith(s, j)) +- found = k; +- +- if (found) { +- if (id) +- *id = found; +- +- return 1; +- } ++ if (startswith(s, j)) { ++ _id = k; ++ r = 1; ++ goto finish; ++ } + } + + if (hypervisor || hvtype) { +- if (id) +- *id = "other"; +- +- return 1; ++ _id = "other"; ++ r = 1; ++ goto finish; + } + + #endif +@@ -171,17 +174,40 @@ int detect_vm(const char **id) { + if (r < 0) + return r; + if (strstr(cpuinfo_contents, "\nvendor_id\t: User Mode Linux\n")) { +- *id = "uml"; +- return 1; ++ _id = "uml"; ++ r = 1; ++ goto finish; + } + +- return 0; ++ r = 0; ++ ++finish: ++ cached_found = r; ++ ++ cached_id = _id; ++ if (id) ++ *id = _id; ++ ++ return r; + } + + int detect_container(const char **id) { ++ ++ static __thread int cached_found = -1; ++ static __thread const char *cached_id = NULL; ++ + _cleanup_free_ char *e = NULL; ++ const char *_id = NULL; + int r; + ++ if (_likely_(cached_found >= 0)) { ++ ++ if (id) ++ *id = cached_id; ++ ++ return cached_found; ++ } ++ + /* Unfortunately many of these operations require root access + * in one way or another */ + +@@ -189,95 +215,61 @@ int detect_container(const char **id) { + if (r < 0) + return r; + if (r > 0) { +- +- if (id) +- *id = "chroot"; +- +- return 1; ++ _id = "chroot"; ++ goto finish; + } + + /* /proc/vz exists in container and outside of the container, + * /proc/bc only outside of the container. */ + if (access("/proc/vz", F_OK) >= 0 && + access("/proc/bc", F_OK) < 0) { +- +- if (id) +- *id = "openvz"; +- +- return 1; ++ _id = "openvz"; ++ r = 1; ++ goto finish; + } + + r = getenv_for_pid(1, "container", &e); +- if (r <= 0) ++ if (r < 0) + return r; ++ if (r == 0) ++ goto finish; + + /* We only recognize a selected few here, since we want to + * enforce a redacted namespace */ +- if (streq(e, "lxc")) { +- if (id) +- *id = "lxc"; +- } else if (streq(e, "lxc-libvirt")) { +- if (id) +- *id = "lxc-libvirt"; +- } else if (streq(e, "systemd-nspawn")) { +- if (id) +- *id = "systemd-nspawn"; +- } else { +- if (id) +- *id = "other"; +- } ++ if (streq(e, "lxc")) ++ _id ="lxc"; ++ else if (streq(e, "lxc-libvirt")) ++ _id = "lxc-libvirt"; ++ else if (streq(e, "systemd-nspawn")) ++ _id = "systemd-nspawn"; ++ else ++ _id = "other"; ++ ++finish: ++ cached_found = r; ++ ++ cached_id = _id; ++ if (id) ++ *id = _id; + + return r; + } + + /* Returns a short identifier for the various VM/container implementations */ + Virtualization detect_virtualization(const char **id) { +- +- static __thread Virtualization cached_virt = _VIRTUALIZATION_INVALID; +- static __thread const char *cached_id = NULL; +- +- const char *_id; + int r; +- Virtualization v; +- +- if (_likely_(cached_virt >= 0)) { +- +- if (id && cached_virt > 0) +- *id = cached_id; + +- return cached_virt; +- } +- +- r = detect_container(&_id); +- if (r < 0) { +- v = r; +- goto finish; +- } else if (r > 0) { +- v = VIRTUALIZATION_CONTAINER; +- goto finish; +- } +- +- r = detect_vm(&_id); +- if (r < 0) { +- v = r; +- goto finish; +- } else if (r > 0) { +- v = VIRTUALIZATION_VM; +- goto finish; +- } +- +- v = VIRTUALIZATION_NONE; +- +-finish: +- if (v > 0) { +- cached_id = _id; +- +- if (id) +- *id = _id; +- } ++ r = detect_container(id); ++ if (r < 0) ++ return r; ++ if (r > 0) ++ return VIRTUALIZATION_CONTAINER; + +- if (v >= 0) +- cached_virt = v; ++ r = detect_vm(id); ++ if (r < 0) ++ return r; ++ if (r > 0) ++ return VIRTUALIZATION_VM; + +- return v; ++ return VIRTUALIZATION_NONE; + } diff --git a/0062-systemctl-fix-typo-in-help-text.patch b/0062-systemctl-fix-typo-in-help-text.patch new file mode 100644 index 0000000..3ce5b45 --- /dev/null +++ b/0062-systemctl-fix-typo-in-help-text.patch @@ -0,0 +1,22 @@ +From 93a311b380a9c7367efe46fbc1d45902a9abcff5 Mon Sep 17 00:00:00 2001 +From: Thomas Hindoe Paaboel Andersen +Date: Fri, 1 Nov 2013 20:46:49 +0100 +Subject: [PATCH] systemctl: fix typo in help text + +--- + src/systemctl/systemctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c +index 036828b..36040db 100644 +--- a/src/systemctl/systemctl.c ++++ b/src/systemctl/systemctl.c +@@ -4743,7 +4743,7 @@ static int systemctl_help(void) { + " -f --force When enabling unit files, override existing symlinks\n" + " When shutting down, execute action immediately\n" + " --root=PATH Enable unit files in the specified root directory\n" +- " -n --lines=INTEGER Numer of journal entries to show\n" ++ " -n --lines=INTEGER Number of journal entries to show\n" + " -o --output=STRING Change journal output mode (short, short-monotonic,\n" + " verbose, export, json, json-pretty, json-sse, cat)\n\n" + "Unit Commands:\n" diff --git a/0063-analyze-plot-place-the-text-on-the-side-with-most-sp.patch b/0063-analyze-plot-place-the-text-on-the-side-with-most-sp.patch new file mode 100644 index 0000000..1786814 --- /dev/null +++ b/0063-analyze-plot-place-the-text-on-the-side-with-most-sp.patch @@ -0,0 +1,91 @@ +From 319b9f00eb3d84744453ae70bf9c89c37131124b Mon Sep 17 00:00:00 2001 +From: Thomas Hindoe Paaboel Andersen +Date: Fri, 1 Nov 2013 22:57:47 +0100 +Subject: [PATCH] analyze: plot: place the text on the side with most space + +Set the width of the svg to always fit the longest string +while taking its starting position into consideration. + +Place the text on the right while the starting point is +in the first half of the screen. After that we put it on +the left to save the svg from being wider that it has to. +--- + src/analyze/systemd-analyze.c | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c +index 9a69795..f4c7f68 100644 +--- a/src/analyze/systemd-analyze.c ++++ b/src/analyze/systemd-analyze.c +@@ -462,7 +462,7 @@ static int analyze_plot(DBusConnection *bus) { + m++; + + for (u = times; u < times + n; u++) { +- double len; ++ double text_start, text_width; + + if (u->ixt < boot->userspace_time || + u->ixt > boot->finish_time) { +@@ -470,10 +470,14 @@ static int analyze_plot(DBusConnection *bus) { + u->name = NULL; + continue; + } +- len = ((boot->firmware_time + u->ixt) * SCALE_X) +- + (10.0 * strlen(u->name)); +- if (len > width) +- width = len; ++ ++ /* If the text cannot fit on the left side then ++ * increase the svg width so it fits on the right. ++ * TODO: calculate the text width more accurately */ ++ text_width = 8.0 * strlen(u->name); ++ text_start = (boot->firmware_time + u->ixt) * SCALE_X; ++ if (text_width > text_start && text_width + text_start > width) ++ width = text_width + text_start; + + if (u->iet > u->ixt && u->iet <= boot->finish_time + && u->aet == 0 && u->axt == 0) +@@ -561,7 +565,7 @@ static int analyze_plot(DBusConnection *bus) { + svg_bar("active", boot->userspace_time, boot->finish_time, y); + svg_bar("generators", boot->generators_start_time, boot->generators_finish_time, y); + svg_bar("unitsload", boot->unitsload_start_time, boot->unitsload_finish_time, y); +- svg_text("left", boot->userspace_time, y, "systemd"); ++ svg_text(true, boot->userspace_time, y, "systemd"); + y++; + + for (u = times; u < times + n; u++) { +@@ -575,7 +579,8 @@ static int analyze_plot(DBusConnection *bus) { + svg_bar("active", u->aet, u->axt, y); + svg_bar("deactivating", u->axt, u->iet, y); + +- b = u->ixt * SCALE_X > width * 2 / 3; ++ /* place the text on the left if we have passed the half of the svg width */ ++ b = u->ixt * SCALE_X < width / 2; + if (u->time) + svg_text(b, u->ixt, y, "%s (%s)", + u->name, format_timespan(ts, sizeof(ts), u->time, USEC_PER_MSEC)); +@@ -587,19 +592,19 @@ static int analyze_plot(DBusConnection *bus) { + /* Legend */ + y++; + svg_bar("activating", 0, 300000, y); +- svg_text("right", 400000, y, "Activating"); ++ svg_text(true, 400000, y, "Activating"); + y++; + svg_bar("active", 0, 300000, y); +- svg_text("right", 400000, y, "Active"); ++ svg_text(true, 400000, y, "Active"); + y++; + svg_bar("deactivating", 0, 300000, y); +- svg_text("right", 400000, y, "Deactivating"); ++ svg_text(true, 400000, y, "Deactivating"); + y++; + svg_bar("generators", 0, 300000, y); +- svg_text("right", 400000, y, "Generators"); ++ svg_text(true, 400000, y, "Generators"); + y++; + svg_bar("unitsload", 0, 300000, y); +- svg_text("right", 400000, y, "Loading unit files"); ++ svg_text(true, 400000, y, "Loading unit files"); + y++; + + svg("\n\n"); diff --git a/0064-detect_virtualization-returns-NULL-pass-empty-string.patch b/0064-detect_virtualization-returns-NULL-pass-empty-string.patch new file mode 100644 index 0000000..02a7316 --- /dev/null +++ b/0064-detect_virtualization-returns-NULL-pass-empty-string.patch @@ -0,0 +1,32 @@ +From 855359a615a6002ac601a778f12e60970f18c64f Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Sat, 2 Nov 2013 00:01:32 +0100 +Subject: [PATCH] detect_virtualization() returns NULL; pass empty string to + dbus + +--- + src/core/dbus-manager.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c +index 8f4d017..536f2ea 100644 +--- a/src/core/dbus-manager.c ++++ b/src/core/dbus-manager.c +@@ -466,7 +466,7 @@ static int bus_manager_append_progress(DBusMessageIter *i, const char *property, + + static int bus_manager_append_virt(DBusMessageIter *i, const char *property, void *data) { + Manager *m = data; +- const char *id = ""; ++ const char *id = NULL; + + assert(i); + assert(property); +@@ -474,6 +474,8 @@ static int bus_manager_append_virt(DBusMessageIter *i, const char *property, voi + + detect_virtualization(&id); + ++ if (!id) ++ id = ""; + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &id)) + return -ENOMEM; + diff --git a/0065-rules-load-path_id-on-DRM-devices.patch b/0065-rules-load-path_id-on-DRM-devices.patch new file mode 100644 index 0000000..620f14a --- /dev/null +++ b/0065-rules-load-path_id-on-DRM-devices.patch @@ -0,0 +1,44 @@ +From 0af3aeb44697533df2bc79d0985b65bca6b8cd86 Mon Sep 17 00:00:00 2001 +From: David Herrmann +Date: Sun, 3 Nov 2013 13:01:20 +0100 +Subject: [PATCH] rules: load path_id on DRM devices + +The path_id-builtin provides useful unique aliases for DRM devices. If we +want to configure DRM render-nodes for compositors, we want to avoid +storing the whole sys-path in configuration files. Hence, allow users to +store the short PATH_ID instead. + +Load path_id-builtin unconditionally on DRM devices now to always provide +this alias. +--- + Makefile.am | 1 + + rules/60-drm.rules | 8 ++++++++ + 2 files changed, 9 insertions(+) + create mode 100644 rules/60-drm.rules + +diff --git a/Makefile.am b/Makefile.am +index 7ab345a..34de7f2 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -2209,6 +2209,7 @@ dist_udevrules_DATA += \ + rules/99-systemd.rules \ + rules/42-usb-hid-pm.rules \ + rules/50-udev-default.rules \ ++ rules/60-drm.rules \ + rules/60-keyboard.rules \ + rules/60-persistent-storage-tape.rules \ + rules/60-persistent-serial.rules \ +diff --git a/rules/60-drm.rules b/rules/60-drm.rules +new file mode 100644 +index 0000000..de038c1 +--- /dev/null ++++ b/rules/60-drm.rules +@@ -0,0 +1,8 @@ ++# do not edit this file, it will be overwritten on update ++ ++ACTION=="remove", GOTO="drm_end" ++SUBSYSTEM!="drm", GOTO="drm_end" ++ ++SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id" ++ ++LABEL="drm_end" diff --git a/0066-rules-simply-60-drm.rules.patch b/0066-rules-simply-60-drm.rules.patch new file mode 100644 index 0000000..b19766b --- /dev/null +++ b/0066-rules-simply-60-drm.rules.patch @@ -0,0 +1,24 @@ +From 5700379e437756e1e7a2508b238c8220367292bc Mon Sep 17 00:00:00 2001 +From: David Herrmann +Date: Sun, 3 Nov 2013 16:17:14 +0100 +Subject: [PATCH] rules: simply 60-drm.rules + +We don't need any GOTO, if we merge all matches into a single line. +--- + rules/60-drm.rules | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/rules/60-drm.rules b/rules/60-drm.rules +index de038c1..1ed3e44 100644 +--- a/rules/60-drm.rules ++++ b/rules/60-drm.rules +@@ -1,8 +1,3 @@ + # do not edit this file, it will be overwritten on update + +-ACTION=="remove", GOTO="drm_end" +-SUBSYSTEM!="drm", GOTO="drm_end" +- +-SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id" +- +-LABEL="drm_end" ++ACTION!="remove", SUBSYSTEM=="drm", SUBSYSTEMS=="pci|usb|platform", IMPORT{builtin}="path_id" diff --git a/0067-udev-builtin-keyboard-Fix-large-scan-codes-on-32-bit.patch b/0067-udev-builtin-keyboard-Fix-large-scan-codes-on-32-bit.patch new file mode 100644 index 0000000..889ab51 --- /dev/null +++ b/0067-udev-builtin-keyboard-Fix-large-scan-codes-on-32-bit.patch @@ -0,0 +1,31 @@ +From 4f0d2ef232fe578576a2bec5076fda19de15ff27 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Mon, 4 Nov 2013 07:25:45 +0100 +Subject: [PATCH] udev-builtin-keyboard: Fix large scan codes on 32 bit + architectures + +Use strtoul(), as scan codes are always positive. On 32 bit architectures +strtol gives wrong results: + + strtol("fffffff0", &endptr, 16) + +returns 2147483647 instead of 4294967280. + +https://launchpad.net/bugs/1247676 +--- + src/udev/udev-builtin-keyboard.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c +index ddd8535..8f457ab 100644 +--- a/src/udev/udev-builtin-keyboard.c ++++ b/src/udev/udev-builtin-keyboard.c +@@ -88,7 +88,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo + continue; + + /* KEYBOARD_KEY_= */ +- scancode = strtol(key + 13, &endptr, 16); ++ scancode = strtoul(key + 13, &endptr, 16); + if (endptr[0] != '\0') { + log_error("Error, unable to parse scan code from '%s'\n", key); + continue; diff --git a/0068-nspawn-log-out-of-memory-errors.patch b/0068-nspawn-log-out-of-memory-errors.patch new file mode 100644 index 0000000..bef1d8b --- /dev/null +++ b/0068-nspawn-log-out-of-memory-errors.patch @@ -0,0 +1,37 @@ +From 30304d0fd69e703992c62ab3bcabcc6239f5fe1c Mon Sep 17 00:00:00 2001 +From: Djalal Harouni +Date: Tue, 5 Nov 2013 15:26:37 +0100 +Subject: [PATCH] nspawn: log out of memory errors + +--- + src/nspawn/nspawn.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 9616dbf..db47fbd 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -224,6 +224,9 @@ static int parse_argv(int argc, char *argv[]) { + + case 'S': + arg_slice = strdup(optarg); ++ if (!arg_slice) ++ return log_oom(); ++ + break; + + case 'M': +@@ -315,11 +318,11 @@ static int parse_argv(int argc, char *argv[]) { + + r = strv_extend(x, a); + if (r < 0) +- return r; ++ return log_oom(); + + r = strv_extend(x, b); + if (r < 0) +- return r; ++ return log_oom(); + + break; + } diff --git a/0069-Configurable-Timeouts-Restarts-default-values.patch b/0069-Configurable-Timeouts-Restarts-default-values.patch new file mode 100644 index 0000000..1711fd3 --- /dev/null +++ b/0069-Configurable-Timeouts-Restarts-default-values.patch @@ -0,0 +1,293 @@ +From f9d232e896bec3301a20a33a38a87b102f0172bc Mon Sep 17 00:00:00 2001 +From: Oleksii Shevchuk +Date: Mon, 4 Nov 2013 18:47:43 +0200 +Subject: [PATCH] Configurable Timeouts/Restarts default values + +https://bugs.freedesktop.org/show_bug.cgi?id=71132 + +Patch adds DefaultTimeoutStartSec, DefaultTimeoutStopSec, DefaultRestartSec +configuration options to manager configuration file. +--- + man/systemd-system.conf.xml | 24 +++++++++++++++++++++++- + man/systemd.mount.xml | 4 ++-- + man/systemd.service.xml | 6 ++++-- + man/systemd.socket.xml | 4 ++-- + man/systemd.swap.xml | 4 ++-- + src/core/device.c | 2 +- + src/core/main.c | 9 +++++++++ + src/core/manager.h | 3 +++ + src/core/mount.c | 2 +- + src/core/scope.c | 2 +- + src/core/service.c | 6 +++--- + src/core/socket.c | 2 +- + src/core/swap.c | 2 +- + src/core/system.conf | 3 +++ + src/core/user.conf | 3 +++ + 15 files changed, 59 insertions(+), 17 deletions(-) + +diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml +index e8cf8a9..c1f2648 100644 +--- a/man/systemd-system.conf.xml ++++ b/man/systemd-system.conf.xml +@@ -61,7 +61,6 @@ + otherwise user.conf. These + configuration files contain a few settings controlling + basic manager operations. +- + + + +@@ -95,6 +94,29 @@ + + + ++ DefaultTimeoutStartSec= ++ DefaultTimeoutStopSec= ++ DefaultRestartSec= ++ ++ Configures the default ++ time-outs for starting and stopping of ++ units, as well as the default time to ++ sleep between automatic restarts of a ++ units, as configured per-unit in ++ TimeoutStartSec=, ++ TimeoutStopSec= and ++ RestartSec= (for ++ service units see ++ systemd.service5 ++ for details on the per-unit ++ settings). For non-service units ++ DefaultTimeoutStartSec= ++ sets the default ++ TimeoutSec= value. ++ ++ ++ ++ + CPUAffinity= + + Configures the initial +diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml +index 48af1ca..71a5736 100644 +--- a/man/systemd.mount.xml ++++ b/man/systemd.mount.xml +@@ -260,8 +260,8 @@ + Takes a unit-less value in seconds, or + a time span value such as "5min + 20s". Pass 0 to disable the timeout +- logic. Defaults to +- 90s. ++ logic. Default value is setted up in manager configuration ++ file via DefaultTimeoutStart=. + + + +diff --git a/man/systemd.service.xml b/man/systemd.service.xml +index 5e1ddf7..df04048 100644 +--- a/man/systemd.service.xml ++++ b/man/systemd.service.xml +@@ -524,7 +524,8 @@ + Takes a unit-less value in seconds, or a + time span value such as "5min + 20s". Pass 0 to disable the timeout +- logic. Defaults to 90s, except when ++ logic. Defaults to TimeoutStartSec= in ++ manager configuration file, except when + Type=oneshot is + used in which case the timeout + is disabled by default. +@@ -545,7 +546,8 @@ + Takes a unit-less value in seconds, or a + time span value such as "5min + 20s". Pass 0 to disable the timeout +- logic. Defaults to 90s. ++ logic. Defaults to TimeoutStartSec= in ++ manager configuration file. + + + +diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml +index 8c88d9f..1c78562 100644 +--- a/man/systemd.socket.xml ++++ b/man/systemd.socket.xml +@@ -679,8 +679,8 @@ + Takes a unit-less value in seconds, or + a time span value such as "5min + 20s". Pass 0 to disable the timeout +- logic. Defaults to +- 90s. ++ logic. Defaults to TimeoutStartSec= in ++ manager configuration file. + + + +diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml +index 813ae6c..13f6c84 100644 +--- a/man/systemd.swap.xml ++++ b/man/systemd.swap.xml +@@ -186,8 +186,8 @@ + Takes a unit-less value in seconds, or + a time span value such as "5min + 20s". Pass 0 to disable the timeout +- logic. Defaults to +- 90s. ++ logic. Defaults to TimeoutStartSec= in ++ manager configuration file. + + + +diff --git a/src/core/device.c b/src/core/device.c +index 9fca82a..5397bd6 100644 +--- a/src/core/device.c ++++ b/src/core/device.c +@@ -70,7 +70,7 @@ static void device_init(Unit *u) { + * indefinitely for plugged in devices, something which cannot + * happen for the other units since their operations time out + * anyway. */ +- UNIT(d)->job_timeout = DEFAULT_TIMEOUT_USEC; ++ UNIT(d)->job_timeout = u->manager->default_timeout_start_usec; + + UNIT(d)->ignore_on_isolate = true; + UNIT(d)->ignore_on_snapshot = true; +diff --git a/src/core/main.c b/src/core/main.c +index fe291f8..937994c 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -90,6 +90,9 @@ static bool arg_switched_root = false; + static char ***arg_join_controllers = NULL; + static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL; + static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT; ++static usec_t arg_default_restart_usec = DEFAULT_RESTART_USEC; ++static usec_t arg_default_timeout_start_usec = DEFAULT_TIMEOUT_USEC; ++static usec_t arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC; + static usec_t arg_runtime_watchdog = 0; + static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE; + static char **arg_default_environment = NULL; +@@ -636,6 +639,9 @@ static int parse_config_file(void) { + { "Manager", "CPUAffinity", config_parse_cpu_affinity2, 0, NULL }, + { "Manager", "DefaultStandardOutput", config_parse_output, 0, &arg_default_std_output }, + { "Manager", "DefaultStandardError", config_parse_output, 0, &arg_default_std_error }, ++ { "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec }, ++ { "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec }, ++ { "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec }, + { "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers }, + { "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog }, + { "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog }, +@@ -1542,6 +1548,9 @@ int main(int argc, char *argv[]) { + m->confirm_spawn = arg_confirm_spawn; + m->default_std_output = arg_default_std_output; + m->default_std_error = arg_default_std_error; ++ m->default_restart_usec = arg_default_restart_usec; ++ m->default_timeout_start_usec = arg_default_timeout_start_usec; ++ m->default_timeout_stop_usec = arg_default_timeout_stop_usec; + m->runtime_watchdog = arg_runtime_watchdog; + m->shutdown_watchdog = arg_shutdown_watchdog; + m->userspace_timestamp = userspace_timestamp; +diff --git a/src/core/manager.h b/src/core/manager.h +index a3049b5..e74c609 100644 +--- a/src/core/manager.h ++++ b/src/core/manager.h +@@ -230,6 +230,9 @@ struct Manager { + + ExecOutput default_std_output, default_std_error; + ++ usec_t default_restart_usec, default_timeout_start_usec, ++ default_timeout_stop_usec; ++ + struct rlimit *rlimit[RLIMIT_NLIMITS]; + + /* non-zero if we are reloading or reexecuting, */ +diff --git a/src/core/mount.c b/src/core/mount.c +index 70cd372..c0445a6 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -131,7 +131,7 @@ static void mount_init(Unit *u) { + assert(u); + assert(u->load_state == UNIT_STUB); + +- m->timeout_usec = DEFAULT_TIMEOUT_USEC; ++ m->timeout_usec = u->manager->default_timeout_start_usec; + m->directory_mode = 0755; + + exec_context_init(&m->exec_context); +diff --git a/src/core/scope.c b/src/core/scope.c +index 50e5dba..41da3b9 100644 +--- a/src/core/scope.c ++++ b/src/core/scope.c +@@ -46,7 +46,7 @@ static void scope_init(Unit *u) { + assert(u); + assert(u->load_state == UNIT_STUB); + +- s->timeout_stop_usec = DEFAULT_TIMEOUT_USEC; ++ s->timeout_stop_usec = u->manager->default_timeout_stop_usec; + + watch_init(&s->timer_watch); + +diff --git a/src/core/service.c b/src/core/service.c +index 96ed2d3..e81aa1f 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -124,9 +124,9 @@ static void service_init(Unit *u) { + assert(u); + assert(u->load_state == UNIT_STUB); + +- s->timeout_start_usec = DEFAULT_TIMEOUT_USEC; +- s->timeout_stop_usec = DEFAULT_TIMEOUT_USEC; +- s->restart_usec = DEFAULT_RESTART_USEC; ++ s->timeout_start_usec = u->manager->default_timeout_start_usec; ++ s->timeout_stop_usec = u->manager->default_timeout_stop_usec; ++ s->restart_usec = u->manager->default_restart_usec; + s->type = _SERVICE_TYPE_INVALID; + + watch_init(&s->watchdog_watch); +diff --git a/src/core/socket.c b/src/core/socket.c +index 6c0ac1a..d368f7e 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -73,7 +73,7 @@ static void socket_init(Unit *u) { + assert(u->load_state == UNIT_STUB); + + s->backlog = SOMAXCONN; +- s->timeout_usec = DEFAULT_TIMEOUT_USEC; ++ s->timeout_usec = u->manager->default_timeout_start_usec; + s->directory_mode = 0755; + s->socket_mode = 0666; + +diff --git a/src/core/swap.c b/src/core/swap.c +index a68ab7c..147f710 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -86,7 +86,7 @@ static void swap_init(Unit *u) { + assert(s); + assert(UNIT(s)->load_state == UNIT_STUB); + +- s->timeout_usec = DEFAULT_TIMEOUT_USEC; ++ s->timeout_usec = u->manager->default_timeout_start_usec; + + exec_context_init(&s->exec_context); + s->exec_context.std_output = u->manager->default_std_output; +diff --git a/src/core/system.conf b/src/core/system.conf +index 7b03c87..3c6cc03 100644 +--- a/src/core/system.conf ++++ b/src/core/system.conf +@@ -24,6 +24,9 @@ + #ShutdownWatchdogSec=10min + #CapabilityBoundingSet= + #TimerSlackNSec= ++#DefaultTimeoutStartSec=90s ++#DefaultTimeoutStopSec=90s ++#DefaultRestartSec=100ms + #DefaultEnvironment= + #DefaultLimitCPU= + #DefaultLimitFSIZE= +diff --git a/src/core/user.conf b/src/core/user.conf +index 4a0129a..b030701 100644 +--- a/src/core/user.conf ++++ b/src/core/user.conf +@@ -14,3 +14,6 @@ + #LogLocation=no + #DefaultStandardOutput=inherit + #DefaultStandardError=inherit ++#DefaultTimeoutStartSec=90s ++#DefaultTimeoutStopSec=90s ++#DefaultRestartSec=100ms diff --git a/0070-man-fix-typo.patch b/0070-man-fix-typo.patch new file mode 100644 index 0000000..8c3a68c --- /dev/null +++ b/0070-man-fix-typo.patch @@ -0,0 +1,22 @@ +From 6f0949daa0b7f4928a7abb8e26ded604988f8efc Mon Sep 17 00:00:00 2001 +From: Ronny Chevalier +Date: Sun, 3 Nov 2013 15:07:31 +0100 +Subject: [PATCH] man: fix typo + +--- + man/systemd-run.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/systemd-run.xml b/man/systemd-run.xml +index e76a402..252335b 100644 +--- a/man/systemd-run.xml ++++ b/man/systemd-run.xml +@@ -60,7 +60,7 @@ along with systemd; If not, see . + + Description + +- systemd-run may be used create and start ++ systemd-run may be used to create and start + a transient .service or a + .scope unit and run the specified + COMMAND in it. diff --git a/0071-man-do-not-use-term-in-para.patch b/0071-man-do-not-use-term-in-para.patch new file mode 100644 index 0000000..cbea9ce --- /dev/null +++ b/0071-man-do-not-use-term-in-para.patch @@ -0,0 +1,23 @@ +From 6547d848002537063bf0d5457e56ebd15ed947b0 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Tue, 5 Nov 2013 21:34:50 +0100 +Subject: [PATCH] man: do not use in + +Element term in namespace '' encountered in para, but no template matches. +--- + man/systemd.mount.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml +index 71a5736..df5a79e 100644 +--- a/man/systemd.mount.xml ++++ b/man/systemd.mount.xml +@@ -261,7 +261,7 @@ + a time span value such as "5min + 20s". Pass 0 to disable the timeout + logic. Default value is setted up in manager configuration +- file via DefaultTimeoutStart=. ++ file via DefaultTimeoutStart=. + + + diff --git a/0072-cgroup-run-PID-1-in-the-root-cgroup.patch b/0072-cgroup-run-PID-1-in-the-root-cgroup.patch new file mode 100644 index 0000000..b2d7b57 --- /dev/null +++ b/0072-cgroup-run-PID-1-in-the-root-cgroup.patch @@ -0,0 +1,61 @@ +From 298f884a265c1c4b30cce7467650cc4a165a284e Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 5 Nov 2013 22:14:52 +0100 +Subject: [PATCH] cgroup: run PID 1 in the root cgroup + +This way cleaning up the cgroup tree on shutdown is a lot easier since +we are in the root dir. Also PID 1 was previously artificially placed in +system.slice, even though our rule actually was not to have processes in +slices. The root slice otoh is magic anyway, so having PID 1 in there +sounds less surprising. + +Of course, this means that PID is scheduled against the three top-level +slices. +--- + src/core/cgroup.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 8bf4d89..42c0b3f 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -589,8 +589,8 @@ pid_t unit_search_main_pid(Unit *u) { + + int manager_setup_cgroup(Manager *m) { + _cleanup_free_ char *path = NULL; ++ char *e; + int r; +- char *e, *a; + + assert(m); + +@@ -610,9 +610,13 @@ int manager_setup_cgroup(Manager *m) { + return r; + } + +- /* Already in /system.slice? If so, let's cut this off again */ ++ /* LEGACY: Already in /system.slice? If so, let's cut this ++ * off. This is to support live upgrades from older systemd ++ * versions where PID 1 was moved there. */ + if (m->running_as == SYSTEMD_SYSTEM) { + e = endswith(m->cgroup_root, "/" SPECIAL_SYSTEM_SLICE); ++ if (!e) ++ e = endswith(m->cgroup_root, "/system"); + if (e) + *e = 0; + } +@@ -643,12 +647,8 @@ int manager_setup_cgroup(Manager *m) { + log_debug("Release agent already installed."); + } + +- /* 4. Realize the system slice and put us in there */ +- if (m->running_as == SYSTEMD_SYSTEM) { +- a = strappenda(m->cgroup_root, "/" SPECIAL_SYSTEM_SLICE); +- r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, a, 0); +- } else +- r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0); ++ /* 4. Make sure we are in the root cgroup */ ++ r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, 0); + if (r < 0) { + log_error("Failed to create root cgroup hierarchy: %s", strerror(-r)); + return r; diff --git a/0073-shutdown-trim-the-cgroup-tree-on-loop-iteration.patch b/0073-shutdown-trim-the-cgroup-tree-on-loop-iteration.patch new file mode 100644 index 0000000..88edf87 --- /dev/null +++ b/0073-shutdown-trim-the-cgroup-tree-on-loop-iteration.patch @@ -0,0 +1,65 @@ +From db296e9f3e78b9694464dbde956d04f6621125ed Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 5 Nov 2013 22:17:03 +0100 +Subject: [PATCH] shutdown: trim the cgroup tree on loop iteration + +This way we leave the cgroup empty before exiting in a container which +makes sure the container manager will get cgroup notification event + +https://bugs.freedesktop.org/show_bug.cgi?id=68370 +https://bugzilla.redhat.com/show_bug.cgi?id=988883 +--- + src/core/shutdown.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/core/shutdown.c b/src/core/shutdown.c +index 4709746..ea02b60 100644 +--- a/src/core/shutdown.c ++++ b/src/core/shutdown.c +@@ -46,6 +46,7 @@ + #include "virt.h" + #include "watchdog.h" + #include "killall.h" ++#include "cgroup-util.h" + + #define FINALIZE_ATTEMPTS 50 + +@@ -131,12 +132,12 @@ static int pivot_to_new_root(void) { + } + + int main(int argc, char *argv[]) { +- _cleanup_free_ char *line = NULL; +- int cmd, r; +- unsigned retries; + bool need_umount = true, need_swapoff = true, need_loop_detach = true, need_dm_detach = true; + bool in_container, use_watchdog = false; ++ _cleanup_free_ char *line = NULL, *cgroup = NULL; + char *arguments[3]; ++ unsigned retries; ++ int cmd, r; + + /* suppress shutdown status output if 'quiet' is used */ + r = read_one_line_file("/proc/cmdline", &line); +@@ -186,6 +187,8 @@ int main(int argc, char *argv[]) { + goto error; + } + ++ cg_get_root_path(&cgroup); ++ + use_watchdog = !!getenv("WATCHDOG_USEC"); + + /* lock us into memory */ +@@ -210,6 +213,13 @@ int main(int argc, char *argv[]) { + if (use_watchdog) + watchdog_ping(); + ++ /* Let's trim the cgroup tree on each iteration so ++ that we leave an empty cgroup tree around, so that ++ container managers get a nice notify event when we ++ are down */ ++ if (cgroup) ++ cg_trim(SYSTEMD_CGROUP_CONTROLLER, cgroup, false); ++ + if (need_umount) { + log_info("Unmounting file systems."); + r = umount_all(&changed); diff --git a/0074-nspawn-split-out-pty-forwaring-logic-into-ptyfwd.c.patch b/0074-nspawn-split-out-pty-forwaring-logic-into-ptyfwd.c.patch new file mode 100644 index 0000000..f1571da --- /dev/null +++ b/0074-nspawn-split-out-pty-forwaring-logic-into-ptyfwd.c.patch @@ -0,0 +1,593 @@ +From f1b1f3bab4764964d12a62aba1cdbd71ec6415ae Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 30 Oct 2013 18:58:59 +0100 +Subject: [PATCH] nspawn: split out pty forwaring logic into ptyfwd.c + +Conflicts: + Makefile.am + src/nspawn/nspawn.c +--- + Makefile.am | 4 +- + src/nspawn/nspawn.c | 245 +------------------------------------------------- + src/shared/ptyfwd.c | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/shared/ptyfwd.h | 27 ++++++ + 4 files changed, 284 insertions(+), 244 deletions(-) + create mode 100644 src/shared/ptyfwd.c + create mode 100644 src/shared/ptyfwd.h + +diff --git a/Makefile.am b/Makefile.am +index 34de7f2..b4fc33b 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -724,7 +724,9 @@ libsystemd_shared_la_SOURCES = \ + src/shared/boot-timestamps.c \ + src/shared/refcnt.h \ + src/shared/mkdir.c \ +- src/shared/mkdir.h ++ src/shared/mkdir.h \ ++ src/shared/ptyfwd.c \ ++ src/shared/ptyfwd.h + + #------------------------------------------------------------------------------- + noinst_LTLIBRARIES += \ +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index db47fbd..cda6c82 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -63,6 +63,7 @@ + #include "fileio.h" + #include "bus-internal.h" + #include "bus-message.h" ++#include "ptyfwd.h" + + #ifndef TTY_GID + #define TTY_GID 5 +@@ -937,248 +938,6 @@ static int drop_capabilities(void) { + return capability_bounding_set_drop(~arg_retain, false); + } + +-static int process_pty(int master, pid_t pid, sigset_t *mask) { +- +- char in_buffer[LINE_MAX], out_buffer[LINE_MAX]; +- size_t in_buffer_full = 0, out_buffer_full = 0; +- struct epoll_event stdin_ev, stdout_ev, master_ev, signal_ev; +- bool stdin_readable = false, stdout_writable = false, master_readable = false, master_writable = false; +- int ep = -1, signal_fd = -1, r; +- bool tried_orderly_shutdown = false; +- +- assert(master >= 0); +- assert(pid > 0); +- assert(mask); +- +- fd_nonblock(STDIN_FILENO, 1); +- fd_nonblock(STDOUT_FILENO, 1); +- fd_nonblock(master, 1); +- +- signal_fd = signalfd(-1, mask, SFD_NONBLOCK|SFD_CLOEXEC); +- if (signal_fd < 0) { +- log_error("signalfd(): %m"); +- r = -errno; +- goto finish; +- } +- +- ep = epoll_create1(EPOLL_CLOEXEC); +- if (ep < 0) { +- log_error("Failed to create epoll: %m"); +- r = -errno; +- goto finish; +- } +- +- /* We read from STDIN only if this is actually a TTY, +- * otherwise we assume non-interactivity. */ +- if (isatty(STDIN_FILENO)) { +- zero(stdin_ev); +- stdin_ev.events = EPOLLIN|EPOLLET; +- stdin_ev.data.fd = STDIN_FILENO; +- +- if (epoll_ctl(ep, EPOLL_CTL_ADD, STDIN_FILENO, &stdin_ev) < 0) { +- log_error("Failed to register STDIN in epoll: %m"); +- r = -errno; +- goto finish; +- } +- } +- +- zero(stdout_ev); +- stdout_ev.events = EPOLLOUT|EPOLLET; +- stdout_ev.data.fd = STDOUT_FILENO; +- +- zero(master_ev); +- master_ev.events = EPOLLIN|EPOLLOUT|EPOLLET; +- master_ev.data.fd = master; +- +- zero(signal_ev); +- signal_ev.events = EPOLLIN; +- signal_ev.data.fd = signal_fd; +- +- if (epoll_ctl(ep, EPOLL_CTL_ADD, STDOUT_FILENO, &stdout_ev) < 0) { +- if (errno != EPERM) { +- log_error("Failed to register stdout in epoll: %m"); +- r = -errno; +- goto finish; +- } +- /* stdout without epoll support. Likely redirected to regular file. */ +- stdout_writable = true; +- } +- +- if (epoll_ctl(ep, EPOLL_CTL_ADD, master, &master_ev) < 0 || +- epoll_ctl(ep, EPOLL_CTL_ADD, signal_fd, &signal_ev) < 0) { +- log_error("Failed to register fds in epoll: %m"); +- r = -errno; +- goto finish; +- } +- +- for (;;) { +- struct epoll_event ev[16]; +- ssize_t k; +- int i, nfds; +- +- nfds = epoll_wait(ep, ev, ELEMENTSOF(ev), -1); +- if (nfds < 0) { +- +- if (errno == EINTR || errno == EAGAIN) +- continue; +- +- log_error("epoll_wait(): %m"); +- r = -errno; +- goto finish; +- } +- +- assert(nfds >= 1); +- +- for (i = 0; i < nfds; i++) { +- if (ev[i].data.fd == STDIN_FILENO) { +- +- if (ev[i].events & (EPOLLIN|EPOLLHUP)) +- stdin_readable = true; +- +- } else if (ev[i].data.fd == STDOUT_FILENO) { +- +- if (ev[i].events & (EPOLLOUT|EPOLLHUP)) +- stdout_writable = true; +- +- } else if (ev[i].data.fd == master) { +- +- if (ev[i].events & (EPOLLIN|EPOLLHUP)) +- master_readable = true; +- +- if (ev[i].events & (EPOLLOUT|EPOLLHUP)) +- master_writable = true; +- +- } else if (ev[i].data.fd == signal_fd) { +- struct signalfd_siginfo sfsi; +- ssize_t n; +- +- n = read(signal_fd, &sfsi, sizeof(sfsi)); +- if (n != sizeof(sfsi)) { +- +- if (n >= 0) { +- log_error("Failed to read from signalfd: invalid block size"); +- r = -EIO; +- goto finish; +- } +- +- if (errno != EINTR && errno != EAGAIN) { +- log_error("Failed to read from signalfd: %m"); +- r = -errno; +- goto finish; +- } +- } else { +- +- if (sfsi.ssi_signo == SIGWINCH) { +- struct winsize ws; +- +- /* The window size changed, let's forward that. */ +- if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) >= 0) +- ioctl(master, TIOCSWINSZ, &ws); +- } else if (sfsi.ssi_signo == SIGTERM && arg_boot && !tried_orderly_shutdown) { +- +- log_info("Trying to halt container. Send SIGTERM again to trigger immediate termination."); +- +- /* This only works for systemd... */ +- tried_orderly_shutdown = true; +- kill(pid, SIGRTMIN+3); +- +- } else { +- r = 0; +- goto finish; +- } +- } +- } +- } +- +- while ((stdin_readable && in_buffer_full <= 0) || +- (master_writable && in_buffer_full > 0) || +- (master_readable && out_buffer_full <= 0) || +- (stdout_writable && out_buffer_full > 0)) { +- +- if (stdin_readable && in_buffer_full < LINE_MAX) { +- +- k = read(STDIN_FILENO, in_buffer + in_buffer_full, LINE_MAX - in_buffer_full); +- if (k < 0) { +- +- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) +- stdin_readable = false; +- else { +- log_error("read(): %m"); +- r = -errno; +- goto finish; +- } +- } else +- in_buffer_full += (size_t) k; +- } +- +- if (master_writable && in_buffer_full > 0) { +- +- k = write(master, in_buffer, in_buffer_full); +- if (k < 0) { +- +- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) +- master_writable = false; +- else { +- log_error("write(): %m"); +- r = -errno; +- goto finish; +- } +- +- } else { +- assert(in_buffer_full >= (size_t) k); +- memmove(in_buffer, in_buffer + k, in_buffer_full - k); +- in_buffer_full -= k; +- } +- } +- +- if (master_readable && out_buffer_full < LINE_MAX) { +- +- k = read(master, out_buffer + out_buffer_full, LINE_MAX - out_buffer_full); +- if (k < 0) { +- +- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) +- master_readable = false; +- else { +- log_error("read(): %m"); +- r = -errno; +- goto finish; +- } +- } else +- out_buffer_full += (size_t) k; +- } +- +- if (stdout_writable && out_buffer_full > 0) { +- +- k = write(STDOUT_FILENO, out_buffer, out_buffer_full); +- if (k < 0) { +- +- if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) +- stdout_writable = false; +- else { +- log_error("write(): %m"); +- r = -errno; +- goto finish; +- } +- +- } else { +- assert(out_buffer_full >= (size_t) k); +- memmove(out_buffer, out_buffer + k, out_buffer_full - k); +- out_buffer_full -= k; +- } +- } +- } +- } +- +-finish: +- if (ep >= 0) +- close_nointr_nofail(ep); +- +- if (signal_fd >= 0) +- close_nointr_nofail(signal_fd); +- +- return r; +-} +- + static int register_machine(void) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_bus_unref_ sd_bus *bus = NULL; +@@ -1683,7 +1442,7 @@ int main(int argc, char *argv[]) { + fdset_free(fds); + fds = NULL; + +- if (process_pty(master, pid, &mask) < 0) ++ if (process_pty(master, &mask, arg_boot ? pid : 0, SIGRTMIN+3) < 0) + goto finish; + + if (saved_attr_valid) +diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c +new file mode 100644 +index 0000000..1e2852b +--- /dev/null ++++ b/src/shared/ptyfwd.c +@@ -0,0 +1,252 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2010-2013 Lennart Poettering ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "util.h" ++#include "ptyfwd.h" ++ ++int process_pty(int master, sigset_t *mask, pid_t kill_pid, int signo) { ++ char in_buffer[LINE_MAX], out_buffer[LINE_MAX]; ++ size_t in_buffer_full = 0, out_buffer_full = 0; ++ struct epoll_event stdin_ev, stdout_ev, master_ev, signal_ev; ++ bool stdin_readable = false, stdout_writable = false, master_readable = false, master_writable = false; ++ bool tried_orderly_shutdown = false; ++ _cleanup_close_ int ep = -1, signal_fd = -1; ++ ++ assert(master >= 0); ++ assert(mask); ++ assert(kill_pid == 0 || kill_pid > 1); ++ assert(signo >= 0 && signo < _NSIG); ++ ++ fd_nonblock(STDIN_FILENO, 1); ++ fd_nonblock(STDOUT_FILENO, 1); ++ fd_nonblock(master, 1); ++ ++ signal_fd = signalfd(-1, mask, SFD_NONBLOCK|SFD_CLOEXEC); ++ if (signal_fd < 0) { ++ log_error("signalfd(): %m"); ++ return -errno; ++ } ++ ++ ep = epoll_create1(EPOLL_CLOEXEC); ++ if (ep < 0) { ++ log_error("Failed to create epoll: %m"); ++ return -errno; ++ } ++ ++ /* We read from STDIN only if this is actually a TTY, ++ * otherwise we assume non-interactivity. */ ++ if (isatty(STDIN_FILENO)) { ++ zero(stdin_ev); ++ stdin_ev.events = EPOLLIN|EPOLLET; ++ stdin_ev.data.fd = STDIN_FILENO; ++ ++ if (epoll_ctl(ep, EPOLL_CTL_ADD, STDIN_FILENO, &stdin_ev) < 0) { ++ log_error("Failed to register STDIN in epoll: %m"); ++ return -errno; ++ } ++ } ++ ++ zero(stdout_ev); ++ stdout_ev.events = EPOLLOUT|EPOLLET; ++ stdout_ev.data.fd = STDOUT_FILENO; ++ ++ zero(master_ev); ++ master_ev.events = EPOLLIN|EPOLLOUT|EPOLLET; ++ master_ev.data.fd = master; ++ ++ zero(signal_ev); ++ signal_ev.events = EPOLLIN; ++ signal_ev.data.fd = signal_fd; ++ ++ if (epoll_ctl(ep, EPOLL_CTL_ADD, STDOUT_FILENO, &stdout_ev) < 0) { ++ if (errno != EPERM) { ++ log_error("Failed to register stdout in epoll: %m"); ++ return -errno; ++ } ++ ++ /* stdout without epoll support. Likely redirected to regular file. */ ++ stdout_writable = true; ++ } ++ ++ if (epoll_ctl(ep, EPOLL_CTL_ADD, master, &master_ev) < 0 || ++ epoll_ctl(ep, EPOLL_CTL_ADD, signal_fd, &signal_ev) < 0) { ++ log_error("Failed to register fds in epoll: %m"); ++ return -errno; ++ } ++ ++ for (;;) { ++ struct epoll_event ev[16]; ++ ssize_t k; ++ int i, nfds; ++ ++ nfds = epoll_wait(ep, ev, ELEMENTSOF(ev), -1); ++ if (nfds < 0) { ++ ++ if (errno == EINTR || errno == EAGAIN) ++ continue; ++ ++ log_error("epoll_wait(): %m"); ++ return -errno; ++ } ++ ++ assert(nfds >= 1); ++ ++ for (i = 0; i < nfds; i++) { ++ if (ev[i].data.fd == STDIN_FILENO) { ++ ++ if (ev[i].events & (EPOLLIN|EPOLLHUP)) ++ stdin_readable = true; ++ ++ } else if (ev[i].data.fd == STDOUT_FILENO) { ++ ++ if (ev[i].events & (EPOLLOUT|EPOLLHUP)) ++ stdout_writable = true; ++ ++ } else if (ev[i].data.fd == master) { ++ ++ if (ev[i].events & (EPOLLIN|EPOLLHUP)) ++ master_readable = true; ++ ++ if (ev[i].events & (EPOLLOUT|EPOLLHUP)) ++ master_writable = true; ++ ++ } else if (ev[i].data.fd == signal_fd) { ++ struct signalfd_siginfo sfsi; ++ ssize_t n; ++ ++ n = read(signal_fd, &sfsi, sizeof(sfsi)); ++ if (n != sizeof(sfsi)) { ++ ++ if (n >= 0) { ++ log_error("Failed to read from signalfd: invalid block size"); ++ return -EIO; ++ } ++ ++ if (errno != EINTR && errno != EAGAIN) { ++ log_error("Failed to read from signalfd: %m"); ++ return -errno; ++ } ++ } else { ++ ++ if (sfsi.ssi_signo == SIGWINCH) { ++ struct winsize ws; ++ ++ /* The window size changed, let's forward that. */ ++ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) >= 0) ++ ioctl(master, TIOCSWINSZ, &ws); ++ ++ } else if (sfsi.ssi_signo == SIGTERM && kill_pid > 0 && signo > 0 && !tried_orderly_shutdown) { ++ ++ if (kill(kill_pid, signo) < 0) ++ return 0; ++ ++ log_info("Trying to halt container. Send SIGTERM again to trigger immediate termination."); ++ ++ /* This only works for systemd... */ ++ tried_orderly_shutdown = true; ++ ++ } else ++ return 0; ++ } ++ } ++ } ++ ++ while ((stdin_readable && in_buffer_full <= 0) || ++ (master_writable && in_buffer_full > 0) || ++ (master_readable && out_buffer_full <= 0) || ++ (stdout_writable && out_buffer_full > 0)) { ++ ++ if (stdin_readable && in_buffer_full < LINE_MAX) { ++ ++ k = read(STDIN_FILENO, in_buffer + in_buffer_full, LINE_MAX - in_buffer_full); ++ if (k < 0) { ++ ++ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) ++ stdin_readable = false; ++ else { ++ log_error("read(): %m"); ++ return -errno; ++ } ++ } else ++ in_buffer_full += (size_t) k; ++ } ++ ++ if (master_writable && in_buffer_full > 0) { ++ ++ k = write(master, in_buffer, in_buffer_full); ++ if (k < 0) { ++ ++ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) ++ master_writable = false; ++ else { ++ log_error("write(): %m"); ++ return -errno; ++ } ++ ++ } else { ++ assert(in_buffer_full >= (size_t) k); ++ memmove(in_buffer, in_buffer + k, in_buffer_full - k); ++ in_buffer_full -= k; ++ } ++ } ++ ++ if (master_readable && out_buffer_full < LINE_MAX) { ++ ++ k = read(master, out_buffer + out_buffer_full, LINE_MAX - out_buffer_full); ++ if (k < 0) { ++ ++ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) ++ master_readable = false; ++ else { ++ log_error("read(): %m"); ++ return -errno; ++ } ++ } else ++ out_buffer_full += (size_t) k; ++ } ++ ++ if (stdout_writable && out_buffer_full > 0) { ++ ++ k = write(STDOUT_FILENO, out_buffer, out_buffer_full); ++ if (k < 0) { ++ ++ if (errno == EAGAIN || errno == EPIPE || errno == ECONNRESET || errno == EIO) ++ stdout_writable = false; ++ else { ++ log_error("write(): %m"); ++ return -errno; ++ } ++ ++ } else { ++ assert(out_buffer_full >= (size_t) k); ++ memmove(out_buffer, out_buffer + k, out_buffer_full - k); ++ out_buffer_full -= k; ++ } ++ } ++ } ++ } ++} +diff --git a/src/shared/ptyfwd.h b/src/shared/ptyfwd.h +new file mode 100644 +index 0000000..8b65702 +--- /dev/null ++++ b/src/shared/ptyfwd.h +@@ -0,0 +1,27 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++#pragma once ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2010-2013 Lennart Poettering ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include ++#include ++ ++int process_pty(int master, sigset_t *mask, pid_t kill_pid, int signo); diff --git a/0075-nspawn-explicitly-terminate-machines-when-we-exit-ns.patch b/0075-nspawn-explicitly-terminate-machines-when-we-exit-ns.patch new file mode 100644 index 0000000..0edaeb7 --- /dev/null +++ b/0075-nspawn-explicitly-terminate-machines-when-we-exit-ns.patch @@ -0,0 +1,125 @@ +From 546f518baf5c1cb083030fe2b3de751f160e5eea Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 6 Nov 2013 02:05:06 +0100 +Subject: [PATCH] nspawn: explicitly terminate machines when we exit nspawn + +https://bugs.freedesktop.org/show_bug.cgi?id=68370 +https://bugzilla.redhat.com/show_bug.cgi?id=988883 + +Conflicts: + src/nspawn/nspawn.c +--- + src/nspawn/nspawn.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 65 insertions(+), 5 deletions(-) + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index cda6c82..85bbadf 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -43,9 +43,9 @@ + #include + #include + +-#include +-#include +- ++#include "sd-daemon.h" ++#include "sd-bus.h" ++#include "sd-id128.h" + #include "log.h" + #include "util.h" + #include "mkdir.h" +@@ -56,13 +56,13 @@ + #include "strv.h" + #include "path-util.h" + #include "loopback-setup.h" +-#include "sd-id128.h" + #include "dev-setup.h" + #include "fdset.h" + #include "build.h" + #include "fileio.h" + #include "bus-internal.h" + #include "bus-message.h" ++#include "bus-error.h" + #include "ptyfwd.h" + + #ifndef TTY_GID +@@ -966,10 +966,64 @@ static int register_machine(void) { + strempty(arg_directory), + !isempty(arg_slice), "Slice", "s", arg_slice); + if (r < 0) { +- log_error("Failed to register machine: %s", error.message ? error.message : strerror(-r)); ++ log_error("Failed to register machine: %s", bus_error_message(&error, r)); ++ return r; ++ } ++ ++ return 0; ++} ++ ++static int terminate_machine(pid_t pid) { ++ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; ++ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL; ++ _cleanup_bus_unref_ sd_bus *bus = NULL; ++ const char *path; ++ int r; ++ ++ r = sd_bus_open_system(&bus); ++ if (r < 0) { ++ log_error("Failed to open system bus: %s", strerror(-r)); ++ return r; ++ } ++ ++ r = sd_bus_call_method( ++ bus, ++ "org.freedesktop.machine1", ++ "/org/freedesktop/machine1", ++ "org.freedesktop.machine1.Manager", ++ "GetMachineByPID", ++ &error, ++ &reply, ++ "u", ++ (uint32_t) pid); ++ if (r < 0) { ++ /* Note that the machine might already have been ++ * cleaned up automatically, hence don't consider it a ++ * failure if we cannot get the machine object. */ ++ log_debug("Failed to get machine: %s", bus_error_message(&error, r)); ++ return 0; ++ } ++ ++ r = sd_bus_message_read(reply, "o", &path); ++ if (r < 0) { ++ log_error("Failed to parse GetMachineByPID() reply: %s", bus_error_message(&error, r)); + return r; + } + ++ r = sd_bus_call_method( ++ bus, ++ "org.freedesktop.machine1", ++ path, ++ "org.freedesktop.machine1.Machine", ++ "Terminate", ++ &error, ++ NULL, ++ NULL); ++ if (r < 0) { ++ log_debug("Failed to terminate machine: %s", bus_error_message(&error, r)); ++ return 0; ++ } ++ + return 0; + } + +@@ -1448,6 +1502,12 @@ int main(int argc, char *argv[]) { + if (saved_attr_valid) + tcsetattr(STDIN_FILENO, TCSANOW, &saved_attr); + ++ /* Kill if it is not dead yet anyway */ ++ terminate_machine(pid); ++ ++ /* Redundant, but better safe than sorry */ ++ kill(pid, SIGKILL); ++ + k = wait_for_terminate(pid, &status); + if (k < 0) { + r = EXIT_FAILURE; diff --git a/0076-run-support-system-to-match-other-commands-even-if-r.patch b/0076-run-support-system-to-match-other-commands-even-if-r.patch new file mode 100644 index 0000000..4081aa1 --- /dev/null +++ b/0076-run-support-system-to-match-other-commands-even-if-r.patch @@ -0,0 +1,112 @@ +From 9888a5919971d6eacd1ca025c1d4197248022319 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 6 Nov 2013 17:31:20 +0100 +Subject: [PATCH] run: support --system to match other commands, even if + redundant + +Conflicts: + man/systemd-run.xml + src/run/run.c +--- + man/systemd-run.xml | 9 +++++++++ + src/run/run.c | 20 +++++++++++++------- + 2 files changed, 22 insertions(+), 7 deletions(-) + +diff --git a/man/systemd-run.xml b/man/systemd-run.xml +index 252335b..48a0715 100644 +--- a/man/systemd-run.xml ++++ b/man/systemd-run.xml +@@ -113,6 +113,15 @@ along with systemd; If not, see . + + + ++ ++ ++ ++ Talk to the service manager of the system. This is the ++ implied default. ++ ++ ++ ++ + + + +diff --git a/src/run/run.c b/src/run/run.c +index 18a4920..a6abead 100644 +--- a/src/run/run.c ++++ b/src/run/run.c +@@ -61,6 +61,7 @@ static int parse_argv(int argc, char *argv[]) { + enum { + ARG_VERSION = 0x100, + ARG_USER, ++ ARG_SYSTEM, + ARG_SCOPE, + ARG_UNIT, + ARG_DESCRIPTION, +@@ -72,6 +73,7 @@ static int parse_argv(int argc, char *argv[]) { + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, ARG_VERSION }, + { "user", no_argument, NULL, ARG_USER }, ++ { "system", no_argument, NULL, ARG_SYSTEM }, + { "scope", no_argument, NULL, ARG_SCOPE }, + { "unit", required_argument, NULL, ARG_UNIT }, + { "description", required_argument, NULL, ARG_DESCRIPTION }, +@@ -103,6 +105,10 @@ static int parse_argv(int argc, char *argv[]) { + arg_user = true; + break; + ++ case ARG_SYSTEM: ++ arg_user = false; ++ break; ++ + case ARG_SCOPE: + arg_scope = true; + break; +@@ -333,12 +339,12 @@ int main(int argc, char* argv[]) { + + r = parse_argv(argc, argv); + if (r <= 0) +- goto fail; ++ goto finish; + + r = find_binary(argv[optind], &command); + if (r < 0) { + log_error("Failed to find executable %s: %s", argv[optind], strerror(-r)); +- goto fail; ++ goto finish; + } + argv[optind] = command; + +@@ -346,7 +352,7 @@ int main(int argc, char* argv[]) { + description = strv_join(argv + optind, " "); + if (!description) { + r = log_oom(); +- goto fail; ++ goto finish; + } + + arg_description = description; +@@ -357,8 +363,8 @@ int main(int argc, char* argv[]) { + else + r = sd_bus_open_system(&bus); + if (r < 0) { +- log_error("Failed to create new bus connection: %s", strerror(-r)); +- goto fail; ++ log_error("Failed to create bus connection: %s", strerror(-r)); ++ goto finish; + } + + if (arg_scope) +@@ -368,9 +374,9 @@ int main(int argc, char* argv[]) { + if (r < 0) { + log_error("Failed start transient unit: %s", error.message ? error.message : strerror(-r)); + sd_bus_error_free(&error); +- goto fail; ++ goto finish; + } + +-fail: ++finish: + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + } diff --git a/0077-acpi-fpdt-break-on-zero-or-negative-length-read.patch b/0077-acpi-fpdt-break-on-zero-or-negative-length-read.patch new file mode 100644 index 0000000..778d99e --- /dev/null +++ b/0077-acpi-fpdt-break-on-zero-or-negative-length-read.patch @@ -0,0 +1,23 @@ +From 98f6a4dfe1d6e601ddd2b59c42e8fc16193d187b Mon Sep 17 00:00:00 2001 +From: Pavel Holica +Date: Wed, 6 Nov 2013 23:24:16 +0100 +Subject: [PATCH] acpi-fpdt: break on zero or negative length read + +https://bugzilla.redhat.com/show_bug.cgi?id=1027478 +--- + src/shared/acpi-fpdt.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c +index 75648b4..7bae47f 100644 +--- a/src/shared/acpi-fpdt.c ++++ b/src/shared/acpi-fpdt.c +@@ -109,6 +109,8 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) { + for (rec = (struct acpi_fpdt_header *)(buf + sizeof(struct acpi_table_header)); + (char *)rec < buf + l; + rec = (struct acpi_fpdt_header *)((char *)rec + rec->length)) { ++ if (rec->length <= 0) ++ break; + if (rec->type != ACPI_FPDT_TYPE_BOOT) + continue; + if (rec->length != sizeof(struct acpi_fpdt_header)) diff --git a/0078-man-add-rationale-into-systemd-halt-8.patch b/0078-man-add-rationale-into-systemd-halt-8.patch new file mode 100644 index 0000000..c8cf0aa --- /dev/null +++ b/0078-man-add-rationale-into-systemd-halt-8.patch @@ -0,0 +1,28 @@ +From 85f85783569c4a662262c7b7579fb130d25ccd42 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +Date: Thu, 7 Nov 2013 01:17:49 +0100 +Subject: [PATCH] man: add rationale into systemd-halt(8) + +The explanation is from +http://people.debian.org/~stapelberg/docs/systemd-dependencies.html +--- + man/systemd-halt.service.xml | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/man/systemd-halt.service.xml b/man/systemd-halt.service.xml +index 812281e..90b443f 100644 +--- a/man/systemd-halt.service.xml ++++ b/man/systemd-halt.service.xml +@@ -83,6 +83,12 @@ + remaining swap devices, detach all remaining storage + devices and kill all remaining processes. + ++ It is necessary to have this code in a separate binary ++ because otherwise rebooting after an upgrade might be broken — ++ the running PID 1 could still depend on libraries which are not ++ available any more, thus keeping the filesystem busy, which ++ then cannot be re-mounted read-only. ++ + Immediately before executing the actual system + halt/poweroff/reboot/kexec + systemd-shutdown will run all diff --git a/0079-systemd-python-convert-keyword-value-to-string.patch b/0079-systemd-python-convert-keyword-value-to-string.patch new file mode 100644 index 0000000..f66c752 --- /dev/null +++ b/0079-systemd-python-convert-keyword-value-to-string.patch @@ -0,0 +1,27 @@ +From 044615d3520fe1884b6d1c410b99c26c0b02d41a Mon Sep 17 00:00:00 2001 +From: Richard Marko +Date: Tue, 5 Nov 2013 15:41:20 +0100 +Subject: [PATCH] systemd-python: convert keyword value to string + +Allows using journal.send('msg', PRIORITY=journal.LOG_CRIT) + +Before this commit this results in +TypeError: cannot concatenate 'str' and 'int' objects +and requires passing PRIORITY value as string to work. +--- + src/python-systemd/journal.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/python-systemd/journal.py b/src/python-systemd/journal.py +index d0bcd24..9c7e004 100644 +--- a/src/python-systemd/journal.py ++++ b/src/python-systemd/journal.py +@@ -352,6 +352,8 @@ def get_catalog(mid): + def _make_line(field, value): + if isinstance(value, bytes): + return field.encode('utf-8') + b'=' + value ++ elif isinstance(value, int): ++ return field + '=' + str(value) + else: + return field + '=' + value + diff --git a/0080-systemctl-make-LOAD-column-width-dynamic.patch b/0080-systemctl-make-LOAD-column-width-dynamic.patch new file mode 100644 index 0000000..f37ecc4 --- /dev/null +++ b/0080-systemctl-make-LOAD-column-width-dynamic.patch @@ -0,0 +1,65 @@ +From 4beb4dc09a06e36a5831530115f1a14beeaa436a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= +Date: Mon, 4 Nov 2013 23:01:17 +0200 +Subject: [PATCH] systemctl: make LOAD column width dynamic + +Otherwise 'not-found' overflows into the ACTIVE column. +--- + src/systemctl/systemctl.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c +index 36040db..906982a 100644 +--- a/src/systemctl/systemctl.c ++++ b/src/systemctl/systemctl.c +@@ -287,14 +287,16 @@ static bool output_show_unit(const struct unit_info *u) { + } + + static void output_units_list(const struct unit_info *unit_infos, unsigned c) { +- unsigned id_len, max_id_len, active_len, sub_len, job_len, desc_len, n_shown = 0; ++ unsigned id_len, max_id_len, load_len, active_len, sub_len, job_len, desc_len; ++ unsigned n_shown = 0; + const struct unit_info *u; + int job_count = 0; + +- max_id_len = sizeof("UNIT")-1; +- active_len = sizeof("ACTIVE")-1; +- sub_len = sizeof("SUB")-1; +- job_len = sizeof("JOB")-1; ++ max_id_len = strlen("UNIT"); ++ load_len = strlen("LOAD"); ++ active_len = strlen("ACTIVE"); ++ sub_len = strlen("SUB"); ++ job_len = strlen("JOB"); + desc_len = 0; + + for (u = unit_infos; u < unit_infos + c; u++) { +@@ -302,6 +304,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) { + continue; + + max_id_len = MAX(max_id_len, strlen(u->id)); ++ load_len = MAX(load_len, strlen(u->load_state)); + active_len = MAX(active_len, strlen(u->active_state)); + sub_len = MAX(sub_len, strlen(u->sub_state)); + if (u->job_id != 0) { +@@ -344,7 +347,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) { + continue; + + if (!n_shown && !arg_no_legend) { +- printf("%-*s %-6s %-*s %-*s ", id_len, "UNIT", "LOAD", ++ printf("%-*s %-*s %-*s %-*s ", id_len, "UNIT", load_len, "LOAD", + active_len, "ACTIVE", sub_len, "SUB"); + if (job_count) + printf("%-*s ", job_len, "JOB"); +@@ -371,9 +374,9 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) { + + e = arg_full ? NULL : ellipsize(u->id, id_len, 33); + +- printf("%s%-*s%s %s%-6s%s %s%-*s %-*s%s %-*s", ++ printf("%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s", + on, id_len, e ? e : u->id, off, +- on_loaded, u->load_state, off_loaded, ++ on_loaded, load_len, u->load_state, off_loaded, + on_active, active_len, u->active_state, + sub_len, u->sub_state, off_active, + job_count ? job_len + 1 : 0, u->job_id ? u->job_type : ""); diff --git a/0081-Make-hibernation-test-work-for-swap-files.patch b/0081-Make-hibernation-test-work-for-swap-files.patch new file mode 100644 index 0000000..6f096f8 --- /dev/null +++ b/0081-Make-hibernation-test-work-for-swap-files.patch @@ -0,0 +1,25 @@ +From a5fd1d54d63e9e5861113fd30911949a148921e1 Mon Sep 17 00:00:00 2001 +From: Jan Janssen +Date: Thu, 31 Oct 2013 17:22:03 +0100 +Subject: [PATCH] Make hibernation test work for swap files + +Suspend to disk works for swap files too (even if it is located +on an ecrypted file system): +https://www.kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt +--- + src/shared/sleep-config.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c +index d068bfc..2bb0493 100644 +--- a/src/shared/sleep-config.c ++++ b/src/shared/sleep-config.c +@@ -206,7 +206,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) { + if (!d) + return -ENOMEM; + +- if (!streq(type, "partition")) { ++ if (!streq(type, "partition") && !streq(type, "file")) { + log_debug("Partition %s has type %s, ignoring.", d, type); + continue; + } diff --git a/0082-man-add-docs-for-sd_is_special-and-some-man-page-sym.patch b/0082-man-add-docs-for-sd_is_special-and-some-man-page-sym.patch new file mode 100644 index 0000000..249e1ef --- /dev/null +++ b/0082-man-add-docs-for-sd_is_special-and-some-man-page-sym.patch @@ -0,0 +1,134 @@ +From 82e54a15fa202a67c9a9d2e53aad660f8a5ff36c Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 7 Nov 2013 17:51:09 +0100 +Subject: [PATCH] man: add docs for sd_is_special() and some man page symlinks + +Conflicts: + Makefile.am +--- + Makefile-man.am | 15 +++++++++++++++ + man/sd_is_fifo.xml | 17 +++++++++++++++++ + man/sd_seat_get_active.xml | 2 ++ + 3 files changed, 34 insertions(+) + +diff --git a/Makefile-man.am b/Makefile-man.am +index c8a4342..b8c8acc 100644 +--- a/Makefile-man.am ++++ b/Makefile-man.am +@@ -138,6 +138,7 @@ MANPAGES_ALIAS += \ + man/sd_is_socket.3 \ + man/sd_is_socket_inet.3 \ + man/sd_is_socket_unix.3 \ ++ man/sd_is_special.3 \ + man/sd_journal.3 \ + man/sd_journal_add_conjunction.3 \ + man/sd_journal_add_disjunction.3 \ +@@ -238,6 +239,7 @@ man/sd_is_mq.3: man/sd_is_fifo.3 + man/sd_is_socket.3: man/sd_is_fifo.3 + man/sd_is_socket_inet.3: man/sd_is_fifo.3 + man/sd_is_socket_unix.3: man/sd_is_fifo.3 ++man/sd_is_special.3: man/sd_is_fifo.3 + man/sd_journal.3: man/sd_journal_open.3 + man/sd_journal_add_conjunction.3: man/sd_journal_add_match.3 + man/sd_journal_add_disjunction.3: man/sd_journal_add_match.3 +@@ -410,6 +412,9 @@ man/sd_is_socket_inet.html: man/sd_is_fifo.html + man/sd_is_socket_unix.html: man/sd_is_fifo.html + $(html-alias) + ++man/sd_is_special.html: man/sd_is_fifo.html ++ $(html-alias) ++ + man/sd_journal.html: man/sd_journal_open.html + $(html-alias) + +@@ -844,7 +849,9 @@ MANPAGES_ALIAS += \ + man/sd_pid_get_slice.3 \ + man/sd_pid_get_unit.3 \ + man/sd_pid_get_user_unit.3 \ ++ man/sd_seat_can_graphical.3 \ + man/sd_seat_can_multi_session.3 \ ++ man/sd_seat_can_tty.3 \ + man/sd_seat_get_sessions.3 \ + man/sd_session_get_class.3 \ + man/sd_session_get_display.3 \ +@@ -873,7 +880,9 @@ man/sd_pid_get_owner_uid.3: man/sd_pid_get_session.3 + man/sd_pid_get_slice.3: man/sd_pid_get_session.3 + man/sd_pid_get_unit.3: man/sd_pid_get_session.3 + man/sd_pid_get_user_unit.3: man/sd_pid_get_session.3 ++man/sd_seat_can_graphical.3: man/sd_seat_get_active.3 + man/sd_seat_can_multi_session.3: man/sd_seat_get_active.3 ++man/sd_seat_can_tty.3: man/sd_seat_get_active.3 + man/sd_seat_get_sessions.3: man/sd_seat_get_active.3 + man/sd_session_get_class.3: man/sd_session_is_active.3 + man/sd_session_get_display.3: man/sd_session_is_active.3 +@@ -930,9 +939,15 @@ man/sd_pid_get_unit.html: man/sd_pid_get_session.html + man/sd_pid_get_user_unit.html: man/sd_pid_get_session.html + $(html-alias) + ++man/sd_seat_can_graphical.html: man/sd_seat_get_active.html ++ $(html-alias) ++ + man/sd_seat_can_multi_session.html: man/sd_seat_get_active.html + $(html-alias) + ++man/sd_seat_can_tty.html: man/sd_seat_get_active.html ++ $(html-alias) ++ + man/sd_seat_get_sessions.html: man/sd_seat_get_active.html + $(html-alias) + +diff --git a/man/sd_is_fifo.xml b/man/sd_is_fifo.xml +index 2bc860c..4d9cd79 100644 +--- a/man/sd_is_fifo.xml ++++ b/man/sd_is_fifo.xml +@@ -48,6 +48,7 @@ + sd_is_socket_inet + sd_is_socket_unix + sd_is_mq ++ sd_is_special + Check the type of a file descriptor + + +@@ -93,6 +94,12 @@ + const char *path + + ++ ++ int sd_is_special ++ int fd ++ const char *path ++ ++ + + + +@@ -153,6 +160,16 @@ + path parameter is not + NULL, it is checked whether the + message queue is bound to the specified name. ++ ++ sd_is_special() may be ++ called to check whether the specified file descriptor ++ refers to a special file. If the ++ path parameter is not ++ NULL, it is checked whether file ++ descriptor is bound to the specified file ++ name. Special files in this context are character ++ device nodes and files in /proc ++ or /sys. + + + +diff --git a/man/sd_seat_get_active.xml b/man/sd_seat_get_active.xml +index 1610d3e..cd87696 100644 +--- a/man/sd_seat_get_active.xml ++++ b/man/sd_seat_get_active.xml +@@ -46,6 +46,8 @@ + sd_seat_get_active + sd_seat_get_sessions + sd_seat_can_multi_session ++ sd_seat_can_tty ++ sd_seat_can_graphical + Determine state of a specific seat + + diff --git a/0083-systemctl-return-r-instead-of-always-returning-0.patch b/0083-systemctl-return-r-instead-of-always-returning-0.patch new file mode 100644 index 0000000..77b647f --- /dev/null +++ b/0083-systemctl-return-r-instead-of-always-returning-0.patch @@ -0,0 +1,22 @@ +From 94c73ca7e22de4355f8ef32ea30ddf1ef8dae662 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Wed, 6 Nov 2013 11:18:02 +0100 +Subject: [PATCH] systemctl: return r instead of always returning 0 + +--- + src/systemctl/systemctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c +index 906982a..db584b2 100644 +--- a/src/systemctl/systemctl.c ++++ b/src/systemctl/systemctl.c +@@ -1365,7 +1365,7 @@ static int list_jobs(DBusConnection *bus, char **args) { + } + free(jobs); + +- return 0; ++ return r; + } + + static int cancel_job(DBusConnection *bus, char **args) { diff --git a/0084-journal-fix-minor-memory-leak.patch b/0084-journal-fix-minor-memory-leak.patch new file mode 100644 index 0000000..0cf84fb --- /dev/null +++ b/0084-journal-fix-minor-memory-leak.patch @@ -0,0 +1,22 @@ +From e46b85ec8f333d1bdd0e66b99530965c7781110b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 8 Nov 2013 13:53:25 +0100 +Subject: [PATCH] journal: fix minor memory leak + +--- + src/journal/sd-journal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c +index 7700d6c..9676f0f 100644 +--- a/src/journal/sd-journal.c ++++ b/src/journal/sd-journal.c +@@ -1276,7 +1276,7 @@ static void check_network(sd_journal *j, int fd) { + static bool file_has_type_prefix(const char *prefix, const char *filename) { + const char *full, *tilded, *atted; + +- full = strappend(prefix, ".journal"); ++ full = strappenda(prefix, ".journal"); + tilded = strappenda(full, "~"); + atted = strappenda(prefix, "@"); + diff --git a/0085-manager-configurable-StartLimit-default-values.patch b/0085-manager-configurable-StartLimit-default-values.patch new file mode 100644 index 0000000..bbf7780 --- /dev/null +++ b/0085-manager-configurable-StartLimit-default-values.patch @@ -0,0 +1,161 @@ +From 9e694cd271f7bce2ad7a77de03b66d493ca5dd61 Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Fri, 8 Nov 2013 16:01:22 +0100 +Subject: [PATCH] manager: configurable StartLimit default values + +https://bugzilla.redhat.com/show_bug.cgi?id=821723 +--- + man/systemd-system.conf.xml | 13 +++++++++++++ + man/systemd.service.xml | 9 ++++++--- + src/core/main.c | 6 ++++++ + src/core/manager.h | 3 +++ + src/core/service.c | 4 +++- + src/core/system.conf | 2 ++ + src/core/user.conf | 2 ++ + src/shared/def.h | 3 +++ + 8 files changed, 38 insertions(+), 4 deletions(-) + +diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml +index c1f2648..9a1a99f 100644 +--- a/man/systemd-system.conf.xml ++++ b/man/systemd-system.conf.xml +@@ -115,6 +115,19 @@ + TimeoutSec= value. + + ++ ++ DefaultStartLimitInterval= ++ DefaultStartLimitBurst= ++ ++ Configure the default start rate ++ limiting, as configured per-service by ++ StartLimitInterval= and ++ StartLimitBurst=. See ++ systemd.service5 ++ for details on the per-service ++ settings). ++ ++ + + + CPUAffinity= +diff --git a/man/systemd.service.xml b/man/systemd.service.xml +index df04048..3f31c11 100644 +--- a/man/systemd.service.xml ++++ b/man/systemd.service.xml +@@ -863,12 +863,15 @@ + these two options, this rate limiting + may be modified. Use + StartLimitInterval= +- to configure the checking interval +- (defaults to 10s, set to 0 to disable ++ to configure the checking interval (defaults to ++ DefaultStartLimitInterval= in ++ manager configuration file, set to 0 to disable + any kind of rate limiting). Use + StartLimitBurst= to + configure how many starts per interval +- are allowed (defaults to 5). These ++ are allowed (defaults to ++ DefaultStartLimitBurst= in ++ manager configuration file). These + configuration options are particularly + useful in conjunction with + Restart=, however +diff --git a/src/core/main.c b/src/core/main.c +index 937994c..00fd394 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -93,6 +93,8 @@ static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT; + static usec_t arg_default_restart_usec = DEFAULT_RESTART_USEC; + static usec_t arg_default_timeout_start_usec = DEFAULT_TIMEOUT_USEC; + static usec_t arg_default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC; ++static usec_t arg_default_start_limit_interval = DEFAULT_START_LIMIT_INTERVAL; ++static unsigned arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST; + static usec_t arg_runtime_watchdog = 0; + static usec_t arg_shutdown_watchdog = 10 * USEC_PER_MINUTE; + static char **arg_default_environment = NULL; +@@ -642,6 +644,8 @@ static int parse_config_file(void) { + { "Manager", "DefaultTimeoutStartSec", config_parse_sec, 0, &arg_default_timeout_start_usec }, + { "Manager", "DefaultTimeoutStopSec", config_parse_sec, 0, &arg_default_timeout_stop_usec }, + { "Manager", "DefaultRestartSec", config_parse_sec, 0, &arg_default_restart_usec }, ++ { "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval }, ++ { "Manager", "DefaultStartLimitBurst", config_parse_unsigned, 0, &arg_default_start_limit_burst }, + { "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers }, + { "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog }, + { "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog }, +@@ -1551,6 +1555,8 @@ int main(int argc, char *argv[]) { + m->default_restart_usec = arg_default_restart_usec; + m->default_timeout_start_usec = arg_default_timeout_start_usec; + m->default_timeout_stop_usec = arg_default_timeout_stop_usec; ++ m->default_start_limit_interval = arg_default_start_limit_interval; ++ m->default_start_limit_burst = arg_default_start_limit_burst; + m->runtime_watchdog = arg_runtime_watchdog; + m->shutdown_watchdog = arg_shutdown_watchdog; + m->userspace_timestamp = userspace_timestamp; +diff --git a/src/core/manager.h b/src/core/manager.h +index e74c609..ee42c5e 100644 +--- a/src/core/manager.h ++++ b/src/core/manager.h +@@ -233,6 +233,9 @@ struct Manager { + usec_t default_restart_usec, default_timeout_start_usec, + default_timeout_stop_usec; + ++ usec_t default_start_limit_interval; ++ unsigned default_start_limit_burst; ++ + struct rlimit *rlimit[RLIMIT_NLIMITS]; + + /* non-zero if we are reloading or reexecuting, */ +diff --git a/src/core/service.c b/src/core/service.c +index e81aa1f..5662180 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -143,7 +143,9 @@ static void service_init(Unit *u) { + kill_context_init(&s->kill_context); + cgroup_context_init(&s->cgroup_context); + +- RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5); ++ RATELIMIT_INIT(s->start_limit, ++ u->manager->default_start_limit_interval, ++ u->manager->default_start_limit_burst); + + s->control_command_id = _SERVICE_EXEC_COMMAND_INVALID; + } +diff --git a/src/core/system.conf b/src/core/system.conf +index 3c6cc03..38bbca5 100644 +--- a/src/core/system.conf ++++ b/src/core/system.conf +@@ -27,6 +27,8 @@ + #DefaultTimeoutStartSec=90s + #DefaultTimeoutStopSec=90s + #DefaultRestartSec=100ms ++#DefaultStartLimitInterval=10s ++#DefaultStartLimitBurst=5 + #DefaultEnvironment= + #DefaultLimitCPU= + #DefaultLimitFSIZE= +diff --git a/src/core/user.conf b/src/core/user.conf +index b030701..923ca66 100644 +--- a/src/core/user.conf ++++ b/src/core/user.conf +@@ -17,3 +17,5 @@ + #DefaultTimeoutStartSec=90s + #DefaultTimeoutStopSec=90s + #DefaultRestartSec=100ms ++#DefaultStartLimitInterval=10s ++#DefaultStartLimitBurst=5 +diff --git a/src/shared/def.h b/src/shared/def.h +index edd0bcf..e4ef735 100644 +--- a/src/shared/def.h ++++ b/src/shared/def.h +@@ -27,6 +27,9 @@ + #define DEFAULT_RESTART_USEC (100*USEC_PER_MSEC) + #define DEFAULT_CONFIRM_USEC (30*USEC_PER_SEC) + ++#define DEFAULT_START_LIMIT_INTERVAL (10*USEC_PER_SEC) ++#define DEFAULT_START_LIMIT_BURST 5 ++ + #define DEFAULT_EXIT_USEC (5*USEC_PER_MINUTE) + + #define SYSTEMD_CGROUP_CONTROLLER "name=systemd" diff --git a/0086-man-units-fix-installation-of-systemd-nspawn-.servic.patch b/0086-man-units-fix-installation-of-systemd-nspawn-.servic.patch new file mode 100644 index 0000000..adc022c --- /dev/null +++ b/0086-man-units-fix-installation-of-systemd-nspawn-.servic.patch @@ -0,0 +1,57 @@ +From 4108d06603404e70b93747e156213eb59ed8bc27 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 7 Nov 2013 23:57:19 -0500 +Subject: [PATCH] man,units: fix installation of systemd-nspawn@.service and + add example + +--- + TODO | 1 + + man/systemd-nspawn.xml | 12 ++++++++++++ + units/systemd-nspawn@.service.in | 2 +- + 3 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/TODO b/TODO +index 425f673..42ba030 100644 +--- a/TODO ++++ b/TODO +@@ -491,6 +491,7 @@ Features: + - nspawn: maybe add a way to drop additional caps, in addition to add additional caps + - nspawn: maybe explicitly reset loginuid? + - nspawn: make it work for dwalsh and shared /usr containers -- tmpfs mounts as command line parameters, selinux exec context ++ - refuses to boot containers without /etc/machine-id (OK?), and with empty /etc/machine-id (not OK). + + * cryptsetup: + - cryptsetup-generator: allow specification of passwords in crypttab itself +diff --git a/man/systemd-nspawn.xml b/man/systemd-nspawn.xml +index 7d450f9..ba9e516 100644 +--- a/man/systemd-nspawn.xml ++++ b/man/systemd-nspawn.xml +@@ -428,6 +428,18 @@ + + + ++ Example 4 ++ ++ # mv ~/arch-tree /var/lib/container/arch ++# systemctl enable systemd-nspawn@arch.service ++# systemctl start systemd-nspawn@arch.service ++ ++ This makes the Arch Linux container part of the ++ multi-user.target on the host. ++ ++ ++ ++ + Exit status + + The exit code of the program executed in the +diff --git a/units/systemd-nspawn@.service.in b/units/systemd-nspawn@.service.in +index eca62e3..8e00736 100644 +--- a/units/systemd-nspawn@.service.in ++++ b/units/systemd-nspawn@.service.in +@@ -14,4 +14,4 @@ ExecStart=@bindir@/systemd-nspawn -bjD /var/lib/container/%i + Type=notify + + [Install] +-Also=multi-user.target ++WantedBy=multi-user.target diff --git a/0087-systemd-fix-memory-leak-in-cgroup-code.patch b/0087-systemd-fix-memory-leak-in-cgroup-code.patch new file mode 100644 index 0000000..292241d --- /dev/null +++ b/0087-systemd-fix-memory-leak-in-cgroup-code.patch @@ -0,0 +1,65 @@ +From 7930484abfb17a9c72efdd93ebfc4637ad2be738 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 8 Nov 2013 08:41:13 -0500 +Subject: [PATCH] systemd: fix memory leak in cgroup code + +If the unit already was in the hashmap, path would be leaked. +--- + src/core/cgroup.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 42c0b3f..32e2599 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -376,23 +376,23 @@ static CGroupControllerMask unit_get_siblings_mask(Unit *u) { + } + + static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) { +- char *path = NULL; ++ _cleanup_free_ char *path; + int r; +- bool is_in_hash = false; ++ bool was_in_hash = false; + + assert(u); + + path = unit_default_cgroup_path(u); + if (!path) +- return -ENOMEM; ++ return log_oom(); + + r = hashmap_put(u->manager->cgroup_unit, path, u); + if (r == 0) +- is_in_hash = true; +- +- if (r < 0) { +- log_error("cgroup %s exists already: %s", path, strerror(-r)); +- free(path); ++ was_in_hash = true; ++ else if (r < 0) { ++ log_error(r == -EEXIST ? ++ "cgroup %s exists already: %s" : "hashmap_put failed for %s: %s", ++ path, strerror(-r)); + return r; + } + +@@ -405,13 +405,15 @@ static int unit_create_cgroups(Unit *u, CGroupControllerMask mask) { + if (u->cgroup_path) { + r = cg_migrate_everywhere(u->manager->cgroup_supported, u->cgroup_path, path); + if (r < 0) +- log_error("Failed to migrate cgroup %s: %s", path, strerror(-r)); ++ log_error("Failed to migrate cgroup from %s to %s: %s", ++ u->cgroup_path, path, strerror(-r)); + } + +- if (!is_in_hash) { +- /* And remember the new data */ ++ if (!was_in_hash) { ++ /* Remember the new data */ + free(u->cgroup_path); + u->cgroup_path = path; ++ path = NULL; + } + + u->cgroup_realized = true; diff --git a/0088-button-don-t-exit-if-we-cannot-handle-a-button-press.patch b/0088-button-don-t-exit-if-we-cannot-handle-a-button-press.patch new file mode 100644 index 0000000..d8f59d7 --- /dev/null +++ b/0088-button-don-t-exit-if-we-cannot-handle-a-button-press.patch @@ -0,0 +1,22 @@ +From 12a195707153882b1df1b1503b51703a81c85de6 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Sun, 10 Nov 2013 23:05:08 +0100 +Subject: [PATCH] button: don't exit if we cannot handle a button press + +--- + src/login/logind-button.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/login/logind-button.c b/src/login/logind-button.c +index ea45c28..4f456d2 100644 +--- a/src/login/logind-button.c ++++ b/src/login/logind-button.c +@@ -172,7 +172,7 @@ static int button_handle( + * execute another one until the lid is opened/closed again */ + b->lid_close_queued = false; + +- return r; ++ return 0; + } + + int button_process(Button *b) { diff --git a/0089-timer-properly-format-relative-timestamps-in-the-fut.patch b/0089-timer-properly-format-relative-timestamps-in-the-fut.patch new file mode 100644 index 0000000..81db5ad --- /dev/null +++ b/0089-timer-properly-format-relative-timestamps-in-the-fut.patch @@ -0,0 +1,120 @@ +From d5910017f2cfaea144f766a3fb772b53f8d9dcbf Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 11 Nov 2013 03:02:52 +0100 +Subject: [PATCH] timer: properly format relative timestamps in the future + +--- + src/shared/time-util.c | 69 ++++++++++++++++++++++++++++++++------------------ + 1 file changed, 44 insertions(+), 25 deletions(-) + +diff --git a/src/shared/time-util.c b/src/shared/time-util.c +index 860be61..b8a6bd7 100644 +--- a/src/shared/time-util.c ++++ b/src/shared/time-util.c +@@ -191,55 +191,62 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t) { + } + + char *format_timestamp_relative(char *buf, size_t l, usec_t t) { ++ const char *s; + usec_t n, d; + + n = now(CLOCK_REALTIME); + +- if (t <= 0 || t > n || t + USEC_PER_DAY*7 <= t) ++ if (t <= 0 || (t == (usec_t) -1)) + return NULL; + +- d = n - t; ++ if (n > t) { ++ d = n - t; ++ s = "ago"; ++ } else { ++ d = t - n; ++ s = "left"; ++ } + + if (d >= USEC_PER_YEAR) +- snprintf(buf, l, "%llu years %llu months ago", ++ snprintf(buf, l, "%llu years %llu months %s", + (unsigned long long) (d / USEC_PER_YEAR), +- (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH)); ++ (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH), s); + else if (d >= USEC_PER_MONTH) +- snprintf(buf, l, "%llu months %llu days ago", ++ snprintf(buf, l, "%llu months %llu days %s", + (unsigned long long) (d / USEC_PER_MONTH), +- (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY)); ++ (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY), s); + else if (d >= USEC_PER_WEEK) +- snprintf(buf, l, "%llu weeks %llu days ago", ++ snprintf(buf, l, "%llu weeks %llu days %s", + (unsigned long long) (d / USEC_PER_WEEK), +- (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY)); ++ (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY), s); + else if (d >= 2*USEC_PER_DAY) +- snprintf(buf, l, "%llu days ago", (unsigned long long) (d / USEC_PER_DAY)); ++ snprintf(buf, l, "%llu days %s", (unsigned long long) (d / USEC_PER_DAY), s); + else if (d >= 25*USEC_PER_HOUR) +- snprintf(buf, l, "1 day %lluh ago", +- (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR)); ++ snprintf(buf, l, "1 day %lluh %s", ++ (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR), s); + else if (d >= 6*USEC_PER_HOUR) +- snprintf(buf, l, "%lluh ago", +- (unsigned long long) (d / USEC_PER_HOUR)); ++ snprintf(buf, l, "%lluh %s", ++ (unsigned long long) (d / USEC_PER_HOUR), s); + else if (d >= USEC_PER_HOUR) +- snprintf(buf, l, "%lluh %llumin ago", ++ snprintf(buf, l, "%lluh %llumin %s", + (unsigned long long) (d / USEC_PER_HOUR), +- (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE)); ++ (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE), s); + else if (d >= 5*USEC_PER_MINUTE) +- snprintf(buf, l, "%llumin ago", +- (unsigned long long) (d / USEC_PER_MINUTE)); ++ snprintf(buf, l, "%llumin %s", ++ (unsigned long long) (d / USEC_PER_MINUTE), s); + else if (d >= USEC_PER_MINUTE) +- snprintf(buf, l, "%llumin %llus ago", ++ snprintf(buf, l, "%llumin %llus %s", + (unsigned long long) (d / USEC_PER_MINUTE), +- (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC)); ++ (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC), s); + else if (d >= USEC_PER_SEC) +- snprintf(buf, l, "%llus ago", +- (unsigned long long) (d / USEC_PER_SEC)); ++ snprintf(buf, l, "%llus %s", ++ (unsigned long long) (d / USEC_PER_SEC), s); + else if (d >= USEC_PER_MSEC) +- snprintf(buf, l, "%llums ago", +- (unsigned long long) (d / USEC_PER_MSEC)); ++ snprintf(buf, l, "%llums %s", ++ (unsigned long long) (d / USEC_PER_MSEC), s); + else if (d > 0) +- snprintf(buf, l, "%lluus ago", +- (unsigned long long) d); ++ snprintf(buf, l, "%lluus %s", ++ (unsigned long long) d, s); + else + snprintf(buf, l, "now"); + +@@ -479,6 +486,18 @@ int parse_timestamp(const char *t, usec_t *usec) { + return r; + + goto finish; ++ } else if (endswith(t, " left")) { ++ _cleanup_free_ char *z; ++ ++ z = strndup(t, strlen(t) - 4); ++ if (!z) ++ return -ENOMEM; ++ ++ r = parse_sec(z, &plus); ++ if (r < 0) ++ return r; ++ ++ goto finish; + } + + for (i = 0; i < ELEMENTSOF(day_nr); i++) { diff --git a/0090-timer-consider-usec_t-1-an-invalid-timestamp.patch b/0090-timer-consider-usec_t-1-an-invalid-timestamp.patch new file mode 100644 index 0000000..54b9943 --- /dev/null +++ b/0090-timer-consider-usec_t-1-an-invalid-timestamp.patch @@ -0,0 +1,48 @@ +From a0598047e4bfd308a25b9a516529ab49074fa527 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 11 Nov 2013 03:03:17 +0100 +Subject: [PATCH] timer: consider (usec_t) -1 an invalid timestamp + +--- + src/shared/time-util.c | 4 ++-- + src/shared/time-util.h | 5 ++++- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/shared/time-util.c b/src/shared/time-util.c +index b8a6bd7..81d4ede 100644 +--- a/src/shared/time-util.c ++++ b/src/shared/time-util.c +@@ -157,7 +157,7 @@ char *format_timestamp(char *buf, size_t l, usec_t t) { + assert(buf); + assert(l > 0); + +- if (t <= 0) ++ if (t <= 0 || t == (usec_t) -1) + return NULL; + + sec = (time_t) (t / USEC_PER_SEC); +@@ -175,7 +175,7 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t) { + assert(buf); + assert(l > 0); + +- if (t <= 0) ++ if (t <= 0 || t == (usec_t) -1) + return NULL; + + sec = (time_t) (t / USEC_PER_SEC); +diff --git a/src/shared/time-util.h b/src/shared/time-util.h +index 7660fe1..bc10d22 100644 +--- a/src/shared/time-util.h ++++ b/src/shared/time-util.h +@@ -64,7 +64,10 @@ dual_timestamp* dual_timestamp_get(dual_timestamp *ts); + dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u); + dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u); + +-#define dual_timestamp_is_set(ts) ((ts)->realtime > 0) ++static inline bool dual_timestamp_is_set(dual_timestamp *ts) { ++ return ((ts->realtime > 0 && ts->realtime != (usec_t) -1) || ++ (ts->monotonic > 0 && ts->monotonic != (usec_t) -1)); ++} + + usec_t timespec_load(const struct timespec *ts) _pure_; + struct timespec *timespec_store(struct timespec *ts, usec_t u); diff --git a/0091-udev-usb_id-remove-obsoleted-bInterfaceSubClass-5-ma.patch b/0091-udev-usb_id-remove-obsoleted-bInterfaceSubClass-5-ma.patch new file mode 100644 index 0000000..45ff980 --- /dev/null +++ b/0091-udev-usb_id-remove-obsoleted-bInterfaceSubClass-5-ma.patch @@ -0,0 +1,38 @@ +From 7583c92b266cd632712ced40be837f52a8de9715 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Fri, 11 Oct 2013 11:23:34 +0200 +Subject: [PATCH] udev: usb_id - remove obsoleted bInterfaceSubClass == 5 match + +bInterfaceSubClass == 5 is not a "floppy"; just identify the obsolete +QIC-157 interface as "generic". +--- + src/udev/udev-builtin-usb_id.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c +index e3bbd05..3e2f43e 100644 +--- a/src/udev/udev-builtin-usb_id.c ++++ b/src/udev/udev-builtin-usb_id.c +@@ -91,6 +91,9 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { ++ case 1: /* RBC devices */ ++ type = "rbc"; ++ break; + case 2: + type = "atapi"; + break; +@@ -98,12 +101,8 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len + type = "tape"; + break; + case 4: /* UFI */ +- case 5: /* SFF-8070i */ + type = "floppy"; + break; +- case 1: /* RBC devices */ +- type = "rbc"; +- break; + case 6: /* Transparent SPC-2 devices */ + type = "scsi"; + break; diff --git a/0092-Add-support-for-saving-restoring-keyboard-backlights.patch b/0092-Add-support-for-saving-restoring-keyboard-backlights.patch new file mode 100644 index 0000000..0b3a777 --- /dev/null +++ b/0092-Add-support-for-saving-restoring-keyboard-backlights.patch @@ -0,0 +1,66 @@ +From e7e2208e73ccc4a93dc87d1fc4624be0dbe3e747 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Fri, 11 Oct 2013 09:45:32 +0200 +Subject: [PATCH] Add support for saving/restoring keyboard backlights + +Piggy-backing on the display backlight code, this saves and restores +keyboard backlights on supported devices. + +The detection code matches that of UPower: +http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c#n173 + +https://bugs.freedesktop.org/show_bug.cgi?id=70367 + +[tomegun: also work for devices named "{smc,samsung,asus}::kbd_backlight"] + +Conflicts: + rules/99-systemd.rules.in +--- + rules/99-systemd.rules.in | 4 +++- + src/backlight/backlight.c | 7 +++++-- + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in +index 307f18f..a00ffed 100644 +--- a/rules/99-systemd.rules.in ++++ b/rules/99-systemd.rules.in +@@ -51,9 +51,11 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??: + + ACTION=="add", SUBSYSTEM=="net", KERNEL!="lo", RUN+="@rootlibexecdir@/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name --prefix=/proc/sys/net/ipv4/neigh/$name --prefix=/proc/sys/net/ipv6/conf/$name --prefix=/proc/sys/net/ipv6/neigh/$name" + +-# Pull in backlight save/restore for all firmware backlight devices ++# Pull in backlight save/restore for all firmware backlight devices, ++# and keyboard backlights + + SUBSYSTEM=="backlight", ATTR{type}=="firmware", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service" ++SUBSYSTEM=="leds", KERNEL=="*kbd_backlight", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@$name.service" + + # Asynchronously mount file systems implemented by these modules as + # soon as they are loaded. +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index 9b2eada..f22deed 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -56,9 +56,11 @@ int main(int argc, char *argv[]) { + + errno = 0; + device = udev_device_new_from_subsystem_sysname(udev, "backlight", argv[2]); ++ if (!device) ++ device = udev_device_new_from_subsystem_sysname(udev, "leds", argv[2]); + if (!device) { + if (errno != 0) { +- log_error("Failed to get backlight device: %m"); ++ log_error("Failed to get backlight device '%s': %m", argv[2]); + r = -errno; + } else + r = log_oom(); +@@ -66,7 +68,8 @@ int main(int argc, char *argv[]) { + goto finish; + } + +- if (!streq_ptr(udev_device_get_subsystem(device), "backlight")) { ++ if (!streq_ptr(udev_device_get_subsystem(device), "backlight") && ++ !streq_ptr(udev_device_get_subsystem(device), "leds")) { + log_error("Not a backlight device: %s", argv[2]); + r = -ENODEV; + goto finish; diff --git a/0093-static-nodes-don-t-call-mkdir.patch b/0093-static-nodes-don-t-call-mkdir.patch new file mode 100644 index 0000000..3fa8043 --- /dev/null +++ b/0093-static-nodes-don-t-call-mkdir.patch @@ -0,0 +1,48 @@ +From fada68e9f922a3a6a176092a7abdeec0b58408e8 Mon Sep 17 00:00:00 2001 +From: Tom Gundersen +Date: Thu, 17 Oct 2013 19:49:19 +0200 +Subject: [PATCH] static-nodes: don't call mkdir + +This is no longer necessary with kmod-15. Bump the requirement. +--- + README | 2 +- + configure.ac | 2 +- + units/kmod-static-nodes.service.in | 1 - + 3 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/README b/README +index b39cd37..cf0a18d 100644 +--- a/README ++++ b/README +@@ -95,7 +95,7 @@ REQUIREMENTS: + dbus >= 1.4.0 + libcap + libblkid >= 2.20 (from util-linux) (optional) +- libkmod >= 14 (optional) ++ libkmod >= 15 (optional) + PAM >= 1.1.2 (optional) + libcryptsetup (optional) + libaudit (optional) +diff --git a/configure.ac b/configure.ac +index 4f26092..5bc31c5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -269,7 +269,7 @@ AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules s + if test "x$enable_kmod" != "xno"; then + PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no) + if test "x$have_kmod" = "xyes"; then +- PKG_CHECK_MODULES(KMOD, [ libkmod >= 14 ], ++ PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ], + [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])], + AC_MSG_ERROR([*** kmod version >= 14 not found])) + fi +diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in +index ff4017b..368f980 100644 +--- a/units/kmod-static-nodes.service.in ++++ b/units/kmod-static-nodes.service.in +@@ -15,5 +15,4 @@ ConditionPathExists=/lib/modules/%v/modules.devname + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStartPre=@MKDIR_P@ /run/tmpfiles.d + ExecStart=@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf diff --git a/0094-Fix-kmod-error-message-to-have-correct-version-requi.patch b/0094-Fix-kmod-error-message-to-have-correct-version-requi.patch new file mode 100644 index 0000000..7d2503b --- /dev/null +++ b/0094-Fix-kmod-error-message-to-have-correct-version-requi.patch @@ -0,0 +1,22 @@ +From 6ff7db9dcee918b020f6c50e2785785b2b9ca854 Mon Sep 17 00:00:00 2001 +From: David Strauss +Date: Thu, 17 Oct 2013 13:19:29 -0700 +Subject: [PATCH] Fix kmod error message to have correct version requirement + +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 5bc31c5..9904e25 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -271,7 +271,7 @@ if test "x$enable_kmod" != "xno"; then + if test "x$have_kmod" = "xyes"; then + PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ], + [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])], +- AC_MSG_ERROR([*** kmod version >= 14 not found])) ++ AC_MSG_ERROR([*** kmod version >= 15 not found])) + fi + if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then + AC_MSG_ERROR([*** kmod support requested, but libraries not found]) diff --git a/0095-systemd-python-fix-booted-and-add-two-functions-to-d.patch b/0095-systemd-python-fix-booted-and-add-two-functions-to-d.patch new file mode 100644 index 0000000..384676c --- /dev/null +++ b/0095-systemd-python-fix-booted-and-add-two-functions-to-d.patch @@ -0,0 +1,34 @@ +From 57db3ee2c1aa714f6fc88a40043bf531f155843c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 11 Nov 2013 19:53:59 -0500 +Subject: [PATCH] systemd-python: fix booted() and add two functions to docs + +For some reason sphinx doesn't want to show inherited C functions. +--- + src/python-systemd/_daemon.c | 2 +- + src/python-systemd/docs/daemon.rst | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/python-systemd/_daemon.c b/src/python-systemd/_daemon.c +index 6b84fb8..f0ab16f 100644 +--- a/src/python-systemd/_daemon.c ++++ b/src/python-systemd/_daemon.c +@@ -51,7 +51,7 @@ static PyObject* booted(PyObject *self, PyObject *args) { + assert(args == NULL); + + r = sd_booted(); +- if (set_error(r, NULL, NULL)) ++ if (set_error(r, NULL, NULL) < 0) + return NULL; + + return PyBool_FromLong(r); +diff --git a/src/python-systemd/docs/daemon.rst b/src/python-systemd/docs/daemon.rst +index 72280ca..0ad11ed 100644 +--- a/src/python-systemd/docs/daemon.rst ++++ b/src/python-systemd/docs/daemon.rst +@@ -14,3 +14,5 @@ + .. autofunction:: _is_socket_unix + .. autofunction:: _is_socket_inet + .. autofunction:: _is_mq ++ .. autofunction:: notify ++ .. autofunction:: booted diff --git a/0096-activate-mention-E-in-the-help-text.patch b/0096-activate-mention-E-in-the-help-text.patch new file mode 100644 index 0000000..e01f913 --- /dev/null +++ b/0096-activate-mention-E-in-the-help-text.patch @@ -0,0 +1,22 @@ +From 8aa997f8e2e0ff3d801c1a3fe4065edc940c41f1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= +Date: Wed, 13 Nov 2013 13:36:17 +0200 +Subject: [PATCH] activate: mention -E in the help text + +--- + src/activate/activate.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/activate/activate.c b/src/activate/activate.c +index 83d25b1..fc581b9 100644 +--- a/src/activate/activate.c ++++ b/src/activate/activate.c +@@ -316,6 +316,8 @@ static int help(void) { + " -l --listen=ADDR Listen for raw connections at ADDR\n" + " -a --accept Spawn separate child for each connection\n" + " -h --help Show this help and exit\n" ++ " -E --environment=NAME[=VALUE]\n" ++ " Pass an environment variable to children\n" + " --version Print version string and exit\n" + "\n" + "Note: file descriptors from sd_listen_fds() will be passed through.\n" diff --git a/0097-activate-fix-crash-when-s-is-passed.patch b/0097-activate-fix-crash-when-s-is-passed.patch new file mode 100644 index 0000000..bc81890 --- /dev/null +++ b/0097-activate-fix-crash-when-s-is-passed.patch @@ -0,0 +1,23 @@ +From 767d458826e99cc55aeccb65c469124be61851a0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= +Date: Wed, 13 Nov 2013 13:36:16 +0200 +Subject: [PATCH] activate: fix crash when -s is passed + +getopt_long() was told to accept -s which was never implemented. +--- + src/activate/activate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/activate/activate.c b/src/activate/activate.c +index fc581b9..a9461bc 100644 +--- a/src/activate/activate.c ++++ b/src/activate/activate.c +@@ -346,7 +346,7 @@ static int parse_argv(int argc, char *argv[]) { + assert(argc >= 0); + assert(argv); + +- while ((c = getopt_long(argc, argv, "+hl:saE:", options, NULL)) >= 0) ++ while ((c = getopt_long(argc, argv, "+hl:aE:", options, NULL)) >= 0) + switch(c) { + case 'h': + help(); diff --git a/0098-journal-timestamp-support-on-console-messages.patch b/0098-journal-timestamp-support-on-console-messages.patch new file mode 100644 index 0000000..abff166 --- /dev/null +++ b/0098-journal-timestamp-support-on-console-messages.patch @@ -0,0 +1,85 @@ +From d787844df7f23a079c8bab893a8412550848bb6a Mon Sep 17 00:00:00 2001 +From: Umut Tezduyar Lindskog +Date: Wed, 13 Nov 2013 15:27:19 +0100 +Subject: [PATCH] journal: timestamp support on console messages + +journald mimics the kernel here: timestamps will be printed if +/sys/module/printk/parameters/time contains "Y". +--- + src/journal/journald-console.c | 34 +++++++++++++++++++++++++++++++--- + 1 file changed, 31 insertions(+), 3 deletions(-) + +diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c +index be55f94..1ee3afe 100644 +--- a/src/journal/journald-console.c ++++ b/src/journal/journald-console.c +@@ -19,13 +19,30 @@ + along with systemd; If not, see . + ***/ + ++#include + #include + #include + #include + ++#include "fileio.h" + #include "journald-server.h" + #include "journald-console.h" + ++static bool prefix_timestamp(void) { ++ ++ static int cached_printk_time = -1; ++ ++ if (_unlikely_(cached_printk_time < 0)) { ++ _cleanup_free_ char *p = NULL; ++ ++ cached_printk_time = ++ read_one_line_file("/sys/module/printk/parameters/time", &p) >= 0 ++ && parse_boolean(p) > 0; ++ } ++ ++ return cached_printk_time; ++} ++ + void server_forward_console( + Server *s, + int priority, +@@ -33,8 +50,10 @@ void server_forward_console( + const char *message, + struct ucred *ucred) { + +- struct iovec iovec[4]; ++ struct iovec iovec[5]; + char header_pid[16]; ++ struct timespec ts; ++ char tbuf[4 + DECIMAL_STR_MAX(ts.tv_sec) + DECIMAL_STR_MAX(ts.tv_nsec)-3 + 1]; + int n = 0, fd; + char *ident_buf = NULL; + const char *tty; +@@ -45,7 +64,16 @@ void server_forward_console( + if (LOG_PRI(priority) > s->max_level_console) + return; + +- /* First: identifier and PID */ ++ /* First: timestamp */ ++ if (prefix_timestamp()) { ++ assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0); ++ snprintf(tbuf, sizeof(tbuf), "[%5llu.%06llu] ", ++ (unsigned long long) ts.tv_sec, ++ (unsigned long long) ts.tv_nsec / 1000); ++ IOVEC_SET_STRING(iovec[n++], tbuf); ++ } ++ ++ /* Second: identifier and PID */ + if (ucred) { + if (!identifier) { + get_process_comm(ucred->pid, &ident_buf); +@@ -64,7 +92,7 @@ void server_forward_console( + IOVEC_SET_STRING(iovec[n++], ": "); + } + +- /* Third: message */ ++ /* Fourth: message */ + IOVEC_SET_STRING(iovec[n++], message); + IOVEC_SET_STRING(iovec[n++], "\n"); + diff --git a/0099-man-add-bootctl-8.patch b/0099-man-add-bootctl-8.patch new file mode 100644 index 0000000..6041d2a --- /dev/null +++ b/0099-man-add-bootctl-8.patch @@ -0,0 +1,163 @@ +From 30712bf9c2baefc73ce110854c40be354a60bd78 Mon Sep 17 00:00:00 2001 +From: Marko Myllynen +Date: Wed, 13 Nov 2013 11:06:13 +0200 +Subject: [PATCH] man: add bootctl(8) + +https://bugzilla.redhat.com/show_bug.cgi?id=1014303 +--- + Makefile-man.am | 9 ++++ + man/bootctl.xml | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 134 insertions(+) + create mode 100644 man/bootctl.xml + +diff --git a/Makefile-man.am b/Makefile-man.am +index b8c8acc..3f626e8 100644 +--- a/Makefile-man.am ++++ b/Makefile-man.am +@@ -650,6 +650,15 @@ MANPAGES_ALIAS += \ + + endif + ++if ENABLE_EFI ++MANPAGES += \ ++ man/bootctl.1 ++MANPAGES_ALIAS += \ ++ # ++ ++ ++endif ++ + if ENABLE_HOSTNAMED + MANPAGES += \ + man/hostnamectl.1 \ +diff --git a/man/bootctl.xml b/man/bootctl.xml +new file mode 100644 +index 0000000..28f1b92 +--- /dev/null ++++ b/man/bootctl.xml +@@ -0,0 +1,125 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ bootctl ++ systemd ++ ++ ++ ++ Developer ++ Kay ++ Sievers ++ kay@vrfy.org ++ ++ ++ ++ ++ ++ bootctl ++ 1 ++ ++ ++ ++ bootctl ++ Control the firmware and boot manager settings ++ ++ ++ ++ ++ bootctl ++ OPTIONS ++ COMMAND ++ ++ ++ ++ ++ Description ++ ++ bootctl may be used to ++ query or (in the future) change the firmware and boot ++ manager settings. ++ ++ Firmware information is available only on EFI ++ systems. ++ ++ Currently, only the gummiboot8 boot ++ manager implements the required boot loader interface ++ to provide complete boot manager information. ++ ++ ++ ++ Options ++ ++ The following options are understood: ++ ++ ++ ++ ++ ++ ++ Prints a short help ++ text and exits. ++ ++ ++ ++ ++ ++ Prints a short version ++ string and exits. ++ ++ ++ ++ The following commands are understood: ++ ++ ++ ++ status ++ ++ Show firmware and boot ++ manager information about the system, ++ including secure boot mode status and ++ selected firmware entry (where ++ available). ++ ++ ++ ++ ++ ++ ++ Exit status ++ ++ On success, 0 is returned, a non-zero failure ++ code otherwise. ++ ++ ++ ++ See Also ++ ++ Boot loader interface, ++ Boot loader specification, ++ gummiboot ++ ++ ++ ++ diff --git a/0100-zsh-completion-add-bootctl.patch b/0100-zsh-completion-add-bootctl.patch new file mode 100644 index 0000000..b1d20d7 --- /dev/null +++ b/0100-zsh-completion-add-bootctl.patch @@ -0,0 +1,57 @@ +From 99f96571a3a7667ab6f3a46944c267bcc7c980e6 Mon Sep 17 00:00:00 2001 +From: Marko Myllynen +Date: Wed, 13 Nov 2013 23:02:23 -0500 +Subject: [PATCH] zsh-completion: add bootctl + +--- + Makefile.am | 4 ++++ + shell-completion/zsh/_bootctl | 25 +++++++++++++++++++++++++ + 2 files changed, 29 insertions(+) + create mode 100644 shell-completion/zsh/_bootctl + +diff --git a/Makefile.am b/Makefile.am +index b4fc33b..efe5aa3 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1743,6 +1743,10 @@ bootctl_LDADD = \ + + bin_PROGRAMS += \ + bootctl ++ ++dist_zshcompletion_DATA += \ ++ shell-completion/zsh/_bootctl ++ + endif + + # ------------------------------------------------------------------------------ +diff --git a/shell-completion/zsh/_bootctl b/shell-completion/zsh/_bootctl +new file mode 100644 +index 0000000..7d2453c +--- /dev/null ++++ b/shell-completion/zsh/_bootctl +@@ -0,0 +1,25 @@ ++#compdef bootctl ++ ++(( $+functions[_bootctl_command] )) || _bootctl_command() ++{ ++ local -a _bootctl_cmds ++ _bootctl_cmds=( ++ "status:Show current firmware and boot settings" ++ ) ++ if (( CURRENT == 1 )); then ++ _describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@" ++ else ++ local curcontext="$curcontext" ++ cmd="${${_bootctl_cmds[(r)$words[1]:*]%%:*}}" ++ if (( $+functions[_bootctl_$cmd] )); then ++ _bootctl_$cmd ++ else ++ _message "no more options" ++ fi ++ fi ++} ++ ++_arguments \ ++ {-h,--help}'[Prints a short help text and exits.]' \ ++ '--version[Prints a short version string and exits.]' \ ++ '*::bootctl command:_bootctl_command' diff --git a/0101-Resolve-dev-console-to-the-active-tty-instead-of-jus.patch b/0101-Resolve-dev-console-to-the-active-tty-instead-of-jus.patch new file mode 100644 index 0000000..39f7887 --- /dev/null +++ b/0101-Resolve-dev-console-to-the-active-tty-instead-of-jus.patch @@ -0,0 +1,33 @@ +From b5f796a636fed8b75fcfbb44f48b808743fca964 Mon Sep 17 00:00:00 2001 +From: Olivier Brunel +Date: Fri, 20 Sep 2013 22:18:28 +0200 +Subject: [PATCH] Resolve /dev/console to the active tty instead of just "tty0" + +When resolving /dev/console one would often get "tty0" meaning the active VT. +Resolving to the actual tty (e.g. "tty1") will notably help on boot when +determining whether or not PID1 can output to the console. +--- + src/shared/util.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/shared/util.c b/src/shared/util.c +index 6c88040..3fc080a 100644 +--- a/src/shared/util.c ++++ b/src/shared/util.c +@@ -3621,6 +3621,16 @@ char *resolve_dev_console(char **active) { + else + tty = *active; + ++ if (streq(tty, "tty0")) { ++ char *tmp; ++ ++ /* Get the active VC (e.g. tty1) */ ++ if (read_one_line_file("/sys/class/tty/tty0/active", &tmp) >= 0) { ++ free(*active); ++ tty = *active = tmp; ++ } ++ } ++ + return tty; + } + diff --git a/0102-Only-disable-output-on-console-during-boot-if-needed.patch b/0102-Only-disable-output-on-console-during-boot-if-needed.patch new file mode 100644 index 0000000..7f32abe --- /dev/null +++ b/0102-Only-disable-output-on-console-during-boot-if-needed.patch @@ -0,0 +1,37 @@ +From 00fac3c4c2ef02d5f0056a47a2ae29b048ed4d74 Mon Sep 17 00:00:00 2001 +From: Olivier Brunel +Date: Fri, 20 Sep 2013 22:18:29 +0200 +Subject: [PATCH] Only disable output on console during boot if needed + +If there are no more jobs on console, no need/we shouldn't disable output. +--- + src/core/manager.c | 2 +- + src/core/unit.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/manager.c b/src/core/manager.c +index 58dacdc..ce32baf 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -1761,7 +1761,7 @@ static int process_event(Manager *m, struct epoll_event *ev) { + } + + case WATCH_IDLE_PIPE: { +- m->no_console_output = true; ++ m->no_console_output = m->n_on_console > 0; + + manager_unwatch_idle_pipe(m); + close_idle_pipe(m); +diff --git a/src/core/unit.c b/src/core/unit.c +index 1db7d06..717ce84 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -1454,7 +1454,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su + + if (m->n_on_console == 0) + /* unset no_console_output flag, since the console is free */ +- m->no_console_output = 0; ++ m->no_console_output = false; + } else + m->n_on_console ++; + } diff --git a/0103-Fix-possible-lack-of-status-messages-on-shutdown-reb.patch b/0103-Fix-possible-lack-of-status-messages-on-shutdown-reb.patch new file mode 100644 index 0000000..1bf6f9c --- /dev/null +++ b/0103-Fix-possible-lack-of-status-messages-on-shutdown-reb.patch @@ -0,0 +1,26 @@ +From 4131de47cae7e769b6cabb4894830efd3476fc0b Mon Sep 17 00:00:00 2001 +From: Olivier Brunel +Date: Fri, 20 Sep 2013 22:18:30 +0200 +Subject: [PATCH] Fix possible lack of status messages on shutdown/reboot + +Since 31a7eb86 the output on console can be disabled to avoid colliding with +gettys. However, it could also lead to a lack of messages during +shutdown/reboot. +--- + src/core/job.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/core/job.c b/src/core/job.c +index bf1d956..dc3bc12 100644 +--- a/src/core/job.c ++++ b/src/core/job.c +@@ -1097,6 +1097,9 @@ void job_shutdown_magic(Job *j) { + if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET)) + return; + ++ /* In case messages on console has been disabled on boot */ ++ j->unit->manager->no_console_output = false; ++ + if (detect_container(NULL) > 0) + return; + diff --git a/0104-fsck-modernization.patch b/0104-fsck-modernization.patch new file mode 100644 index 0000000..2af6795 --- /dev/null +++ b/0104-fsck-modernization.patch @@ -0,0 +1,137 @@ +From ed1c300e6bd7d27d3dde228a3bb0f73fe8e00ca6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 11 Nov 2013 23:32:31 -0500 +Subject: [PATCH] fsck: modernization + +--- + src/fsck/fsck.c | 43 ++++++++++++++++++------------------------- + 1 file changed, 18 insertions(+), 25 deletions(-) + +diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c +index f298cf7..e23ddc5 100644 +--- a/src/fsck/fsck.c ++++ b/src/fsck/fsck.c +@@ -175,7 +175,7 @@ static double percent(int pass, unsigned long cur, unsigned long max) { + } + + static int process_progress(int fd) { +- FILE *f, *console; ++ _cleanup_fclose_ FILE *console = NULL, *f = NULL; + usec_t last = 0; + bool locked = false; + int clear = 0; +@@ -187,15 +187,13 @@ static int process_progress(int fd) { + } + + console = fopen("/dev/console", "w"); +- if (!console) { +- fclose(f); ++ if (!console) + return -ENOMEM; +- } + + while (!feof(f)) { + int pass, m; + unsigned long cur, max; +- char *device; ++ _cleanup_free_ char *device = NULL; + double p; + usec_t t; + +@@ -204,20 +202,16 @@ static int process_progress(int fd) { + + /* Only show one progress counter at max */ + if (!locked) { +- if (flock(fileno(console), LOCK_EX|LOCK_NB) < 0) { +- free(device); ++ if (flock(fileno(console), LOCK_EX|LOCK_NB) < 0) + continue; +- } + + locked = true; + } + + /* Only update once every 50ms */ + t = now(CLOCK_MONOTONIC); +- if (last + 50 * USEC_PER_MSEC > t) { +- free(device); ++ if (last + 50 * USEC_PER_MSEC > t) + continue; +- } + + last = t; + +@@ -225,8 +219,6 @@ static int process_progress(int fd) { + fprintf(console, "\r%s: fsck %3.1f%% complete...\r%n", device, p, &m); + fflush(console); + +- free(device); +- + if (m > clear) + clear = m; + } +@@ -241,8 +233,6 @@ static int process_progress(int fd) { + fflush(console); + } + +- fclose(f); +- fclose(console); + return 0; + } + +@@ -286,34 +276,37 @@ int main(int argc, char *argv[]) { + + if (stat("/", &st) < 0) { + log_error("Failed to stat() the root directory: %m"); +- goto finish; ++ return EXIT_FAILURE; + } + + /* Virtual root devices don't need an fsck */ + if (major(st.st_dev) == 0) +- return 0; ++ return EXIT_SUCCESS; + + /* check if we are already writable */ + times[0] = st.st_atim; + times[1] = st.st_mtim; + if (utimensat(AT_FDCWD, "/", times, 0) == 0) { + log_info("Root directory is writable, skipping check."); +- return 0; ++ return EXIT_SUCCESS; + } + +- if (!(udev = udev_new())) { ++ udev = udev_new(); ++ if (!udev) { + log_oom(); +- goto finish; ++ return EXIT_FAILURE; + } + +- if (!(udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev))) { ++ udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev); ++ if (!udev_device) { + log_error("Failed to detect root device."); +- goto finish; ++ return EXIT_FAILURE; + } + +- if (!(device = udev_device_get_devnode(udev_device))) { ++ device = udev_device_get_devnode(udev_device); ++ if (!device) { + log_error("Failed to detect device node of root directory."); +- goto finish; ++ return EXIT_FAILURE; + } + + root_directory = true; +@@ -322,7 +315,7 @@ int main(int argc, char *argv[]) { + if (arg_show_progress) + if (pipe(progress_pipe) < 0) { + log_error("pipe(): %m"); +- goto finish; ++ return EXIT_FAILURE; + } + + cmdline[i++] = "/sbin/fsck"; diff --git a/0105-Introduce-udev-object-cleanup-functions.patch b/0105-Introduce-udev-object-cleanup-functions.patch new file mode 100644 index 0000000..4a1259c --- /dev/null +++ b/0105-Introduce-udev-object-cleanup-functions.patch @@ -0,0 +1,1040 @@ +From 48ee0228ec2bcfcb48866b717ac8a5a8dbbd506e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sat, 12 Oct 2013 20:28:21 -0400 +Subject: [PATCH] Introduce udev object cleanup functions + +Conflicts: + src/gpt-auto-generator/gpt-auto-generator.c <-- skipped + src/shared/fdset.h + src/shared/util.h +--- + Makefile.am | 1 + + src/backlight/backlight.c | 55 ++++++--------- + src/core/umount.c | 143 ++++++++++++++------------------------- + src/cryptsetup/cryptsetup.c | 27 +++----- + src/fsck/fsck.c | 13 ++-- + src/journal/journal-internal.h | 7 +- + src/login/sysfs-show.c | 22 ++---- + src/readahead/readahead-common.c | 66 +++++++----------- + src/shared/fdset.h | 3 + + src/shared/install.c | 6 +- + src/shared/set.h | 10 +-- + src/shared/strv.h | 7 +- + src/shared/udev-util.h | 37 ++++++++++ + src/shared/util.h | 32 ++++----- + src/test/test-libudev.c | 8 +-- + src/test/test-udev.c | 21 +++--- + src/tmpfiles/tmpfiles.c | 5 +- + 17 files changed, 194 insertions(+), 269 deletions(-) + create mode 100644 src/shared/udev-util.h + +diff --git a/Makefile.am b/Makefile.am +index efe5aa3..910e780 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -648,6 +648,7 @@ libsystemd_shared_la_SOURCES = \ + src/shared/sparse-endian.h \ + src/shared/util.c \ + src/shared/util.h \ ++ src/shared/udev-util.h \ + src/shared/virt.c \ + src/shared/virt.h \ + src/shared/efivars.c \ +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index f22deed..c45b2d0 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -19,15 +19,15 @@ + along with systemd; If not, see . + ***/ + +-#include +- + #include "util.h" + #include "mkdir.h" + #include "fileio.h" ++#include "libudev.h" ++#include "udev-util.h" + + int main(int argc, char *argv[]) { +- struct udev *udev = NULL; +- struct udev_device *device = NULL; ++ _cleanup_udev_unref_ struct udev *udev = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *device = NULL; + _cleanup_free_ char *saved = NULL; + int r; + +@@ -45,13 +45,13 @@ int main(int argc, char *argv[]) { + r = mkdir_p("/var/lib/systemd/backlight", 0755); + if (r < 0) { + log_error("Failed to create backlight directory: %s", strerror(-r)); +- goto finish; ++ return EXIT_FAILURE; + } + + udev = udev_new(); + if (!udev) { +- r = log_oom(); +- goto finish; ++ log_oom(); ++ return EXIT_FAILURE; + } + + errno = 0; +@@ -59,26 +59,24 @@ int main(int argc, char *argv[]) { + if (!device) + device = udev_device_new_from_subsystem_sysname(udev, "leds", argv[2]); + if (!device) { +- if (errno != 0) { ++ if (errno != 0) + log_error("Failed to get backlight device '%s': %m", argv[2]); +- r = -errno; +- } else ++ else + r = log_oom(); + +- goto finish; ++ return EXIT_FAILURE; + } + + 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; ++ return EXIT_FAILURE; + } + + saved = strappend("/var/lib/systemd/backlight/", udev_device_get_sysname(device)); + if (!saved) { +- r = log_oom(); +- goto finish; ++ log_oom(); ++ return EXIT_FAILURE; + } + + if (streq(argv[1], "load")) { +@@ -87,19 +85,17 @@ int main(int argc, char *argv[]) { + r = read_one_line_file(saved, &value); + if (r < 0) { + +- if (r == -ENOENT) { +- r = 0; +- goto finish; +- } ++ if (r == -ENOENT) ++ return EXIT_SUCCESS; + + log_error("Failed to read %s: %s", saved, strerror(-r)); +- goto finish; ++ return EXIT_FAILURE; + } + + r = udev_device_set_sysattr_value(device, "brightness", value); + if (r < 0) { + log_error("Failed to write system attribute: %s", strerror(-r)); +- goto finish; ++ return EXIT_FAILURE; + } + + } else if (streq(argv[1], "save")) { +@@ -108,28 +104,19 @@ int main(int argc, char *argv[]) { + value = udev_device_get_sysattr_value(device, "brightness"); + if (!value) { + log_error("Failed to read system attribute: %s", strerror(-r)); +- goto finish; ++ return EXIT_FAILURE; + } + + r = write_string_file(saved, value); + if (r < 0) { + log_error("Failed to write %s: %s", saved, strerror(-r)); +- goto finish; ++ return EXIT_FAILURE; + } + + } else { + log_error("Unknown verb %s.", argv[1]); +- r = -EINVAL; +- goto finish; ++ return EXIT_FAILURE; + } + +-finish: +- if (device) +- udev_device_unref(device); +- +- if (udev) +- udev_unref(udev); +- +- return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; +- ++ return EXIT_SUCCESS; + } +diff --git a/src/core/umount.c b/src/core/umount.c +index 1e95ad7..99dbe27 100644 +--- a/src/core/umount.c ++++ b/src/core/umount.c +@@ -27,7 +27,6 @@ + #include + #include + #include +-#include + + #include "list.h" + #include "mount-setup.h" +@@ -35,6 +34,8 @@ + #include "path-util.h" + #include "util.h" + #include "virt.h" ++#include "libudev.h" ++#include "udev-util.h" + + typedef struct MountPoint { + char *path; +@@ -201,145 +202,108 @@ finish: + } + + static int loopback_list_get(MountPoint **head) { +- int r; +- struct udev *udev; +- struct udev_enumerate *e = NULL; ++ _cleanup_udev_unref_ struct udev *udev; ++ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; + struct udev_list_entry *item = NULL, *first = NULL; + + assert(head); + +- if (!(udev = udev_new())) { +- r = -ENOMEM; +- goto finish; +- } ++ udev = udev_new(); ++ if (!udev) ++ return -ENOMEM; + +- if (!(e = udev_enumerate_new(udev))) { +- r = -ENOMEM; +- goto finish; +- } ++ e = udev_enumerate_new(udev); ++ if (!e) ++ return -ENOMEM; + + if (udev_enumerate_add_match_subsystem(e, "block") < 0 || + udev_enumerate_add_match_sysname(e, "loop*") < 0 || +- udev_enumerate_add_match_sysattr(e, "loop/backing_file", NULL) < 0) { +- r = -EIO; +- goto finish; +- } ++ udev_enumerate_add_match_sysattr(e, "loop/backing_file", NULL) < 0) ++ return -EIO; + +- if (udev_enumerate_scan_devices(e) < 0) { +- r = -EIO; +- goto finish; +- } ++ if (udev_enumerate_scan_devices(e) < 0) ++ return -EIO; + + first = udev_enumerate_get_list_entry(e); + udev_list_entry_foreach(item, first) { + MountPoint *lb; +- struct udev_device *d; ++ _cleanup_udev_device_unref_ struct udev_device *d; + char *loop; + const char *dn; + +- if (!(d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)))) { +- r = -ENOMEM; +- goto finish; +- } ++ d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); ++ if (!d) ++ return -ENOMEM; + +- if (!(dn = udev_device_get_devnode(d))) { +- udev_device_unref(d); ++ dn = udev_device_get_devnode(d); ++ if (!dn) + continue; +- } + + loop = strdup(dn); +- udev_device_unref(d); +- +- if (!loop) { +- r = -ENOMEM; +- goto finish; +- } ++ if (!loop) ++ return -ENOMEM; + +- if (!(lb = new0(MountPoint, 1))) { ++ lb = new0(MountPoint, 1); ++ if (!lb) { + free(loop); +- r = -ENOMEM; +- goto finish; ++ return -ENOMEM; + } + + lb->path = loop; + LIST_PREPEND(MountPoint, mount_point, *head, lb); + } + +- r = 0; +- +-finish: +- if (e) +- udev_enumerate_unref(e); +- +- if (udev) +- udev_unref(udev); +- +- return r; ++ return 0; + } + + static int dm_list_get(MountPoint **head) { +- int r; +- struct udev *udev; +- struct udev_enumerate *e = NULL; ++ _cleanup_udev_unref_ struct udev *udev; ++ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; + struct udev_list_entry *item = NULL, *first = NULL; + + assert(head); + +- if (!(udev = udev_new())) { +- r = -ENOMEM; +- goto finish; +- } ++ udev = udev_new(); ++ if (!udev) ++ return -ENOMEM; + +- if (!(e = udev_enumerate_new(udev))) { +- r = -ENOMEM; +- goto finish; +- } ++ e = udev_enumerate_new(udev); ++ if (!e) ++ return -ENOMEM; + + if (udev_enumerate_add_match_subsystem(e, "block") < 0 || +- udev_enumerate_add_match_sysname(e, "dm-*") < 0) { +- r = -EIO; +- goto finish; +- } ++ udev_enumerate_add_match_sysname(e, "dm-*") < 0) ++ return -EIO; + +- if (udev_enumerate_scan_devices(e) < 0) { +- r = -EIO; +- goto finish; +- } ++ if (udev_enumerate_scan_devices(e) < 0) ++ return -EIO; + + first = udev_enumerate_get_list_entry(e); + + udev_list_entry_foreach(item, first) { + MountPoint *m; +- struct udev_device *d; ++ _cleanup_udev_device_unref_ struct udev_device *d; + dev_t devnum; + char *node; + const char *dn; + +- if (!(d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)))) { +- r = -ENOMEM; +- goto finish; +- } ++ d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); ++ if (!d) ++ return -ENOMEM; + + devnum = udev_device_get_devnum(d); + dn = udev_device_get_devnode(d); +- +- if (major(devnum) == 0 || !dn) { +- udev_device_unref(d); ++ if (major(devnum) == 0 || !dn) + continue; +- } + + node = strdup(dn); +- udev_device_unref(d); +- +- if (!node) { +- r = -ENOMEM; +- goto finish; +- } ++ if (!node) ++ return -ENOMEM; + +- if (!(m = new(MountPoint, 1))) { ++ m = new(MountPoint, 1); ++ if (!m) { + free(node); +- r = -ENOMEM; +- goto finish; ++ return -ENOMEM; + } + + m->path = node; +@@ -347,16 +311,7 @@ static int dm_list_get(MountPoint **head) { + LIST_PREPEND(MountPoint, mount_point, *head, m); + } + +- r = 0; +- +-finish: +- if (e) +- udev_enumerate_unref(e); +- +- if (udev) +- udev_unref(udev); +- +- return r; ++ return 0; + } + + static int delete_loopback(const char *device) { +diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c +index 769c3e4..39f7db7 100644 +--- a/src/cryptsetup/cryptsetup.c ++++ b/src/cryptsetup/cryptsetup.c +@@ -25,7 +25,6 @@ + #include + + #include +-#include + + #include "fileio.h" + #include "log.h" +@@ -34,6 +33,8 @@ + #include "strv.h" + #include "ask-password-api.h" + #include "def.h" ++#include "libudev.h" ++#include "udev-util.h" + + static const char *opt_type = NULL; /* CRYPT_LUKS1, CRYPT_TCRYPT or CRYPT_PLAIN */ + static char *opt_cipher = NULL; +@@ -184,7 +185,7 @@ static void log_glue(int level, const char *msg, void *usrptr) { + log_debug("%s", msg); + } + +-static char *disk_description(const char *path) { ++static char* disk_description(const char *path) { + + static const char name_fields[] = { + "ID_PART_ENTRY_NAME\0" +@@ -193,10 +194,9 @@ static char *disk_description(const char *path) { + "ID_MODEL\0" + }; + +- struct udev *udev = NULL; +- struct udev_device *device = NULL; ++ _cleanup_udev_unref_ struct udev *udev = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *device = NULL; + struct stat st; +- char *description = NULL; + const char *i; + + assert(path); +@@ -213,26 +213,17 @@ static char *disk_description(const char *path) { + + device = udev_device_new_from_devnum(udev, 'b', st.st_rdev); + if (!device) +- goto finish; ++ return NULL; + + NULSTR_FOREACH(i, name_fields) { + const char *name; + + name = udev_device_get_property_value(device, i); +- if (!isempty(name)) { +- description = strdup(name); +- break; +- } ++ if (!isempty(name)) ++ return strdup(name); + } + +-finish: +- if (device) +- udev_device_unref(device); +- +- if (udev) +- udev_unref(udev); +- +- return description; ++ return NULL; + } + + static char *disk_mount_point(const char *label) { +diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c +index e23ddc5..9b4e555 100644 +--- a/src/fsck/fsck.c ++++ b/src/fsck/fsck.c +@@ -27,7 +27,6 @@ + #include + #include + +-#include + #include + + #include "util.h" +@@ -36,6 +35,8 @@ + #include "bus-errors.h" + #include "virt.h" + #include "fileio.h" ++#include "libudev.h" ++#include "udev-util.h" + + static bool arg_skip = false; + static bool arg_force = false; +@@ -241,8 +242,8 @@ int main(int argc, char *argv[]) { + int i = 0, r = EXIT_FAILURE, q; + pid_t pid; + siginfo_t status; +- struct udev *udev = NULL; +- struct udev_device *udev_device = NULL; ++ _cleanup_udev_unref_ struct udev *udev = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL; + const char *device; + bool root_directory; + int progress_pipe[2] = { -1, -1 }; +@@ -393,12 +394,6 @@ int main(int argc, char *argv[]) { + touch("/run/systemd/quotacheck"); + + finish: +- if (udev_device) +- udev_device_unref(udev_device); +- +- if (udev) +- udev_unref(udev); +- + close_pipe(progress_pipe); + + return r; +diff --git a/src/journal/journal-internal.h b/src/journal/journal-internal.h +index 5bc6535..1bc912c 100644 +--- a/src/journal/journal-internal.h ++++ b/src/journal/journal-internal.h +@@ -135,11 +135,8 @@ struct sd_journal { + char *journal_make_match_string(sd_journal *j); + void journal_print_header(sd_journal *j); + +-static inline void journal_closep(sd_journal **j) { +- sd_journal_close(*j); +-} +- +-#define _cleanup_journal_close_ _cleanup_(journal_closep) ++define_trivial_cleanup_func(sd_journal*, sd_journal_close) ++#define _cleanup_journal_close_ _cleanup_(sd_journal_closep) + + #define JOURNAL_FOREACH_DATA_RETVAL(j, data, l, retval) \ + for (sd_journal_restart_data(j); ((retval) = sd_journal_enumerate_data((j), &(data), &(l))) > 0; ) +diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c +index 3c03bd1..7c1adfa 100644 +--- a/src/login/sysfs-show.c ++++ b/src/login/sysfs-show.c +@@ -26,6 +26,7 @@ + #include "util.h" + #include "sysfs-show.h" + #include "path-util.h" ++#include "udev-util.h" + + static int show_sysfs_one( + struct udev *udev, +@@ -143,9 +144,9 @@ static int show_sysfs_one( + } + + int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) { +- struct udev *udev; ++ _cleanup_udev_unref_ struct udev *udev; ++ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; + struct udev_list_entry *first = NULL; +- struct udev_enumerate *e; + int r; + + if (n_columns <= 0) +@@ -162,10 +163,8 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) { + return -ENOMEM; + + e = udev_enumerate_new(udev); +- if (!e) { +- r = -ENOMEM; +- goto finish; +- } ++ if (!e) ++ return ENOMEM; + + if (!streq(seat, "seat0")) + r = udev_enumerate_add_match_tag(e, seat); +@@ -173,22 +172,15 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns) { + r = udev_enumerate_add_match_tag(e, "seat"); + + if (r < 0) +- goto finish; ++ return r; + + r = udev_enumerate_scan_devices(e); + if (r < 0) +- goto finish; ++ return r; + + first = udev_enumerate_get_list_entry(e); + if (first) + show_sysfs_one(udev, seat, &first, "/", prefix, n_columns); + +-finish: +- if (e) +- udev_enumerate_unref(e); +- +- if (udev) +- udev_unref(udev); +- + return r; + } +diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c +index a234a89..aea1fbe 100644 +--- a/src/readahead/readahead-common.c ++++ b/src/readahead/readahead-common.c +@@ -27,13 +27,14 @@ + #include + #include + #include +-#include + + #include "log.h" + #include "readahead-common.h" + #include "util.h" + #include "missing.h" + #include "fileio.h" ++#include "libudev.h" ++#include "udev-util.h" + + int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st) { + assert(fd >= 0); +@@ -60,9 +61,9 @@ int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st) { + + int fs_on_ssd(const char *p) { + struct stat st; +- struct udev *udev = NULL; +- struct udev_device *udev_device = NULL, *look_at = NULL; +- bool b = false; ++ _cleanup_udev_unref_ struct udev *udev = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL; ++ struct udev_device *look_at = NULL; + const char *devtype, *rotational, *model, *id; + int r; + +@@ -128,7 +129,7 @@ int fs_on_ssd(const char *p) { + + udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev); + if (!udev_device) +- goto finish; ++ return false; + + devtype = udev_device_get_property_value(udev_device, "DEVTYPE"); + if (devtype && streq(devtype, "partition")) +@@ -137,46 +138,34 @@ int fs_on_ssd(const char *p) { + look_at = udev_device; + + if (!look_at) +- goto finish; ++ return false; + + /* First, try high-level property */ + id = udev_device_get_property_value(look_at, "ID_SSD"); +- if (id) { +- b = streq(id, "1"); +- goto finish; +- } ++ if (id) ++ return streq(id, "1"); + + /* Second, try kernel attribute */ + rotational = udev_device_get_sysattr_value(look_at, "queue/rotational"); +- if (rotational) { +- b = streq(rotational, "0"); +- goto finish; +- } ++ if (rotational) ++ return streq(rotational, "0"); + + /* Finally, fallback to heuristics */ + look_at = udev_device_get_parent(look_at); + if (!look_at) +- goto finish; ++ return false; + + model = udev_device_get_sysattr_value(look_at, "model"); + if (model) +- b = !!strstr(model, "SSD"); +- +-finish: +- if (udev_device) +- udev_device_unref(udev_device); +- +- if (udev) +- udev_unref(udev); ++ return !!strstr(model, "SSD"); + +- return b; ++ return false; + } + + int fs_on_read_only(const char *p) { + struct stat st; +- struct udev *udev = NULL; +- struct udev_device *udev_device = NULL; +- bool b = false; ++ _cleanup_udev_unref_ struct udev *udev = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL; + const char *read_only; + + assert(p); +@@ -187,24 +176,19 @@ int fs_on_read_only(const char *p) { + if (major(st.st_dev) == 0) + return false; + +- if (!(udev = udev_new())) ++ udev = udev_new(); ++ if (!udev) + return -ENOMEM; + +- if (!(udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev))) +- goto finish; +- +- if ((read_only = udev_device_get_sysattr_value(udev_device, "ro"))) +- if ((b = streq(read_only, "1"))) +- goto finish; +- +-finish: +- if (udev_device) +- udev_device_unref(udev_device); ++ udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev); ++ if (!udev_device) ++ return false; + +- if (udev) +- udev_unref(udev); ++ read_only = udev_device_get_sysattr_value(udev_device, "ro"); ++ if (read_only) ++ return streq(read_only, "1"); + +- return b; ++ return false; + } + + bool enough_ram(void) { +diff --git a/src/shared/fdset.h b/src/shared/fdset.h +index a7bd5e2..d0dc875 100644 +--- a/src/shared/fdset.h ++++ b/src/shared/fdset.h +@@ -47,3 +47,6 @@ int fdset_iterate(FDSet *s, Iterator *i); + + #define FDSET_FOREACH(fd, fds, i) \ + for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i))) ++ ++define_trivial_cleanup_func(FDSet*, fdset_free) ++#define _cleanup_fdset_free_ _cleanup_(fdset_freep) +diff --git a/src/shared/install.c b/src/shared/install.c +index 9722ed4..b9c85b7 100644 +--- a/src/shared/install.c ++++ b/src/shared/install.c +@@ -44,10 +44,8 @@ typedef struct { + Hashmap *have_installed; + } InstallContext; + +-#define _cleanup_lookup_paths_free_ \ +- __attribute__((cleanup(lookup_paths_free))) +-#define _cleanup_install_context_done_ \ +- __attribute__((cleanup(install_context_done))) ++#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free) ++#define _cleanup_install_context_done_ _cleanup_(install_context_done) + + static int lookup_paths_init_from_scope(LookupPaths *paths, UnitFileScope scope) { + assert(paths); +diff --git a/src/shared/set.h b/src/shared/set.h +index e5d46e9..a291470 100644 +--- a/src/shared/set.h ++++ b/src/shared/set.h +@@ -28,19 +28,13 @@ + * for each set use. */ + + #include "hashmap.h" ++#include "util.h" + + typedef struct Set Set; + + Set *set_new(hash_func_t hash_func, compare_func_t compare_func); + void set_free(Set* s); +-static inline void set_freep(Set **s) { +- set_free(*s); +-} +- + void set_free_free(Set *s); +-static inline void set_free_freep(Set **s) { +- set_free_free(*s); +-} + + Set* set_copy(Set *s); + int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func); +@@ -79,5 +73,7 @@ char **set_get_strv(Set *s); + #define SET_FOREACH_BACKWARDS(e, s, i) \ + for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i))) + ++define_trivial_cleanup_func(Set*, set_free) ++define_trivial_cleanup_func(Set*, set_free_free) + #define _cleanup_set_free_ _cleanup_(set_freep) + #define _cleanup_set_free_free_ _cleanup_(set_free_freep) +diff --git a/src/shared/strv.h b/src/shared/strv.h +index d1f2a0e..4d117f8 100644 +--- a/src/shared/strv.h ++++ b/src/shared/strv.h +@@ -24,16 +24,13 @@ + #include + #include + +-#include "macro.h" ++#include "util.h" + + char *strv_find(char **l, const char *name) _pure_; + char *strv_find_prefix(char **l, const char *name) _pure_; + + void strv_free(char **l); +-static inline void strv_freep(char ***l) { +- strv_free(*l); +-} +- ++define_trivial_cleanup_func(char**, strv_free) + #define _cleanup_strv_free_ _cleanup_(strv_freep) + + char **strv_copy(char * const *l); +diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h +new file mode 100644 +index 0000000..bff8f5f +--- /dev/null ++++ b/src/shared/udev-util.h +@@ -0,0 +1,37 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++#pragma once ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2013 Zbigniew Jędrzejewski-Szmek ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include "udev.h" ++#include "util.h" ++ ++define_trivial_cleanup_func(struct udev*, udev_unref) ++define_trivial_cleanup_func(struct udev_device*, udev_device_unref) ++define_trivial_cleanup_func(struct udev_enumerate*, udev_enumerate_unref) ++define_trivial_cleanup_func(struct udev_event*, udev_event_unref) ++define_trivial_cleanup_func(struct udev_rules*, udev_rules_unref) ++ ++#define _cleanup_udev_unref_ _cleanup_(udev_unrefp) ++#define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp) ++#define _cleanup_udev_enumerate_unref_ _cleanup_(udev_enumerate_unrefp) ++#define _cleanup_udev_event_unref_ _cleanup_(udev_event_unrefp) ++#define _cleanup_udev_rules_unref_ _cleanup_(udev_rules_unrefp) +diff --git a/src/shared/util.h b/src/shared/util.h +index 222abe0..2c41765 100644 +--- a/src/shared/util.h ++++ b/src/shared/util.h +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include "macro.h" + #include "time-util.h" +@@ -554,37 +555,34 @@ static inline void freep(void *p) { + free(*(void**) p); + } + +-static inline void fclosep(FILE **f) { +- if (*f) +- fclose(*f); +-} +- +-static inline void pclosep(FILE **f) { +- if (*f) +- pclose(*f); +-} ++#define define_trivial_cleanup_func(type, func) \ ++ static inline void func##p(type *p) { \ ++ if (*p) \ ++ func(*p); \ ++ } \ + + static inline void closep(int *fd) { + if (*fd >= 0) + close_nointr_nofail(*fd); + } + +-static inline void closedirp(DIR **d) { +- if (*d) +- closedir(*d); +-} +- + static inline void umaskp(mode_t *u) { + umask(*u); + } + ++define_trivial_cleanup_func(FILE*, fclose) ++define_trivial_cleanup_func(FILE*, pclose) ++define_trivial_cleanup_func(DIR*, closedir) ++define_trivial_cleanup_func(FILE*, endmntent) ++ + #define _cleanup_free_ _cleanup_(freep) +-#define _cleanup_fclose_ _cleanup_(fclosep) +-#define _cleanup_pclose_ _cleanup_(pclosep) + #define _cleanup_close_ _cleanup_(closep) +-#define _cleanup_closedir_ _cleanup_(closedirp) + #define _cleanup_umask_ _cleanup_(umaskp) + #define _cleanup_globfree_ _cleanup_(globfree) ++#define _cleanup_fclose_ _cleanup_(fclosep) ++#define _cleanup_pclose_ _cleanup_(pclosep) ++#define _cleanup_closedir_ _cleanup_(closedirp) ++#define _cleanup_endmntent_ _cleanup_(endmntentp) + + _malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) { + if (_unlikely_(b == 0 || a > ((size_t) -1) / b)) +diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c +index 716767b..ab7d5a9 100644 +--- a/src/test/test-libudev.c ++++ b/src/test/test-libudev.c +@@ -29,6 +29,7 @@ + #include + + #include "libudev.h" ++#include "udev-util.h" + #include "util.h" + + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +@@ -117,7 +118,7 @@ static void print_device(struct udev_device *device) + + static int test_device(struct udev *udev, const char *syspath) + { +- struct udev_device *device; ++ _cleanup_udev_device_unref_ struct udev_device *device; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); +@@ -126,13 +127,13 @@ static int test_device(struct udev *udev, const char *syspath) + return -1; + } + print_device(device); +- udev_device_unref(device); ++ + return 0; + } + + static int test_device_parents(struct udev *udev, const char *syspath) + { +- struct udev_device *device; ++ _cleanup_udev_device_unref_ struct udev_device *device; + struct udev_device *device_parent; + + printf("looking at device: %s\n", syspath); +@@ -153,7 +154,6 @@ static int test_device_parents(struct udev *udev, const char *syspath) + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); +- udev_device_unref(device); + + return 0; + } +diff --git a/src/test/test-udev.c b/src/test/test-udev.c +index 52b61b4..17825f1 100644 +--- a/src/test/test-udev.c ++++ b/src/test/test-udev.c +@@ -34,6 +34,7 @@ + + #include "missing.h" + #include "udev.h" ++#include "udev-util.h" + + void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, +@@ -82,10 +83,10 @@ out: + + int main(int argc, char *argv[]) + { +- struct udev *udev; +- struct udev_event *event = NULL; +- struct udev_device *dev = NULL; +- struct udev_rules *rules = NULL; ++ _cleanup_udev_unref_ struct udev *udev = NULL; ++ _cleanup_udev_event_unref_ struct udev_event *event = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *dev = NULL; ++ _cleanup_udev_rules_unref_ struct udev_rules *rules = NULL; + char syspath[UTIL_PATH_SIZE]; + const char *devpath; + const char *action; +@@ -98,7 +99,8 @@ int main(int argc, char *argv[]) + + udev = udev_new(); + if (udev == NULL) +- exit(EXIT_FAILURE); ++ return EXIT_FAILURE; ++ + log_debug("version %s\n", VERSION); + label_init("/dev"); + +@@ -160,12 +162,7 @@ int main(int argc, char *argv[]) + out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); +- udev_event_unref(event); +- udev_device_unref(dev); +- udev_rules_unref(rules); + label_finish(); +- udev_unref(udev); +- if (err != 0) +- return EXIT_FAILURE; +- return EXIT_SUCCESS; ++ ++ return err ? EXIT_FAILURE : EXIT_SUCCESS; + } +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 239e56b..7e873af 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -998,10 +998,7 @@ static void item_free(Item *i) { + free(i); + } + +-static inline void item_freep(Item **i) { +- if (*i) +- item_free(*i); +-} ++define_trivial_cleanup_func(Item*, item_free) + #define _cleanup_item_free_ _cleanup_(item_freep) + + static bool item_equal(Item *a, Item *b) { diff --git a/0106-util-allow-trailing-semicolons-on-define_trivial_cle.patch b/0106-util-allow-trailing-semicolons-on-define_trivial_cle.patch new file mode 100644 index 0000000..381c57c --- /dev/null +++ b/0106-util-allow-trailing-semicolons-on-define_trivial_cle.patch @@ -0,0 +1,493 @@ +From 925af552121e7028d432685948c2e061d86955e5 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 14 Oct 2013 04:59:26 +0200 +Subject: [PATCH] util: allow trailing semicolons on + define_trivial_cleanup_func lines + +Emacs C indenting really gets confused by these lines if they carry no +trailing semicolon, hence let's make this nicer for good old emacs. The +other macros which define functions already do this too, so let's copy +the scheme here. + +Also, let's use an uppercase name for the macro. So far our rough rule +was that macros that are totally not function-like (like this ones, +which define a function) are uppercase. (Well, admittedly it is a rough +rule only, for example function and variable decorators are all +lower-case SINCE THE CONSTANT YELLING IN THE SOURCES WOULD SUCK, and +also they at least got underscore prefixes.) Also, the macros that +define functions that we already have are all uppercase, so let's do the +same here... + +Conflicts: + src/gpt-auto-generator/gpt-auto-generator.c +--- + src/gpt-auto-generator/gpt-auto-generator.c | 157 ++++++++++------------------ + src/journal/journal-internal.h | 2 +- + src/shared/fdset.h | 2 +- + src/shared/set.h | 4 +- + src/shared/strv.h | 2 +- + src/shared/udev-util.h | 10 +- + src/shared/util.h | 19 ++-- + src/tmpfiles/tmpfiles.c | 2 +- + 8 files changed, 78 insertions(+), 120 deletions(-) + +diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c +index d2b4213..25440e7 100644 +--- a/src/gpt-auto-generator/gpt-auto-generator.c ++++ b/src/gpt-auto-generator/gpt-auto-generator.c +@@ -36,6 +36,7 @@ + #include "missing.h" + #include "sd-id128.h" + #include "libudev.h" ++#include "udev-util.h" + #include "special.h" + #include "unit-name.h" + #include "virt.h" +@@ -48,12 +49,12 @@ + * + */ + ++#define GPT_SWAP SD_ID128_MAKE(06,57,fd,6d,a4,ab,43,c4,84,e5,09,33,c8,4b,4f,4f) ++#define GPT_HOME SD_ID128_MAKE(93,3a,c7,e1,2e,b4,4f,13,b8,44,0e,14,e2,ae,f9,15) ++ + static const char *arg_dest = "/tmp"; + +-static inline void blkid_free_probep(blkid_probe *b) { +- if (*b) +- blkid_free_probe(*b); +-} ++DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe); + #define _cleanup_blkid_freep_probe_ _cleanup_(blkid_free_probep) + + static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr, char **fstype) { +@@ -113,13 +114,13 @@ static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr + + + if (fstype) { +- char *fst; +- + errno = 0; + r = blkid_probe_lookup_value(b, "TYPE", &v, NULL); + if (r != 0) + *fstype = NULL; + else { ++ char *fst; ++ + fst = strdup(v); + if (!fst) + return -ENOMEM; +@@ -181,7 +182,7 @@ static int add_swap(const char *path, const char *fstype) { + } + + static int add_home(const char *path, const char *fstype) { +- _cleanup_free_ char *unit = NULL, *lnk = NULL; ++ _cleanup_free_ char *unit = NULL, *lnk = NULL, *fsck = NULL; + _cleanup_fclose_ FILE *f = NULL; + + if (dir_is_empty("/home") <= 0) +@@ -199,19 +200,23 @@ static int add_home(const char *path, const char *fstype) { + return -errno; + } + ++ fsck = unit_name_from_path_instance("systemd-fsck", path, ".service"); ++ if (!fsck) ++ return log_oom(); ++ + fprintf(f, + "# Automatically generated by systemd-gpt-auto-generator\n\n" + "[Unit]\n" + "DefaultDependencies=no\n" +- "After=" SPECIAL_LOCAL_FS_PRE_TARGET "\n" ++ "Requires=%s\n" ++ "After=" SPECIAL_LOCAL_FS_PRE_TARGET " %s\n" + "Conflicts=" SPECIAL_UMOUNT_TARGET "\n" + "Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_LOCAL_FS_TARGET "\n\n" + "[Mount]\n" + "What=%s\n" + "Where=/home\n" +- "Type=%s\n" +- "FsckPassNo=2\n", +- path, fstype); ++ "Type=%s\n", ++ fsck, fsck, path, fstype); + + fflush(f); + if (ferror(f)) { +@@ -234,97 +239,80 @@ static int add_home(const char *path, const char *fstype) { + } + + static int enumerate_partitions(struct udev *udev, dev_t dev) { +- struct udev_enumerate *e = NULL; +- struct udev_device *parent = NULL, *d = NULL; ++ struct udev_device *parent = NULL; ++ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *d = NULL; + struct udev_list_entry *first, *item; + unsigned home_nr = (unsigned) -1; + _cleanup_free_ char *home = NULL, *home_fstype = NULL; + int r; + + e = udev_enumerate_new(udev); +- if (!e) { +- r = log_oom(); +- goto finish; +- } ++ if (!e) ++ return log_oom(); + + d = udev_device_new_from_devnum(udev, 'b', dev); +- if (!d) { +- r = log_oom(); +- goto finish; +- } ++ if (!d) ++ return log_oom(); + + parent = udev_device_get_parent(d); +- if (!parent) { +- r = log_oom(); +- goto finish; +- } ++ if (!parent) ++ return log_oom(); + + r = udev_enumerate_add_match_parent(e, parent); +- if (r < 0) { +- r = log_oom(); +- goto finish; +- } ++ if (r < 0) ++ return log_oom(); + + r = udev_enumerate_add_match_subsystem(e, "block"); +- if (r < 0) { +- r = log_oom(); +- goto finish; +- } ++ if (r < 0) ++ return log_oom(); + + r = udev_enumerate_scan_devices(e); + if (r < 0) { + log_error("Failed to enumerate partitions on /dev/block/%u:%u: %s", + major(dev), minor(dev), strerror(-r)); +- goto finish; ++ return r; + } + + first = udev_enumerate_get_list_entry(e); + udev_list_entry_foreach(item, first) { + _cleanup_free_ char *fstype = NULL; + const char *node = NULL; +- struct udev_device *q; ++ _cleanup_udev_device_unref_ struct udev_device *q; + sd_id128_t type_id; + unsigned nr; + + q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item)); +- if (!q) { +- r = log_oom(); +- goto finish; +- } ++ if (!q) ++ return log_oom(); + + if (udev_device_get_devnum(q) == udev_device_get_devnum(d)) +- goto skip; ++ continue; + + if (udev_device_get_devnum(q) == udev_device_get_devnum(parent)) +- goto skip; ++ continue; + + node = udev_device_get_devnode(q); +- if (!node) { +- r = log_oom(); +- goto finish; +- } ++ if (!node) ++ return log_oom(); + + r = verify_gpt_partition(node, &type_id, &nr, &fstype); + if (r < 0) { + log_error("Failed to verify GPT partition %s: %s", + node, strerror(-r)); +- udev_device_unref(q); +- goto finish; ++ return r; + } + if (r == 0) +- goto skip; ++ continue; + +- if (sd_id128_equal(type_id, SD_ID128_MAKE(06,57,fd,6d,a4,ab,43,c4,84,e5,09,33,c8,4b,4f,4f))) ++ if (sd_id128_equal(type_id, GPT_SWAP)) + add_swap(node, fstype); +- else if (sd_id128_equal(type_id, SD_ID128_MAKE(93,3a,c7,e1,2e,b4,4f,13,b8,44,0e,14,e2,ae,f9,15))) { +- ++ else if (sd_id128_equal(type_id, GPT_HOME)) { + if (!home || nr < home_nr) { + free(home); + home = strdup(node); +- if (!home) { +- r = log_oom(); +- goto finish; +- } ++ if (!home) ++ return log_oom(); + + home_nr = nr; + +@@ -333,27 +321,16 @@ static int enumerate_partitions(struct udev *udev, dev_t dev) { + fstype = NULL; + } + } +- +- skip: +- udev_device_unref(q); + } + + if (home && home_fstype) + add_home(home, home_fstype); + +-finish: +- if (d) +- udev_device_unref(d); +- +- if (e) +- udev_enumerate_unref(e); +- +- + return r; + } + + static int get_btrfs_block_device(const char *path, dev_t *dev) { +- struct btrfs_ioctl_fs_info_args fsi; ++ struct btrfs_ioctl_fs_info_args fsi = {}; + _cleanup_close_ int fd = -1; + uint64_t id; + +@@ -364,7 +341,6 @@ static int get_btrfs_block_device(const char *path, dev_t *dev) { + if (fd < 0) + return -errno; + +- zero(fsi); + if (ioctl(fd, BTRFS_IOC_FS_INFO, &fsi) < 0) + return -errno; + +@@ -373,12 +349,11 @@ static int get_btrfs_block_device(const char *path, dev_t *dev) { + return 0; + + for (id = 1; id <= fsi.max_id; id++) { +- struct btrfs_ioctl_dev_info_args di; ++ struct btrfs_ioctl_dev_info_args di = { ++ .devid = id, ++ }; + struct stat st; + +- zero(di); +- di.devid = id; +- + if (ioctl(fd, BTRFS_IOC_DEV_INFO, &di) < 0) { + if (errno == ENODEV) + continue; +@@ -427,44 +402,31 @@ static int get_block_device(const char *path, dev_t *dev) { + } + + static int devno_to_devnode(struct udev *udev, dev_t devno, char **ret) { +- struct udev_device *d = NULL; ++ _cleanup_udev_device_unref_ struct udev_device *d; + const char *t; + char *n; +- int r; + + d = udev_device_new_from_devnum(udev, 'b', devno); +- if (!d) { +- r = log_oom(); +- goto finish; +- } ++ if (!d) ++ return log_oom(); + + t = udev_device_get_devnode(d); +- if (!t) { +- r = -ENODEV; +- goto finish; +- } ++ if (!t) ++ return -ENODEV; + + n = strdup(t); +- if (!n) { +- r = -ENOMEM; +- goto finish; +- } ++ if (!n) ++ return -ENOMEM; + + *ret = n; +- r = 0; +- +-finish: +- if (d) +- udev_device_unref(d); +- +- return r; ++ return 0; + } + + int main(int argc, char *argv[]) { + _cleanup_free_ char *node = NULL; +- struct udev *udev = NULL; ++ _cleanup_udev_unref_ struct udev *udev = NULL; + dev_t devno; +- int r; ++ int r = 0; + + if (argc > 1 && argc != 4) { + log_error("This program takes three or no arguments."); +@@ -483,13 +445,11 @@ int main(int argc, char *argv[]) { + + 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; + } + +@@ -528,8 +488,5 @@ int main(int argc, char *argv[]) { + r = enumerate_partitions(udev, devno); + + finish: +- if (udev) +- udev_unref(udev); +- + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + } +diff --git a/src/journal/journal-internal.h b/src/journal/journal-internal.h +index 1bc912c..3355fca 100644 +--- a/src/journal/journal-internal.h ++++ b/src/journal/journal-internal.h +@@ -135,7 +135,7 @@ struct sd_journal { + char *journal_make_match_string(sd_journal *j); + void journal_print_header(sd_journal *j); + +-define_trivial_cleanup_func(sd_journal*, sd_journal_close) ++DEFINE_TRIVIAL_CLEANUP_FUNC(sd_journal*, sd_journal_close); + #define _cleanup_journal_close_ _cleanup_(sd_journal_closep) + + #define JOURNAL_FOREACH_DATA_RETVAL(j, data, l, retval) \ +diff --git a/src/shared/fdset.h b/src/shared/fdset.h +index d0dc875..b91b430 100644 +--- a/src/shared/fdset.h ++++ b/src/shared/fdset.h +@@ -48,5 +48,5 @@ int fdset_iterate(FDSet *s, Iterator *i); + #define FDSET_FOREACH(fd, fds, i) \ + for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i))) + +-define_trivial_cleanup_func(FDSet*, fdset_free) ++DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free); + #define _cleanup_fdset_free_ _cleanup_(fdset_freep) +diff --git a/src/shared/set.h b/src/shared/set.h +index a291470..5612478 100644 +--- a/src/shared/set.h ++++ b/src/shared/set.h +@@ -73,7 +73,7 @@ char **set_get_strv(Set *s); + #define SET_FOREACH_BACKWARDS(e, s, i) \ + for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i))) + +-define_trivial_cleanup_func(Set*, set_free) +-define_trivial_cleanup_func(Set*, set_free_free) ++DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free); ++DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free_free); + #define _cleanup_set_free_ _cleanup_(set_freep) + #define _cleanup_set_free_free_ _cleanup_(set_free_freep) +diff --git a/src/shared/strv.h b/src/shared/strv.h +index 4d117f8..f6fb033 100644 +--- a/src/shared/strv.h ++++ b/src/shared/strv.h +@@ -30,7 +30,7 @@ char *strv_find(char **l, const char *name) _pure_; + char *strv_find_prefix(char **l, const char *name) _pure_; + + void strv_free(char **l); +-define_trivial_cleanup_func(char**, strv_free) ++DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free); + #define _cleanup_strv_free_ _cleanup_(strv_freep) + + char **strv_copy(char * const *l); +diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h +index bff8f5f..27677af 100644 +--- a/src/shared/udev-util.h ++++ b/src/shared/udev-util.h +@@ -24,11 +24,11 @@ + #include "udev.h" + #include "util.h" + +-define_trivial_cleanup_func(struct udev*, udev_unref) +-define_trivial_cleanup_func(struct udev_device*, udev_device_unref) +-define_trivial_cleanup_func(struct udev_enumerate*, udev_enumerate_unref) +-define_trivial_cleanup_func(struct udev_event*, udev_event_unref) +-define_trivial_cleanup_func(struct udev_rules*, udev_rules_unref) ++DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev*, udev_unref); ++DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_device*, udev_device_unref); ++DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_enumerate*, udev_enumerate_unref); ++DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_unref); ++DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_rules*, udev_rules_unref); + + #define _cleanup_udev_unref_ _cleanup_(udev_unrefp) + #define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp) +diff --git a/src/shared/util.h b/src/shared/util.h +index 2c41765..bdbdca3 100644 +--- a/src/shared/util.h ++++ b/src/shared/util.h +@@ -555,11 +555,12 @@ static inline void freep(void *p) { + free(*(void**) p); + } + +-#define define_trivial_cleanup_func(type, func) \ +- static inline void func##p(type *p) { \ +- if (*p) \ +- func(*p); \ +- } \ ++#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \ ++ static inline void func##p(type *p) { \ ++ if (*p) \ ++ func(*p); \ ++ } \ ++ struct __useless_struct_to_allow_trailing_semicolon__ + + static inline void closep(int *fd) { + if (*fd >= 0) +@@ -570,10 +571,10 @@ static inline void umaskp(mode_t *u) { + umask(*u); + } + +-define_trivial_cleanup_func(FILE*, fclose) +-define_trivial_cleanup_func(FILE*, pclose) +-define_trivial_cleanup_func(DIR*, closedir) +-define_trivial_cleanup_func(FILE*, endmntent) ++DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, fclose); ++DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, pclose); ++DEFINE_TRIVIAL_CLEANUP_FUNC(DIR*, closedir); ++DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent); + + #define _cleanup_free_ _cleanup_(freep) + #define _cleanup_close_ _cleanup_(closep) +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 7e873af..e23847b 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -998,7 +998,7 @@ static void item_free(Item *i) { + free(i); + } + +-define_trivial_cleanup_func(Item*, item_free) ++DEFINE_TRIVIAL_CLEANUP_FUNC(Item*, item_free); + #define _cleanup_item_free_ _cleanup_(item_freep) + + static bool item_equal(Item *a, Item *b) { diff --git a/0107-fsck-fstab-generator-be-lenient-about-missing-fsck.-.patch b/0107-fsck-fstab-generator-be-lenient-about-missing-fsck.-.patch new file mode 100644 index 0000000..ce66f9e --- /dev/null +++ b/0107-fsck-fstab-generator-be-lenient-about-missing-fsck.-.patch @@ -0,0 +1,178 @@ +From ea46250058d413de21a38d29290eb90f453af72d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 12 Nov 2013 00:53:59 -0500 +Subject: [PATCH] fsck,fstab-generator: be lenient about missing fsck. + +If fstab contains 1 for passno, treat this as an error, but only warn +briefly. If fstab doesn't contain this information, don't complain at +all. + +Patch is complicated a bit by the fact that we might have the fstype specified +in fstab or on /proc/cmdline, in which case we can check if we have the appropriate +fsck tool, or not specified, or specified as auto, in which case we have to look +and check the type of the filesystem ourselves. It cannot be done before the +device appears, so it is too early in the generator phase, and it must be done +directly in fsck service. + +Conflicts: + src/fstab-generator/fstab-generator.c +--- + src/fsck/fsck.c | 40 +++++++++++++++++++++------ + src/fstab-generator/fstab-generator.c | 51 +++++++++++++++++++++++++++++++++++ + 2 files changed, 83 insertions(+), 8 deletions(-) + +diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c +index 9b4e555..1189fe7 100644 +--- a/src/fsck/fsck.c ++++ b/src/fsck/fsck.c +@@ -244,10 +244,11 @@ int main(int argc, char *argv[]) { + siginfo_t status; + _cleanup_udev_unref_ struct udev *udev = NULL; + _cleanup_udev_device_unref_ struct udev_device *udev_device = NULL; +- const char *device; ++ const char *device, *type; + bool root_directory; + int progress_pipe[2] = { -1, -1 }; + char dash_c[2+10+1]; ++ struct stat st; + + if (argc > 2) { + log_error("This program expects one or no arguments."); +@@ -266,11 +267,27 @@ int main(int argc, char *argv[]) { + if (!arg_force && arg_skip) + return 0; + ++ udev = udev_new(); ++ if (!udev) { ++ log_oom(); ++ return EXIT_FAILURE; ++ } ++ + if (argc > 1) { + device = argv[1]; + root_directory = false; ++ ++ if (stat(device, &st) < 0) { ++ log_error("Failed to stat '%s': %m", device); ++ return EXIT_FAILURE; ++ } ++ ++ udev_device = udev_device_new_from_devnum(udev, 'b', st.st_rdev); ++ if (!udev_device) { ++ log_error("Failed to detect device %s", device); ++ return EXIT_FAILURE; ++ } + } else { +- struct stat st; + struct timespec times[2]; + + /* Find root device */ +@@ -292,12 +309,6 @@ int main(int argc, char *argv[]) { + return EXIT_SUCCESS; + } + +- udev = udev_new(); +- if (!udev) { +- log_oom(); +- return EXIT_FAILURE; +- } +- + udev_device = udev_device_new_from_devnum(udev, 'b', st.st_dev); + if (!udev_device) { + log_error("Failed to detect root device."); +@@ -313,6 +324,19 @@ int main(int argc, char *argv[]) { + root_directory = true; + } + ++ type = udev_device_get_property_value(udev_device, "ID_FS_TYPE"); ++ if (type) { ++ const char *checker = strappenda("/sbin/fsck.", type); ++ r = access(checker, X_OK); ++ if (r < 0) { ++ if (errno == ENOENT) { ++ log_info("%s doesn't exist, not checking file system.", checker); ++ return EXIT_SUCCESS; ++ } else ++ log_warning("%s cannot be used: %m", checker); ++ } ++ } ++ + if (arg_show_progress) + if (pipe(progress_pipe) < 0) { + log_error("pipe(): %m"); +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index 9efccb9..795a24c 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -147,6 +147,52 @@ static bool mount_in_initrd(struct mntent *me) { + streq(me->mnt_dir, "/usr"); + } + ++static int add_fsck(FILE *f, const char *what, const char *where, const char *type, int passno) { ++ assert(f); ++ ++ if (passno == 0) ++ return 0; ++ ++ if (type && !streq(type, "auto")) { ++ int r; ++ const char *checker; ++ ++ checker = strappenda("/sbin/fsck.", type); ++ r = access(checker, X_OK); ++ if (r < 0) { ++ log_warning("Checking was requested for %s, but %s cannot be used: %m", what, checker); ++ ++ /* treat missing check as essentially OK */ ++ return errno == ENOENT ? 0 : -errno; ++ } ++ } ++ ++ if (streq(where, "/")) { ++ char *lnk; ++ ++ lnk = strappenda(arg_dest, "/" SPECIAL_LOCAL_FS_TARGET ".wants/systemd-fsck-root.service"); ++ mkdir_parents_label(lnk, 0755); ++ if (symlink("systemd-fsck-root.service", lnk) < 0) { ++ log_error("Failed to create symlink %s: %m", lnk); ++ return -errno; ++ } ++ } else { ++ _cleanup_free_ char *fsck = NULL; ++ ++ fsck = unit_name_from_path_instance("systemd-fsck", what, ".service"); ++ if (!fsck) ++ return log_oom(); ++ ++ fprintf(f, ++ "Requires=%s\n" ++ "After=%s\n", ++ fsck, ++ fsck); ++ } ++ ++ return 0; ++} ++ + static int add_mount( + const char *what, + const char *where, +@@ -162,6 +208,7 @@ static int add_mount( + *name = NULL, *unit = NULL, *lnk = NULL, + *automount_name = NULL, *automount_unit = NULL; + _cleanup_fclose_ FILE *f = NULL; ++ int r; + + assert(what); + assert(where); +@@ -209,6 +256,10 @@ static int add_mount( + "Before=%s\n", + post); + ++ r = add_fsck(f, what, where, type, passno); ++ if (r < 0) ++ return r; ++ + fprintf(f, + "\n" + "[Mount]\n" diff --git a/0108-fstab-generator-use-RequiresOverridable-for-fsck-uni.patch b/0108-fstab-generator-use-RequiresOverridable-for-fsck-uni.patch new file mode 100644 index 0000000..32459c3 --- /dev/null +++ b/0108-fstab-generator-use-RequiresOverridable-for-fsck-uni.patch @@ -0,0 +1,37 @@ +From a787829ac3db6a0f34c59180c796dfa49f46d34c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 12 Nov 2013 22:01:10 -0500 +Subject: [PATCH] fstab-generator: use RequiresOverridable for fsck units + +This allows the user to disable fsck's by masking. + +If fsck fails, emergency target is started, the user might mount the +unit using mount and disable fsck by masking the unit. In this case, +.mount will be active because the mount is detect through +/proc/self/mountinfo, but systemd-fsck@.service will still be in +failed mode. This results in a funny situation where + +$ systemctl show -p ActiveState local-fs.target yyy.mount +ActiveState=active +ActiveState=active + +$ sudo systemctl start local-fs.target +[sudo] password for test: +Failed to start local-fs.target: Unit systemd-fsck@xxx.service is masked. +--- + src/fstab-generator/fstab-generator.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index 795a24c..4137796 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -184,7 +184,7 @@ static int add_fsck(FILE *f, const char *what, const char *where, const char *ty + return log_oom(); + + fprintf(f, +- "Requires=%s\n" ++ "RequiresOverridable=%s\n" + "After=%s\n", + fsck, + fsck); diff --git a/0109-bash-completion-journalctl-file.patch b/0109-bash-completion-journalctl-file.patch new file mode 100644 index 0000000..5bee4a1 --- /dev/null +++ b/0109-bash-completion-journalctl-file.patch @@ -0,0 +1,33 @@ +From 6fe0184c4b1f5689e735c4e826ed42689e96c618 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 15 Nov 2013 19:00:01 -0500 +Subject: [PATCH] bash-completion: journalctl --file + +--- + shell-completion/bash/journalctl | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl +index 942a253..e4b2f4a 100644 +--- a/shell-completion/bash/journalctl ++++ b/shell-completion/bash/journalctl +@@ -43,7 +43,7 @@ _journalctl() { + -h --help -l --local --new-id128 -m --merge --no-pager + --no-tail -q --quiet --setup-keys --this-boot --verify + --version --list-catalog --update-catalog --list-boots' +- [ARG]='-b --boot --this-boot -D --directory -F --field ++ [ARG]='-b --boot --this-boot -D --directory --file -F --field + -o --output -u --unit --user-unit' + [ARGUNKNOWN]='-c --cursor --interval -n --lines -p --priority --since --until + --verify-key' +@@ -58,6 +58,10 @@ _journalctl() { + comps=$(compgen -d -- "$cur") + compopt -o filenames + ;; ++ --file) ++ comps=$(compgen -f -- "$cur") ++ compopt -o filenames ++ ;; + --output|-o) + comps='short short-monotonic verbose export json cat' + ;; diff --git a/0110-random-seed-improve-debugging-messages-a-bit.patch b/0110-random-seed-improve-debugging-messages-a-bit.patch new file mode 100644 index 0000000..340ba3b --- /dev/null +++ b/0110-random-seed-improve-debugging-messages-a-bit.patch @@ -0,0 +1,70 @@ +From 2fee90a7564f87472c39238b3345025dd383ce60 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 12 Nov 2013 22:05:16 -0500 +Subject: [PATCH] random-seed: improve debugging messages a bit + +--- + Makefile.am | 2 ++ + src/random-seed/random-seed.c | 8 ++++---- + 2 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 910e780..16a5c3c 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -159,6 +159,7 @@ AM_CPPFLAGS = \ + -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"$(rootbindir)/systemd-tty-ask-password-agent\" \ + -DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"$(bindir)/systemd-stdio-bridge\" \ + -DROOTPREFIX=\"$(rootprefix)\" \ ++ -DRANDOM_SEED_DIR=\"$(localstatedir)/lib/systemd/\" \ + -DRANDOM_SEED=\"$(localstatedir)/lib/systemd/random-seed\" \ + -DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\" \ + -DSYSTEM_GENERATOR_PATH=\"$(systemgeneratordir)\" \ +@@ -4242,6 +4243,7 @@ substitutions = \ + '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \ + '|PACKAGE_NAME=$(PACKAGE_NAME)|' \ + '|PACKAGE_URL=$(PACKAGE_URL)|' \ ++ '|RANDOM_SEED_DIR=$(localstatedir)/lib/systemd/|' \ + '|RANDOM_SEED=$(localstatedir)/lib/systemd/random-seed|' \ + '|prefix=$(prefix)|' \ + '|exec_prefix=$(exec_prefix)|' \ +diff --git a/src/random-seed/random-seed.c b/src/random-seed/random-seed.c +index afbd500..af79ecf 100644 +--- a/src/random-seed/random-seed.c ++++ b/src/random-seed/random-seed.c +@@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { + + r = mkdir_parents_label(RANDOM_SEED, 0755); + if (r < 0) { +- log_error("Failed to create parent directory of " RANDOM_SEED ": %s", strerror(-r)); ++ log_error("Failed to create directory " RANDOM_SEED_DIR ": %s", strerror(-r)); + goto finish; + } + +@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { + if (seed_fd < 0) { + seed_fd = open(RANDOM_SEED, O_RDONLY|O_CLOEXEC|O_NOCTTY); + if (seed_fd < 0) { +- log_error("Failed to open random seed: %m"); ++ log_error("Failed to open " RANDOM_SEED ": %m"); + r = -errno; + goto finish; + } +@@ -106,7 +106,7 @@ int main(int argc, char *argv[]) { + if (k <= 0) { + + if (r != 0) +- log_error("Failed to read seed file: %m"); ++ log_error("Failed to read seed from " RANDOM_SEED ": %m"); + + r = k == 0 ? -EIO : (int) k; + +@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) { + + seed_fd = open(RANDOM_SEED, O_WRONLY|O_CLOEXEC|O_NOCTTY|O_CREAT, 0600); + if (seed_fd < 0) { +- log_error("Failed to open random seed: %m"); ++ log_error("Failed to open " RANDOM_SEED ": %m"); + r = -errno; + goto finish; + } diff --git a/0111-Fix-RemainAfterExit-services-keeping-a-hold-on-conso.patch b/0111-Fix-RemainAfterExit-services-keeping-a-hold-on-conso.patch new file mode 100644 index 0000000..e066f8e --- /dev/null +++ b/0111-Fix-RemainAfterExit-services-keeping-a-hold-on-conso.patch @@ -0,0 +1,54 @@ +From 24f0323b41612b3170ce1ed84917bdb6c60f0b78 Mon Sep 17 00:00:00 2001 +From: Olivier Brunel +Date: Thu, 14 Nov 2013 15:52:54 +0100 +Subject: [PATCH] Fix RemainAfterExit services keeping a hold on console + +When a service exits succesfully and has RemainAfterExit set, its hold +on the console (in m->n_on_console) wasn't released since the unit state +didn't change. +--- + src/core/service.c | 16 ++++++++++++++++ + src/core/unit.c | 3 +++ + 2 files changed, 19 insertions(+) + +diff --git a/src/core/service.c b/src/core/service.c +index 5662180..62ae8f0 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -1570,6 +1570,22 @@ static void service_set_state(Service *s, ServiceState state) { + if (state == SERVICE_EXITED && UNIT(s)->manager->n_reloading <= 0) + unit_destroy_cgroup(UNIT(s)); + ++ /* For remain_after_exit services, let's see if we can "release" the ++ * hold on the console, since unit_notify() only does that in case of ++ * change of state */ ++ if (state == SERVICE_EXITED && s->remain_after_exit && ++ UNIT(s)->manager->n_on_console > 0) { ++ ExecContext *ec = unit_get_exec_context(UNIT(s)); ++ if (ec && exec_context_may_touch_console(ec)) { ++ Manager *m = UNIT(s)->manager; ++ ++ m->n_on_console --; ++ if (m->n_on_console == 0) ++ /* unset no_console_output flag, since the console is free */ ++ m->no_console_output = false; ++ } ++ } ++ + if (old_state != state) + log_debug_unit(UNIT(s)->id, + "%s changed %s -> %s", UNIT(s)->id, +diff --git a/src/core/unit.c b/src/core/unit.c +index 717ce84..b65e798 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -1446,6 +1446,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su + if (UNIT_IS_INACTIVE_OR_FAILED(ns)) + unit_destroy_cgroup(u); + ++ /* Note that this doesn't apply to RemainAfterExit services exiting ++ * sucessfully, since there's no change of state in that case. Which is ++ * why it is handled in service_set_state() */ + if (UNIT_IS_INACTIVE_OR_FAILED(os) != UNIT_IS_INACTIVE_OR_FAILED(ns)) { + ExecContext *ec = unit_get_exec_context(u); + if (ec && exec_context_may_touch_console(ec)) { diff --git a/0112-tmpfiles-adjust-excludes-for-the-new-per-service-pri.patch b/0112-tmpfiles-adjust-excludes-for-the-new-per-service-pri.patch new file mode 100644 index 0000000..2d05999 --- /dev/null +++ b/0112-tmpfiles-adjust-excludes-for-the-new-per-service-pri.patch @@ -0,0 +1,40 @@ +From f1d712f9028cec81748102a4b05b09a98cddfc79 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +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 a/tmpfiles.d/tmp.conf b/tmpfiles.d/tmp.conf +index 3b534a1..f0312ef 100644 +--- a/tmpfiles.d/tmp.conf ++++ b/tmpfiles.d/tmp.conf +@@ -12,6 +12,23 @@ d /tmp 1777 root root 10d + d /var/tmp 1777 root root 30d + + # 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 diff --git a/0113-core-socket-fix-SO_REUSEPORT.patch b/0113-core-socket-fix-SO_REUSEPORT.patch new file mode 100644 index 0000000..b567411 --- /dev/null +++ b/0113-core-socket-fix-SO_REUSEPORT.patch @@ -0,0 +1,35 @@ +From d125991e2d5f4095605eece35d8d436437036a12 Mon Sep 17 00:00:00 2001 +From: Shawn Landden +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 a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 +index 31fb7bc..d65bcc1 100644 +--- a/src/core/load-fragment-gperf.gperf.m4 ++++ b/src/core/load-fragment-gperf.gperf.m4 +@@ -211,6 +211,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 a/src/core/socket.c b/src/core/socket.c +index d368f7e..e673f38 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -770,7 +770,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"); + } + diff --git a/0114-localed-match-converted-keymaps-before-legacy.patch b/0114-localed-match-converted-keymaps-before-legacy.patch new file mode 100644 index 0000000..f4ca6f4 --- /dev/null +++ b/0114-localed-match-converted-keymaps-before-legacy.patch @@ -0,0 +1,324 @@ +From 3f3485b6bc8995f0e51e6725d1a4d99d825c8188 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 18 Nov 2013 13:42:57 -0500 +Subject: [PATCH] localed: match converted keymaps before legacy + +Before, X11 keymap fr-pc105-oss would be converted to fr, +even though fr-oss exists. Now, if +/usr/lib/kbd/keymaps/xkb/[-].map[.gz] exists, +[-] will be used as the console keymap, +falling back to the legacy mappings otherwise. + +% sudo localectl set-x11-keymap pl pc105 +% localectl + System Locale: LANG=en_US.UTF-8 + VC Keymap: pl (was pl2 before) + X11 Layout: pl + X11 Model: pc105 +% sudo localectl set-x11-keymap fr pc105 oss +% localectl + System Locale: LANG=en_US.UTF-8 + VC Keymap: fr-oss (was fr before) + X11 Layout: fr + X11 Model: pc105 + X11 Variant: oss +% sudo localectl set-x11-keymap fr pc105 +% localectl + System Locale: LANG=en_US.UTF-8 + VC Keymap: fr + X11 Layout: fr + X11 Model: pc105 +% sudo localectl set-x11-keymap gb +% localectl + System Locale: LANG=en_US.UTF-8 + VC Keymap: gb (was uk before) + X11 Layout: gb + +Conflicts: + src/locale/localed.c + src/shared/def.h +--- + src/locale/localectl.c | 8 +-- + src/locale/localed.c | 189 ++++++++++++++++++++++++++++--------------------- + src/shared/def.h | 13 ++++ + 3 files changed, 126 insertions(+), 84 deletions(-) + +diff --git a/src/locale/localectl.c b/src/locale/localectl.c +index 8259c0a..d3c6152 100644 +--- a/src/locale/localectl.c ++++ b/src/locale/localectl.c +@@ -38,6 +38,7 @@ + #include "set.h" + #include "path-util.h" + #include "utf8.h" ++#include "def.h" + + static bool arg_no_pager = false; + static enum transport { +@@ -533,15 +534,14 @@ static int nftw_cb( + + static int list_vconsole_keymaps(DBusConnection *bus, char **args, unsigned n) { + _cleanup_strv_free_ char **l = NULL; ++ const char *dir; + + keymaps = set_new(string_hash_func, string_compare_func); + if (!keymaps) + return log_oom(); + +- nftw("/usr/share/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS); +- nftw("/usr/share/kbd/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS); +- nftw("/usr/lib/kbd/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS); +- nftw("/lib/kbd/keymaps/", nftw_cb, 20, FTW_MOUNT|FTW_PHYS); ++ NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) ++ nftw(dir, nftw_cb, 20, FTW_MOUNT|FTW_PHYS); + + l = set_get_strv(keymaps); + if (!l) { +diff --git a/src/locale/localed.c b/src/locale/localed.c +index e160c04..b9b98f4 100644 +--- a/src/locale/localed.c ++++ b/src/locale/localed.c +@@ -792,105 +792,135 @@ static int convert_vconsole_to_x11(DBusConnection *connection) { + return 0; + } + +-static int convert_x11_to_vconsole(DBusConnection *connection) { +- bool modified = false; ++static int find_converted_keymap(char **new_keymap) { ++ const char *dir; ++ _cleanup_free_ char *n; ++ ++ if (state.x11_variant) ++ n = strjoin(state.x11_layout, "-", state.x11_variant, NULL); ++ else ++ n = strdup(state.x11_layout); ++ if (!n) ++ return -ENOMEM; + +- assert(connection); ++ NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) { ++ _cleanup_free_ char *p = NULL, *pz = NULL; + +- if (isempty(state.x11_layout)) { ++ p = strjoin(dir, "xkb/", n, ".map", NULL); ++ pz = strjoin(dir, "xkb/", n, ".map.gz", NULL); ++ if (!p || !pz) ++ return -ENOMEM; + +- modified = +- !isempty(state.vc_keymap) || +- !isempty(state.vc_keymap_toggle); ++ if (access(p, F_OK) == 0 || access(pz, F_OK) == 0) { ++ *new_keymap = n; ++ n = NULL; ++ return 1; ++ } ++ } + +- free_data_x11(); +- } else { +- FILE *f; +- unsigned n = 0; +- unsigned best_matching = 0; +- char *new_keymap = NULL; ++ return 0; ++} + +- f = fopen(SYSTEMD_KBD_MODEL_MAP, "re"); +- if (!f) +- return -errno; ++static int find_legacy_keymap(char **new_keymap) { ++ _cleanup_fclose_ FILE *f; ++ unsigned n = 0; ++ unsigned best_matching = 0; + +- for (;;) { +- char **a; +- unsigned matching = 0; +- int r; + +- r = read_next_mapping(f, &n, &a); +- if (r < 0) { +- fclose(f); +- return r; +- } ++ f = fopen(SYSTEMD_KBD_MODEL_MAP, "re"); ++ if (!f) ++ return -errno; + +- if (r == 0) +- break; ++ for (;;) { ++ _cleanup_strv_free_ char **a = NULL; ++ unsigned matching = 0; ++ int r; + +- /* Determine how well matching this entry is */ +- if (streq_ptr(state.x11_layout, a[1])) +- /* If we got an exact match, this is best */ +- matching = 10; +- else { +- size_t x; +- +- x = strcspn(state.x11_layout, ","); +- +- /* We have multiple X layouts, look +- * for an entry that matches our key +- * with the everything but the first +- * layout stripped off. */ +- if (x > 0 && +- strlen(a[1]) == x && +- strneq(state.x11_layout, a[1], x)) +- matching = 5; +- else { +- size_t w; +- +- /* If that didn't work, strip +- * off the other layouts from +- * the entry, too */ +- +- w = strcspn(a[1], ","); +- +- if (x > 0 && x == w && +- memcmp(state.x11_layout, a[1], x) == 0) +- matching = 1; +- } ++ r = read_next_mapping(f, &n, &a); ++ if (r < 0) ++ return r; ++ if (r == 0) ++ break; ++ ++ /* Determine how well matching this entry is */ ++ if (streq_ptr(state.x11_layout, a[1])) ++ /* If we got an exact match, this is best */ ++ matching = 10; ++ else { ++ size_t x; ++ ++ x = strcspn(state.x11_layout, ","); ++ ++ /* We have multiple X layouts, look for an ++ * entry that matches our key with everything ++ * but the first layout stripped off. */ ++ if (x > 0 && ++ strlen(a[1]) == x && ++ strneq(state.x11_layout, a[1], x)) ++ matching = 5; ++ else { ++ size_t w; ++ ++ /* If that didn't work, strip off the ++ * other layouts from the entry, too */ ++ w = strcspn(a[1], ","); ++ ++ if (x > 0 && x == w && ++ memcmp(state.x11_layout, a[1], x) == 0) ++ matching = 1; + } ++ } ++ ++ if (matching > 0 && ++ streq_ptr(state.x11_model, a[2])) { ++ matching++; + +- if (matching > 0 && +- streq_ptr(state.x11_model, a[2])) { ++ if (streq_ptr(state.x11_variant, a[3])) { + matching++; + +- if (streq_ptr(state.x11_variant, a[3])) { ++ if (streq_ptr(state.x11_options, a[4])) + matching++; +- +- if (streq_ptr(state.x11_options, a[4])) +- matching++; +- } + } ++ } + +- /* The best matching entry so far, then let's +- * save that */ +- if (matching > best_matching) { +- best_matching = matching; ++ /* The best matching entry so far, then let's save that */ ++ if (matching > best_matching) { ++ best_matching = matching; + +- free(new_keymap); +- new_keymap = strdup(a[0]); ++ free(*new_keymap); ++ *new_keymap = strdup(a[0]); ++ if (!*new_keymap) ++ return -ENOMEM; ++ } ++ } + +- if (!new_keymap) { +- strv_free(a); +- fclose(f); +- return -ENOMEM; +- } +- } ++ return 0; ++} + +- strv_free(a); +- } ++static int convert_x11_to_vconsole(DBusConnection *connection) { ++ bool modified = false; ++ int r; + +- fclose(f); ++ assert(connection); ++ ++ if (isempty(state.x11_layout)) { ++ ++ modified = ++ !isempty(state.vc_keymap) || ++ !isempty(state.vc_keymap_toggle); ++ ++ free_data_x11(); ++ } else { ++ char *new_keymap = NULL; ++ ++ r = find_converted_keymap(&new_keymap); ++ if (r < 0) ++ return r; ++ else if (r == 0) { ++ r = find_legacy_keymap(&new_keymap); ++ if (r < 0) ++ return r; ++ } + + if (!streq_ptr(state.vc_keymap, new_keymap)) { + free(state.vc_keymap); +@@ -907,7 +937,6 @@ static int convert_x11_to_vconsole(DBusConnection *connection) { + if (modified) { + dbus_bool_t b; + DBusMessage *changed; +- int r; + + r = write_data_vconsole(); + if (r < 0) +diff --git a/src/shared/def.h b/src/shared/def.h +index e4ef735..58c834c 100644 +--- a/src/shared/def.h ++++ b/src/shared/def.h +@@ -41,3 +41,16 @@ + #define LOWERCASE_LETTERS "abcdefghijklmnopqrstuvwxyz" + #define UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + #define LETTERS LOWERCASE_LETTERS UPPERCASE_LETTERS ++ ++#ifdef HAVE_SPLIT_USR ++#define KBD_KEYMAP_DIRS \ ++ "/usr/share/keymaps/\0" \ ++ "/usr/share/kbd/keymaps/\0" \ ++ "/usr/lib/kbd/keymaps/\0" \ ++ "/lib/kbd/keymaps/\0" ++#else ++#define KBD_KEYMAP_DIRS \ ++ "/usr/share/keymaps/\0" \ ++ "/usr/share/kbd/keymaps/\0" \ ++ "/usr/lib/kbd/keymaps/\0" ++#endif diff --git a/0115-keymap-Add-Toshiba-Satellite-U940.patch b/0115-keymap-Add-Toshiba-Satellite-U940.patch new file mode 100644 index 0000000..d59b50b --- /dev/null +++ b/0115-keymap-Add-Toshiba-Satellite-U940.patch @@ -0,0 +1,28 @@ +From e62bf9ca184d34e100014b4ef3c0c6b3b04ccebf Mon Sep 17 00:00:00 2001 +From: Jose Ignacio Naranjo +Date: Sun, 17 Nov 2013 21:11:34 +0100 +Subject: [PATCH] keymap: Add Toshiba Satellite U940 + +Signed-off-by: Martin Pitt +--- + hwdb/60-keyboard.hwdb | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb +index b497f92..d4d948d 100644 +--- a/hwdb/60-keyboard.hwdb ++++ b/hwdb/60-keyboard.hwdb +@@ -1031,6 +1031,13 @@ keyboard:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatellite*P75-A:pvr* + KEYBOARD_KEY_a9=switchvideomode # switch display outputs + KEYBOARD_KEY_d4=wlan # RF Switch Off + ++# Satellite U940 ++keyboard:name:Toshiba*input*device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSATELLITEU940:pvr* ++ KEYBOARD_KEY_13c=brightnessdown ++ KEYBOARD_KEY_13d=brightnessup ++ KEYBOARD_KEY_13e=switchvideomode ++ KEYBOARD_KEY_13f=f21 # Touchpad toggle ++ + ########################################################### + # VIA + ########################################################### diff --git a/systemd.spec b/systemd.spec index ee0e0fd..c9346b4 100644 --- a/systemd.spec +++ b/systemd.spec @@ -16,7 +16,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 208 -Release: 4%{?gitcommit:.git%{gitcommit}}%{?dist} +Release: 5%{?gitcommit:.git%{gitcommit}}%{?dist} # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -36,6 +36,7 @@ Source4: listen.conf # Prevent accidental removal of the systemd package Source6: yum-protect-systemd.conf +# i=1; for p in 00*patch;do printf "Patch%02d: %s\n" $i $p; ((i++));done Patch01: 0001-acpi-fptd-fix-memory-leak-in-acpi_get_boot_usec.patch Patch02: 0002-fix-lingering-references-to-var-lib-backlight-random.patch Patch03: 0003-acpi-make-sure-we-never-free-an-uninitialized-pointe.patch @@ -87,6 +88,54 @@ Patch48: 0048-hwdb-update.patch Patch49: 0049-rules-remove-pointless-MODE-settings.patch Patch50: 0050-analyze-set-white-backgound.patch Patch51: 0051-shell-completion-dump-has-moved-to-systemd-analyze.patch +Patch52: 0052-systemd-use-unit-name-in-PrivateTmp-directories.patch +Patch53: 0053-catalog-remove-links-to-non-existent-wiki-pages.patch +Patch54: 0054-journalctl-add-list-boots-to-show-boot-IDs-and-times.patch +Patch55: 0055-udev-builtin-path_id-add-support-for-bcma-bus.patch +Patch56: 0056-udev-ata_id-log-faling-ioctls-as-debug.patch +Patch57: 0057-libudev-default-log_priority-to-INFO.patch +Patch58: 0058-nspawn-only-pass-in-slice-setting-if-it-is-set.patch +Patch59: 0059-zsh-completion-add-systemd-run.patch +Patch60: 0060-man-explain-NAME-in-systemctl-man-page.patch +Patch61: 0061-virt-move-caching-of-virtualization-check-results-in.patch +Patch62: 0062-systemctl-fix-typo-in-help-text.patch +Patch63: 0063-analyze-plot-place-the-text-on-the-side-with-most-sp.patch +Patch64: 0064-detect_virtualization-returns-NULL-pass-empty-string.patch +Patch65: 0065-rules-load-path_id-on-DRM-devices.patch +Patch66: 0066-rules-simply-60-drm.rules.patch +Patch67: 0067-udev-builtin-keyboard-Fix-large-scan-codes-on-32-bit.patch +Patch68: 0068-nspawn-log-out-of-memory-errors.patch +Patch69: 0069-Configurable-Timeouts-Restarts-default-values.patch +Patch70: 0070-man-fix-typo.patch +Patch71: 0071-man-do-not-use-term-in-para.patch +Patch72: 0072-cgroup-run-PID-1-in-the-root-cgroup.patch +Patch73: 0073-shutdown-trim-the-cgroup-tree-on-loop-iteration.patch +Patch74: 0074-nspawn-split-out-pty-forwaring-logic-into-ptyfwd.c.patch +Patch75: 0075-nspawn-explicitly-terminate-machines-when-we-exit-ns.patch +Patch76: 0076-run-support-system-to-match-other-commands-even-if-r.patch +Patch77: 0077-acpi-fpdt-break-on-zero-or-negative-length-read.patch +Patch78: 0078-man-add-rationale-into-systemd-halt-8.patch +Patch79: 0079-systemd-python-convert-keyword-value-to-string.patch +Patch80: 0080-systemctl-make-LOAD-column-width-dynamic.patch +Patch81: 0081-Make-hibernation-test-work-for-swap-files.patch +Patch82: 0082-man-add-docs-for-sd_is_special-and-some-man-page-sym.patch +Patch83: 0083-systemctl-return-r-instead-of-always-returning-0.patch +Patch84: 0084-journal-fix-minor-memory-leak.patch +Patch85: 0085-manager-configurable-StartLimit-default-values.patch +Patch86: 0086-man-units-fix-installation-of-systemd-nspawn-.servic.patch +Patch87: 0087-systemd-fix-memory-leak-in-cgroup-code.patch +Patch88: 0088-button-don-t-exit-if-we-cannot-handle-a-button-press.patch +Patch89: 0089-timer-properly-format-relative-timestamps-in-the-fut.patch +Patch90: 0090-timer-consider-usec_t-1-an-invalid-timestamp.patch +Patch91: 0091-udev-usb_id-remove-obsoleted-bInterfaceSubClass-5-ma.patch +Patch92: 0092-Add-support-for-saving-restoring-keyboard-backlights.patch +Patch93: 0093-static-nodes-don-t-call-mkdir.patch +Patch94: 0094-Fix-kmod-error-message-to-have-correct-version-requi.patch +Patch95: 0095-systemd-python-fix-booted-and-add-two-functions-to-d.patch +Patch96: 0096-activate-mention-E-in-the-help-text.patch +Patch97: 0097-activate-fix-crash-when-s-is-passed.patch +Patch98: 0098-journal-timestamp-support-on-console-messages.patch +Patch99: 0099-man-add-bootctl-8.patch # kernel-install patch for grubby, drop if grubby is obsolete Patch1000: kernel-install-grubby.patch @@ -134,7 +183,7 @@ Requires(pre): /usr/bin/getent Requires(pre): /usr/sbin/groupadd Requires: dbus Requires: %{name}-libs = %{version}-%{release} -Requires: kmod >= 14 +Requires: kmod >= 15 Provides: /bin/systemctl Provides: /sbin/shutdown Provides: syslog @@ -735,6 +784,21 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g %{_datadir}/systemd/gatewayd %changelog +* Tue Nov 19 2013 Zbigniew Jędrzejewski-Szmek - 208-5 +- Use unit name in PrivateTmp= directories (#957439) +- Update manual pages, completion scripts, and hardware database +- Configurable Timeouts/Restarts default values +- Support printing of timestamps on the console +- Fix some corner cases in detecting when writing to the console is safe +- Python API: convert keyword values to string, fix sd_is_booted() wrapper +- Do not tread missing /sbin/fsck.btrfs as an error (#1015467) +- Allow masking of fsck units +- Advertise hibernation to swap files +- Fix SO_REUSEPORT settings +- Prefer converted xkb keymaps to legacy keymaps (#981805, #1026872) +- Make use of newer kmod +- Assorted bugfixes: #1017161, #967521, #988883, #1027478, #821723, #1014303 + * Tue Oct 22 2013 Zbigniew Jędrzejewski-Szmek - 208-4 - Add temporary fix for #1002806