f3ac1f58a2
We now have a branch upstream for tracking el10 patches which makes this a lot easier to maintain. This updates to using that branch as a diff upon 47.1. Resolves: RHEL-65743
169 lines
5.0 KiB
Diff
169 lines
5.0 KiB
Diff
From d34689ff54650a581a2af3595a6f42c7d5c0166e Mon Sep 17 00:00:00 2001
|
|
From: Christian Hergert <chergert@redhat.com>
|
|
Date: Wed, 13 Nov 2024 16:20:06 -0800
|
|
Subject: [PATCH 31/31] build: allow await for FD with older libdex
|
|
|
|
This just makes backports easier.
|
|
---
|
|
meson.build | 2 +-
|
|
src/libsysprof/sysprof-fd-private.h | 7 +++++
|
|
src/libsysprof/sysprof-fd.c | 24 ++++++++++++++++
|
|
src/libsysprof/sysprof-user-sampler.c | 28 ++-----------------
|
|
.../tests/test-live-unwinder.c | 5 ++--
|
|
5 files changed, 37 insertions(+), 29 deletions(-)
|
|
|
|
diff --git a/meson.build b/meson.build
|
|
index 16d64e8a..e2a9a995 100644
|
|
--- a/meson.build
|
|
+++ b/meson.build
|
|
@@ -45,7 +45,7 @@ need_libsysprof = (need_gtk or
|
|
get_option('tools') or
|
|
get_option('tests'))
|
|
|
|
-dex_req = '0.9'
|
|
+dex_req = '0.8'
|
|
glib_req = '2.76.0'
|
|
gtk_req = '4.15'
|
|
polkit_req = '0.105'
|
|
diff --git a/src/libsysprof/sysprof-fd-private.h b/src/libsysprof/sysprof-fd-private.h
|
|
index 1d4dfabc..f6f11b0c 100644
|
|
--- a/src/libsysprof/sysprof-fd-private.h
|
|
+++ b/src/libsysprof/sysprof-fd-private.h
|
|
@@ -22,6 +22,8 @@
|
|
|
|
#include <glib-object.h>
|
|
|
|
+#include <libdex.h>
|
|
+
|
|
G_BEGIN_DECLS
|
|
|
|
#define SYSPROF_TYPE_FD (sysprof_fd_get_type())
|
|
@@ -36,4 +38,9 @@ void sysprof_fd_free (SysprofFD *fd);
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofFD, sysprof_fd_free)
|
|
|
|
+int sysprof_await_fd (DexFuture *future,
|
|
+ GError **error);
|
|
+void sysprof_promise_resolve_fd (DexPromise *promise,
|
|
+ int fd);
|
|
+
|
|
G_END_DECLS
|
|
diff --git a/src/libsysprof/sysprof-fd.c b/src/libsysprof/sysprof-fd.c
|
|
index 5e34f8d9..a571cefe 100644
|
|
--- a/src/libsysprof/sysprof-fd.c
|
|
+++ b/src/libsysprof/sysprof-fd.c
|
|
@@ -65,3 +65,27 @@ sysprof_fd_dup (const SysprofFD *fd)
|
|
}
|
|
|
|
G_DEFINE_BOXED_TYPE (SysprofFD, sysprof_fd, sysprof_fd_dup, sysprof_fd_free)
|
|
+
|
|
+void
|
|
+sysprof_promise_resolve_fd (DexPromise *promise,
|
|
+ int fd)
|
|
+{
|
|
+ GValue gvalue = {SYSPROF_TYPE_FD, {{.v_pointer = &fd}, {.v_int = 0}}};
|
|
+ dex_promise_resolve (promise, &gvalue);
|
|
+}
|
|
+
|
|
+int
|
|
+sysprof_await_fd (DexFuture *future,
|
|
+ GError **error)
|
|
+{
|
|
+ SysprofFD *fd = dex_await_boxed (future, error);
|
|
+ int ret = -1;
|
|
+
|
|
+ if (fd != NULL)
|
|
+ {
|
|
+ ret = sysprof_fd_steal (fd);
|
|
+ sysprof_fd_free (fd);
|
|
+ }
|
|
+
|
|
+ return ret;
|
|
+}
|
|
diff --git a/src/libsysprof/sysprof-user-sampler.c b/src/libsysprof/sysprof-user-sampler.c
|
|
index 6079708e..05f97cbf 100644
|
|
--- a/src/libsysprof/sysprof-user-sampler.c
|
|
+++ b/src/libsysprof/sysprof-user-sampler.c
|
|
@@ -89,30 +89,6 @@ close_fd (gpointer data)
|
|
}
|
|
}
|
|
|
|
-static void
|
|
-promise_resolve_fd (DexPromise *promise,
|
|
- int fd)
|
|
-{
|
|
- GValue gvalue = {SYSPROF_TYPE_FD, {{.v_pointer = &fd}, {.v_int = 0}}};
|
|
- dex_promise_resolve (promise, &gvalue);
|
|
-}
|
|
-
|
|
-static int
|
|
-await_fd (DexFuture *future,
|
|
- GError **error)
|
|
-{
|
|
- SysprofFD *fd = dex_await_boxed (future, error);
|
|
- int ret = -1;
|
|
-
|
|
- if (fd != NULL)
|
|
- {
|
|
- ret = sysprof_fd_steal (fd);
|
|
- sysprof_fd_free (fd);
|
|
- }
|
|
-
|
|
- return ret;
|
|
-}
|
|
-
|
|
static void
|
|
sysprof_user_sampler_ioctl (SysprofUserSampler *self,
|
|
gboolean enable)
|
|
@@ -177,7 +153,7 @@ _perf_event_open_cb (GObject *object,
|
|
if (-1 == (fd = g_unix_fd_list_get (fd_list, handle, &error)))
|
|
goto failure;
|
|
|
|
- promise_resolve_fd (promise, g_steal_fd (&fd));
|
|
+ sysprof_promise_resolve_fd (promise, g_steal_fd (&fd));
|
|
return;
|
|
}
|
|
|
|
@@ -262,7 +238,7 @@ try_again:
|
|
_perf_event_open_cb,
|
|
dex_ref (promise));
|
|
|
|
- if (-1 == (perf_fd = await_fd (dex_ref (promise), error)))
|
|
+ if (-1 == (perf_fd = sysprof_await_fd (dex_ref (promise), error)))
|
|
{
|
|
g_clear_pointer (&options, g_variant_unref);
|
|
|
|
diff --git a/src/sysprof-live-unwinder/tests/test-live-unwinder.c b/src/sysprof-live-unwinder/tests/test-live-unwinder.c
|
|
index 114cc568..c3eda85a 100644
|
|
--- a/src/sysprof-live-unwinder/tests/test-live-unwinder.c
|
|
+++ b/src/sysprof-live-unwinder/tests/test-live-unwinder.c
|
|
@@ -33,6 +33,7 @@
|
|
|
|
#include <sysprof.h>
|
|
|
|
+#include "sysprof-fd-private.h"
|
|
#include "sysprof-perf-event-stream-private.h"
|
|
|
|
#if HAVE_POLKIT_AGENT
|
|
@@ -89,7 +90,7 @@ open_perf_stream_cb (GObject *object,
|
|
|
|
if (-1 != (fd = g_unix_fd_list_get (fd_list, handle, &error)))
|
|
{
|
|
- dex_promise_resolve_fd (promise, g_steal_fd (&fd));
|
|
+ sysprof_promise_resolve_fd (promise, g_steal_fd (&fd));
|
|
return;
|
|
}
|
|
}
|
|
@@ -179,7 +180,7 @@ try_again:
|
|
open_perf_stream_cb,
|
|
dex_ref (promise));
|
|
|
|
- fd = dex_await_fd (dex_ref (promise), error);
|
|
+ fd = sysprof_await_fd (dex_ref (promise), error);
|
|
|
|
if (*error == NULL)
|
|
{
|
|
--
|
|
2.45.2
|
|
|