[systemd-commits] 9 commits - NEWS TODO src/core src/delta src/shared src/timesync

Lennart Poettering lennart at kemper.freedesktop.org
Fri Oct 24 10:10:35 PDT 2014


 NEWS                             |   28 +++++++++++++++++----
 TODO                             |   19 ++++++--------
 src/core/load-fragment.c         |    3 --
 src/delta/delta.c                |    7 +----
 src/shared/calendarspec.c        |    4 ++-
 src/shared/time-util.c           |   50 ++++++++++++++++++++++++---------------
 src/timesync/timesyncd-manager.c |    4 ---
 7 files changed, 68 insertions(+), 47 deletions(-)

New commits:
commit bb1fada8cc691821ade680c36dfb2be13e0658d6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:10:09 2014 +0200

    time: don't do comparison twice

diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 33d0822..d3404af 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -296,8 +296,14 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
         assert(buf);
         assert(l > 0);
 
-        if (t == USEC_INFINITY || t <= 0) {
-                strncpy(p, t == USEC_INFINITY ? "infinity" : "0", l);
+        if (t == USEC_INFINITY) {
+                strncpy(p, "infinity", l-1);
+                p[l-1] = 0;
+                return p;
+        }
+
+        if (t <= 0) {
+                strncpy(p, "0", l-1);
                 p[l-1] = 0;
                 return p;
         }

commit 75a5f1d837739fc84a7c5af14797490774a10646
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:09:36 2014 +0200

    time: minor simplification

diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 43ad9db..33d0822 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -49,25 +49,20 @@ dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u) {
         int64_t delta;
         assert(ts);
 
-        if (u == USEC_INFINITY) {
-                ts->realtime = ts->monotonic = USEC_INFINITY;
+        if (u == USEC_INFINITY || u <= 0) {
+                ts->realtime = ts->monotonic = u;
                 return ts;
         }
 
         ts->realtime = u;
 
-        if (u == 0)
-                ts->monotonic = 0;
-        else {
-                delta = (int64_t) now(CLOCK_REALTIME) - (int64_t) u;
-
-                ts->monotonic = now(CLOCK_MONOTONIC);
+        delta = (int64_t) now(CLOCK_REALTIME) - (int64_t) u;
+        ts->monotonic = now(CLOCK_MONOTONIC);
 
-                if ((int64_t) ts->monotonic > delta)
-                        ts->monotonic -= delta;
-                else
-                        ts->monotonic = 0;
-        }
+        if ((int64_t) ts->monotonic > delta)
+                ts->monotonic -= delta;
+        else
+                ts->monotonic = 0;
 
         return ts;
 }

commit 65de0395ffe1cfb0f9af86504e8588fb31bb0fbc
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:08:22 2014 +0200

    time: earlier exit from format_timestamp_relative() on special times

diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 4d34362..43ad9db 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -219,11 +219,10 @@ 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 == USEC_INFINITY))
+        if (t <= 0 || t == USEC_INFINITY)
                 return NULL;
 
+        n = now(CLOCK_REALTIME);
         if (n > t) {
                 d = n - t;
                 s = "ago";

commit e73c78c27511b03c7abc55aed87896092c0de699
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:07:26 2014 +0200

    time: also support 'infinity' syntax in parse_nsec()
    
    Let's make parse_usec() and parse_nsec() work similar

diff --git a/src/shared/time-util.c b/src/shared/time-util.c
index 433c262..4d34362 100644
--- a/src/shared/time-util.c
+++ b/src/shared/time-util.c
@@ -773,7 +773,7 @@ int parse_nsec(const char *t, nsec_t *nsec) {
                 { "", 1ULL }, /* default is nsec */
         };
 
-        const char *p;
+        const char *p, *s;
         nsec_t r = 0;
         bool something = false;
 
@@ -781,6 +781,18 @@ int parse_nsec(const char *t, nsec_t *nsec) {
         assert(nsec);
 
         p = t;
+
+        p += strspn(p, WHITESPACE);
+        s = startswith(p, "infinity");
+        if (s) {
+                s += strspn(s, WHITESPACE);
+                if (!*s != 0)
+                        return -EINVAL;
+
+                *nsec = NSEC_INFINITY;
+                return 0;
+        }
+
         for (;;) {
                 long long l, z = 0;
                 char *e;

commit afe3ab588a6b2992efe5a9b22ed038545ba3cdbf
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:07:01 2014 +0200

    update TODO

diff --git a/TODO b/TODO
index e38d829..ed00661 100644
--- a/TODO
+++ b/TODO
@@ -1,13 +1,14 @@
 Fixes needed before 217:
 
+* sd_session_get_desktop() yells at me?
+
 * change startup timeout to not cover the full bootup, but only sysinit part (see below)
 
 * remove Discard= in .mount units and replace it by Options=, to prepare for later swapon fix
 
-Bugfixes:
+* verify that both resolved and timesyncd work OK without networkd around
 
-* Re-enable "fsck -l" when it is ready:
-   https://bugs.freedesktop.org/show_bug.cgi?id=79576#c5
+Bugfixes:
 
 * Should systemctl status \* work on all unit types, not just .service?
 
@@ -17,19 +18,15 @@ Bugfixes:
 
 * properly handle .mount unit state tracking when two mount points are stacked one on top of another on the exact same mount point.
 
-After killing 'systemd --user', systemctl restart user at ... fails.
-/run/user/1000/systemd/notify has to be removed manually.
-
-ExecStart with unicode characters fails in strv_split_quoted:
+* ExecStart with unicode characters fails in strv_split_quoted:
 
           [Service]
           Environment=ONE='one' "TWO='two two' too" THREE=
           ExecStart=/bin/python3 -c 'import sys;print(sys.argv)' $ONE $TWO $THREE
 
-MEMORY return code is overloaded for syntax errors in the commandline.
-str_split_quoted() should return a real return code, so spawn_child can
-report the failure properly.
-
+* MEMORY return code is overloaded for syntax errors in the commandline.
+  str_split_quoted() should return a real return code, so spawn_child can
+  report the failure properly.
 
 External:
 * Fedora: add an rpmlint check that verifies that all unit files in the RPM are listed in %systemd_post macros.

commit 4bdc60cb6fab336d455abbbd269e5bfccf760c91
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:06:23 2014 +0200

    NEWS: more preparations for 217

diff --git a/NEWS b/NEWS
index 6e2b961..6e86c2d 100644
--- a/NEWS
+++ b/NEWS
@@ -9,13 +9,13 @@ CHANGES WITH 217:
 
         * Services can notify the manager before they start a reload
           (by sending RELOADING=1) or shutdown (by sending
-          STOPPING=1). This allows the manager to show the
-          internal state of daemons and closes a race condition
-          when the process is still running but has closed its
-          d-bus connection.
+          STOPPING=1). This allows the manager to track and show the
+          internal state of daemons and closes a race condition when
+          the process is still running but has closed its d-bus
+          connection.
 
         * Services with Type=oneshot do not have to have any
-          ExecStart commands.
+          ExecStart commands anymore.
 
         * User units are now loaded also from
           $XDG_RUNTIME_DIR/systemd/user/. This is similar to the
@@ -57,7 +57,7 @@ CHANGES WITH 217:
 
         * Udev rules can now remove tags with TAG-="foobar".
 
-        * Readhead implementation has been removed. In many
+        * systemd's readahead implementation has been removed. In many
           circumstatances it didn't give expected benefits even for
           rotational disk drives and was becoming less relevant in the
           age of SSDs.
@@ -86,6 +86,22 @@ CHANGES WITH 217:
           servers that do not do forwarding, "fq" may perform better.
           Systems without a good clocksource should use "pfifo_fast".
 
+        * If kdbus is enabled during build a new option BusPolicy= is
+          available for service units, that allows locking all service
+          processes into a stricter bus policy, in order to limit
+          access to various bus services, or even hide most of them
+          from the service's view entirely.
+
+        * networkctl will now show the .network and .link file
+          networkd has applied to a specific interface.
+
+        * sd-login gained a new API call sd_session_get_desktop() to
+          query which desktop environment has been selected for a
+          session.
+
+        * UNIX utmp support is now compile-time optional to support
+          legacy-free systems.
+
 CHANGES WITH 216:
 
         * timedated no longer reads NTP implementation unit names from

commit a572b2e00685af01b8b593e2f20c263b22840b32
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 18:48:11 2014 +0200

    delta: use wait_for_terminate_and_warn() to generate warnin when diff fails

diff --git a/src/delta/delta.c b/src/delta/delta.c
index 2fdbeea..25c4a0b 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -159,7 +159,7 @@ static int notify_override_unchanged(const char *f) {
 
 static int found_override(const char *top, const char *bottom) {
         _cleanup_free_ char *dest = NULL;
-        int k, r;
+        int k;
         pid_t pid;
 
         assert(top);
@@ -194,10 +194,7 @@ static int found_override(const char *top, const char *bottom) {
                 _exit(1);
         }
 
-        r = wait_for_terminate(pid, NULL);
-        if (r < 0)
-                log_warning("Failed to wait for diff: %s", strerror(-r));
-
+        wait_for_terminate_and_warn("diff", pid);
         putchar('\n');
 
         return k;

commit 0b76b4d8c28e8d82422ddeea2cc3c079fe4bb3dc
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 18:33:29 2014 +0200

    calendar: make freeing a calendar spec object deal fine with NULL
    
    In order to make object destruction easier (in particular in combination
    with _cleanup_) we usually make destructors deal with NULL objects as
    NOPs. Change the calendar spec destructor to follow the same scheme.

diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 6b6f990..e193a67 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1366,8 +1366,7 @@ int config_parse_timer(const char *unit,
 
         v = new0(TimerValue, 1);
         if (!v) {
-                if (c)
-                        calendar_spec_free(c);
+                calendar_spec_free(c);
                 return log_oom();
         }
 
diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c
index 69b7427..4ac74ab 100644
--- a/src/shared/calendarspec.c
+++ b/src/shared/calendarspec.c
@@ -35,7 +35,9 @@ static void free_chain(CalendarComponent *c) {
 }
 
 void calendar_spec_free(CalendarSpec *c) {
-        assert(c);
+
+        if (!c)
+                return;
 
         free_chain(c->year);
         free_chain(c->month);

commit 69f0081748fb4be1b7b772815e5c4202cdb88d3d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 18:32:30 2014 +0200

    timesyncd: the IP_TOS sockopt is really just an optimization, we shouldn't fail if we can't set it
    
    This partially undos 2f905e821e0342c36f5a5d3a51d53aabccc800bd

diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index e5b156b..3ae01eb 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -720,9 +720,7 @@ static int manager_listen_setup(Manager *m) {
         if (r < 0)
                 return -errno;
 
-        r = setsockopt(m->server_socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
-        if (r < 0)
-                return -errno;
+        (void) setsockopt(m->server_socket, IPPROTO_IP, IP_TOS, &tos, sizeof(tos));
 
         return sd_event_add_io(m->event, &m->event_receive, m->server_socket, EPOLLIN, manager_receive_response, m);
 }



More information about the systemd-commits mailing list