All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-filesystem][PATCH] zfs: Fix build on musl systems
@ 2022-05-07 19:19 Khem Raj
  0 siblings, 0 replies; only message in thread
From: Khem Raj @ 2022-05-07 19:19 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Khem Raj, Windel Bouwman

musl does not provide strndupa

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Windel Bouwman <windel@windel.nl>
---
 ...Define-strndupa-if-it-does-not-exist.patch | 36 +++++++++++++++++++
 .../recipes-filesystems/zfs/zfs_2.1.4.bb      |  4 ++-
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch

diff --git a/meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch b/meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch
new file mode 100644
index 0000000000..8bb8b9479a
--- /dev/null
+++ b/meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch
@@ -0,0 +1,36 @@
+From 54883e714b7fd1e7f4ce47eb1fc09adff35d561e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 7 May 2022 12:15:22 -0700
+Subject: [PATCH] Define strndupa if it does not exist
+
+musl e.g. does not supply strndupa, unlike glibc
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ etc/systemd/system-generators/zfs-mount-generator.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/etc/systemd/system-generators/zfs-mount-generator.c b/etc/systemd/system-generators/zfs-mount-generator.c
+index b806339..592d2f9 100644
+--- a/etc/systemd/system-generators/zfs-mount-generator.c
++++ b/etc/systemd/system-generators/zfs-mount-generator.c
+@@ -47,6 +47,15 @@
+ #define	STRCMP ((int(*)(const void *, const void *))&strcmp)
+ #define	PID_T_CMP ((int(*)(const void *, const void *))&pid_t_cmp)
+ 
++#ifndef strndupa
++#define strndupa(s, n) \
++       (__extension__ ({const char *__in = (s);                    \
++                        size_t __len = strnlen (__in, (n)) + 1;    \
++                        char *__out = (char *) alloca (__len);     \
++                        __out[__len-1] = '\0';                     \
++                        (char *) memcpy (__out, __in, __len-1);}))
++#endif
++
+ static int
+ pid_t_cmp(const pid_t *lhs, const pid_t *rhs)
+ {
+-- 
+2.36.0
+
diff --git a/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb b/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb
index 072af79019..1752e03750 100644
--- a/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb
+++ b/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb
@@ -5,7 +5,9 @@ LICENSE = "CDDL-1.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa"
 HOMEPAGE ="https://github.com/openzfs/zfs"
 
-SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz"
+SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
+           file://0001-Define-strndupa-if-it-does-not-exist.patch \
+"
 SRC_URI[sha256sum] = "3b52c0d493f806f638dca87dde809f53861cd318c1ebb0e60daeaa061cf1acf6"
 
 # Using both 'module' and 'autotools' classes seems a bit odd, they both
-- 
2.36.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-07 19:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-07 19:19 [meta-filesystem][PATCH] zfs: Fix build on musl systems Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.