[sysprof] build: track changes to GLib and gdbus-codegen



commit b624ec8809afa52f03dd2feeaa6bc883f53c52bd
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 30 14:46:20 2019 -0700

    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

 meson.build                         |  2 +-
 src/org.gnome.Sysprof2.xml          |  4 +++-
 src/org.gnome.Sysprof3.Profiler.xml |  4 +++-
 src/org.gnome.Sysprof3.Service.xml  | 12 +++++++++---
 src/sysprofd/ipc-legacy-impl.c      |  8 +++++---
 src/sysprofd/ipc-rapl-profiler.c    |  8 +++-----
 src/sysprofd/ipc-service-impl.c     | 21 +++++++++++----------
 7 files changed, 35 insertions(+), 24 deletions(-)
---
diff --git a/meson.build b/meson.build
index a018c34..a49ac74 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,7 @@ version_split = meson.project_version().split('.')
 datadir = get_option('datadir')
 podir = join_paths(meson.source_root(), 'po')
 
-glib_req_version = '>= 2.61.3'
+glib_req_version = '>= 2.63.0'
 gtk_req_version = '>= 3.22'
 polkit_req_version = '>= 0.105'
 dazzle_req_version = '>= 3.30.0'
diff --git a/src/org.gnome.Sysprof2.xml b/src/org.gnome.Sysprof2.xml
index b22de4f..442d32d 100644
--- a/src/org.gnome.Sysprof2.xml
+++ b/src/org.gnome.Sysprof2.xml
@@ -18,7 +18,9 @@
    <arg name="pid" type="i" direction="in"/>
    <arg name="cpu" type="i" 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>
 
   <!--
diff --git a/src/org.gnome.Sysprof3.Profiler.xml b/src/org.gnome.Sysprof3.Profiler.xml
index 3208511..fe88a10 100644
--- a/src/org.gnome.Sysprof3.Profiler.xml
+++ b/src/org.gnome.Sysprof3.Profiler.xml
@@ -30,7 +30,9 @@
     -->
     <method name="Start">
       <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>
     <!--
       Stop:
diff --git a/src/org.gnome.Sysprof3.Service.xml b/src/org.gnome.Sysprof3.Service.xml
index 70a83ae..f9808af 100644
--- a/src/org.gnome.Sysprof3.Service.xml
+++ b/src/org.gnome.Sysprof3.Service.xml
@@ -18,9 +18,13 @@
       <arg name="options" type="a{sv}" direction="in"/>
       <arg name="pid" 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="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>
 
     <!--
@@ -55,7 +59,9 @@
     -->
     <method name="GetProcFd">
       <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>
 
     <!--
diff --git a/src/sysprofd/ipc-legacy-impl.c b/src/sysprofd/ipc-legacy-impl.c
index 78157b6..445b763 100644
--- a/src/sysprofd/ipc-legacy-impl.c
+++ b/src/sysprofd/ipc-legacy-impl.c
@@ -50,6 +50,7 @@ static guint signals [N_SIGNALS];
 static gboolean
 ipc_legacy_impl_handle_perf_event_open (IpcLegacySysprof2     *service,
                                         GDBusMethodInvocation *invocation,
+                                        GUnixFDList           *fd_list,
                                         GVariant              *options,
                                         gint32                 pid,
                                         gint32                 cpu,
@@ -86,9 +87,10 @@ ipc_legacy_impl_handle_perf_event_open (IpcLegacySysprof2     *service,
         }
       else
         {
-          g_dbus_method_invocation_return_value_with_unix_fd_list (g_steal_pointer (&invocation),
-                                                                   g_variant_new ("(h)", handle),
-                                                                   out_fd_list);
+          ipc_legacy_sysprof2_complete_perf_event_open (service,
+                                                        g_steal_pointer (&invocation),
+                                                        out_fd_list,
+                                                        g_variant_new ("h", handle));
         }
     }
 
diff --git a/src/sysprofd/ipc-rapl-profiler.c b/src/sysprofd/ipc-rapl-profiler.c
index f9dd511..259016b 100644
--- a/src/sysprofd/ipc-rapl-profiler.c
+++ b/src/sysprofd/ipc-rapl-profiler.c
@@ -345,6 +345,7 @@ on_sample_cb (gpointer data,
 static gboolean
 ipc_rapl_profiler_handle_start (IpcProfiler           *profiler,
                                 GDBusMethodInvocation *invocation,
+                                GUnixFDList           *in_fd_list,
                                 GVariant              *arg_options,
                                 GVariant              *arg_fd)
 {
@@ -353,8 +354,6 @@ ipc_rapl_profiler_handle_start (IpcProfiler           *profiler,
   g_autoptr(GMutexLocker) locker = NULL;
   g_autoptr(GError) error = NULL;
   g_autofree gchar *path = NULL;
-  GDBusMessage *message;
-  GUnixFDList *in_fd_list = NULL;
   gint fd = -1;
   gint handle;
 
@@ -374,8 +373,7 @@ ipc_rapl_profiler_handle_start (IpcProfiler           *profiler,
     }
 
   /* Get the FD for capture writing */
-  message = g_dbus_method_invocation_get_message (invocation);
-  if ((in_fd_list = g_dbus_message_get_unix_fd_list (message)) &&
+  if (in_fd_list != NULL &&
       (handle = g_variant_get_handle (arg_fd)) > -1)
     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,
                                              self);
 
-  ipc_profiler_complete_start (profiler, g_steal_pointer (&invocation));
+  ipc_profiler_complete_start (profiler, g_steal_pointer (&invocation), NULL);
 
   return TRUE;
 }
diff --git a/src/sysprofd/ipc-service-impl.c b/src/sysprofd/ipc-service-impl.c
index fb77d6d..88ab4b3 100644
--- a/src/sysprofd/ipc-service-impl.c
+++ b/src/sysprofd/ipc-service-impl.c
@@ -147,6 +147,7 @@ ipc_service_impl_handle_get_proc_file (IpcService            *service,
 static gboolean
 ipc_service_impl_handle_get_proc_fd (IpcService            *service,
                                      GDBusMethodInvocation *invocation,
+                                     GUnixFDList           *in_fd_list,
                                      const gchar           *path)
 {
   g_autoptr(GFile) file = NULL;
@@ -172,9 +173,10 @@ ipc_service_impl_handle_get_proc_fd (IpcService            *service,
 
           if (handle != -1)
             {
-              g_dbus_method_invocation_return_value_with_unix_fd_list (g_steal_pointer (&invocation),
-                                                                       g_variant_new ("(h)", handle),
-                                                                       fd_list);
+              ipc_service_complete_get_proc_fd (service,
+                                                g_steal_pointer (&invocation),
+                                                fd_list,
+                                                g_variant_new ("h", handle));
               return TRUE;
             }
         }
@@ -191,14 +193,13 @@ ipc_service_impl_handle_get_proc_fd (IpcService            *service,
 static gboolean
 ipc_service_impl_handle_perf_event_open (IpcService            *service,
                                          GDBusMethodInvocation *invocation,
+                                         GUnixFDList           *in_fd_list,
                                          GVariant              *options,
                                          gint32                 pid,
                                          gint32                 cpu,
                                          GVariant              *group_fdv,
                                          guint64                flags)
 {
-  GUnixFDList *in_fd_list = NULL;
-  GDBusMessage *message;
   gint group_fd = -1;
   gint out_fd = -1;
   gint handle;
@@ -209,8 +210,7 @@ ipc_service_impl_handle_perf_event_open (IpcService            *service,
   g_message ("PerfEventOpen(pid=%d, cpu=%d)", pid, cpu);
 
   /* Get the group_fd if provided */
-  message = g_dbus_method_invocation_get_message (invocation);
-  if ((in_fd_list = g_dbus_message_get_unix_fd_list (message)) &&
+  if (in_fd_list != NULL &&
       (handle = g_variant_get_handle (group_fdv)) > -1)
     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
         {
-          g_dbus_method_invocation_return_value_with_unix_fd_list (g_steal_pointer (&invocation),
-                                                                   g_variant_new ("(h)", handle),
-                                                                   out_fd_list);
+          ipc_service_complete_perf_event_open (service,
+                                                g_steal_pointer (&invocation),
+                                                out_fd_list,
+                                                g_variant_new ("h", handle));
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]