linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sandipan Das <sandipan@linux.ibm.com>
To: mpe@ellerman.id.au
Cc: fweimer@redhat.com, aneesh.kumar@linux.ibm.com,
	linuxram@us.ibm.com, linuxppc-dev@lists.ozlabs.org,
	bauerman@linux.ibm.com
Subject: [PATCH v2 5/6] selftests/powerpc: Add wrapper for gettid
Date: Mon, 27 Jul 2020 09:30:39 +0530	[thread overview]
Message-ID: <8ca3b0eeda989707815d1cf337cc33f090408965.1595821792.git.sandipan@linux.ibm.com> (raw)
In-Reply-To: <cover.1595821792.git.sandipan@linux.ibm.com>

The gettid() syscall wrapper was first introduced in
glibc 2.30. This adds a wrapper for use in distros
running older versions.

Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
 tools/testing/selftests/powerpc/include/utils.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h
index 69d16875802da..71d2924f5b8b3 100644
--- a/tools/testing/selftests/powerpc/include/utils.h
+++ b/tools/testing/selftests/powerpc/include/utils.h
@@ -42,6 +42,16 @@ int perf_event_enable(int fd);
 int perf_event_disable(int fd);
 int perf_event_reset(int fd);
 
+#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30)
+#include <unistd.h>
+#include <sys/syscall.h>
+
+static inline pid_t gettid(void)
+{
+	return syscall(SYS_gettid);
+}
+#endif
+
 static inline bool have_hwcap(unsigned long ftr)
 {
 	return ((unsigned long)get_auxv_entry(AT_HWCAP) & ftr) == ftr;
-- 
2.25.1


  parent reply	other threads:[~2020-07-27  4:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27  4:00 [PATCH v2 0/6] Improvements to pkey tests Sandipan Das
2020-07-27  4:00 ` [PATCH v2 1/6] selftests/powerpc: Move pkey helpers to headers Sandipan Das
2020-07-27  4:00 ` [PATCH v2 2/6] selftests/powerpc: Add pkey helpers for rights Sandipan Das
2020-07-27  4:00 ` [PATCH v2 3/6] selftests/powerpc: Harden test for execute-disabled pkeys Sandipan Das
2020-07-27  4:00 ` [PATCH v2 4/6] selftests/powerpc: Add helper to exit on failure Sandipan Das
2020-07-27  4:00 ` Sandipan Das [this message]
2020-07-27  4:00 ` [PATCH v2 6/6] selftests/powerpc: Add test for pkey siginfo verification Sandipan Das
2020-07-30 12:50 ` [PATCH v2 0/6] Improvements to pkey tests Michael Ellerman

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=8ca3b0eeda989707815d1cf337cc33f090408965.1595821792.git.sandipan@linux.ibm.com \
    --to=sandipan@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=fweimer@redhat.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxram@us.ibm.com \
    --cc=mpe@ellerman.id.au \
    /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).