From b54f586058fd6623645512e4631468cede9933b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= Date: Sat, 30 Aug 2025 20:19:56 +0200 Subject: [PATCH] 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 Tested-by: Commit checker robot --- headers/posix/sys/wait.h | 8 +++++++- src/system/libroot/posix/sys/wait.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/headers/posix/sys/wait.h b/headers/posix/sys/wait.h index 6b3217309b..8bb44ce36e 100644 --- a/headers/posix/sys/wait.h +++ b/headers/posix/sys/wait.h @@ -6,6 +6,7 @@ #define _SYS_WAIT_H +#include #include #include @@ -25,9 +26,14 @@ #define WTERMSIG(value) (((value) >> 8) & 0xff) #define WIFSTOPPED(value) ((((value) >> 16) & 0xff) != 0) #define WSTOPSIG(value) (((value) >> 16) & 0xff) -#define WIFCORED(value) ((value) & 0x10000) +#define WCOREDUMP(value) ((value) & 0x10000) #define WIFCONTINUED(value) ((value) & 0x20000) +#ifdef _DEFAULT_SOURCE +/* non-standard macro for backwards compatibility */ +#define WIFCORED(value) WCOREDUMP(value) +#endif + /* ID types for waitid() */ typedef enum { P_ALL, /* wait for any children, ignore ID */ diff --git a/src/system/libroot/posix/sys/wait.cpp b/src/system/libroot/posix/sys/wait.cpp index d8dd5b025c..e5f5487b3d 100644 --- a/src/system/libroot/posix/sys/wait.cpp +++ b/src/system/libroot/posix/sys/wait.cpp @@ -54,7 +54,7 @@ _waitpid(pid_t pid, int* _status, int options, team_usage_info *usage_info) case CLD_DUMPED: // fill in signal for WIFSIGNALED() and WTERMSIG() 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) status |= 0x10000; break;