summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-10-13 13:12:40 -0700
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-10-13 13:12:40 -0700
commit51ccef27cab58277775e62518a59666d2a059b62 (patch)
tree330f404888dbf265c7f92557bd2948159845de84 /adb
parent207c17ff1f48d0db3c69628bb036a14db40b5887 (diff)
parent89c2812bd68ce81fb7a85bb1b946cc2f79f5dbfd (diff)
downloadsystem_core-51ccef27cab58277775e62518a59666d2a059b62.zip
system_core-51ccef27cab58277775e62518a59666d2a059b62.tar.gz
system_core-51ccef27cab58277775e62518a59666d2a059b62.tar.bz2
Merge "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 22f01dd..e883557 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -274,6 +274,21 @@ static __inline__ int adb_is_absolute_host_path( const char* path )
#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 "/"