diff mbox series

[2/2] nptl: don't set pidfd in create_thread()

Message ID 20240716224136.784105-2-kolyshkin@gmail.com
State New
Headers show
Series [1/2] linux: fix/improve clone_args description | expand

Commit Message

Kir Kolyshkin July 16, 2024, 10:41 p.m. UTC
The pidfd field is not used in clone3 syscall (or its glibc wrapper)
unless CLONE_PIDFD flag is set. As we don't set CLONE_PIDFD flag here,
it makes no sense to initialize pidfd field.

This patch doesn't fix anything, the aim is make the code more readable.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
---
 nptl/pthread_create.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Adhemerval Zanella Netto July 19, 2024, 1:37 p.m. UTC | #1
On 16/07/24 19:41, Kir Kolyshkin wrote:
> The pidfd field is not used in clone3 syscall (or its glibc wrapper)
> unless CLONE_PIDFD flag is set. As we don't set CLONE_PIDFD flag here,
> it makes no sense to initialize pidfd field.
> 
> This patch doesn't fix anything, the aim is make the code more readable.
> 
> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

LGTM, thanks.

> ---
>  nptl/pthread_create.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
> index 1d3665d5ed..616afb8baa 100644
> --- a/nptl/pthread_create.c
> +++ b/nptl/pthread_create.c
> @@ -287,7 +287,6 @@ static int create_thread (struct pthread *pd, const struct pthread_attr *attr,
>    struct clone_args args =
>      {
>        .flags = clone_flags,
> -      .pidfd = (uintptr_t) &pd->tid,
>        .parent_tid = (uintptr_t) &pd->tid,
>        .child_tid = (uintptr_t) &pd->tid,
>        .stack = (uintptr_t) stackaddr,
diff mbox series

Patch

diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 1d3665d5ed..616afb8baa 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -287,7 +287,6 @@  static int create_thread (struct pthread *pd, const struct pthread_attr *attr,
   struct clone_args args =
     {
       .flags = clone_flags,
-      .pidfd = (uintptr_t) &pd->tid,
       .parent_tid = (uintptr_t) &pd->tid,
       .child_tid = (uintptr_t) &pd->tid,
       .stack = (uintptr_t) stackaddr,