sysprof/0025-unwinder-wait-for-completion-of-subprocess.patch
Christian Hergert 857a3982f5 Update to 47.2
Resolves: RHEL-69379
2024-11-27 09:59:15 -08:00

68 lines
2.4 KiB
Diff

From 68f856e8b2617823c1e00e4e4cfaf6da4ce24bcd Mon Sep 17 00:00:00 2001
From: Christian Hergert <chergert@redhat.com>
Date: Wed, 13 Nov 2024 15:46:01 -0800
Subject: [PATCH 25/33] unwinder: wait for completion of subprocess
---
src/sysprofd/ipc-unwinder-impl.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/sysprofd/ipc-unwinder-impl.c b/src/sysprofd/ipc-unwinder-impl.c
index 7f218de6..4341516b 100644
--- a/src/sysprofd/ipc-unwinder-impl.c
+++ b/src/sysprofd/ipc-unwinder-impl.c
@@ -46,6 +46,25 @@ child_setup (gpointer data)
prctl (PR_SET_PDEATHSIG, SIGKILL);
}
+static void
+ipc_unwinder_impl_wait_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GSubprocess *subprocess = (GSubprocess *)object;
+ g_autoptr(IpcUnwinderImpl) self = user_data;
+ g_autoptr(GError) error = NULL;
+
+ g_assert (G_IS_SUBPROCESS (subprocess));
+ g_assert (G_IS_ASYNC_RESULT (result));
+ g_assert (IPC_IS_UNWINDER_IMPL (self));
+
+ if (!g_subprocess_wait_check_finish (subprocess, result, &error))
+ g_warning ("wait_check failure: %s", error->message);
+ else
+ g_info ("sysprof-live-unwinder exited");
+}
+
static gboolean
ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder,
GDBusMethodInvocation *invocation,
@@ -155,16 +174,23 @@ ipc_unwinder_impl_handle_unwind (IpcUnwinder *unwinder,
if (!(subprocess = g_subprocess_launcher_spawnv (launcher, (const char * const *)argv->pdata, &error)))
{
+ g_critical ("Failed to start sysprof-live-unwinder: %s", error->message);
g_dbus_method_invocation_return_gerror (g_steal_pointer (&invocation), error);
return TRUE;
}
+ g_message ("sysprof-live-unwinder started as process %s",
+ g_subprocess_get_identifier (subprocess));
+
ipc_unwinder_complete_unwind (unwinder,
g_steal_pointer (&invocation),
out_fd_list,
g_variant_new_handle (capture_fd_handle));
- g_subprocess_wait_async (subprocess, NULL, NULL, NULL);
+ g_subprocess_wait_check_async (subprocess,
+ NULL,
+ ipc_unwinder_impl_wait_cb,
+ g_object_ref (unwinder));
return TRUE;
}
--
2.45.2