[v2,04/15] linux: Add P_PIDFD
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
It was added on Linux 5.4 (3695eae5fee0605f316fbaad0b9e3de791d7dfaf)
to extend waitid to wait on pidfd.
---
posix/Makefile | 2 +-
posix/sys/wait.h | 7 +------
sysdeps/mach/hurd/bits/types/idtype_t.h | 12 ++++++++++++
sysdeps/unix/sysv/linux/bits/types/idtype_t.h | 14 ++++++++++++++
4 files changed, 28 insertions(+), 7 deletions(-)
create mode 100644 sysdeps/mach/hurd/bits/types/idtype_t.h
create mode 100644 sysdeps/unix/sysv/linux/bits/types/idtype_t.h
Comments
On 2/7/22 12:44, Adhemerval Zanella via Libc-alpha wrote:
> It was added on Linux 5.4 (3695eae5fee0605f316fbaad0b9e3de791d7dfaf)
> to extend waitid to wait on pidfd.
New API constant P_PIDFD in user/include/linux/wait.h.
LGTM.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
> ---
> posix/Makefile | 2 +-
> posix/sys/wait.h | 7 +------
> sysdeps/mach/hurd/bits/types/idtype_t.h | 12 ++++++++++++
> sysdeps/unix/sysv/linux/bits/types/idtype_t.h | 14 ++++++++++++++
> 4 files changed, 28 insertions(+), 7 deletions(-)
> create mode 100644 sysdeps/mach/hurd/bits/types/idtype_t.h
> create mode 100644 sysdeps/unix/sysv/linux/bits/types/idtype_t.h
>
> diff --git a/posix/Makefile b/posix/Makefile
> index 9b30b53a7c..cfebb8ef06 100644
> --- a/posix/Makefile
> +++ b/posix/Makefile
> @@ -32,7 +32,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
> bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \
> bits/sched.h bits/cpu-set.h re_comp.h wait.h bits/environments.h \
> cpio.h spawn.h bits/unistd.h bits/types/struct_sched_param.h \
> - bits/unistd_ext.h
> + bits/unistd_ext.h bits/types/idtype_t.h
OK. New bits types header.
>
> routines := \
> uname \
> diff --git a/posix/sys/wait.h b/posix/sys/wait.h
> index 79bcdb013d..4d649cd4b1 100644
> --- a/posix/sys/wait.h
> +++ b/posix/sys/wait.h
> @@ -71,12 +71,7 @@ typedef __pid_t pid_t;
>
> /* 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;
> +# include <bits/types/idtype_t.h>
OK. Refactor. No other locations - confirmed.
> #endif
>
>
> diff --git a/sysdeps/mach/hurd/bits/types/idtype_t.h b/sysdeps/mach/hurd/bits/types/idtype_t.h
> new file mode 100644
> index 0000000000..207eb777ba
> --- /dev/null
> +++ b/sysdeps/mach/hurd/bits/types/idtype_t.h
> @@ -0,0 +1,12 @@
> +#ifndef __idtype_t_defined
> +#define __idtype_t_defined
> +
> +/* The following values are used by the `waitid' function. */
> +typedef enum
> +{
> + P_ALL, /* Wait for any child. */
> + P_PID, /* Wait for specified process. */
> + P_PGID, /* Wait for members of process group. */
> +} idtype_t;
OK. Use new bits types for mach (allows splitting).
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/bits/types/idtype_t.h b/sysdeps/unix/sysv/linux/bits/types/idtype_t.h
> new file mode 100644
> index 0000000000..fc084c7774
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/types/idtype_t.h
> @@ -0,0 +1,14 @@
> +#ifndef __idtype_t_defined
> +#define __idtype_t_defined
> +
> +/* The following values are used by the `waitid' function. */
> +typedef enum
> +{
> + P_ALL, /* Wait for any child. */
> + P_PID, /* Wait for specified process. */
> + P_PGID, /* Wait for members of process group. */
> + P_PIDFD, /* Wait for the child referred by the PID file
> + descriptor. */
OK. New header for linux includes P_PIDFD. Confirmed P_PIDFD is 3 in the kernel.
> +} idtype_t;
> +
> +#endif
@@ -32,7 +32,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \
bits/sched.h bits/cpu-set.h re_comp.h wait.h bits/environments.h \
cpio.h spawn.h bits/unistd.h bits/types/struct_sched_param.h \
- bits/unistd_ext.h
+ bits/unistd_ext.h bits/types/idtype_t.h
routines := \
uname \
@@ -71,12 +71,7 @@ typedef __pid_t pid_t;
/* 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;
+# include <bits/types/idtype_t.h>
#endif
new file mode 100644
@@ -0,0 +1,12 @@
+#ifndef __idtype_t_defined
+#define __idtype_t_defined
+
+/* The following values are used by the `waitid' function. */
+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
new file mode 100644
@@ -0,0 +1,14 @@
+#ifndef __idtype_t_defined
+#define __idtype_t_defined
+
+/* The following values are used by the `waitid' function. */
+typedef enum
+{
+ P_ALL, /* Wait for any child. */
+ P_PID, /* Wait for specified process. */
+ P_PGID, /* Wait for members of process group. */
+ P_PIDFD, /* Wait for the child referred by the PID file
+ descriptor. */
+} idtype_t;
+
+#endif