summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-09-13 15:07:41 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-13 15:07:42 -0700
commit7918d816401a92456709ba64ccbe60b8e5ffb14c (patch)
treef336403c40d12b71c15306b55e428831b41f3647 /include
parentad59e0a90ec414ddc59cbe73319039981f433c53 (diff)
parentddb173394430a7b55b0c24896a843556f5f8de7a (diff)
downloadsystem_core-7918d816401a92456709ba64ccbe60b8e5ffb14c.zip
system_core-7918d816401a92456709ba64ccbe60b8e5ffb14c.tar.gz
system_core-7918d816401a92456709ba64ccbe60b8e5ffb14c.tar.bz2
Merge "Wrap system calls in TEMP_FAILURE_RETRY." into jb-mr1-dev
Diffstat (limited to 'include')
-rw-r--r--include/cutils/fs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/cutils/fs.h b/include/cutils/fs.h
index 04c8839..fd5296b 100644
--- a/include/cutils/fs.h
+++ b/include/cutils/fs.h
@@ -19,6 +19,21 @@
#include <sys/types.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
+
#ifdef __cplusplus
extern "C" {
#endif