[systemd-commits] 3 commits - man/systemd.exec.xml src/bootchart src/libsystemd

Lennart Poettering lennart at kemper.freedesktop.org
Mon Aug 18 12:04:17 PDT 2014


 man/systemd.exec.xml                 |    2 +-
 src/bootchart/store.c                |    5 +++--
 src/libsystemd/sd-bus/bus-control.c  |    8 +++-----
 src/libsystemd/sd-bus/bus-internal.h |    2 ++
 src/libsystemd/sd-bus/bus-kernel.c   |    8 +++-----
 src/libsystemd/sd-bus/sd-bus.c       |   18 ++++++++++++++++++
 6 files changed, 30 insertions(+), 13 deletions(-)

New commits:
commit 8257df2767fe2eb535fb83966d92f3074c522150
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date:   Mon Aug 18 21:00:23 2014 +0200

    man: fix typo

diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index cfcf996..af103ff 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -1013,7 +1013,7 @@
                                 made inaccessible and empty for
                                 processes invoked by this unit. If set
                                 to <literal>read-only</literal>, the
-                                two directores are made read-only
+                                two directories are made read-only
                                 instead. It is recommended to enable
                                 this setting for all long-running
                                 services (in particular network-facing

commit ece74070c7102b2d48ccc01260976b3f5cb6d9f0
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date:   Mon Aug 18 20:59:11 2014 +0200

    bootchart: use NSEC_PER_SEC

diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index cedcba8..2d2ea42 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -34,6 +34,7 @@
 #include <time.h>
 
 #include "util.h"
+#include "time-util.h"
 #include "strxcpyx.h"
 #include "store.h"
 #include "bootchart.h"
@@ -54,14 +55,14 @@ double gettime_ns(void) {
 
         clock_gettime(CLOCK_MONOTONIC, &n);
 
-        return (n.tv_sec + (n.tv_nsec / 1000000000.0));
+        return (n.tv_sec + (n.tv_nsec / (double) NSEC_PER_SEC));
 }
 
 static double gettime_up(void) {
         struct timespec n;
 
         clock_gettime(CLOCK_BOOTTIME, &n);
-        return (n.tv_sec + (n.tv_nsec / 1000000000.0));
+        return (n.tv_sec + (n.tv_nsec / (double) NSEC_PER_SEC));
 }
 
 void log_uptime(void) {

commit fe3f22d116f6f0cac3bdfa512ac54c0faf8bb7cd
Author: Denis Kenzior <denkenz at gmail.com>
Date:   Mon Aug 18 13:21:55 2014 -0500

    bus-control: Fix cgroup handling
    
    On systems without properly setup systemd, cg_get_root_path returns
    -ENOENT.  This means that busctl doesn't display much information.
    
    busctl monitor also fails whenever it intercepts messages.
    
    This fix fakes creates a fake "/" root cgroup which lets busctl work
    on such systems.

diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 076bbce..ad372f6 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -495,11 +495,9 @@ static int bus_get_owner_kdbus(
                                         goto fail;
                                 }
 
-                                if (!bus->cgroup_root) {
-                                        r = cg_get_root_path(&bus->cgroup_root);
-                                        if (r < 0)
-                                                goto fail;
-                                }
+                                r = bus_get_root_path(bus);
+                                if (r < 0)
+                                        goto fail;
 
                                 c->cgroup_root = strdup(bus->cgroup_root);
                                 if (!c->cgroup_root) {
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index f2ccdfd..601ea5a 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -383,3 +383,5 @@ int bus_set_address_system_remote(sd_bus *b, const char *host);
 int bus_set_address_system_container(sd_bus *b, const char *machine);
 
 int bus_remove_match_by_string(sd_bus *bus, const char *match, sd_bus_message_handler_t callback, void *userdata);
+
+int bus_get_root_path(sd_bus *bus);
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index d384f84..3ca271c 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -542,11 +542,9 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
                         m->creds.cgroup = d->str;
                         m->creds.mask |= (SD_BUS_CREDS_CGROUP|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_USER_UNIT|SD_BUS_CREDS_SLICE|SD_BUS_CREDS_SESSION|SD_BUS_CREDS_OWNER_UID) & bus->creds_mask;
 
-                        if (!bus->cgroup_root) {
-                                r = cg_get_root_path(&bus->cgroup_root);
-                                if (r < 0)
-                                        goto fail;
-                        }
+                        r = bus_get_root_path(bus);
+                        if (r < 0)
+                                goto fail;
 
                         m->creds.cgroup_root = bus->cgroup_root;
 
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 83233fd..a204d67 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -3358,3 +3358,21 @@ _public_ int sd_bus_get_name(sd_bus *bus, const char **name) {
         *name = bus->connection_name;
         return 0;
 }
+
+int bus_get_root_path(sd_bus *bus) {
+        int r;
+
+        if (bus->cgroup_root)
+                return 0;
+
+        r = cg_get_root_path(&bus->cgroup_root);
+        if (r == -ENOENT) {
+                bus->cgroup_root = strdup("/");
+                if (!bus->cgroup_root)
+                        return -ENOMEM;
+
+                r = 0;
+        }
+
+        return r;
+}



More information about the systemd-commits mailing list