[arch-commits] Commit in systemd/trunk (5 files)
Thomas Bächler
thomas at nymeria.archlinux.org
Sun Apr 13 07:29:51 UTC 2014
Date: Sunday, April 13, 2014 @ 09:29:51
Author: thomas
Revision: 210251
upgpkg: systemd 212-3: backport some upstream fixes
Added:
systemd/trunk/0001-backlight-do-nothing-if-max_brightness-is-0.patch
systemd/trunk/0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch
systemd/trunk/0003-man-reword-Persistent-description.patch
systemd/trunk/0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch
Modified:
systemd/trunk/PKGBUILD
-----------------------------------------------------------------+
0001-backlight-do-nothing-if-max_brightness-is-0.patch | 108 ++++++++++
0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch | 38 +++
0003-man-reword-Persistent-description.patch | 50 ++++
0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch | 85 +++++++
PKGBUILD | 28 ++
5 files changed, 306 insertions(+), 3 deletions(-)
Added: 0001-backlight-do-nothing-if-max_brightness-is-0.patch
===================================================================
--- 0001-backlight-do-nothing-if-max_brightness-is-0.patch (rev 0)
+++ 0001-backlight-do-nothing-if-max_brightness-is-0.patch 2014-04-13 07:29:51 UTC (rev 210251)
@@ -0,0 +1,108 @@
+From eab2144e7ef737e532a241bcfae432395ae8f22d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas at archlinux.org>
+Date: Thu, 27 Mar 2014 23:41:59 +0100
+Subject: [PATCH 1/4] backlight: do nothing if max_brightness is 0
+
+On virtually any newer Asus mainboard, the eeepc-wmi driver is loaded.
+It exposes a backlight device despite the lack of any physical backlight
+devices. This fake backlight device has max_brightness set to 0. Since
+the introduction of the clamp_brightness function, systemd-backlight
+tries to write '1' to brightness and fails.
+
+This patch changes systemd-backlight to exit gracefully when
+max_brightness is 0 before performing any action. This affects
+both the load and save actions.
+---
+ src/backlight/backlight.c | 44 ++++++++++++++++++++++++++++++--------------
+ 1 file changed, 30 insertions(+), 14 deletions(-)
+
+diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
+index abf8bcf..ce0385b 100644
+--- a/src/backlight/backlight.c
++++ b/src/backlight/backlight.c
+@@ -192,30 +192,37 @@ static bool validate_device(struct udev *udev, struct udev_device *device) {
+ return true;
+ }
+
+-/* Some systems turn the backlight all the way off at the lowest levels.
+- * clamp_brightness clamps the saved brightness to at least 1 or 5% of
+- * max_brightness. This avoids preserving an unreadably dim screen, which
+- * would otherwise force the user to disable state restoration. */
+-static void clamp_brightness(struct udev_device *device, char **value) {
++static unsigned get_max_brightness(struct udev_device *device) {
+ int r;
+ const char *max_brightness_str;
+- unsigned brightness, max_brightness, new_brightness;
++ unsigned max_brightness;
+
+ max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness");
+ if (!max_brightness_str) {
+- log_warning("Failed to read max_brightness attribute; not checking saved brightness");
+- return;
++ log_warning("Failed to read max_brightness attribute");
++ return 0;
+ }
+
+- r = safe_atou(*value, &brightness);
++ r = safe_atou(max_brightness_str, &max_brightness);
+ if (r < 0) {
+- log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r));
+- return;
++ log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r));
++ return 0;
+ }
+
+- r = safe_atou(max_brightness_str, &max_brightness);
++ return max_brightness;
++}
++
++/* Some systems turn the backlight all the way off at the lowest levels.
++ * clamp_brightness clamps the saved brightness to at least 1 or 5% of
++ * max_brightness. This avoids preserving an unreadably dim screen, which
++ * would otherwise force the user to disable state restoration. */
++static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) {
++ int r;
++ unsigned brightness, new_brightness;
++
++ r = safe_atou(*value, &brightness);
+ if (r < 0) {
+- log_warning("Failed to parse max_brightness \"%s\": %s", max_brightness_str, strerror(-r));
++ log_warning("Failed to parse brightness \"%s\": %s", *value, strerror(-r));
+ return;
+ }
+
+@@ -239,6 +246,7 @@ int main(int argc, char *argv[]) {
+ _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_free_ char *saved = NULL, *ss = NULL, *escaped_ss = NULL, *escaped_sysname = NULL, *escaped_path_id = NULL;
+ const char *sysname, *path_id;
++ unsigned max_brightness;
+ int r;
+
+ if (argc != 3) {
+@@ -294,6 +302,14 @@ int main(int argc, char *argv[]) {
+ return EXIT_FAILURE;
+ }
+
++ /* If max_brightness is 0, then there is no actual backlight
++ * device. This happens on desktops with Asus mainboards
++ * that load the eeepc-wmi module.
++ */
++ max_brightness = get_max_brightness(device);
++ if (max_brightness == 0)
++ return EXIT_SUCCESS;
++
+ escaped_ss = cescape(ss);
+ if (!escaped_ss) {
+ log_oom();
+@@ -348,7 +364,7 @@ int main(int argc, char *argv[]) {
+ return EXIT_FAILURE;
+ }
+
+- clamp_brightness(device, &value);
++ clamp_brightness(device, &value, max_brightness);
+
+ r = udev_device_set_sysattr_value(device, "brightness", value);
+ if (r < 0) {
+--
+1.9.2
+
Added: 0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch
===================================================================
--- 0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch (rev 0)
+++ 0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch 2014-04-13 07:29:51 UTC (rev 210251)
@@ -0,0 +1,38 @@
+From cad77d38e7e0544f719812af2bf5dc97d71a6f02 Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay at vrfy.org>
+Date: Sat, 5 Apr 2014 13:59:01 -0400
+Subject: [PATCH 2/4] reduce the amount of messages logged to /dev/kmsg when
+ "debug" is specified
+
+---
+ src/core/main.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/src/core/main.c b/src/core/main.c
+index 41605ee..feabead 100644
+--- a/src/core/main.c
++++ b/src/core/main.c
+@@ -412,18 +412,13 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
+ }
+
+ } else if (streq(key, "quiet") && !value) {
+-
+ if (arg_show_status == _SHOW_STATUS_UNSET)
+ arg_show_status = SHOW_STATUS_AUTO;
+
+ } else if (streq(key, "debug") && !value) {
+-
+- /* Log to kmsg, the journal socket will fill up before the
+- * journal is started and tools running during that time
+- * will block with every log message for for 60 seconds,
+- * before they give up. */
+ log_set_max_level(LOG_DEBUG);
+- log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG);
++ if (detect_container(NULL) > 0)
++ log_set_target(LOG_TARGET_CONSOLE);
+
+ } else if (!in_initrd() && !value) {
+ unsigned i;
+--
+1.9.2
+
Added: 0003-man-reword-Persistent-description.patch
===================================================================
--- 0003-man-reword-Persistent-description.patch (rev 0)
+++ 0003-man-reword-Persistent-description.patch 2014-04-13 07:29:51 UTC (rev 210251)
@@ -0,0 +1,50 @@
+From 1d83dac5adba9e1db5b058436e23ba7ac403d652 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek at in.waw.pl>
+Date: Mon, 7 Apr 2014 20:58:37 -0400
+Subject: [PATCH 3/4] man: reword Persistent= description
+
+I think it is easier to grok this way.
+---
+ man/systemd.timer.xml | 26 ++++++++++++--------------
+ 1 file changed, 12 insertions(+), 14 deletions(-)
+
+diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml
+index 58eaab0..44f55e0 100644
+--- a/man/systemd.timer.xml
++++ b/man/systemd.timer.xml
+@@ -255,20 +255,18 @@
+ <term><varname>Persistent=</varname></term>
+
+ <listitem><para>Takes a boolean
+- argument. If true the service unit is
+- immediately triggered when the timer
+- unit is activated and the timer
+- elapsed at least once since the last
+- time the service unit has been
+- triggered by the timer unit. The time
+- when the service unit was last
+- triggered is stored on disk. This is
+- useful to catch up for missed timers
+- when a machine is shutdown temporarily
+- and then is powered up again. Note
+- that this setting only has an effect
+- on timers configured with
+- <varname>OnCalendar=</varname>.
++ argument. If true, the time when the
++ service unit was last triggered is
++ stored on disk. When the timer is
++ activated, the service unit is
++ triggered immediately if it would have
++ been triggered at least once during
++ the time when the timer was inactive.
++ This is useful to catch up on missed
++ runs of the service when the machine
++ was off. Note that this setting only
++ has an effect on timers configured
++ with <varname>OnCalendar=</varname>.
+ </para></listitem>
+ </varlistentry>
+
+--
+1.9.2
+
Added: 0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch
===================================================================
--- 0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch (rev 0)
+++ 0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch 2014-04-13 07:29:51 UTC (rev 210251)
@@ -0,0 +1,85 @@
+From 7cee0cf1ecc18ea8a016bef48c79f7ea4fd4195a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20B=C3=A4chler?= <thomas at archlinux.org>
+Date: Wed, 2 Apr 2014 20:18:44 +0200
+Subject: [PATCH 4/4] core: Make sure a stamp file exists for all
+ Persistent=true timers
+
+If a persistent timer has no stamp file yet, it behaves just like a normal
+timer until it runs for the first time. If the system is always shut down
+while the timer is supposed to run, a stamp file is never created and
+Peristent=true has no effect.
+
+This patch fixes this by creating a stamp file with the current time
+when the timer is first started.
+---
+ src/core/timer.c | 40 ++++++++++++++++++++++++----------------
+ 1 file changed, 24 insertions(+), 16 deletions(-)
+
+diff --git a/src/core/timer.c b/src/core/timer.c
+index 6c85304..b0a9023 100644
+--- a/src/core/timer.c
++++ b/src/core/timer.c
+@@ -111,6 +111,23 @@ static int timer_add_default_dependencies(Timer *t) {
+ return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
+ }
+
++static void update_stampfile(Timer *t, usec_t timestamp) {
++ _cleanup_close_ int fd = -1;
++
++ mkdir_parents_label(t->stamp_path, 0755);
++
++ /* Update the file atime + mtime, if we can */
++ fd = open(t->stamp_path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
++ if (fd >= 0) {
++ struct timespec ts[2];
++
++ timespec_store(&ts[0], timestamp);
++ ts[1] = ts[0];
++
++ futimens(fd, ts);
++ }
++}
++
+ static int timer_setup_persistent(Timer *t) {
+ int r;
+
+@@ -496,22 +513,8 @@ static void timer_enter_running(Timer *t) {
+
+ dual_timestamp_get(&t->last_trigger);
+
+- if (t->stamp_path) {
+- _cleanup_close_ int fd = -1;
+-
+- mkdir_parents_label(t->stamp_path, 0755);
+-
+- /* Update the file atime + mtime, if we can */
+- fd = open(t->stamp_path, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
+- if (fd >= 0) {
+- struct timespec ts[2];
+-
+- timespec_store(&ts[0], t->last_trigger.realtime);
+- ts[1] = ts[0];
+-
+- futimens(fd, ts);
+- }
+- }
++ if (t->stamp_path)
++ update_stampfile(t, t->last_trigger.realtime);
+
+ timer_set_state(t, TIMER_RUNNING);
+ return;
+@@ -539,6 +542,11 @@ static int timer_start(Unit *u) {
+
+ if (stat(t->stamp_path, &st) >= 0)
+ t->last_trigger.realtime = timespec_load(&st.st_atim);
++ else if (errno == ENOENT)
++ /* The timer has never run before,
++ * make sure a stamp file exists.
++ */
++ update_stampfile(t, now(CLOCK_REALTIME));
+ }
+
+ t->result = TIMER_SUCCESS;
+--
+1.9.2
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2014-04-13 02:17:07 UTC (rev 210250)
+++ PKGBUILD 2014-04-13 07:29:51 UTC (rev 210251)
@@ -4,7 +4,7 @@
pkgbase=systemd
pkgname=('systemd' 'libsystemd' 'systemd-sysvcompat')
pkgver=212
-pkgrel=2
+pkgrel=3
arch=('i686' 'x86_64')
url="http://www.freedesktop.org/wiki/Software/systemd"
makedepends=('acl' 'cryptsetup' 'docbook-xsl' 'gobject-introspection' 'gperf'
@@ -14,12 +14,34 @@
source=("http://www.freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz"
'initcpio-hook-udev'
'initcpio-install-systemd'
- 'initcpio-install-udev')
+ 'initcpio-install-udev'
+ '0001-backlight-do-nothing-if-max_brightness-is-0.patch'
+ '0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch'
+ '0003-man-reword-Persistent-description.patch'
+ '0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch'
+ )
md5sums=('257a75fff826ff91cb1ce567091cf270'
'29245f7a240bfba66e2b1783b63b6b40'
'66cca7318e13eaf37c5b7db2efa69846'
- 'bde43090d4ac0ef048e3eaee8202a407')
+ 'bde43090d4ac0ef048e3eaee8202a407'
+ '4b5d61e30b423ff5a0ec38037146b61b'
+ 'd9518fc6cef154ebc76555b0fb9d4412'
+ 'c35c7f55d41c0a8b8725785b49ce6440'
+ '2e7aee18c749727c8bbc8db86f17edc0')
+prepare() {
+ cd "$pkgname-$pkgver"
+
+ # http://cgit.freedesktop.org/systemd/systemd/commit/?id=3cadce7d33e263ec7a6a83c00c11144930258b22
+ patch -p1 -i "$srcdir/0001-backlight-do-nothing-if-max_brightness-is-0.patch"
+ # http://cgit.freedesktop.org/systemd/systemd/commit/?id=b2103dccb354de3f38c49c14ccb637bdf665e40f
+ patch -p1 -i "$srcdir/0002-reduce-the-amount-of-messages-logged-to-dev-kmsg-whe.patch"
+ # http://cgit.freedesktop.org/systemd/systemd/commit/?id=de41590a9bb370de92e4a1ed933bc6e38abb6787
+ patch -p1 -i "$srcdir/0003-man-reword-Persistent-description.patch"
+ # http://cgit.freedesktop.org/systemd/systemd/commit/?id=472fc28fdade525e700ebf4b25d026a8c907796d
+ patch -p1 -i "$srcdir/0004-core-Make-sure-a-stamp-file-exists-for-all-Persisten.patch"
+}
+
build() {
cd "$pkgname-$pkgver"
More information about the arch-commits
mailing list