Merge branch '2852-musl-siginfo-t' into 'main'

gmain: Define fallback values for siginfo_t constants for musl

Closes #2852

See merge request GNOME/glib!3158
This commit is contained in:
Emmanuele Bassi 2022-12-21 13:13:10 +00:00
commit 9174af5421

View File

@ -79,6 +79,16 @@
#ifndef W_STOPCODE
#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
#endif
#ifndef WCOREFLAG
/* musl doesnt define WCOREFLAG while glibc does. Unfortunately, theres no way
* to detect were 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: