Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 1 | use glibc provided gettid API for glibc 2.30+ |
| 2 | |
| 3 | glibc 2.30 introduced this function see [1] |
| 4 | so it's best to detect it |
| 5 | and provide fallback only if it's not present |
| 6 | |
| 7 | [1] https://sourceware.org/bugzilla/show_bug.cgi?id=6399 |
| 8 | |
| 9 | Upstream-Status: Pending |
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- a/src/core/lib/gpr/log_linux.cc |
| 12 | +++ b/src/core/lib/gpr/log_linux.cc |
| 13 | @@ -40,7 +40,13 @@ |
| 14 | #include <time.h> |
| 15 | #include <unistd.h> |
| 16 | |
| 17 | +#if defined(__GLIBC__) |
| 18 | +#if !__GLIBC_PREREQ(2,29) |
| 19 | static long gettid(void) { return syscall(__NR_gettid); } |
| 20 | +#endif |
| 21 | +#else |
| 22 | +static long gettid(void) { return syscall(__NR_gettid); } |
| 23 | +#endif |
| 24 | |
| 25 | void gpr_log(const char* file, int line, gpr_log_severity severity, |
| 26 | const char* format, ...) { |