sys/wait.h: add WCOREDUMP as alternative to WIFCORED

As this is part of POSIX since 2024, WCOREDUMP is the new default name.
WIFCORED is retained under _DEFAULT_SOURCE.

Fixes #19735.

Change-Id: Ic3f65e47b436bae92fe82ef73c3094be6bc9f29d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9622
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Joachim Mairböck
2025-09-01 16:33:57 +00:00
committed by waddlesplash
parent 53930893f4
commit b54f586058
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -6,6 +6,7 @@
#define _SYS_WAIT_H #define _SYS_WAIT_H
#include <features.h>
#include <sys/types.h> #include <sys/types.h>
#include <signal.h> #include <signal.h>
@@ -25,9 +26,14 @@
#define WTERMSIG(value) (((value) >> 8) & 0xff) #define WTERMSIG(value) (((value) >> 8) & 0xff)
#define WIFSTOPPED(value) ((((value) >> 16) & 0xff) != 0) #define WIFSTOPPED(value) ((((value) >> 16) & 0xff) != 0)
#define WSTOPSIG(value) (((value) >> 16) & 0xff) #define WSTOPSIG(value) (((value) >> 16) & 0xff)
#define WIFCORED(value) ((value) & 0x10000) #define WCOREDUMP(value) ((value) & 0x10000)
#define WIFCONTINUED(value) ((value) & 0x20000) #define WIFCONTINUED(value) ((value) & 0x20000)
#ifdef _DEFAULT_SOURCE
/* non-standard macro for backwards compatibility */
#define WIFCORED(value) WCOREDUMP(value)
#endif
/* ID types for waitid() */ /* ID types for waitid() */
typedef enum { typedef enum {
P_ALL, /* wait for any children, ignore ID */ P_ALL, /* wait for any children, ignore ID */
+1 -1
View File
@@ -54,7 +54,7 @@ _waitpid(pid_t pid, int* _status, int options, team_usage_info *usage_info)
case CLD_DUMPED: case CLD_DUMPED:
// fill in signal for WIFSIGNALED() and WTERMSIG() // fill in signal for WIFSIGNALED() and WTERMSIG()
status = (info.si_status << 8) & 0xff00; status = (info.si_status << 8) & 0xff00;
// if core dumped, set flag for WIFCORED() // if core dumped, set flag for WCOREDUMP()
if (info.si_code == CLD_DUMPED) if (info.si_code == CLD_DUMPED)
status |= 0x10000; status |= 0x10000;
break; break;