From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 1/2] Add tst_gettid wrapper around gettid syscall
Date: Wed, 1 Nov 2023 13:29:32 +0100 [thread overview]
Message-ID: <ZUJErMEfJO4C7d3N@yuki> (raw)
In-Reply-To: <20230908102315.8163-2-andrea.cervesato@suse.de>
Hi!
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> include/tst_pid.h | 8 ++++++++
> lib/tst_pid.c | 5 +++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/include/tst_pid.h b/include/tst_pid.h
> index 774c845ce..6958d5d23 100644
> --- a/include/tst_pid.h
> +++ b/include/tst_pid.h
> @@ -50,4 +50,12 @@ static inline int tst_get_free_pids(void (*cleanup_fn)(void))
> */
> pid_t tst_getpid(void);
>
> +/*
> + * Direct gettid() syscall. Some glibc versions cache gettid() return value
> + * which can cause confusing issues for example in processes created by
> + * direct clone() syscall (without using the glibc wrapper). Use this function
> + * whenever the current process may be a child of the main test process.
^
thread spawned from the main ...
> + */
> +pid_t tst_gettid(void);
> +
> #endif /* TST_PID_H__ */
> diff --git a/lib/tst_pid.c b/lib/tst_pid.c
> index cfaa5db36..4e9dc7a52 100644
> --- a/lib/tst_pid.c
> +++ b/lib/tst_pid.c
> @@ -166,3 +166,8 @@ pid_t tst_getpid(void)
> {
> return syscall(SYS_getpid);
> }
> +
> +pid_t tst_gettid(void)
> +{
> + return syscall(SYS_gettid);
> +}
> --
> 2.35.3
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-11-01 12:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 10:23 [LTP] [PATCH v3 0/2] Rewrite exit_group01 test Andrea Cervesato
2023-09-08 10:23 ` [LTP] [PATCH v3 1/2] Add tst_gettid wrapper around gettid syscall Andrea Cervesato
2023-11-01 12:29 ` Cyril Hrubis [this message]
2023-09-08 10:23 ` [LTP] [PATCH v3 2/2] Refactor exit_group01 using new API Andrea Cervesato
2023-10-16 10:03 ` Richard Palethorpe
2023-11-01 12:50 ` Cyril Hrubis
2023-11-16 13:24 ` Richard Palethorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZUJErMEfJO4C7d3N@yuki \
--to=chrubis@suse.cz \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.