aboutsummaryrefslogtreecommitdiffstats
path: root/testing/low-memory-monitor/musl.patch
blob: b2faac74dd64fea9228d5f060498b419c7c6476e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/src/memory-pressure-monitor.c b/src/memory-pressure-monitor.c
index f59af0a..0863c13 100644
--- a/src/memory-pressure-monitor.c
+++ b/src/memory-pressure-monitor.c
@@ -12,6 +12,16 @@
 #include <glib-unix.h>
 #include <errno.h>
 
+/* taken from glibc unistd.h and fixes musl */
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+#endif
+
 /* Constants */
 #define MEMORY_PRESSURE_PATH "/proc/pressure/memory"