X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dbus-manager.c;h=47fb403f11b1d2521c55ed59e9b83c3003c852e9;hb=d4d0d4db9345170cc61a6b46ac9e11c5b8424b19;hp=a8bf7e52c95f07bd505b6e0f8008f34bd001b0c5;hpb=a16e112358ea8fea381ee106b89e645aed8b0a8c;p=elogind.git diff --git a/dbus-manager.c b/dbus-manager.c index a8bf7e52c..47fb403f1 100644 --- a/dbus-manager.c +++ b/dbus-manager.c @@ -78,8 +78,10 @@ " " \ " " \ " " \ - " " \ - " " \ + " " \ + " " \ + " " \ + " " \ " " \ BUS_PROPERTIES_INTERFACE \ BUS_INTROSPECTABLE_INTERFACE @@ -119,6 +121,36 @@ static int bus_manager_append_log_level(Manager *m, DBusMessageIter *i, const ch return 0; } +static int bus_manager_append_n_names(Manager *m, DBusMessageIter *i, const char *property, void *data) { + uint32_t u; + + assert(m); + assert(i); + assert(property); + + u = hashmap_size(m->units); + + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT32, &u)) + return -ENOMEM; + + return 0; +} + +static int bus_manager_append_n_jobs(Manager *m, DBusMessageIter *i, const char *property, void *data) { + uint32_t u; + + assert(m); + assert(i); + assert(property); + + u = hashmap_size(m->jobs); + + if (!dbus_message_iter_append_basic(i, DBUS_TYPE_UINT32, &u)) + return -ENOMEM; + + return 0; +} + static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusMessage *message, void *data) { Manager *m = data; @@ -128,6 +160,8 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection { "org.freedesktop.systemd1.Manager", "BootTimestamp", bus_property_append_uint64, "t", &m->boot_timestamp }, { "org.freedesktop.systemd1.Manager", "LogLevel", bus_manager_append_log_level, "s", NULL }, { "org.freedesktop.systemd1.Manager", "LogTarget", bus_manager_append_log_target, "s", NULL }, + { "org.freedesktop.systemd1.Manager", "NNames", bus_manager_append_n_names, "u", NULL }, + { "org.freedesktop.systemd1.Manager", "NJobs", bus_manager_append_n_jobs, "u", NULL }, { NULL, NULL, NULL, NULL, NULL } }; @@ -199,7 +233,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection DBUS_TYPE_INVALID)) goto oom; - } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1", "GetJob")) { + } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetJob")) { uint32_t id; Job *j;