[systemd-commits] 4 commits - src/dbus-manager.c src/main.c src/systemctl.c TODO

Lennart Poettering lennart at kemper.freedesktop.org
Fri Mar 4 10:55:38 PST 2011


 TODO               |    2 ++
 src/dbus-manager.c |   34 +++++++++++++++++++++++++++++++++-
 src/main.c         |    7 ++-----
 src/systemctl.c    |    9 ++++++++-
 4 files changed, 45 insertions(+), 7 deletions(-)

New commits:
commit 63a723f3a7caf4eb1bc46a3849f59f27337924b7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 4 19:48:38 2011 +0100

    systemctl: fix exit code when directing is-enabled to chkconfig

diff --git a/src/systemctl.c b/src/systemctl.c
index b733b47..6adcbcc 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4087,10 +4087,15 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
                                         return r;
 
                                 if (status.si_code == CLD_EXITED) {
-                                        if (status.si_status == 0 && (streq(verb, "enable") || streq(verb, "disable")))
+
+                                        if (streq(verb, "is-enabled"))
+                                                return status.si_status == 0 ? 1 : 0;
+
+                                        if (status.si_status == 0)
                                                 n_symlinks ++;
 
                                         return status.si_status == 0 ? 0 : -EINVAL;
+
                                 } else
                                         return -EPROTO;
                         }
@@ -4193,6 +4198,8 @@ static int enable_unit(DBusConnection *bus, char **args, unsigned n) {
                         goto finish;
                 }
 
+        r = 0;
+
         while ((i = hashmap_first(will_install))) {
                 int q;
 

commit 81ab0d3c65206140fffafefa6d14e8494edc44cb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 4 19:48:12 2011 +0100

    main: minor optimization

diff --git a/src/main.c b/src/main.c
index 3291561..ef6e681 100644
--- a/src/main.c
+++ b/src/main.c
@@ -941,15 +941,12 @@ static void test_mtab(void) {
 }
 
 static void test_usr(void) {
-        struct stat a, b;
         bool separate = false;
 
         /* Check that /usr is not a separate fs */
 
-        if (lstat("/", &a) >= 0 && lstat("/usr", &b) >= 0)
-                if (a.st_dev != b.st_dev)
-                        separate = true;
-
+        if (path_is_mount_point("/usr") > 0)
+                separate = true;
         /* This check won't work usually during boot, since /usr is
          * probably not mounted yet, hence let's add a second
          * check. We just check whether /usr is an empty directory. */

commit c5d3439055d20be03ed3dff4b31f64da54319be0
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 4 19:47:43 2011 +0100

    dbus: add 'Tainted' property to Manager object

diff --git a/TODO b/TODO
index 43ac165..77ed9cb 100644
--- a/TODO
+++ b/TODO
@@ -18,8 +18,6 @@ Features:
 
 * guarantee /etc/machineid
 
-* add "tainted" flag to systemctl show output
-
 * introduce "x-systemd-automount" as alternative to the "comment=systemd.automount" mount option
 
 * show failure error string in "systemctl status"
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index 9b6cda8..1a58719 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -150,7 +150,8 @@
 #define BUS_MANAGER_INTERFACE_PROPERTIES_GENERAL                        \
         "  <property name=\"Version\" type=\"s\" access=\"read\"/>\n"   \
         "  <property name=\"Distribution\" type=\"s\" access=\"read\"/>\n" \
-        "  <property name=\"Features\" type=\"s\" access=\"read\"/\n"   \
+        "  <property name=\"Features\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"Tainted\" type=\"s\" access=\"read\"/>\n"   \
         "  <property name=\"RunningAs\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"InitRDTimestamp\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"StartupTimestamp\" type=\"t\" access=\"read\"/>\n" \
@@ -210,6 +211,32 @@ const char bus_manager_interface[] _introspect_("Manager") = BUS_MANAGER_INTERFA
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs);
 static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_output, ExecOutput);
 
+static int bus_manager_append_tainted(Manager *m, DBusMessageIter *i, const char *property, void *data) {
+        const char *t;
+        char buf[64] = "", *e = buf, *p = NULL;
+
+        assert(m);
+        assert(i);
+        assert(property);
+
+        if (path_is_mount_point("/usr") > 0 || dir_is_empty("/usr") > 0)
+                e = stpcpy(e, "usr-separate-fs");
+
+        if (readlink_malloc("/etc/mtab", &p) < 0) {
+                if (e != buf)
+                        e = stpcpy(e, " ");
+                e = stpcpy(e, "etc-mtab-not-symlink");
+        } else
+                free(p);
+
+        t = buf;
+
+        if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t))
+                return -ENOMEM;
+
+        return 0;
+}
+
 static int bus_manager_append_log_target(Manager *m, DBusMessageIter *i, const char *property, void *data) {
         const char *t;
 
@@ -310,6 +337,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 { "org.freedesktop.systemd1.Manager", "Distribution",  bus_property_append_string,    "s",  DISTRIBUTION       },
                 { "org.freedesktop.systemd1.Manager", "Features",      bus_property_append_string,    "s",  SYSTEMD_FEATURES   },
                 { "org.freedesktop.systemd1.Manager", "RunningAs",     bus_manager_append_running_as, "s",  &m->running_as     },
+                { "org.freedesktop.systemd1.Manager", "Tainted",       bus_manager_append_tainted,    "s",  m                  },
                 { "org.freedesktop.systemd1.Manager", "InitRDTimestamp", bus_property_append_uint64,  "t",  &m->initrd_timestamp.realtime },
                 { "org.freedesktop.systemd1.Manager", "StartupTimestamp", bus_property_append_uint64, "t",  &m->startup_timestamp.realtime },
                 { "org.freedesktop.systemd1.Manager", "FinishTimestamp", bus_property_append_uint64,  "t",  &m->finish_timestamp.realtime },

commit 09bde77fc798fb0f80714b77b958f24a3c2d798e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Mar 4 18:34:56 2011 +0100

    dbus: expose distribution name and features on manager object as properties

diff --git a/TODO b/TODO
index 14060a5..43ac165 100644
--- a/TODO
+++ b/TODO
@@ -16,6 +16,10 @@ F15:
 
 Features:
 
+* guarantee /etc/machineid
+
+* add "tainted" flag to systemctl show output
+
 * introduce "x-systemd-automount" as alternative to the "comment=systemd.automount" mount option
 
 * show failure error string in "systemctl status"
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index 1b3bddc..9b6cda8 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -26,6 +26,7 @@
 #include "dbus-manager.h"
 #include "strv.h"
 #include "bus-errors.h"
+#include "build.h"
 
 #define BUS_MANAGER_INTERFACE_BEGIN                                     \
         " <interface name=\"org.freedesktop.systemd1.Manager\">\n"
@@ -146,9 +147,10 @@
         "   <arg name=\"result\" type=\"s\"/>\n"                        \
         "  </signal>"
 
-
 #define BUS_MANAGER_INTERFACE_PROPERTIES_GENERAL                        \
         "  <property name=\"Version\" type=\"s\" access=\"read\"/>\n"   \
+        "  <property name=\"Distribution\" type=\"s\" access=\"read\"/>\n" \
+        "  <property name=\"Features\" type=\"s\" access=\"read\"/\n"   \
         "  <property name=\"RunningAs\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"InitRDTimestamp\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"StartupTimestamp\" type=\"t\" access=\"read\"/>\n" \
@@ -305,6 +307,8 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
 
         const BusProperty properties[] = {
                 { "org.freedesktop.systemd1.Manager", "Version",       bus_property_append_string,    "s",  PACKAGE_STRING     },
+                { "org.freedesktop.systemd1.Manager", "Distribution",  bus_property_append_string,    "s",  DISTRIBUTION       },
+                { "org.freedesktop.systemd1.Manager", "Features",      bus_property_append_string,    "s",  SYSTEMD_FEATURES   },
                 { "org.freedesktop.systemd1.Manager", "RunningAs",     bus_manager_append_running_as, "s",  &m->running_as     },
                 { "org.freedesktop.systemd1.Manager", "InitRDTimestamp", bus_property_append_uint64,  "t",  &m->initrd_timestamp.realtime },
                 { "org.freedesktop.systemd1.Manager", "StartupTimestamp", bus_property_append_uint64, "t",  &m->startup_timestamp.realtime },



More information about the systemd-commits mailing list