mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
gmain: Define fallback values for siginfo_t constants for musl
musl doesn’t define them itself, presumably because they’re not defined in POSIX. glibc does define them. Thankfully, the values used in glibc match the values used internally in other musl macros. Define the values as a fallback. As a result of this, we can get rid of the `g_assert_if_reached()` checks in `siginfo_t_to_wait_status()`. This should fix catching signals from a subprocess when built against musl. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Fixes: #2852
This commit is contained in:
parent
9e2ad88455
commit
379a982391
18
glib/gmain.c
18
glib/gmain.c
@ -79,6 +79,16 @@
|
||||
#ifndef W_STOPCODE
|
||||
#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
|
||||
#endif
|
||||
#ifndef WCOREFLAG
|
||||
/* musl doesn’t define WCOREFLAG while glibc does. Unfortunately, there’s no way
|
||||
* to detect we’re building against musl, so just define it and hope.
|
||||
* See https://git.musl-libc.org/cgit/musl/tree/include/sys/wait.h#n51 */
|
||||
#define WCOREFLAG 0x80
|
||||
#endif
|
||||
#ifndef __W_CONTINUED
|
||||
/* Same as above, for musl */
|
||||
#define __W_CONTINUED 0xffff
|
||||
#endif
|
||||
#endif /* HAVE_PIDFD */
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@ -5563,17 +5573,9 @@ siginfo_t_to_wait_status (const siginfo_t *info)
|
||||
case CLD_KILLED:
|
||||
return W_EXITCODE (0, info->si_status);
|
||||
case CLD_DUMPED:
|
||||
#ifdef WCOREFLAG
|
||||
return W_EXITCODE (0, info->si_status | WCOREFLAG);
|
||||
#else
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
case CLD_CONTINUED:
|
||||
#ifdef __W_CONTINUED
|
||||
return __W_CONTINUED;
|
||||
#else
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
case CLD_STOPPED:
|
||||
case CLD_TRAPPED:
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user