From: Riccardo Mancini <rickyman7@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>,
Riccardo Mancini <rickyman7@gmail.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: [PATCH 3/3] perf test: mmap-thread-lookup: use gettid
Date: Thu, 22 Jul 2021 17:34:16 +0200 [thread overview]
Message-ID: <0328557450dc7817cd979ee71b33ca9166a1d78b.1626966805.git.rickyman7@gmail.com> (raw)
In-Reply-To: <cover.1626966805.git.rickyman7@gmail.com>
This patch replaces the manual syscall to get the current thread tid,
with the libc equivalent gettid.
Since it is only available from glibc 2.30, the libc_compat.h header is
included, which provides its definition in case gettid is not available.
Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
---
tools/perf/tests/mmap-thread-lookup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c
index 8d9d4cbff76d17d5..055cc850a6061798 100644
--- a/tools/perf/tests/mmap-thread-lookup.c
+++ b/tools/perf/tests/mmap-thread-lookup.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <inttypes.h>
#include <unistd.h>
-#include <sys/syscall.h>
+#include <tools/libc_compat.h> // gettid
#include <sys/types.h>
#include <sys/mman.h>
#include <pthread.h>
@@ -45,7 +45,7 @@ static int thread_init(struct thread_data *td)
}
td->map = map;
- td->tid = syscall(SYS_gettid);
+ td->tid = gettid();
pr_debug("tid = %d, map = %p\n", td->tid, map);
return 0;
--
2.31.1
next prev parent reply other threads:[~2021-07-22 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 15:34 [PATCH 0/3] tools: add gettid to libc_compat.h Riccardo Mancini
2021-07-22 15:34 ` [PATCH 1/3] tools libc_compat: add gettid Riccardo Mancini
2021-07-25 22:04 ` kernel test robot
2021-07-26 10:43 ` Riccardo Mancini
2021-07-22 15:34 ` [PATCH 2/3] perf jvmti: use gettid from libc_compat Riccardo Mancini
2021-07-22 15:34 ` Riccardo Mancini [this message]
2021-07-22 23:31 ` [PATCH 0/3] tools: add gettid to libc_compat.h Ian Rogers
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=0328557450dc7817cd979ee71b33ca9166a1d78b.1626966805.git.rickyman7@gmail.com \
--to=rickyman7@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).