Skip to contentSkip to conversation

PATCH: v4l-utils/utils/ir-ctl/irc-ctl.c: fix musl build

PATCH Francesco 2 participants 2 messages Feb 20, 2017 Media (V4L/DVB)

lore
Share & tools
lore

Francesco

author
#0 lore raw

Hi.
This is my fist attempt to send a patch for v4l-utils project.
I maintain v4l-utils package for Alpine Linux (www.alpinelinux.org), a musl-based distro.

This patch allows the build for v4l-utils by allowing alternatives to GLIBC assumptions.

Thanks for considering.

Signature · 5 lines
:: Francesco ::
Twit.....http://twitter.com/fcolista
[email protected]
AboutMe..http://about.me/fcolista
GnuPG ID: C4FB9584

From 71f399cb1399c35ff4ce165c2cec0fcd3256d34e Mon Sep 17 00:00:00 2001
From: Francesco Colista <[email protected]>
Date: Mon, 20 Feb 2017 10:16:01 +0100
Subject: [PATCH] utils/ir-ctl/ir-ctl.c: fix build with musl library

This patch allows to build correctly v4l-utils on musl-based distributions. It provides alternative to glibc assumptions.

---
 utils/ir-ctl/ir-ctl.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
utils/ir-ctl/ir-ctl.c +14 -0
index bc58cee0..0bd0ddcc 100644
@@ -42,6 +42,20 @@
 # define _(string) string
 #endif
 
+#if !defined(__GLIBC__)
+
+/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
+   set to EINTR.  */
+
+# define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+
+#endif
+
 # define N_(string) string
 
 
Signature · 1 line
2.11.1
#1 lore raw

Hi Francesco,

Quoted 25 lines · Francesco

This is my fist attempt to send a patch for v4l-utils project. I maintain v4l-utils package for Alpine Linux (www.alpinelinux.org), a musl-based distro.

This patch allows the build for v4l-utils by allowing alternatives to GLIBC assumptions.

Thanks for considering.

From 71f399cb1399c35ff4ce165c2cec0fcd3256d34e Mon Sep 17 00:00:00 2001
From: Francesco Colista <[email protected]>
Date: Mon, 20 Feb 2017 10:16:01 +0100
Subject: [PATCH] utils/ir-ctl/ir-ctl.c: fix build with musl library

This patch allows to build correctly v4l-utils on musl-based distributions. It provides alternative to glibc assumptions.

---
 utils/ir-ctl/ir-ctl.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
utils/ir-ctl/ir-ctl.c +0 -0
index bc58cee0..0bd0ddcc 100644

utils/ir-ctl/ir-ctl.c line 45

Quoted 4 lines
utils/ir-ctl/ir-ctl.c +1 -0
@@ -42,6 +42,20 @@
 # define _(string) string
 #endif
 
+#if !defined(__GLIBC__)

This might break other libc implementations. Instead, do

  #ifndef TEMP_FAILURE_RETRY

See
https://git.busybox.net/buildroot/tree/package/libv4l/0002-ir-ctl-fixes-for-musl-compile.patch

Quoted 4 lines
utils/ir-ctl/ir-ctl.c +4 -0
+
+/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
+   set to EINTR.  */
+

utils/ir-ctl/ir-ctl.c line 59

Quoted 10 lines
utils/ir-ctl/ir-ctl.c +9 -0
+# define TEMP_FAILURE_RETRY(expression) \
+  (__extension__                                                              \
+    ({ long int __result;                                                     \
+       do __result = (long int) (expression);                                 \
+       while (__result == -1L && errno == EINTR);                             \
+       __result; }))
+
+#endif
+
 # define N_(string) string

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -