mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
perfschema: use glibc gettid if available
This commit is contained in:
parent
68eac8a3ad
commit
90adf2aa59
4 changed files with 12 additions and 4 deletions
|
@ -322,6 +322,7 @@ SET(HAVE_SCHED_GETCPU CACHE INTERNAL "")
|
|||
SET(HAVE_NANOSLEEP CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_THREADID_NP CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_GETTID CACHE INTERNAL "")
|
||||
SET(HAVE_GETTID CACHE INTERNAL "")
|
||||
SET(HAVE_INTEGER_PTHREAD_SELF CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_GETTHREADID_NP CACHE INTERNAL "")
|
||||
SET(HAVE_TIMER_DELETE CACHE INTERNAL "")
|
||||
|
|
|
@ -290,6 +290,9 @@ int main(int ac, char **av)
|
|||
}"
|
||||
HAVE_PTHREAD_THREADID_NP)
|
||||
|
||||
# gettid() library function (glibc-2.30+)
|
||||
CHECK_SYMBOL_EXISTS(gettid unistd.h HAVE_GETTID)
|
||||
|
||||
# Check for gettid() system call
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -50,12 +50,14 @@ static inline my_thread_os_id_t my_thread_os_id()
|
|||
pthread_threadid_np(nullptr, &tid64);
|
||||
return (pid_t)tid64;
|
||||
#else
|
||||
#ifdef HAVE_GETTID
|
||||
/* Linux glibc-2.30+ */
|
||||
return gettid();
|
||||
#else
|
||||
#ifdef HAVE_SYS_GETTID
|
||||
/*
|
||||
Linux.
|
||||
Linux before glibc-2.30
|
||||
See man gettid
|
||||
See GLIBC Bug 6399 - gettid() should have a wrapper
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=6399
|
||||
*/
|
||||
return syscall(SYS_gettid);
|
||||
#else
|
||||
|
@ -82,7 +84,8 @@ static inline my_thread_os_id_t my_thread_os_id()
|
|||
#endif /* HAVE_PTHREAD_GETTHREADID_NP */
|
||||
#endif /* _WIN32 */
|
||||
#endif /* HAVE_SYS_GETTID */
|
||||
#endif /* HAVE_SYS_THREAD_SELFID */
|
||||
#endif /* HAVE_GETTID */
|
||||
#endif /* HAVE_PTHREAD_THREADID_NP */
|
||||
}
|
||||
|
||||
#define CHANNEL_NAME_LENGTH MAX_CONNECTION_NAME
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#cmakedefine HAVE_PTHREAD_THREADID_NP 1
|
||||
#cmakedefine HAVE_SYS_GETTID 1
|
||||
#cmakedefine HAVE_GETTID
|
||||
#cmakedefine HAVE_GETTHRID 1
|
||||
#cmakedefine HAVE_PTHREAD_GETTHREADID_NP 1
|
||||
#cmakedefine HAVE_INTEGER_PTHREAD_SELF 1
|
||||
|
|
Loading…
Add table
Reference in a new issue