[systemd-devel] [PATCH 2/2] dbus: add service D-Bus property "Sockets"

Andrey Borzenkov arvidjaar at gmail.com
Fri Mar 11 04:26:52 PST 2011


Support displaying of Sockets for a service. Renames
bus_unit_append_dependencies into bus_properties_append_units
as this is what it really does.
---
 src/dbus-service.c |    2 ++
 src/dbus-unit.c    |    2 +-
 src/dbus-unit.h    |   32 ++++++++++++++++----------------
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/dbus-service.c b/src/dbus-service.c
index ed28e22..45d0a09 100644
--- a/src/dbus-service.c
+++ b/src/dbus-service.c
@@ -58,6 +58,7 @@
         "  <property name=\"BusName\" type=\"s\" access=\"read\"/>\n"   \
         "  <property name=\"StatusText\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"FsckPassNo\" type=\"i\" access=\"read\"/>\n" \
+        "  <property name=\"Sockets\" type=\"as\" access=\"read\"/>\n" \
         BUS_SERVICE_SYSV_INTERFACE                                       \
        " </interface>\n"
 
@@ -118,6 +119,7 @@ DBusHandlerResult bus_service_message_handler(Unit *u, DBusConnection *connectio
                 { "org.freedesktop.systemd1.Service", "ControlPID",             bus_property_append_pid,    "u", &u->service.control_pid               },
                 { "org.freedesktop.systemd1.Service", "BusName",                bus_property_append_string, "s", u->service.bus_name                   },
                 { "org.freedesktop.systemd1.Service", "StatusText",             bus_property_append_string, "s", u->service.status_text                },
+                { "org.freedesktop.systemd1.Service", "Sockets",                bus_property_append_units, "as", u->service.configured_sockets         },
 #ifdef HAVE_SYSV_COMPAT
                 { "org.freedesktop.systemd1.Service", "SysVRunLevels",          bus_property_append_string, "s", u->service.sysv_runlevels             },
                 { "org.freedesktop.systemd1.Service", "SysVStartPriority",      bus_property_append_int,    "i", &u->service.sysv_start_priority       },
diff --git a/src/dbus-unit.c b/src/dbus-unit.c
index 563ef70..f1c6d4c 100644
--- a/src/dbus-unit.c
+++ b/src/dbus-unit.c
@@ -76,7 +76,7 @@ int bus_unit_append_following(Manager *m, DBusMessageIter *i, const char *proper
         return 0;
 }
 
-int bus_unit_append_dependencies(Manager *m, DBusMessageIter *i, const char *property, void *data) {
+int bus_property_append_units(Manager *m, DBusMessageIter *i, const char *property, void *data) {
         Unit *u;
         Iterator j;
         DBusMessageIter sub;
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index efb6179..a61434b 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -114,21 +114,21 @@
         { "org.freedesktop.systemd1.Unit", "Id",                   bus_property_append_string,     "s",    u->meta.id                        }, \
         { "org.freedesktop.systemd1.Unit", "Names",                bus_unit_append_names,          "as",   u                                 }, \
         { "org.freedesktop.systemd1.Unit", "Following",            bus_unit_append_following,      "s",    u                                 }, \
-        { "org.freedesktop.systemd1.Unit", "Requires",             bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUIRES] }, \
-        { "org.freedesktop.systemd1.Unit", "RequiresOverridable",  bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUIRES_OVERRIDABLE] }, \
-        { "org.freedesktop.systemd1.Unit", "Requisite",            bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUISITE] }, \
-        { "org.freedesktop.systemd1.Unit", "RequisiteOverridable", bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUISITE_OVERRIDABLE] }, \
-        { "org.freedesktop.systemd1.Unit", "Wants",                bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_WANTS]  }, \
-        { "org.freedesktop.systemd1.Unit", "BindTo",               bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_BIND_TO]  }, \
-        { "org.freedesktop.systemd1.Unit", "RequiredBy",           bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUIRED_BY] }, \
-        { "org.freedesktop.systemd1.Unit", "RequiredByOverridable",bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE] }, \
-        { "org.freedesktop.systemd1.Unit", "WantedBy",             bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_WANTED_BY] }, \
-        { "org.freedesktop.systemd1.Unit", "BoundBy",              bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_BOUND_BY]  }, \
-        { "org.freedesktop.systemd1.Unit", "Conflicts",            bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_CONFLICTS] }, \
-        { "org.freedesktop.systemd1.Unit", "ConflictedBy",         bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_CONFLICTED_BY] }, \
-        { "org.freedesktop.systemd1.Unit", "Before",               bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_BEFORE] }, \
-        { "org.freedesktop.systemd1.Unit", "After",                bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_AFTER]  }, \
-        { "org.freedesktop.systemd1.Unit", "OnFailure",            bus_unit_append_dependencies,   "as",   u->meta.dependencies[UNIT_ON_FAILURE] }, \
+        { "org.freedesktop.systemd1.Unit", "Requires",             bus_property_append_units,   "as",   u->meta.dependencies[UNIT_REQUIRES] }, \
+        { "org.freedesktop.systemd1.Unit", "RequiresOverridable",  bus_property_append_units,   "as",   u->meta.dependencies[UNIT_REQUIRES_OVERRIDABLE] }, \
+        { "org.freedesktop.systemd1.Unit", "Requisite",            bus_property_append_units,   "as",   u->meta.dependencies[UNIT_REQUISITE] }, \
+        { "org.freedesktop.systemd1.Unit", "RequisiteOverridable", bus_property_append_units,   "as",   u->meta.dependencies[UNIT_REQUISITE_OVERRIDABLE] }, \
+        { "org.freedesktop.systemd1.Unit", "Wants",                bus_property_append_units,   "as",   u->meta.dependencies[UNIT_WANTS]  }, \
+        { "org.freedesktop.systemd1.Unit", "BindTo",               bus_property_append_units,   "as",   u->meta.dependencies[UNIT_BIND_TO]  }, \
+        { "org.freedesktop.systemd1.Unit", "RequiredBy",           bus_property_append_units,   "as",   u->meta.dependencies[UNIT_REQUIRED_BY] }, \
+        { "org.freedesktop.systemd1.Unit", "RequiredByOverridable",bus_property_append_units,   "as",   u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE] }, \
+        { "org.freedesktop.systemd1.Unit", "WantedBy",             bus_property_append_units,   "as",   u->meta.dependencies[UNIT_WANTED_BY] }, \
+        { "org.freedesktop.systemd1.Unit", "BoundBy",              bus_property_append_units,   "as",   u->meta.dependencies[UNIT_BOUND_BY]  }, \
+        { "org.freedesktop.systemd1.Unit", "Conflicts",            bus_property_append_units,   "as",   u->meta.dependencies[UNIT_CONFLICTS] }, \
+        { "org.freedesktop.systemd1.Unit", "ConflictedBy",         bus_property_append_units,   "as",   u->meta.dependencies[UNIT_CONFLICTED_BY] }, \
+        { "org.freedesktop.systemd1.Unit", "Before",               bus_property_append_units,   "as",   u->meta.dependencies[UNIT_BEFORE] }, \
+        { "org.freedesktop.systemd1.Unit", "After",                bus_property_append_units,   "as",   u->meta.dependencies[UNIT_AFTER]  }, \
+        { "org.freedesktop.systemd1.Unit", "OnFailure",            bus_property_append_units,   "as",   u->meta.dependencies[UNIT_ON_FAILURE] }, \
         { "org.freedesktop.systemd1.Unit", "Description",          bus_unit_append_description,    "s",    u                                 }, \
         { "org.freedesktop.systemd1.Unit", "LoadState",            bus_unit_append_load_state,     "s",    &u->meta.load_state               }, \
         { "org.freedesktop.systemd1.Unit", "ActiveState",          bus_unit_append_active_state,   "s",    u                                 }, \
@@ -157,7 +157,7 @@
 
 int bus_unit_append_names(Manager *m, DBusMessageIter *i, const char *property, void *data);
 int bus_unit_append_following(Manager *m, DBusMessageIter *i, const char *property, void *data);
-int bus_unit_append_dependencies(Manager *m, DBusMessageIter *i, const char *property, void *data);
+int bus_property_append_units(Manager *m, DBusMessageIter *i, const char *property, void *data);
 int bus_unit_append_description(Manager *m, DBusMessageIter *i, const char *property, void *data);
 int bus_unit_append_load_state(Manager *m, DBusMessageIter *i, const char *property, void *data);
 int bus_unit_append_active_state(Manager *m, DBusMessageIter *i, const char *property, void *data);
-- 
1.7.4.1



More information about the systemd-devel mailing list