aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/cares
diff options
context:
space:
mode:
authorGravatar apolcyn <apolcyn@google.com>2017-06-16 19:55:32 -0700
committerGravatar GitHub <noreply@github.com>2017-06-16 19:55:32 -0700
commit59c232c904a8ec2e869043cb49cae5b8e822a895 (patch)
treea1b0be436fcb41ffd8feb520f54040eae6fe6f21 /third_party/cares
parentb6c44d42511b335aeb12ef02dce2041d8eed5b67 (diff)
parentc3735cbe90445f2ef71955f9ab48b0ae7e976af3 (diff)
Merge pull request #11404 from apolcyn/fix_ruby_glibc_upgrade
Redefine fd_set macros for compatibilty with older glibc
Diffstat (limited to 'third_party/cares')
-rw-r--r--third_party/cares/config_linux/ares_config.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/third_party/cares/config_linux/ares_config.h b/third_party/cares/config_linux/ares_config.h
index 5be5010ed7..8c1b954327 100644
--- a/third_party/cares/config_linux/ares_config.h
+++ b/third_party/cares/config_linux/ares_config.h
@@ -511,6 +511,34 @@
# define _DARWIN_USE_64_BIT_INODE 1
#endif
+#ifdef GPR_BACKWARDS_COMPATIBILITY_MODE
+ /* Redefine the fd_set macros for GLIBC < 2.15 support.
+ * This is a backwards compatibility hack. At version 2.15, GLIBC introduces
+ * the __fdelt_chk function, and starts using it within its fd_set macros
+ * (which c-ares uses). For compatibility with GLIBC < 2.15, we need to redefine
+ * the fd_set macros to not use __fdelt_chk. */
+ #include <sys/select.h>
+ #undef FD_SET
+ #undef FD_CLR
+ #undef FD_ISSET
+ /* 'FD_ZERO' doesn't use __fdelt_chk, no need to redefine. */
+
+ #ifdef __FDS_BITS
+ #define GRPC_CARES_FDS_BITS(set) __FDS_BITS(set)
+ #else
+ #define GRPC_CARES_FDS_BITS(set) ((set)->fds_bits)
+ #endif
+
+ #define GRPC_CARES_FD_MASK(d) ((long int)(1UL << (d) % NFDBITS))
+
+ #define FD_SET(d, set) \
+ ((void) (GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] |= GRPC_CARES_FD_MASK(d)))
+ #define FD_CLR(d, set) \
+ ((void) (GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] &= ~GRPC_CARES_FD_MASK(d)))
+ #define FD_ISSET(d, set) \
+ ((GRPC_CARES_FDS_BITS (set)[ (d) / NFDBITS ] & GRPC_CARES_FD_MASK(d)) != 0)
+#endif /* GPR_BACKWARDS_COMPATIBILITY_MODE */
+
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */