Christophe Leroy <christophe.le...@csgroup.eu> writes: > Michael Ellerman <m...@ellerman.id.au> a écrit : >> Sandipan Das <sandi...@linux.ibm.com> writes: >>> diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c >>> b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c >>> new file mode 100644 >>> index 0000000000000..58605c53d495d >>> --- /dev/null >>> +++ b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c >>> @@ -0,0 +1,332 @@ >> ... >>> + >>> +static void *protect(void *p) >>> +{ >>> + unsigned long rights; >>> + unsigned int *base; >>> + size_t size; >>> + int tid, i; >>> + >>> + tid = gettid(); >> >> pkey_siginfo.c: In function 'protect': >> pkey_siginfo.c:103:8: error: implicit declaration of function >> 'gettid' [-Werror=implicit-function-declaration] >> tid = gettid(); >> ^ >> >> >> On Ubuntu 18.04 at least. > > See https://man7.org/linux/man-pages/man2/gettid.2.html > > Added in glibc 2.30
Thanks, this seems to work: diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h index 69d16875802d..71d2924f5b8b 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; cheers