diff --git a/.gitignore b/.gitignore
index 700a085ad76..de52b6fbd68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+org.freedesktop.systemd1.*.xml
test-ns
test-loopback
systemd-cgroups-agent
diff --git a/Makefile.am b/Makefile.am
index ffa9ad9a829..b3e9dfde811 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,7 @@ udevrulesdir=@udevrulesdir@
pkgsysconfdir=$(sysconfdir)/systemd
systemunitdir=$(pkgdatadir)/system
sessionunitdir=$(pkgdatadir)/session
+interfacedir=$(datadir)/dbus-1/interfaces
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
@@ -64,6 +65,19 @@ dist_dbuspolicy_DATA = \
dist_udevrules_DATA = \
src/99-systemd.rules
+interface_DATA = \
+ org.freedesktop.systemd1.Manager.xml \
+ org.freedesktop.systemd1.Job.xml \
+ org.freedesktop.systemd1.Unit.xml \
+ org.freedesktop.systemd1.Service.xml \
+ org.freedesktop.systemd1.Socket.xml \
+ org.freedesktop.systemd1.Target.xml \
+ org.freedesktop.systemd1.Device.xml \
+ org.freedesktop.systemd1.Mount.xml \
+ org.freedesktop.systemd1.Automount.xml \
+ org.freedesktop.systemd1.Snapshot.xml \
+ org.freedesktop.systemd1.Swap.xml
+
dist_systemunit_DATA = \
units/emergency.service \
units/getty.target \
@@ -426,6 +440,11 @@ CLEANFILES += \
man/systemd.special.html.in
endif
+org.freedesktop.systemd1.%.xml: systemd
+ $(AM_V_GEN)./systemd --introspect=${@:.xml=} > $@
+
+CLEANFILES += $(interface_DATA)
+
install-data-hook:
$(MKDIR_P) -m 0755 \
$(DESTDIR)$(systemunitdir) \
diff --git a/fixme b/fixme
index b6752d9bf60..6b6f7f7d0a8 100644
--- a/fixme
+++ b/fixme
@@ -64,6 +64,8 @@
* tcpwrap
+* introduce exit.target for session instances
+
Regularly:
* look for close() vs. close_nointr() vs. close_nointr_nofail()
diff --git a/src/dbus-automount.c b/src/dbus-automount.c
index 9003b74b8ac..285f666da91 100644
--- a/src/dbus-automount.c
+++ b/src/dbus-automount.c
@@ -22,16 +22,21 @@
#include "dbus-unit.h"
#include "dbus-automount.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_AUTOMOUNT_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_AUTOMOUNT_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_automount_interface[] = BUS_AUTOMOUNT_INTERFACE;
DBusHandlerResult bus_automount_message_handler(Unit *u, DBusMessage *message) {
const BusProperty properties[] = {
@@ -40,5 +45,5 @@ DBusHandlerResult bus_automount_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-automount.h b/src/dbus-automount.h
index 947bf0f59fd..5e0ee5107b6 100644
--- a/src/dbus-automount.h
+++ b/src/dbus-automount.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_automount_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_automount_interface[];
+
#endif
diff --git a/src/dbus-device.c b/src/dbus-device.c
index 83764783adc..0610ab873ff 100644
--- a/src/dbus-device.c
+++ b/src/dbus-device.c
@@ -22,16 +22,21 @@
#include "dbus-unit.h"
#include "dbus-device.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_DEVICE_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_DEVICE_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_device_interface[] = BUS_DEVICE_INTERFACE;
DBusHandlerResult bus_device_message_handler(Unit *u, DBusMessage *message) {
const BusProperty properties[] = {
@@ -40,5 +45,5 @@ DBusHandlerResult bus_device_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-device.h b/src/dbus-device.h
index f2850a63f83..55bb8f55f3e 100644
--- a/src/dbus-device.h
+++ b/src/dbus-device.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_device_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_device_interface[];
+
#endif
diff --git a/src/dbus-execute.h b/src/dbus-execute.h
index 25ecd982a43..6abae1657c1 100644
--- a/src/dbus-execute.h
+++ b/src/dbus-execute.h
@@ -27,23 +27,23 @@
#include "manager.h"
#define BUS_EXEC_CONTEXT_INTERFACE \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " "
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
#define BUS_EXEC_CONTEXT_PROPERTIES(interface, context) \
{ interface, "Environment", bus_property_append_strv, "as", (context).environment }, \
diff --git a/src/dbus-job.c b/src/dbus-job.c
index 34e64fc6812..7346252a18a 100644
--- a/src/dbus-job.c
+++ b/src/dbus-job.c
@@ -25,20 +25,25 @@
#include "log.h"
#include "dbus-job.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- BUS_PROPERTIES_INTERFACE
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_JOB_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_JOB_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_job_interface[] = BUS_JOB_INTERFACE;
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_job_append_state, job_state, JobState);
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_job_append_type, job_type, JobType);
@@ -92,7 +97,7 @@ static DBusHandlerResult bus_job_message_dispatch(Job *j, DBusMessage *message)
job_free(j);
} else
- return bus_default_message_handler(j->manager, message, introspection, properties);
+ return bus_default_message_handler(j->manager, message, INTROSPECTION, properties);
if (reply) {
if (!dbus_connection_send(m->api_bus, reply, NULL))
diff --git a/src/dbus-job.h b/src/dbus-job.h
index 46023588564..2b79423f01b 100644
--- a/src/dbus-job.h
+++ b/src/dbus-job.h
@@ -29,4 +29,6 @@ void bus_job_send_removed_signal(Job *j, bool success);
extern const DBusObjectPathVTable bus_job_vtable;
+extern const char bus_job_interface[];
+
#endif
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index 9833b6c85f9..6b658d1931e 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -26,77 +26,82 @@
#include "dbus-manager.h"
#include "strv.h"
+#define BUS_MANAGER_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " " \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
+
#define INTROSPECTION_BEGIN \
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
- "" \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
+ "\n" \
+ BUS_MANAGER_INTERFACE \
BUS_PROPERTIES_INTERFACE \
BUS_INTROSPECTABLE_INTERFACE
#define INTROSPECTION_END \
- ""
+ "\n"
+
+const char bus_manager_interface[] = BUS_MANAGER_INTERFACE;
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs);
diff --git a/src/dbus-manager.h b/src/dbus-manager.h
index 0acd2d086d0..996b680e3c2 100644
--- a/src/dbus-manager.h
+++ b/src/dbus-manager.h
@@ -26,4 +26,6 @@
extern const DBusObjectPathVTable bus_manager_vtable;
+extern const char bus_manager_interface[];
+
#endif
diff --git a/src/dbus-mount.c b/src/dbus-mount.c
index 500b773bf6b..cccfa60e109 100644
--- a/src/dbus-mount.c
+++ b/src/dbus-mount.c
@@ -25,23 +25,28 @@
#include "dbus-mount.h"
#include "dbus-execute.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- " "
- " "
- " "
- BUS_EXEC_CONTEXT_INTERFACE
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_MOUNT_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ BUS_EXEC_CONTEXT_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_MOUNT_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_mount_interface[] = BUS_MOUNT_INTERFACE;
static int bus_mount_append_what(Manager *n, DBusMessageIter *i, const char *property, void *data) {
Mount *m = data;
@@ -130,5 +135,5 @@ DBusHandlerResult bus_mount_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-mount.h b/src/dbus-mount.h
index b92867df288..6d8d1a9685a 100644
--- a/src/dbus-mount.h
+++ b/src/dbus-mount.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_mount_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_mount_interface[];
+
#endif
diff --git a/src/dbus-service.c b/src/dbus-service.c
index 24dd6c14f64..6286172a1bc 100644
--- a/src/dbus-service.c
+++ b/src/dbus-service.c
@@ -25,29 +25,34 @@
#include "dbus-execute.h"
#include "dbus-service.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- " "
- " "
- " "
- BUS_EXEC_CONTEXT_INTERFACE
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_SERVICE_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ BUS_EXEC_CONTEXT_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_SERVICE_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_service_interface[] = BUS_SERVICE_INTERFACE;
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_type, service_type, ServiceType);
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_restart, service_restart, ServiceRestart);
@@ -74,5 +79,5 @@ DBusHandlerResult bus_service_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-service.h b/src/dbus-service.h
index f0a468e90d9..ab1e02f3520 100644
--- a/src/dbus-service.h
+++ b/src/dbus-service.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_service_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_service_interface[];
+
#endif
diff --git a/src/dbus-snapshot.c b/src/dbus-snapshot.c
index 8aeca15254e..15e51f032e6 100644
--- a/src/dbus-snapshot.c
+++ b/src/dbus-snapshot.c
@@ -22,17 +22,22 @@
#include "dbus-unit.h"
#include "dbus-snapshot.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_SNAPSHOT_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_SNAPSHOT_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_snapshot_interface[] = BUS_SNAPSHOT_INTERFACE;
DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message) {
const BusProperty properties[] = {
@@ -54,7 +59,7 @@ DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message) {
goto oom;
} else
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
if (reply) {
if (!dbus_connection_send(u->meta.manager->api_bus, reply, NULL))
diff --git a/src/dbus-snapshot.h b/src/dbus-snapshot.h
index 5f28550c95f..bf5a4d4bc53 100644
--- a/src/dbus-snapshot.h
+++ b/src/dbus-snapshot.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_snapshot_interface[];
+
#endif
diff --git a/src/dbus-socket.c b/src/dbus-socket.c
index cb244a90034..426af2b4cf7 100644
--- a/src/dbus-socket.c
+++ b/src/dbus-socket.c
@@ -25,25 +25,30 @@
#include "dbus-socket.h"
#include "dbus-execute.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- " "
- BUS_EXEC_CONTEXT_INTERFACE
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_SOCKET_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ BUS_EXEC_CONTEXT_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_SOCKET_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_socket_interface[] = BUS_SOCKET_INTERFACE;
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_socket_append_bind_ipv6_only, socket_address_bind_ipv6_only, SocketAddressBindIPv6Only);
@@ -64,5 +69,5 @@ DBusHandlerResult bus_socket_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-socket.h b/src/dbus-socket.h
index 6a8f534bf58..ab063220422 100644
--- a/src/dbus-socket.h
+++ b/src/dbus-socket.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_socket_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_socket_interface[];
+
#endif
diff --git a/src/dbus-swap.c b/src/dbus-swap.c
index e935e09bf21..f6f8685dafe 100644
--- a/src/dbus-swap.c
+++ b/src/dbus-swap.c
@@ -25,17 +25,22 @@
#include "dbus-unit.h"
#include "dbus-swap.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_SWAP_INTERFACE \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_SWAP_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_swap_interface[] = BUS_SWAP_INTERFACE;
static int bus_swap_append_priority(Manager *m, DBusMessageIter *i, const char *property, void *data) {
Swap *s = data;
@@ -69,5 +74,5 @@ DBusHandlerResult bus_swap_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-swap.h b/src/dbus-swap.h
index 3bef6ad621b..cbd15919db5 100644
--- a/src/dbus-swap.h
+++ b/src/dbus-swap.h
@@ -29,4 +29,6 @@
DBusHandlerResult bus_swap_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_swap_interface[];
+
#endif
diff --git a/src/dbus-target.c b/src/dbus-target.c
index be984b9bb47..45f0d31f05d 100644
--- a/src/dbus-target.c
+++ b/src/dbus-target.c
@@ -22,15 +22,20 @@
#include "dbus-unit.h"
#include "dbus-target.h"
-static const char introspection[] =
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
- ""
- BUS_UNIT_INTERFACE
- BUS_PROPERTIES_INTERFACE
- " "
- " "
- BUS_INTROSPECTABLE_INTERFACE
- "";
+#define BUS_TARGET_INTERFACE \
+ " \n" \
+ " \n"
+
+#define INTROSPECTION \
+ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
+ "\n" \
+ BUS_UNIT_INTERFACE \
+ BUS_TARGET_INTERFACE \
+ BUS_PROPERTIES_INTERFACE \
+ BUS_INTROSPECTABLE_INTERFACE \
+ "\n"
+
+const char bus_target_interface[] = BUS_TARGET_INTERFACE;
DBusHandlerResult bus_target_message_handler(Unit *u, DBusMessage *message) {
const BusProperty properties[] = {
@@ -38,5 +43,5 @@ DBusHandlerResult bus_target_message_handler(Unit *u, DBusMessage *message) {
{ NULL, NULL, NULL, NULL, NULL }
};
- return bus_default_message_handler(u->meta.manager, message, introspection, properties);
+ return bus_default_message_handler(u->meta.manager, message, INTROSPECTION, properties);
}
diff --git a/src/dbus-target.h b/src/dbus-target.h
index f6a1ac5e65d..d118441a676 100644
--- a/src/dbus-target.h
+++ b/src/dbus-target.h
@@ -28,4 +28,6 @@
DBusHandlerResult bus_target_message_handler(Unit *u, DBusMessage *message);
+extern const char bus_target_interface[];
+
#endif
diff --git a/src/dbus-unit.c b/src/dbus-unit.c
index ba428a8d5c7..87218cd2ee3 100644
--- a/src/dbus-unit.c
+++ b/src/dbus-unit.c
@@ -25,6 +25,8 @@
#include "log.h"
#include "dbus-unit.h"
+const char bus_unit_interface[] = BUS_UNIT_INTERFACE;
+
int bus_unit_append_names(Manager *m, DBusMessageIter *i, const char *property, void *data) {
char *t;
Iterator j;
diff --git a/src/dbus-unit.h b/src/dbus-unit.h
index c5840d56327..07641ee9516 100644
--- a/src/dbus-unit.h
+++ b/src/dbus-unit.h
@@ -27,54 +27,54 @@
#include "manager.h"
#define BUS_UNIT_INTERFACE \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " "
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
#define BUS_UNIT_PROPERTIES \
{ "org.freedesktop.systemd1.Unit", "Id", bus_property_append_string, "s", u->meta.id }, \
@@ -125,4 +125,6 @@ void bus_unit_send_removed_signal(Unit *u);
extern const DBusObjectPathVTable bus_unit_vtable;
+extern const char bus_unit_interface[];
+
#endif
diff --git a/src/dbus.c b/src/dbus.c
index 6ed659a2393..5caf1eb1917 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -32,6 +32,34 @@
#include "dbus-unit.h"
#include "dbus-job.h"
#include "dbus-manager.h"
+#include "dbus-service.h"
+#include "dbus-socket.h"
+#include "dbus-target.h"
+#include "dbus-device.h"
+#include "dbus-mount.h"
+#include "dbus-automount.h"
+#include "dbus-snapshot.h"
+#include "dbus-swap.h"
+
+static const char bus_properties_interface[] = BUS_PROPERTIES_INTERFACE;
+static const char bus_introspectable_interface[] = BUS_INTROSPECTABLE_INTERFACE;
+
+const char *const bus_interface_table[] = {
+ "org.freedesktop.DBus.Properties", bus_properties_interface,
+ "org.freedesktop.DBus.Introspectable", bus_introspectable_interface,
+ "org.freedesktop.systemd1.Manager", bus_manager_interface,
+ "org.freedesktop.systemd1.Job", bus_job_interface,
+ "org.freedesktop.systemd1.Unit", bus_unit_interface,
+ "org.freedesktop.systemd1.Service", bus_service_interface,
+ "org.freedesktop.systemd1.Socket", bus_socket_interface,
+ "org.freedesktop.systemd1.Target", bus_target_interface,
+ "org.freedesktop.systemd1.Device", bus_device_interface,
+ "org.freedesktop.systemd1.Mount", bus_mount_interface,
+ "org.freedesktop.systemd1.Automount", bus_automount_interface,
+ "org.freedesktop.systemd1.Snapshot", bus_snapshot_interface,
+ "org.freedesktop.systemd1.Swap", bus_swap_interface,
+ NULL
+};
static void api_bus_dispatch_status(DBusConnection *bus, DBusDispatchStatus status, void *data) {
Manager *m = data;
diff --git a/src/dbus.h b/src/dbus.h
index 51b71eac610..3ad299ed38d 100644
--- a/src/dbus.h
+++ b/src/dbus.h
@@ -37,24 +37,24 @@ typedef struct BusProperty {
} BusProperty;
#define BUS_PROPERTIES_INTERFACE \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " " \
- " "
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
#define BUS_INTROSPECTABLE_INTERFACE \
- " " \
- " " \
- " " \
- " " \
- " "
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n" \
+ " \n"
int bus_init_system(Manager *m);
int bus_init_api(Manager *m);
@@ -104,4 +104,6 @@ int bus_property_append_uint64(Manager *m, DBusMessageIter *i, const char *prope
int bus_parse_strv(DBusMessage *m, char ***_l);
+extern const char * const bus_interface_table[];
+
#endif
diff --git a/src/main.c b/src/main.c
index 3b9719fb568..d7d3995e1b1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -45,7 +45,8 @@ static enum {
ACTION_RUN,
ACTION_HELP,
ACTION_TEST,
- ACTION_DUMP_CONFIGURATION_ITEMS
+ ACTION_DUMP_CONFIGURATION_ITEMS,
+ ACTION_DONE
} action = ACTION_RUN;
static char *default_unit = NULL;
@@ -347,7 +348,8 @@ static int parse_argv(int argc, char *argv[]) {
ARG_TEST,
ARG_DUMP_CONFIGURATION_ITEMS,
ARG_CONFIRM_SPAWN,
- ARG_DESERIALIZE
+ ARG_DESERIALIZE,
+ ARG_INTROSPECT
};
static const struct option options[] = {
@@ -360,6 +362,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS },
{ "confirm-spawn", no_argument, NULL, ARG_CONFIRM_SPAWN },
{ "deserialize", required_argument, NULL, ARG_DESERIALIZE },
+ { "introspect", optional_argument, NULL, ARG_INTROSPECT },
{ NULL, 0, NULL, 0 }
};
@@ -444,6 +447,27 @@ static int parse_argv(int argc, char *argv[]) {
break;
}
+ case ARG_INTROSPECT: {
+ const char * const * i = NULL;
+
+ for (i = bus_interface_table; *i; i += 2)
+ if (!optarg || streq(i[0], optarg)) {
+ fputs(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
+ "\n", stdout);
+ fputs(i[1], stdout);
+ fputs("\n", stdout);
+
+ if (optarg)
+ break;
+ }
+
+ if (!i[0] && optarg)
+ log_error("Unknown interface %s.", optarg);
+
+ action = ACTION_DONE;
+ break;
+ }
+
case 'h':
action = ACTION_HELP;
break;
@@ -478,7 +502,8 @@ static int help(void) {
" --running-as=AS Set running as (init, system, session)\n"
" --test Determine startup sequence, dump it and exit\n"
" --dump-configuration-items Dump understood unit configuration items\n"
- " --confirm-spawn Ask for confirmation when spawning processes\n",
+ " --confirm-spawn Ask for confirmation when spawning processes\n"
+ " --introspect[=INTERFACE] Extract D-Bus interface data\n",
__progname);
return 0;
@@ -582,6 +607,9 @@ int main(int argc, char *argv[]) {
unit_dump_config_items(stdout);
retval = 0;
goto finish;
+ } else if (action == ACTION_DONE) {
+ retval = 0;
+ goto finish;
}
assert_se(action == ACTION_RUN || action == ACTION_TEST);