diff options
| author | Gianfranco Costamagna <costamagna.gianfranco@gmail.com> | 2019-09-06 14:36:27 +0200 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2019-09-06 08:40:59 -0700 |
| commit | 26ca0854112a9c236aa7a935506c168d04738509 (patch) | |
| tree | 179dead25cc253464a762afc2ca48d72f808fa6a | |
| parent | 0c05d498776d49991756718774ece13af837819b (diff) | |
| download | meta-openembedded-26ca0854112a9c236aa7a935506c168d04738509.tar.gz | |
grpc: Change gettid patch with the upstream merged version
Signed-off-by: Gianfranco Costamagna <locutusofborg@debian.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-networking/recipes-devtools/grpc/grpc/0001-Define-gettid-only-for-glibc-2.30.patch | 128 |
1 files changed, 95 insertions, 33 deletions
diff --git a/meta-networking/recipes-devtools/grpc/grpc/0001-Define-gettid-only-for-glibc-2.30.patch b/meta-networking/recipes-devtools/grpc/grpc/0001-Define-gettid-only-for-glibc-2.30.patch index 4f9b115ec6..88b0af7f88 100644 --- a/meta-networking/recipes-devtools/grpc/grpc/0001-Define-gettid-only-for-glibc-2.30.patch +++ b/meta-networking/recipes-devtools/grpc/grpc/0001-Define-gettid-only-for-glibc-2.30.patch | |||
| @@ -1,53 +1,115 @@ | |||
| 1 | From c27261a8bc1e45ff7d7a585c79b2b871d47217e4 Mon Sep 17 00:00:00 2001 | 1 | Upstream-Status: Backport |
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 26 Jul 2019 18:56:26 -0700 | ||
| 4 | Subject: [PATCH] Define gettid() only for glibc < 2.30 | ||
| 5 | 2 | ||
| 6 | glibc 2.30 has added this API, so let us use that when possible | 3 | From de6255941a5e1c2fb2d50e57f84e38c09f45023d Mon Sep 17 00:00:00 2001 |
| 4 | From: Juanli Shen <juanlishen@google.com> | ||
| 5 | Date: Fri, 23 Aug 2019 08:46:09 -0700 | ||
| 6 | Subject: [PATCH] Fix gettid() naming conflict | ||
| 7 | 7 | ||
| 8 | Upstream-Status: Pending | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | 8 | --- |
| 11 | src/core/lib/gpr/log_linux.cc | 4 ++++ | 9 | src/core/lib/gpr/log_linux.cc | 6 ++++-- |
| 12 | src/core/lib/iomgr/ev_epollex_linux.cc | 7 +++++-- | 10 | 1 file changed, 4 insertions(+), 2 deletions(-) |
| 13 | 2 files changed, 9 insertions(+), 2 deletions(-) | ||
| 14 | 11 | ||
| 15 | diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc | 12 | diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc |
| 16 | index 561276f0c2..25a74864a1 100644 | 13 | index 561276f0c20..81026e5689b 100644 |
| 17 | --- a/src/core/lib/gpr/log_linux.cc | 14 | --- a/src/core/lib/gpr/log_linux.cc |
| 18 | +++ b/src/core/lib/gpr/log_linux.cc | 15 | +++ b/src/core/lib/gpr/log_linux.cc |
| 19 | @@ -40,7 +40,11 @@ | 16 | @@ -40,7 +40,9 @@ |
| 20 | #include <time.h> | 17 | #include <time.h> |
| 21 | #include <unistd.h> | 18 | #include <unistd.h> |
| 22 | 19 | ||
| 23 | +#if defined(__GLIBC__) && (__GLIBC_MINOR__ >= 30) | 20 | -static long gettid(void) { return syscall(__NR_gettid); } |
| 24 | +#include <unistd.h> | 21 | +// Not naming it as gettid() to avoid duplicate declarations when complied with |
| 25 | +#else | 22 | +// GCC 9.1. |
| 26 | static long gettid(void) { return syscall(__NR_gettid); } | 23 | +static long local_gettid(void) { return syscall(__NR_gettid); } |
| 27 | +#endif | ||
| 28 | 24 | ||
| 29 | void gpr_log(const char* file, int line, gpr_log_severity severity, | 25 | void gpr_log(const char* file, int line, gpr_log_severity severity, |
| 30 | const char* format, ...) { | 26 | const char* format, ...) { |
| 27 | @@ -70,7 +72,7 @@ void gpr_default_log(gpr_log_func_args* args) { | ||
| 28 | gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); | ||
| 29 | struct tm tm; | ||
| 30 | static __thread long tid = 0; | ||
| 31 | - if (tid == 0) tid = gettid(); | ||
| 32 | + if (tid == 0) tid = local_gettid(); | ||
| 33 | |||
| 34 | timer = static_cast<time_t>(now.tv_sec); | ||
| 35 | final_slash = strrchr(args->file, '/'); | ||
| 36 | From 57586a1ca7f17b1916aed3dea4ff8de872dbf853 Mon Sep 17 00:00:00 2001 | ||
| 37 | From: Benjamin Peterson <benjamin@dropbox.com> | ||
| 38 | Date: Fri, 3 May 2019 08:11:00 -0700 | ||
| 39 | Subject: [PATCH] Rename gettid() functions. | ||
| 40 | |||
| 41 | glibc 2.30 will declare its own gettid; see https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92. Rename the grpc versions to avoid naming conflicts. | ||
| 42 | --- | ||
| 43 | src/core/lib/gpr/log_linux.cc | 6 ++---- | ||
| 44 | src/core/lib/gpr/log_posix.cc | 4 ++-- | ||
| 45 | src/core/lib/iomgr/ev_epollex_linux.cc | 4 ++-- | ||
| 46 | 3 files changed, 6 insertions(+), 8 deletions(-) | ||
| 47 | |||
| 48 | diff --git a/src/core/lib/gpr/log_linux.cc b/src/core/lib/gpr/log_linux.cc | ||
| 49 | index 81026e5689b..8b597b4cf2f 100644 | ||
| 50 | --- a/src/core/lib/gpr/log_linux.cc | ||
| 51 | +++ b/src/core/lib/gpr/log_linux.cc | ||
| 52 | @@ -40,9 +40,7 @@ | ||
| 53 | #include <time.h> | ||
| 54 | #include <unistd.h> | ||
| 55 | |||
| 56 | -// Not naming it as gettid() to avoid duplicate declarations when complied with | ||
| 57 | -// GCC 9.1. | ||
| 58 | -static long local_gettid(void) { return syscall(__NR_gettid); } | ||
| 59 | +static long sys_gettid(void) { return syscall(__NR_gettid); } | ||
| 60 | |||
| 61 | void gpr_log(const char* file, int line, gpr_log_severity severity, | ||
| 62 | const char* format, ...) { | ||
| 63 | @@ -72,7 +70,7 @@ void gpr_default_log(gpr_log_func_args* args) { | ||
| 64 | gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); | ||
| 65 | struct tm tm; | ||
| 66 | static __thread long tid = 0; | ||
| 67 | - if (tid == 0) tid = local_gettid(); | ||
| 68 | + if (tid == 0) tid = sys_gettid(); | ||
| 69 | |||
| 70 | timer = static_cast<time_t>(now.tv_sec); | ||
| 71 | final_slash = strrchr(args->file, '/'); | ||
| 72 | diff --git a/src/core/lib/gpr/log_posix.cc b/src/core/lib/gpr/log_posix.cc | ||
| 73 | index b6edc14ab6b..2f7c6ce3760 100644 | ||
| 74 | --- a/src/core/lib/gpr/log_posix.cc | ||
| 75 | +++ b/src/core/lib/gpr/log_posix.cc | ||
| 76 | @@ -31,7 +31,7 @@ | ||
| 77 | #include <string.h> | ||
| 78 | #include <time.h> | ||
| 79 | |||
| 80 | -static intptr_t gettid(void) { return (intptr_t)pthread_self(); } | ||
| 81 | +static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); } | ||
| 82 | |||
| 83 | void gpr_log(const char* file, int line, gpr_log_severity severity, | ||
| 84 | const char* format, ...) { | ||
| 85 | @@ -86,7 +86,7 @@ void gpr_default_log(gpr_log_func_args* args) { | ||
| 86 | char* prefix; | ||
| 87 | gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]", | ||
| 88 | gpr_log_severity_string(args->severity), time_buffer, | ||
| 89 | - (int)(now.tv_nsec), gettid(), display_file, args->line); | ||
| 90 | + (int)(now.tv_nsec), sys_gettid(), display_file, args->line); | ||
| 91 | |||
| 92 | fprintf(stderr, "%-70s %s\n", prefix, args->message); | ||
| 93 | gpr_free(prefix); | ||
| 31 | diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc | 94 | diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc |
| 32 | index 08116b3ab5..d3d3025111 100644 | 95 | index c2d80c08ddb..4a83cb6c215 100644 |
| 33 | --- a/src/core/lib/iomgr/ev_epollex_linux.cc | 96 | --- a/src/core/lib/iomgr/ev_epollex_linux.cc |
| 34 | +++ b/src/core/lib/iomgr/ev_epollex_linux.cc | 97 | +++ b/src/core/lib/iomgr/ev_epollex_linux.cc |
| 35 | @@ -1101,10 +1101,13 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, | 98 | @@ -1077,7 +1077,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, |
| 36 | gpr_atm_no_barrier_fetch_add(&pollset->worker_count, -1); | ||
| 37 | } | 99 | } |
| 38 | 100 | ||
| 39 | -#ifndef NDEBUG | 101 | #ifndef NDEBUG |
| 40 | +#if !defined(DEBUG) | 102 | -static long gettid(void) { return syscall(__NR_gettid); } |
| 41 | +#if defined(__GLIBC__) && (__GLIBC_MINOR__ >= 30) | 103 | +static long sys_gettid(void) { return syscall(__NR_gettid); } |
| 42 | +#include <unistd.h> | ||
| 43 | +#else | ||
| 44 | static long gettid(void) { return syscall(__NR_gettid); } | ||
| 45 | #endif | 104 | #endif |
| 46 | - | 105 | |
| 47 | +#endif | ||
| 48 | /* pollset->mu lock must be held by the caller before calling this. | 106 | /* pollset->mu lock must be held by the caller before calling this. |
| 49 | The function pollset_work() may temporarily release the lock (pollset->po.mu) | 107 | @@ -1097,7 +1097,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, |
| 50 | during the course of its execution but it will always re-acquire the lock and | 108 | #define WORKER_PTR (&worker) |
| 51 | -- | 109 | #endif |
| 52 | 2.22.0 | 110 | #ifndef NDEBUG |
| 53 | 111 | - WORKER_PTR->originator = gettid(); | |
| 112 | + WORKER_PTR->originator = sys_gettid(); | ||
| 113 | #endif | ||
| 114 | if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { | ||
| 115 | gpr_log(GPR_INFO, | ||
