From d6928c74f850018eabfcc114bb8c38c7dd788a01 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 24 Aug 2023 10:45:09 -0400 Subject: [PATCH] MT#56374 add gettid() wrapper ... for older glibc which doesn't support it Change-Id: I82cd49e6a10fd48861ae00c4eda06613f930fca7 --- lib/auxlib.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/auxlib.h b/lib/auxlib.h index a57ffe01a..7610fac9f 100644 --- a/lib/auxlib.h +++ b/lib/auxlib.h @@ -9,6 +9,8 @@ #include #include #include +#include +#include #define THREAD_BUF_SIZE 64 @@ -436,6 +438,12 @@ INLINE int rlim(int res, rlim_t val) { return setrlimit(res, &rlim); } +#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 30)) +INLINE pid_t gettid(void) { + return syscall(SYS_gettid); +} +#endif + /*** TAINT FUNCTIONS ***/