summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-10-13 13:54:34 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-13 13:54:34 -0700
commit1dcaf9d054bf92a17d82160865bba5c6f7d15adb (patch)
tree01711f1d37d3c6b2f47b7ebbf124a0f31e6fc489 /adb
parent1dc92bacb8cbf052438e0b1af4030a57901d6e94 (diff)
parent51ccef27cab58277775e62518a59666d2a059b62 (diff)
downloadsystem_core-1dcaf9d054bf92a17d82160865bba5c6f7d15adb.zip
system_core-1dcaf9d054bf92a17d82160865bba5c6f7d15adb.tar.gz
system_core-1dcaf9d054bf92a17d82160865bba5c6f7d15adb.tar.bz2
am 51ccef27: Merge "Add TEMP_FAILURE_RETRY macro for darwin"
* commit '51ccef27cab58277775e62518a59666d2a059b62': Add TEMP_FAILURE_RETRY macro for darwin
Diffstat (limited to 'adb')
-rw-r--r--adb/sysdeps.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index ee7cd49..0252ef3 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -277,6 +277,21 @@ extern char* adb_strtok_r(char *str, const char *delim, char **saveptr);
#include <string.h>
#include <unistd.h>
+/*
+ * 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
+
#define OS_PATH_SEPARATOR '/'
#define OS_PATH_SEPARATOR_STR "/"
#define ENV_PATH_SEPARATOR_STR ":"