Skip to contentSkip to conversation

mbim: add optional copy of TEMP_FAILURE_RETRY macro (fix musl compile)

PATCH In review Nicolas Serafini 2 participants 3 messages Jan 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbim: add optional copy of TEMP_FAILURE_RETRY macro (fix musl compile)

TEMP_FAILURE_RETRY is not available on musl.

---
 drivers/mbimmodem/mbim.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mbimmodem/mbim.c +10 -0
index 54b18acf..4b040528 100644
@@ -37,6 +37,16 @@
 #include "mbim-message.h"
 #include "mbim-private.h"
 
+/* taken from glibc unistd.h for musl support */
+#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
+
 #define MAX_CONTROL_TRANSFER 4096
 #define HEADER_SIZE (sizeof(struct mbim_message_header) + \
 					sizeof(struct mbim_fragment_header))
Signature · 1 line
2.20.1
#1 lore raw

Hi Nicolas,

Quoted 15 lines

TEMP_FAILURE_RETRY is not available on musl.

---
drivers/mbimmodem/mbim.c | 10 ++++++++++

1 file changed, 10 insertions(+)
drivers/mbimmodem/mbim.c +0 -0
index 54b18acf..4b040528 100644
@@ -37,6 +37,16 @@
 #include "mbim-message.h"
 #include "mbim-private.h"
 

drivers/mbimmodem/mbim.c line 49

Quoted 10 lines
drivers/mbimmodem/mbim.c +10 -0
+/* taken from glibc unistd.h for musl support */
+#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
+

or you use the notation that is used in src/storage.h and maybe even move it to a more common place. The TFR macro is used in various places.

Regards

Marcel

#2 lore raw

On Mon, 28 Jan 2019 13:34:37 +0100 Marcel Holtmann <[email protected]> wrote:

Hi Marcel,

Quoted 17 lines

Hi Nicolas,

Quoted 15 lines

TEMP_FAILURE_RETRY is not available on musl.

---
drivers/mbimmodem/mbim.c | 10 ++++++++++

1 file changed, 10 insertions(+)
drivers/mbimmodem/mbim.c +0 -0
index 54b18acf..4b040528 100644
@@ -37,6 +37,16 @@
 #include "mbim-message.h"
 #include "mbim-private.h"
 
Quoted 14 lines

drivers/mbimmodem/mbim.c line 49

Quoted 10 lines
drivers/mbimmodem/mbim.c +10 -0
+/* taken from glibc unistd.h for musl support */
+#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
+

or you use the notation that is used in src/storage.h and maybe even move it to a more common place. The TFR macro is used in various places.

Yes it's a good idea, what do you think about putting it in the "include/types.h" file.

Quoted 5 lines

Regards

Marcel

Regards

Nicolas