203 lines
9.5 KiB
Diff
203 lines
9.5 KiB
Diff
|
From 14099ed04a693791dc6645566ee55a08be19a199 Mon Sep 17 00:00:00 2001
|
||
|
From: Felipe Sateler <fsateler@debian.org>
|
||
|
Date: Tue, 12 Feb 2019 20:29:42 -0300
|
||
|
Subject: [PATCH] build-sys: don't generate introspection xml by running the
|
||
|
program
|
||
|
|
||
|
Instead, embed the xml file into the binary. This should make both
|
||
|
cross-compiling and editing the introspection xml easier.
|
||
|
---
|
||
|
Makefile.am | 8 +++--
|
||
|
configure.ac | 1 +
|
||
|
org.freedesktop.RealtimeKit1.xml | 42 +++++++++++++++++++++++++++
|
||
|
rtkit-daemon.c | 50 +++-----------------------------
|
||
|
xml-introspection.S | 7 +++++
|
||
|
5 files changed, 59 insertions(+), 49 deletions(-)
|
||
|
create mode 100644 org.freedesktop.RealtimeKit1.xml
|
||
|
create mode 100644 xml-introspection.S
|
||
|
|
||
|
diff --git a/Makefile.am b/Makefile.am
|
||
|
index 25aaa10..8fe24f8 100644
|
||
|
--- a/Makefile.am
|
||
|
+++ b/Makefile.am
|
||
|
@@ -33,6 +33,7 @@ EXTRA_DIST = \
|
||
|
org.freedesktop.RealtimeKit1.policy \
|
||
|
org.freedesktop.RealtimeKit1.conf \
|
||
|
org.freedesktop.RealtimeKit1.service.in \
|
||
|
+ org.freedesktop.RealtimeKit1.xml \
|
||
|
rtkit-daemon.service.in
|
||
|
|
||
|
CLEANFILES = \
|
||
|
@@ -60,7 +61,9 @@ systemdsystemunit_DATA = \
|
||
|
endif
|
||
|
|
||
|
rtkit_daemon_SOURCES = \
|
||
|
- rtkit-daemon.c rtkit.h
|
||
|
+ rtkit-daemon.c \
|
||
|
+ rtkit.h \
|
||
|
+ xml-introspection.S
|
||
|
rtkit_daemon_LDADD = \
|
||
|
$(DBUS_LIBS) \
|
||
|
$(LIBSYSTEMD_LIBS)
|
||
|
@@ -91,8 +94,7 @@ org.freedesktop.RealtimeKit1.service: org.freedesktop.RealtimeKit1.service.in
|
||
|
rtkit-daemon.service: rtkit-daemon.service.in
|
||
|
$(AM_V_GEN)sed -e 's,@LIBEXECDIR\@,$(libexecdir),g' < $< > $@
|
||
|
|
||
|
-org.freedesktop.RealtimeKit1.xml: rtkit-daemon
|
||
|
- $(AM_V_GEN)./$< --introspect > $@
|
||
|
+xml-introspection.o: org.freedesktop.RealtimeKit1.xml
|
||
|
|
||
|
man8_MANS = rtkitctl.8
|
||
|
|
||
|
diff --git a/configure.ac b/configure.ac
|
||
|
index 1e62ebc..aafff94 100644
|
||
|
--- a/configure.ac
|
||
|
+++ b/configure.ac
|
||
|
@@ -51,6 +51,7 @@ AM_PROG_CC_C_O
|
||
|
AC_PROG_GCC_TRADITIONAL
|
||
|
AC_USE_SYSTEM_EXTENSIONS
|
||
|
AC_SYS_LARGEFILE
|
||
|
+AM_PROG_AS
|
||
|
|
||
|
# GCC flags
|
||
|
|
||
|
diff --git a/org.freedesktop.RealtimeKit1.xml b/org.freedesktop.RealtimeKit1.xml
|
||
|
new file mode 100644
|
||
|
index 0000000..305e767
|
||
|
--- /dev/null
|
||
|
+++ b/org.freedesktop.RealtimeKit1.xml
|
||
|
@@ -0,0 +1,42 @@
|
||
|
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||
|
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||
|
+<node>
|
||
|
+ <interface name="org.freedesktop.RealtimeKit1">
|
||
|
+ <method name="MakeThreadRealtime">
|
||
|
+ <arg name="thread" type="t" direction="in"/>
|
||
|
+ <arg name="priority" type="u" direction="in"/>
|
||
|
+ </method>
|
||
|
+ <method name="MakeThreadRealtimeWithPID">
|
||
|
+ <arg name="process" type="t" direction="in"/>
|
||
|
+ <arg name="thread" type="t" direction="in"/>
|
||
|
+ <arg name="priority" type="u" direction="in"/>
|
||
|
+ </method>
|
||
|
+ <method name="MakeThreadHighPriority">
|
||
|
+ <arg name="thread" type="t" direction="in"/>
|
||
|
+ <arg name="priority" type="i" direction="in"/>
|
||
|
+ </method>
|
||
|
+ <method name="MakeThreadHighPriorityWithPID">
|
||
|
+ <arg name="process" type="t" direction="in"/>
|
||
|
+ <arg name="thread" type="t" direction="in"/>
|
||
|
+ <arg name="priority" type="i" direction="in"/>
|
||
|
+ </method>
|
||
|
+ <method name="ResetKnown"/>
|
||
|
+ <method name="ResetAll"/>
|
||
|
+ <method name="Exit"/>
|
||
|
+ <property name="RTTimeUSecMax" type="x" access="read"/>
|
||
|
+ <property name="MaxRealtimePriority" type="i" access="read"/>
|
||
|
+ <property name="MinNiceLevel" type="i" access="read"/>
|
||
|
+ </interface>
|
||
|
+ <interface name="org.freedesktop.DBus.Properties">
|
||
|
+ <method name="Get">
|
||
|
+ <arg name="interface" direction="in" type="s"/>
|
||
|
+ <arg name="property" direction="in" type="s"/>
|
||
|
+ <arg name="value" direction="out" type="v"/>
|
||
|
+ </method>
|
||
|
+ </interface>
|
||
|
+ <interface name="org.freedesktop.DBus.Introspectable">
|
||
|
+ <method name="Introspect">
|
||
|
+ <arg name="data" type="s" direction="out"/>
|
||
|
+ </method>
|
||
|
+ </interface>
|
||
|
+</node>
|
||
|
diff --git a/rtkit-daemon.c b/rtkit-daemon.c
|
||
|
index 205478b..6884644 100644
|
||
|
--- a/rtkit-daemon.c
|
||
|
+++ b/rtkit-daemon.c
|
||
|
@@ -67,48 +67,8 @@
|
||
|
#define RLIMIT_RTTIME 15
|
||
|
#endif
|
||
|
|
||
|
-#define INTROSPECT_XML \
|
||
|
- DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
|
||
|
- "<node>\n" \
|
||
|
- " <interface name=\"org.freedesktop.RealtimeKit1\">\n" \
|
||
|
- " <method name=\"MakeThreadRealtime\">\n" \
|
||
|
- " <arg name=\"thread\" type=\"t\" direction=\"in\"/>\n" \
|
||
|
- " <arg name=\"priority\" type=\"u\" direction=\"in\"/>\n" \
|
||
|
- " </method>\n" \
|
||
|
- " <method name=\"MakeThreadRealtimeWithPID\">\n" \
|
||
|
- " <arg name=\"process\" type=\"t\" direction=\"in\"/>\n" \
|
||
|
- " <arg name=\"thread\" type=\"t\" direction=\"in\"/>\n" \
|
||
|
- " <arg name=\"priority\" type=\"u\" direction=\"in\"/>\n" \
|
||
|
- " </method>\n" \
|
||
|
- " <method name=\"MakeThreadHighPriority\">\n" \
|
||
|
- " <arg name=\"thread\" type=\"t\" direction=\"in\"/>\n" \
|
||
|
- " <arg name=\"priority\" type=\"i\" direction=\"in\"/>\n" \
|
||
|
- " </method>\n" \
|
||
|
- " <method name=\"MakeThreadHighPriorityWithPID\">\n" \
|
||
|
- " <arg name=\"process\" type=\"t\" direction=\"in\"/>\n" \
|
||
|
- " <arg name=\"thread\" type=\"t\" direction=\"in\"/>\n" \
|
||
|
- " <arg name=\"priority\" type=\"i\" direction=\"in\"/>\n" \
|
||
|
- " </method>\n" \
|
||
|
- " <method name=\"ResetKnown\"/>\n" \
|
||
|
- " <method name=\"ResetAll\"/>\n" \
|
||
|
- " <method name=\"Exit\"/>\n" \
|
||
|
- " <property name=\"RTTimeUSecMax\" type=\"x\" access=\"read\"/>\n" \
|
||
|
- " <property name=\"MaxRealtimePriority\" type=\"i\" access=\"read\"/>\n" \
|
||
|
- " <property name=\"MinNiceLevel\" type=\"i\" access=\"read\"/>\n" \
|
||
|
- " </interface>\n" \
|
||
|
- " <interface name=\"org.freedesktop.DBus.Properties\">\n"\
|
||
|
- " <method name=\"Get\">" \
|
||
|
- " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n" \
|
||
|
- " <arg name=\"property\" direction=\"in\" type=\"s\"/>\n" \
|
||
|
- " <arg name=\"value\" direction=\"out\" type=\"v\"/>\n" \
|
||
|
- " </method>\n" \
|
||
|
- " </interface>\n" \
|
||
|
- " <interface name=\"org.freedesktop.DBus.Introspectable\">\n" \
|
||
|
- " <method name=\"Introspect\">\n" \
|
||
|
- " <arg name=\"data\" type=\"s\" direction=\"out\"/>\n" \
|
||
|
- " </method>\n" \
|
||
|
- " </interface>\n" \
|
||
|
- "</node>\n"
|
||
|
+/* The introspection XML from org.freedesktop.RealtimeKit1.xml (via xml-introspection.S) */
|
||
|
+extern const char introspect_xml[];
|
||
|
|
||
|
/* Similar to assert(), but has side effects, and hence shall never be optimized away, regardless of NDEBUG */
|
||
|
#define assert_se(expr) \
|
||
|
@@ -1457,12 +1417,10 @@ static DBusHandlerResult dbus_handler(DBusConnection *c, DBusMessage *m, void *u
|
||
|
interface));
|
||
|
|
||
|
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
|
||
|
- const char *xml = INTROSPECT_XML;
|
||
|
-
|
||
|
assert_se(r = dbus_message_new_method_return(m));
|
||
|
assert_se(dbus_message_append_args(
|
||
|
r,
|
||
|
- DBUS_TYPE_STRING, &xml,
|
||
|
+ DBUS_TYPE_STRING, &introspect_xml,
|
||
|
DBUS_TYPE_INVALID));
|
||
|
} else
|
||
|
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||
|
@@ -2256,7 +2214,7 @@ static int parse_command_line(int argc, char *argv[], int *ret) {
|
||
|
break;
|
||
|
|
||
|
case ARG_INTROSPECT:
|
||
|
- fputs(INTROSPECT_XML, stdout);
|
||
|
+ fputs(introspect_xml, stdout);
|
||
|
*ret = 0;
|
||
|
return 0;
|
||
|
|
||
|
diff --git a/xml-introspection.S b/xml-introspection.S
|
||
|
new file mode 100644
|
||
|
index 0000000..4bd2355
|
||
|
--- /dev/null
|
||
|
+++ b/xml-introspection.S
|
||
|
@@ -0,0 +1,7 @@
|
||
|
+.section .rodata
|
||
|
+.global introspect_xml
|
||
|
+.type introspect_xml, @object
|
||
|
+
|
||
|
+introspect_xml:
|
||
|
+.incbin "org.freedesktop.RealtimeKit1.xml"
|
||
|
+.byte 0
|