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

Message ID 20240716224136.784105-2-kolyshkin@gmail.com (mailing list archive)
State Accepted
Headers
Series [1/2] linux: fix/improve clone_args description |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

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 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,
  

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,