diff options
author | Ken Payson <kpayson@google.com> | 2017-03-30 17:38:40 -0700 |
---|---|---|
committer | Ken Payson <kpayson@google.com> | 2017-04-06 13:39:35 -0700 |
commit | 975b5103e5037e3b9fc1bde02740b568cadeb2c5 (patch) | |
tree | 9b1617360b1c568d2ab6d220758653ff46340387 /src/core/lib/support | |
parent | e98ae0e3b74a41217a6039ce5b75d35a0b9edea0 (diff) |
Fix build on Alpine linux + add portability tests
Diffstat (limited to 'src/core/lib/support')
-rw-r--r-- | src/core/lib/support/cpu_linux.c | 5 | ||||
-rw-r--r-- | src/core/lib/support/wrap_memcpy.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/core/lib/support/cpu_linux.c b/src/core/lib/support/cpu_linux.c index d6f7e7d3da..1e50f59823 100644 --- a/src/core/lib/support/cpu_linux.c +++ b/src/core/lib/support/cpu_linux.c @@ -67,12 +67,17 @@ unsigned gpr_cpu_num_cores(void) { } unsigned gpr_cpu_current_cpu(void) { +#ifdef __GLIBC__ int cpu = sched_getcpu(); if (cpu < 0) { gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno)); return 0; } return (unsigned)cpu; +#else + // sched_getcpu() is undefined on musl + return 0; +#endif } #endif /* GPR_CPU_LINUX */ diff --git a/src/core/lib/support/wrap_memcpy.c b/src/core/lib/support/wrap_memcpy.c index 15c289f7b8..050cc6db5e 100644 --- a/src/core/lib/support/wrap_memcpy.c +++ b/src/core/lib/support/wrap_memcpy.c @@ -40,7 +40,7 @@ */ #ifdef __linux__ -#ifdef __x86_64__ +#if defined(__x86_64__) && defined(__GNU_LIBRARY__) __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); void *__wrap_memcpy(void *destination, const void *source, size_t num) { return memcpy(destination, source, num); |