python-grpcio: Use gettid API from glibc 2.30+

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj
2019-07-26 18:29:19 -07:00
parent 5f05cba746
commit 381508f909
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
use glibc provided gettid API for glibc 2.30+
glibc 2.30 introduced this function see [1]
so it's best to detect it
and provide fallback only if it's not present
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=6399
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/src/core/lib/gpr/log_linux.cc
+++ b/src/core/lib/gpr/log_linux.cc
@@ -40,7 +40,13 @@
#include <time.h>
#include <unistd.h>
+#if defined(__GLIBC__)
+#if !__GLIBC_PREREQ(2,29)
static long gettid(void) { return syscall(__NR_gettid); }
+#endif
+#else
+static long gettid(void) { return syscall(__NR_gettid); }
+#endif
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {