From 89c2812bd68ce81fb7a85bb1b946cc2f79f5dbfd Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sat, 13 Oct 2012 11:59:01 -0700 Subject: Add TEMP_FAILURE_RETRY macro for darwin Darwin doesn't define the TEMP_FAILURE_RETRY macro in unistd.h so we need to add it everywhere. Joy! (cherry picked from commit ec90f1dc11488f0ab8a25a9159965b4ae3c4ca88) Change-Id: Ida554fc65193672cc4616dec79e6282e06cc1b28 --- adb/sysdeps.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'adb') 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 #include +/* + * TEMP_FAILURE_RETRY is defined by some, but not all, versions of + * . (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 "/" -- cgit v1.1