X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fdbus-manager.c;h=e1bf9fd28c2ec328c74180b2219e09edffb023ff;hb=4fe60156fc45e34c7bcba4779123e15620532dff;hp=7d4703b88b04e4e0c2baa1036442885bad08745e;hpb=c826cda421f0272275342173e16250adcdf6fbd4;p=elogind.git diff --git a/src/dbus-manager.c b/src/dbus-manager.c index 7d4703b88..e1bf9fd28 100644 --- a/src/dbus-manager.c +++ b/src/dbus-manager.c @@ -20,6 +20,7 @@ ***/ #include +#include #include "dbus.h" #include "log.h" @@ -154,8 +155,11 @@ " \n" \ " \n" \ " \n" \ + " \n" \ " \n" \ + " \n" \ " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ @@ -206,6 +210,10 @@ #define INTROSPECTION_END \ "\n" +#define INTERFACES_LIST \ + BUS_GENERIC_INTERFACES_LIST \ + "org.freedesktop.systemd1.Manager\0" + const char bus_manager_interface[] _introspect_("Manager") = BUS_MANAGER_INTERFACE; static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs); @@ -213,23 +221,24 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_outp 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; + char buf[LINE_MAX] = "", *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 (m->taint_usr) + 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 + if (readlink_malloc("/etc/mtab", &p) < 0) + e = stpcpy(e, "etc-mtab-not-symlink "); + else free(p); - t = buf; + if (access("/proc/cgroups", F_OK) < 0) + e = stpcpy(e, "cgroups-missing "); + + t = strstrip(buf); if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t)) return -ENOMEM; @@ -363,8 +372,11 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, { "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", "InitRDTimestampMonotonic", bus_property_append_uint64, "t", &m->initrd_timestamp.monotonic }, { "org.freedesktop.systemd1.Manager", "StartupTimestamp", bus_property_append_uint64, "t", &m->startup_timestamp.realtime }, + { "org.freedesktop.systemd1.Manager", "StartupTimestampMonotonic", bus_property_append_uint64, "t", &m->startup_timestamp.monotonic }, { "org.freedesktop.systemd1.Manager", "FinishTimestamp", bus_property_append_uint64, "t", &m->finish_timestamp.realtime }, + { "org.freedesktop.systemd1.Manager", "FinishTimestampMonotonic", bus_property_append_uint64, "t",&m->finish_timestamp.monotonic }, { "org.freedesktop.systemd1.Manager", "LogLevel", bus_manager_append_log_level, "s", NULL, bus_manager_set_log_level}, { "org.freedesktop.systemd1.Manager", "LogTarget", bus_manager_append_log_target, "s", NULL, bus_manager_set_log_target}, { "org.freedesktop.systemd1.Manager", "NNames", bus_manager_append_n_names, "u", NULL }, @@ -1014,14 +1026,16 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, if (!e) goto oom; - if (!(reply = dbus_message_new_method_return(message))) + if (!(reply = dbus_message_new_method_return(message))) { + strv_free(e); goto oom; + } strv_free(m->environment); m->environment = e; } else - return bus_default_message_handler(m, connection, message, NULL, properties); + return bus_default_message_handler(m, connection, message, NULL, INTERFACES_LIST, properties); if (job_type != _JOB_TYPE_INVALID) { const char *name, *smode, *old_name = NULL; @@ -1102,8 +1116,6 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, goto oom; } - free(path); - if (reply) { if (!dbus_connection_send(connection, reply, NULL)) goto oom; @@ -1111,6 +1123,8 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, dbus_message_unref(reply); } + free(path); + return DBUS_HANDLER_RESULT_HANDLED; oom: