summaryrefslogtreecommitdiffstats
path: root/libnativehelper
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-10-26 18:41:14 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-10-26 18:41:14 -0400
commitf0597819272a9cc9b4f116dab547e0f6825635dc (patch)
tree7a17e46746ccf1c4617eac1b36c57e94eb6acef3 /libnativehelper
parent8deda4a9fda5408e6aff023622de8d2ca48262a7 (diff)
parent2237714129f425131669ae43b1326ec5cb1ec655 (diff)
downloadandroid_dalvik-f0597819272a9cc9b4f116dab547e0f6825635dc.tar.gz
android_dalvik-f0597819272a9cc9b4f116dab547e0f6825635dc.tar.bz2
android_dalvik-f0597819272a9cc9b4f116dab547e0f6825635dc.zip
Merge change I4c4d050d
* changes: Clone TEMP_FAILURE_RETRY in JNIHelp.h, to make up for (take your pick) laggard libc implementations not keeping up with the times or (perhaps) agressively modern libc implementations too eagerly expanding upon the standard.
Diffstat (limited to 'libnativehelper')
-rw-r--r--libnativehelper/include/nativehelper/JNIHelp.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libnativehelper/include/nativehelper/JNIHelp.h b/libnativehelper/include/nativehelper/JNIHelp.h
index 1e268f845..b8bc3f030 100644
--- a/libnativehelper/include/nativehelper/JNIHelp.h
+++ b/libnativehelper/include/nativehelper/JNIHelp.h
@@ -25,6 +25,7 @@
#include "jni.h"
#include "utils/Log.h"
+#include <unistd.h>
#ifndef NELEM
# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
@@ -120,4 +121,19 @@ inline void jniSetFileDescriptorOfFD(JNIEnv* env, jobject fileDescriptor,
}
#endif
+/*
+ * TEMP_FAILURE_RETRY is defined by some, but not all, versions of
+ * <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
+ * not already defined, then define it here.
+ */
+#ifndef TEMP_FAILURE_RETRY
+/* Used to retry syscalls that can return EINTR. */
+#define TEMP_FAILURE_RETRY(exp) ({ \
+ typeof (exp) _rc; \
+ do { \
+ _rc = (exp); \
+ } while (_rc == -1 && errno == EINTR); \
+ _rc; })
+#endif
+
#endif /*_NATIVEHELPER_JNIHELP_H*/