[systemd-commits] 4 commits - TODO src/libsystemd
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Mar 24 16:03:33 PDT 2014
TODO | 2 +
src/libsystemd/sd-daemon/sd-daemon.c | 2 -
src/libsystemd/sd-event/sd-event.c | 41 ++++++++++++++++++++++-------------
3 files changed, 29 insertions(+), 16 deletions(-)
New commits:
commit b107b705cc97d3033e37c44229deb37b5aa31df5
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Mar 25 00:03:23 2014 +0100
update TODO
diff --git a/TODO b/TODO
index e081fcf..5a5b729 100644
--- a/TODO
+++ b/TODO
@@ -30,6 +30,8 @@ External:
Features:
+* expose "Locked" property on logind sesison objects
+
* add bus api to query unit file's X fields.
* consider adding RuntimeDirectoryUser= + RuntimeDirectoryGroup=
commit 75145780813957ecbe6835f2c8bc20113a3605d2
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Mar 25 00:01:51 2014 +0100
sd-event: don't accidentally turn of watchdog timer event if we determine 0
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index d6a3d1c..4aabec1 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -2087,6 +2087,11 @@ static int arm_watchdog(sd_event *e) {
timespec_store(&its.it_value, t);
+ /* Make sure we never set the watchdog to 0, which tells the
+ * kernel to disable it. */
+ if (its.it_value.tv_sec == 0 && its.it_value.tv_nsec == 0)
+ its.it_value.tv_nsec = 1;
+
r = timerfd_settime(e->watchdog_fd, TFD_TIMER_ABSTIME, &its, NULL);
if (r < 0)
return -errno;
commit 52444dc478fe38b5b69a771923ab429a41927aa5
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Mar 24 23:54:21 2014 +0100
sd-event: initialization perturbation value right before we use it
That way, we don't forget to initialize it when the watchdog is
initialized before all event sources.
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index a4b6743..d6a3d1c 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -733,12 +733,30 @@ _public_ int sd_event_add_io(
return 0;
}
+static void initialize_perturb(sd_event *e) {
+ sd_id128_t bootid = {};
+
+ /* When we sleep for longer, we try to realign the wakeup to
+ the same time wihtin each minute/second/250ms, so that
+ events all across the system can be coalesced into a single
+ CPU wakeup. However, let's take some system-specific
+ randomness for this value, so that in a network of systems
+ with synced clocks timer events are distributed a
+ bit. Here, we calculate a perturbation usec offset from the
+ boot ID. */
+
+ if (_likely_(e->perturb != (usec_t) -1))
+ return;
+
+ if (sd_id128_get_boot(&bootid) >= 0)
+ e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE;
+}
+
static int event_setup_timer_fd(
sd_event *e,
struct clock_data *d,
clockid_t clock) {
- sd_id128_t bootid = {};
struct epoll_event ev = {};
int r, fd;
@@ -762,20 +780,6 @@ static int event_setup_timer_fd(
}
d->fd = fd;
-
- /* When we sleep for longer, we try to realign the wakeup to
- the same time wihtin each minute/second/250ms, so that
- events all across the system can be coalesced into a single
- CPU wakeup. However, let's take some system-specific
- randomness for this value, so that in a network of systems
- with synced clocks timer events are distributed a
- bit. Here, we calculate a perturbation usec offset from the
- boot ID. */
-
- if (e->perturb == (usec_t) -1)
- if (sd_id128_get_boot(&bootid) >= 0)
- e->perturb = (bootid.qwords[0] ^ bootid.qwords[1]) % USEC_PER_MINUTE;
-
return 0;
}
@@ -1588,6 +1592,8 @@ static usec_t sleep_between(sd_event *e, usec_t a, usec_t b) {
if (b <= a + 1)
return a;
+ initialize_perturb(e);
+
/*
Find a good time to wake up again between times a and b. We
have two goals here:
commit 56dc9aec21ab23f76fadf45585adf88e71aa8078
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Mar 24 23:54:14 2014 +0100
sd-daemon: fix incorrect variable access
diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c
index 21fb346..b013438 100644
--- a/src/libsystemd/sd-daemon/sd-daemon.c
+++ b/src/libsystemd/sd-daemon/sd-daemon.c
@@ -517,7 +517,7 @@ _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) {
r = -errno;
goto finish;
}
- if (!p || p == e || *p || l <= 0) {
+ if (!p || p == e || *p || ll <= 0) {
r = -EINVAL;
goto finish;
}
More information about the systemd-commits
mailing list