From 98e784f7dd497337316ef7f95245a9debcec0a62 Mon Sep 17 00:00:00 2001 From: GNU Libc Maintainers Date: Wed, 30 Apr 2025 09:01:35 +0800 Subject: [PATCH] submitted-waitid Gbp-Pq: Topic kfreebsd Gbp-Pq: Name submitted-waitid.diff --- bits/waitflags.h | 13 +++++++++++++ posix/sys/wait.h | 11 ----------- sysdeps/unix/sysv/linux/bits/waitflags.h | 20 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/bits/waitflags.h b/bits/waitflags.h index 82abdf7d5..cc1f96a2a 100644 --- a/bits/waitflags.h +++ b/bits/waitflags.h @@ -32,3 +32,16 @@ # define WNOWAIT 8 /* Don't reap, just poll status. */ # define WEXITED 16 /* Report dead child. */ #endif + +/* The following values are used by the `waitid' function. */ +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# ifndef __ENUM_IDTYPE_T +# define __ENUM_IDTYPE_T 1 +typedef enum +{ + P_ALL, /* Wait for any child. */ + P_PID, /* Wait for specified process. */ + P_PGID /* Wait for members of process group. */ +} idtype_t; +# endif +#endif diff --git a/posix/sys/wait.h b/posix/sys/wait.h index a42e16c1b..db6da9c8e 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -69,17 +69,6 @@ typedef __pid_t pid_t; # define W_STOPCODE(sig) __W_STOPCODE (sig) #endif -/* The following values are used by the `waitid' function. */ -#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -typedef enum -{ - P_ALL, /* Wait for any child. */ - P_PID, /* Wait for specified process. */ - P_PGID /* Wait for members of process group. */ -} idtype_t; -#endif - - /* Wait for a child to die. When one does, put its status in *STAT_LOC and return its process ID. For errors, return (pid_t) -1. diff --git a/sysdeps/unix/sysv/linux/bits/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h index 711d6eccb..33382cd35 100644 --- a/sysdeps/unix/sysv/linux/bits/waitflags.h +++ b/sysdeps/unix/sysv/linux/bits/waitflags.h @@ -37,3 +37,23 @@ in this group */ #define __WALL 0x40000000 /* Wait for any child. */ #define __WCLONE 0x80000000 /* Wait for cloned process. */ + +/* The following values are used by the `waitid' function. */ +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# ifndef __ENUM_IDTYPE_T +# define __ENUM_IDTYPE_T 1 + +/* The Linux kernel defines these bare, rather than an enum, + which causes a conflict if the include order is reversed. */ +# undef P_ALL +# undef P_PID +# undef P_PGID + +typedef enum +{ + P_ALL, /* Wait for any child. */ + P_PID, /* Wait for specified process. */ + P_PGID /* Wait for members of process group. */ +} idtype_t; +# endif +#endif -- 2.30.2