From 7bf3f05197bb6d71beba9dcd0ac83ddfcf7f1919 Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Fri, 23 Aug 2019 13:54:52 +0000 Subject: [PATCH] grpc: Define gettid() only for glibc < 2.30 glibc 2.30 has added this API, so let us use that when possible Upstream-Status: Pending Signed-off-by: Hongxu Jia --- tensorflow/workspace.bzl | 1 + ...01-Define-gettid-only-for-glibc-2.30.patch | 52 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 third_party/systemlibs/0001-Define-gettid-only-for-glibc-2.30.patch diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 788eca2f67..8a37fe5643 100755 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -475,6 +475,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): sha256 = "1aa84387232dda273ea8fdfe722622084f72c16f7b84bfc519ac7759b71cdc91", strip_prefix = "grpc-69b6c047bc767b4d80e7af4d00ccb7c45b683dae", system_build_file = clean_dep("//third_party/systemlibs:grpc.BUILD"), + patch_file = clean_dep("//third_party/systemlibs:0001-Define-gettid-only-for-glibc-2.30.patch"), urls = [ "https://mirror.bazel.build/github.com/grpc/grpc/archive/69b6c047bc767b4d80e7af4d00ccb7c45b683dae.tar.gz", "https://github.com/grpc/grpc/archive/69b6c047bc767b4d80e7af4d00ccb7c45b683dae.tar.gz", diff --git a/third_party/systemlibs/0001-Define-gettid-only-for-glibc-2.30.patch b/third_party/systemlibs/0001-Define-gettid-only-for-glibc-2.30.patch new file mode 100644 index 0000000000..30f1d7b252 --- /dev/null +++ b/third_party/systemlibs/0001-Define-gettid-only-for-glibc-2.30.patch @@ -0,0 +1,52 @@ +From 1d630079c3d1013baebd19060f4e6050112cb66d Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Fri, 23 Aug 2019 13:52:01 +0000 +Subject: [PATCH] Define gettid() only for glibc < 2.30 + +glibc 2.30 has added this API, so let us use that when possible + +Upstream-Status: Pending +Signed-off-by: Khem Raj + +Signed-off-by: Hongxu Jia +--- + src/core/lib/gpr/log_linux.cc | 4 ++++ + src/core/lib/iomgr/ev_epollex_linux.cc | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc +index 561276f..25a7486 100644 +--- a/src/core/lib/gpr/log_linux.cc ++++ b/src/core/lib/gpr/log_linux.cc +@@ -40,7 +40,11 @@ + #include + #include + ++#if defined(__GLIBC__) && (__GLIBC_MINOR__ >= 29) ++#include ++#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, ...) { +diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc +index 06a382c..ec321f2 100644 +--- a/src/core/lib/iomgr/ev_epollex_linux.cc ++++ b/src/core/lib/iomgr/ev_epollex_linux.cc +@@ -1150,8 +1150,12 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, + } + + #ifndef NDEBUG ++#if defined(__GLIBC__) && (__GLIBC_MINOR__ >= 29) ++#include ++#else + static long gettid(void) { return syscall(__NR_gettid); } + #endif ++#endif + + /* pollset->mu lock must be held by the caller before calling this. + The function pollset_work() may temporarily release the lock (pollset->po.mu) +-- +2.17.1 + -- 2.17.1