build: track changes to GLib and gdbus-codegen

GLib is already doing this, which broke a number of auto-generated code.
This tracks those changes and manually sets the annotations so that we
are guaranteed to get this behavior.

We'll need to fix other uses (such as in Mutter), but we have to do that
already because of the change in GLib.

Fixes #17
This commit is contained in:
Christian Hergert
2019-10-30 14:46:20 -07:00
parent 73dc39329a
commit b624ec8809
7 changed files with 35 additions and 24 deletions

View File

@ -17,7 +17,7 @@ version_split = meson.project_version().split('.')
datadir = get_option('datadir') datadir = get_option('datadir')
podir = join_paths(meson.source_root(), 'po') podir = join_paths(meson.source_root(), 'po')
glib_req_version = '>= 2.61.3' glib_req_version = '>= 2.63.0'
gtk_req_version = '>= 3.22' gtk_req_version = '>= 3.22'
polkit_req_version = '>= 0.105' polkit_req_version = '>= 0.105'
dazzle_req_version = '>= 3.30.0' dazzle_req_version = '>= 3.30.0'

View File

@ -18,7 +18,9 @@
<arg name="pid" type="i" direction="in"/> <arg name="pid" type="i" direction="in"/>
<arg name="cpu" type="i" direction="in"/> <arg name="cpu" type="i" direction="in"/>
<arg name="flags" type="t" direction="in"/> <arg name="flags" type="t" direction="in"/>
<arg name="perf_stream_fd" type="h" direction="out"/> <arg name="perf_stream_fd" type="h" direction="out">
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</arg>
</method> </method>
<!-- <!--

View File

@ -30,7 +30,9 @@
--> -->
<method name="Start"> <method name="Start">
<arg type="a{sv}" name="options" direction="in"/> <arg type="a{sv}" name="options" direction="in"/>
<arg type="h" name="fd" direction="in"/> <arg type="h" name="fd" direction="in">
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</arg>
</method> </method>
<!-- <!--
Stop: Stop:

View File

@ -18,9 +18,13 @@
<arg name="options" type="a{sv}" direction="in"/> <arg name="options" type="a{sv}" direction="in"/>
<arg name="pid" type="i" direction="in"/> <arg name="pid" type="i" direction="in"/>
<arg name="cpu" type="i" direction="in"/> <arg name="cpu" type="i" direction="in"/>
<arg name="group_fd" type="h" direction="in"/> <arg name="group_fd" type="h" direction="in">
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</arg>
<arg name="flags" type="t" direction="in"/> <arg name="flags" type="t" direction="in"/>
<arg name="perf_stream_fd" type="h" direction="out"/> <arg name="perf_stream_fd" type="h" direction="out">
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</arg>
</method> </method>
<!-- <!--
@ -55,7 +59,9 @@
--> -->
<method name="GetProcFd"> <method name="GetProcFd">
<arg name="path" type="ay" direction="in"/> <arg name="path" type="ay" direction="in"/>
<arg name="fd" type="h" direction="out"/> <arg name="fd" type="h" direction="out">
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
</arg>
</method> </method>
<!-- <!--

View File

@ -50,6 +50,7 @@ static guint signals [N_SIGNALS];
static gboolean static gboolean
ipc_legacy_impl_handle_perf_event_open (IpcLegacySysprof2 *service, ipc_legacy_impl_handle_perf_event_open (IpcLegacySysprof2 *service,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GUnixFDList *fd_list,
GVariant *options, GVariant *options,
gint32 pid, gint32 pid,
gint32 cpu, gint32 cpu,
@ -86,9 +87,10 @@ ipc_legacy_impl_handle_perf_event_open (IpcLegacySysprof2 *service,
} }
else else
{ {
g_dbus_method_invocation_return_value_with_unix_fd_list (g_steal_pointer (&invocation), ipc_legacy_sysprof2_complete_perf_event_open (service,
g_variant_new ("(h)", handle), g_steal_pointer (&invocation),
out_fd_list); out_fd_list,
g_variant_new ("h", handle));
} }
} }

View File

@ -345,6 +345,7 @@ on_sample_cb (gpointer data,
static gboolean static gboolean
ipc_rapl_profiler_handle_start (IpcProfiler *profiler, ipc_rapl_profiler_handle_start (IpcProfiler *profiler,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GUnixFDList *in_fd_list,
GVariant *arg_options, GVariant *arg_options,
GVariant *arg_fd) GVariant *arg_fd)
{ {
@ -353,8 +354,6 @@ ipc_rapl_profiler_handle_start (IpcProfiler *profiler,
g_autoptr(GMutexLocker) locker = NULL; g_autoptr(GMutexLocker) locker = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
g_autofree gchar *path = NULL; g_autofree gchar *path = NULL;
GDBusMessage *message;
GUnixFDList *in_fd_list = NULL;
gint fd = -1; gint fd = -1;
gint handle; gint handle;
@ -374,8 +373,7 @@ ipc_rapl_profiler_handle_start (IpcProfiler *profiler,
} }
/* Get the FD for capture writing */ /* Get the FD for capture writing */
message = g_dbus_method_invocation_get_message (invocation); if (in_fd_list != NULL &&
if ((in_fd_list = g_dbus_message_get_unix_fd_list (message)) &&
(handle = g_variant_get_handle (arg_fd)) > -1) (handle = g_variant_get_handle (arg_fd)) > -1)
fd = g_unix_fd_list_get (in_fd_list, handle, NULL); fd = g_unix_fd_list_get (in_fd_list, handle, NULL);
@ -420,7 +418,7 @@ ipc_rapl_profiler_handle_start (IpcProfiler *profiler,
ipc_rapl_profiler_poll_cb, ipc_rapl_profiler_poll_cb,
self); self);
ipc_profiler_complete_start (profiler, g_steal_pointer (&invocation)); ipc_profiler_complete_start (profiler, g_steal_pointer (&invocation), NULL);
return TRUE; return TRUE;
} }

View File

@ -147,6 +147,7 @@ ipc_service_impl_handle_get_proc_file (IpcService *service,
static gboolean static gboolean
ipc_service_impl_handle_get_proc_fd (IpcService *service, ipc_service_impl_handle_get_proc_fd (IpcService *service,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GUnixFDList *in_fd_list,
const gchar *path) const gchar *path)
{ {
g_autoptr(GFile) file = NULL; g_autoptr(GFile) file = NULL;
@ -172,9 +173,10 @@ ipc_service_impl_handle_get_proc_fd (IpcService *service,
if (handle != -1) if (handle != -1)
{ {
g_dbus_method_invocation_return_value_with_unix_fd_list (g_steal_pointer (&invocation), ipc_service_complete_get_proc_fd (service,
g_variant_new ("(h)", handle), g_steal_pointer (&invocation),
fd_list); fd_list,
g_variant_new ("h", handle));
return TRUE; return TRUE;
} }
} }
@ -191,14 +193,13 @@ ipc_service_impl_handle_get_proc_fd (IpcService *service,
static gboolean static gboolean
ipc_service_impl_handle_perf_event_open (IpcService *service, ipc_service_impl_handle_perf_event_open (IpcService *service,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
GUnixFDList *in_fd_list,
GVariant *options, GVariant *options,
gint32 pid, gint32 pid,
gint32 cpu, gint32 cpu,
GVariant *group_fdv, GVariant *group_fdv,
guint64 flags) guint64 flags)
{ {
GUnixFDList *in_fd_list = NULL;
GDBusMessage *message;
gint group_fd = -1; gint group_fd = -1;
gint out_fd = -1; gint out_fd = -1;
gint handle; gint handle;
@ -209,8 +210,7 @@ ipc_service_impl_handle_perf_event_open (IpcService *service,
g_message ("PerfEventOpen(pid=%d, cpu=%d)", pid, cpu); g_message ("PerfEventOpen(pid=%d, cpu=%d)", pid, cpu);
/* Get the group_fd if provided */ /* Get the group_fd if provided */
message = g_dbus_method_invocation_get_message (invocation); if (in_fd_list != NULL &&
if ((in_fd_list = g_dbus_message_get_unix_fd_list (message)) &&
(handle = g_variant_get_handle (group_fdv)) > -1) (handle = g_variant_get_handle (group_fdv)) > -1)
group_fd = g_unix_fd_list_get (in_fd_list, handle, NULL); group_fd = g_unix_fd_list_get (in_fd_list, handle, NULL);
@ -237,9 +237,10 @@ ipc_service_impl_handle_perf_event_open (IpcService *service,
} }
else else
{ {
g_dbus_method_invocation_return_value_with_unix_fd_list (g_steal_pointer (&invocation), ipc_service_complete_perf_event_open (service,
g_variant_new ("(h)", handle), g_steal_pointer (&invocation),
out_fd_list); out_fd_list,
g_variant_new ("h", handle));
} }
} }