Cygwin: Define and use __WCOREFLAG

Also fix a typo in description of exit status
This commit is contained in:
Jon Turney 2024-01-10 20:35:49 +00:00
parent b7868e7410
commit a83b93e662
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
2 changed files with 4 additions and 3 deletions

View File

@ -1334,7 +1334,7 @@ signal_exit (int sig, siginfo_t *si, void *)
if (cygheap->rlim_core == 0Ul) if (cygheap->rlim_core == 0Ul)
break; break;
sig |= 0x80; /* Set flag in exit status to show that we've "dumped core" */ sig |= __WCOREFLAG; /* Set flag in exit status to show that we've "dumped core" */
/* If core dump size is >1MB, try to invoke dumper to write a /* If core dump size is >1MB, try to invoke dumper to write a
.core file */ .core file */

View File

@ -16,12 +16,13 @@ details. */
#define WUNTRACED 2 #define WUNTRACED 2
#define WCONTINUED 8 #define WCONTINUED 8
#define __W_CONTINUED 0xffff #define __W_CONTINUED 0xffff
#define __WCOREFLAG 0x80
/* A status is 16 bits, and looks like: /* A status is 16 bits, and looks like:
<1 byte info> <1 byte code> <1 byte info> <1 byte code>
<code> == 0, child has exited, info is the exit value <code> == 0, child has exited, info is the exit value
<code> == 1..7e, child has exited, info is the signal number. <code> == 1..7e, child has exited, code is the signal number.
<code> == 7f, child has stopped, info was the signal number. <code> == 7f, child has stopped, info was the signal number.
<code> == 80, there was a core dump. <code> == 80, there was a core dump.
*/ */
@ -34,6 +35,6 @@ details. */
#define WEXITSTATUS(_w) (((_w) >> 8) & 0xff) #define WEXITSTATUS(_w) (((_w) >> 8) & 0xff)
#define WTERMSIG(_w) ((_w) & 0x7f) #define WTERMSIG(_w) ((_w) & 0x7f)
#define WSTOPSIG WEXITSTATUS #define WSTOPSIG WEXITSTATUS
#define WCOREDUMP(_w) (WIFSIGNALED(_w) && ((_w) & 0x80)) #define WCOREDUMP(_w) (WIFSIGNALED(_w) && ((_w) & __WCOREFLAG))
#endif /* _CYGWIN_WAIT_H */ #endif /* _CYGWIN_WAIT_H */