summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native/Portability.h
diff options
context:
space:
mode:
Diffstat (limited to 'luni/src/main/native/Portability.h')
-rw-r--r--luni/src/main/native/Portability.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/luni/src/main/native/Portability.h b/luni/src/main/native/Portability.h
index 1aaf7a3..5900cb0 100644
--- a/luni/src/main/native/Portability.h
+++ b/luni/src/main/native/Portability.h
@@ -85,4 +85,21 @@ static inline int android_getaddrinfofornet(const char* hostname, const char* se
}
#endif
+#if defined(__GLIBC__) && !defined(__LP64__)
+
+#include <unistd.h>
+
+// 32 bit GLIBC hardcodes a "long int" as the return type for
+// TEMP_FAILURE_RETRY so the return value here gets truncated for
+// functions that return 64 bit types.
+#undef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(exp) ({ \
+ __typeof__(exp) _rc; \
+ do { \
+ _rc = (exp); \
+ } while (_rc == -1 && errno == EINTR); \
+ _rc; })
+
+#endif // __GLIBC__ && !__LP64__
+
#endif // PORTABILITY_H_included