summaryrefslogtreecommitdiffstats
path: root/chromium/patches/027-temp-failure-retry.patch
blob: dc9ac6fc445224eaf91e4876c2ebe7480fac0df4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
random glibc macro, not provided by musl.
https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html
diff --git a/sandbox/linux/suid/process_util.h b/sandbox/linux/suid/process_util.h
index b0b92c1bcc..db6a122ea8 100644
--- a/sandbox/linux/suid/process_util.h
+++ b/sandbox/linux/suid/process_util.h
@@ -12,6 +12,15 @@
 #include <stdint.h>
 #include <sys/types.h>
 
+#define TEMP_FAILURE_RETRY(expression)         \
+  (__extension__({                             \
+    long int __result;                         \
+    do                                         \
+      __result = (long int)(expression);       \
+    while (__result == -1L && errno == EINTR); \
+    __result;                                  \
+  }))
+
 // This adjusts /proc/process/oom_score_adj so the Linux OOM killer
 // will prefer certain process types over others. The range for the
 // adjustment is [-1000, 1000], with [0, 1000] being user accessible.