[sysprof: 2/4] compat: add TEMP_FAILURE_RETRY compatiable implementation




commit 429223635e5a9a1de7903465ae1e8a5eb6d61be9
Author: Đoàn Trần Công Danh <congdanhqx gmail com>
Date:   Tue Sep 15 08:47:12 2020 +0700

    compat: add TEMP_FAILURE_RETRY compatiable implementation

 src/libsysprof-capture/sysprof-capture-util-private.h | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/libsysprof-capture/sysprof-capture-util-private.h 
b/src/libsysprof-capture/sysprof-capture-util-private.h
index 13ec1ee..6181212 100644
--- a/src/libsysprof-capture/sysprof-capture-util-private.h
+++ b/src/libsysprof-capture/sysprof-capture-util-private.h
@@ -60,10 +60,19 @@
 # include <sys/sendfile.h>
 #endif
 
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression)            \
+    ({ long int __result;                         \
+       do { __result = (long int) (expression); } \
+       while (__result == -1L && errno == EINTR); \
+       __result; })
+#endif
+
 static inline void *
 sysprof_malloc0 (size_t size)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]