Merge branch 'backport-3158-musl-siginfo-t-glib-2-74' into 'glib-2-74'

Backport !3158 ”gmain: Define fallback values for siginfo_t constants for musl” to glib-2-74

See merge request GNOME/glib!3161
This commit is contained in:
Philip Withnall 2022-12-21 21:12:55 +00:00
commit 47b7d1d707

View File

@ -79,6 +79,16 @@
#ifndef W_STOPCODE #ifndef W_STOPCODE
#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) #define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
#endif #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 */ #endif /* HAVE_PIDFD */
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
@ -5563,17 +5573,9 @@ siginfo_t_to_wait_status (const siginfo_t *info)
case CLD_KILLED: case CLD_KILLED:
return W_EXITCODE (0, info->si_status); return W_EXITCODE (0, info->si_status);
case CLD_DUMPED: case CLD_DUMPED:
#ifdef WCOREFLAG
return W_EXITCODE (0, info->si_status | WCOREFLAG); return W_EXITCODE (0, info->si_status | WCOREFLAG);
#else
g_assert_not_reached ();
#endif
case CLD_CONTINUED: case CLD_CONTINUED:
#ifdef __W_CONTINUED
return __W_CONTINUED; return __W_CONTINUED;
#else
g_assert_not_reached ();
#endif
case CLD_STOPPED: case CLD_STOPPED:
case CLD_TRAPPED: case CLD_TRAPPED:
default: default: