From 1fe18a72f5549b62b36476f8b0883107b4ad305d Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Thu, 26 Oct 2023 09:56:53 +0200 Subject: [PATCH] meson: Improve PTRACE_O_EXITKILL presence check The PTRACE_O_EXITKILL symbol in sys/ptrace.h is an enum member, not a macro. The #ifdef check added to the GSubprocess test-case in 272ec5dbca8ec957ced2cdca45bde69f47fb4df9 will not detect it. Use cc.has_header_symbol() to properly detect it. According to the documentation: "Symbols here include function, variable, #define, type definition, etc.". Fixes: 272ec5dbca8ec957ced2cdca45bde69f47fb4df9 Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/3156 --- gio/tests/gsubprocess.c | 2 +- meson.build | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c index 1a0d6df34..5baff93a4 100644 --- a/gio/tests/gsubprocess.c +++ b/gio/tests/gsubprocess.c @@ -2006,7 +2006,7 @@ trace_children (pid_t main_child) g_assert_no_errno (waitpid (main_child, &wstatus, 0)); g_assert_no_errno (ptrace (PTRACE_SETOPTIONS, main_child, NULL, (PTRACE_O_TRACEFORK | -#ifdef PTRACE_O_EXITKILL +#ifdef HAVE_PTRACE_O_EXITKILL PTRACE_O_EXITKILL | #endif PTRACE_O_TRACEVFORK | diff --git a/meson.build b/meson.build index 5be52555e..997c5d1c5 100644 --- a/meson.build +++ b/meson.build @@ -2436,6 +2436,10 @@ with open(output, "w") as f: enable_dtrace = true endif +if cc.has_header_symbol('sys/ptrace.h', 'PTRACE_O_EXITKILL') + glib_conf.set('HAVE_PTRACE_O_EXITKILL', 1) +endif + # systemtap want_systemtap = get_option('systemtap') enable_systemtap = false