All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [meta-oe]inotify-tools: Fix build on musl
@ 2021-12-16 23:24 Khem Raj
  2021-12-16 23:24 ` [meta-oe][PATCH 2/2] libkcapi: Fix build with musl Khem Raj
  0 siblings, 1 reply; 2+ messages in thread
From: Khem Raj @ 2021-12-16 23:24 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Khem Raj

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...fytools-Include-limit.h-for-PATH_MAX.patch | 29 ++++++++++++++
 ...Bridge-differences-between-musl-glib.patch | 40 +++++++++++++++++++
 .../inotify-tools/inotify-tools_3.21.9.6.bb   |  5 ++-
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/inotify-tools/inotify-tools/0001-libinotifytools-Include-limit.h-for-PATH_MAX.patch
 create mode 100644 meta-oe/recipes-support/inotify-tools/inotify-tools/0002-libinotifytools-Bridge-differences-between-musl-glib.patch

diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools/0001-libinotifytools-Include-limit.h-for-PATH_MAX.patch b/meta-oe/recipes-support/inotify-tools/inotify-tools/0001-libinotifytools-Include-limit.h-for-PATH_MAX.patch
new file mode 100644
index 0000000000..f30a62d594
--- /dev/null
+++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/0001-libinotifytools-Include-limit.h-for-PATH_MAX.patch
@@ -0,0 +1,29 @@
+From 1e37cc3aa674c4b052f0655fef59a910fd7325cb Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 16 Dec 2021 14:53:25 -0800
+Subject: [PATCH 1/2] libinotifytools: Include limit.h for PATH_MAX
+
+musl builds fail since the required header which defines PATH_MAX is
+missing, its perhaps included indirectly via glibc based systems
+
+Upstream-Status: Submitted [https://github.com/inotify-tools/inotify-tools/pull/153]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libinotifytools/src/inotifytools.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libinotifytools/src/inotifytools.c b/libinotifytools/src/inotifytools.c
+index 8bdfdb6..902eac2 100644
+--- a/libinotifytools/src/inotifytools.c
++++ b/libinotifytools/src/inotifytools.c
+@@ -17,6 +17,7 @@
+ #include "inotifytools_p.h"
+ #include "stats.h"
+ 
++#include <limits.h>
+ #include <string.h>
+ #include <strings.h>
+ #include <stdlib.h>
+-- 
+2.34.1
+
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-libinotifytools-Bridge-differences-between-musl-glib.patch b/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-libinotifytools-Bridge-differences-between-musl-glib.patch
new file mode 100644
index 0000000000..931244830c
--- /dev/null
+++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-libinotifytools-Bridge-differences-between-musl-glib.patch
@@ -0,0 +1,40 @@
+From 6c3ce01a281a9aa661494d24a862219fc9e2b460 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 16 Dec 2021 14:57:55 -0800
+Subject: [PATCH 2/2] libinotifytools: Bridge differences between
+ musl/glibc/kernel fnotify.h
+
+System detects to use sys/fnotify.h and then assumes glibc's definitions
+but musl has definitions of its own. perhaps portable thing would be to
+use linux/fnotify.h interface directly on linux irrespective of libc
+
+See the differences discussion here [1]
+
+[1] https://inbox.vuxu.org/musl/20191112220151.GC27331@x230/T/#ma8700992467200c8792e0fa8508eae656b81aeba
+
+Upstream-Status: Submitted [https://github.com/inotify-tools/inotify-tools/pull/154]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libinotifytools/src/inotifytools.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/libinotifytools/src/inotifytools.c b/libinotifytools/src/inotifytools.c
+index 902eac2..2b96395 100644
+--- a/libinotifytools/src/inotifytools.c
++++ b/libinotifytools/src/inotifytools.c
+@@ -55,6 +55,12 @@ struct fanotify_event_fid {
+ 	struct fanotify_event_info_fid info;
+ 	struct file_handle handle;
+ };
++
++#ifndef __GLIBC__
++#define val __val
++#define __kernel_fsid_t fsid_t
++#endif
++
+ #endif
+ 
+ /**
+-- 
+2.34.1
+
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools_3.21.9.6.bb b/meta-oe/recipes-support/inotify-tools/inotify-tools_3.21.9.6.bb
index e3a4e6350e..89c3a00b71 100644
--- a/meta-oe/recipes-support/inotify-tools/inotify-tools_3.21.9.6.bb
+++ b/meta-oe/recipes-support/inotify-tools/inotify-tools_3.21.9.6.bb
@@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=ac6c26e52aea428ee7f56dc2c56424c6"
 
 SRCREV = "8f8fcdffb7e80928bea6c1fccd3527a9f5d8fe77"
 
-SRC_URI = "git://github.com/${BPN}/${BPN};branch=master;protocol=https"
+SRC_URI = "git://github.com/${BPN}/${BPN};branch=master;protocol=https \
+           file://0001-libinotifytools-Include-limit.h-for-PATH_MAX.patch \
+           file://0002-libinotifytools-Bridge-differences-between-musl-glib.patch \
+          "
 
 S = "${WORKDIR}/git"
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [meta-oe][PATCH 2/2] libkcapi: Fix build with musl
  2021-12-16 23:24 [PATCH 1/2] [meta-oe]inotify-tools: Fix build on musl Khem Raj
@ 2021-12-16 23:24 ` Khem Raj
  0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2021-12-16 23:24 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Khem Raj, Oleksandr Kravchuk

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
---
 ...Adjust-for-musl-msghdr-struct-compat.patch | 81 +++++++++++++++++++
 .../recipes-crypto/libkcapi/libkcapi_1.3.1.bb |  4 +-
 2 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kernel-if-Adjust-for-musl-msghdr-struct-compat.patch

diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kernel-if-Adjust-for-musl-msghdr-struct-compat.patch b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kernel-if-Adjust-for-musl-msghdr-struct-compat.patch
new file mode 100644
index 0000000000..687eb359cf
--- /dev/null
+++ b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kernel-if-Adjust-for-musl-msghdr-struct-compat.patch
@@ -0,0 +1,81 @@
+From d54e532821d40f8094a49742831d32ec7e76caed Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 16 Dec 2021 15:18:21 -0800
+Subject: [PATCH] kcapi-kernel-if: Adjust for musl  msghdr struct compatibility
+
+musl sticks to POSIX and defines msg_iovlen and msg_controllen as int
+and socklen_t types respectively whereas glibc and kernel mark them as
+size_t which is them assumed as such in the code here as well, Make the
+needed conversions to get it going on musl/linux also see [1] for more
+info
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=7168790763cdeb794df52be6e3b39fbb021c5a64
+
+Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/131]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/kcapi-kernel-if.c | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/lib/kcapi-kernel-if.c b/lib/kcapi-kernel-if.c
+index 739841e..e5d15d4 100644
+--- a/lib/kcapi-kernel-if.c
++++ b/lib/kcapi-kernel-if.c
+@@ -168,10 +168,14 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
+ 	}
+ 
+ 	msg.msg_control = buffer_p;
+-	msg.msg_controllen = bufferlen;
+ 	msg.msg_iov = iov;
++#ifdef __GLIBC__
+ 	msg.msg_iovlen = iovlen;
+-
++	msg.msg_controllen = bufferlen;
++#else
++	msg.msg_iovlen = (int)iovlen;
++	msg.msg_controllen = (socklen_t)bufferlen;
++#endif
+ 	/* encrypt/decrypt operation */
+ 	header = CMSG_FIRSTHDR(&msg);
+ 	if (!header) {
+@@ -193,7 +197,11 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
+ 		}
+ 		header->cmsg_level = SOL_ALG;
+ 		header->cmsg_type = ALG_SET_IV;
++#ifdef __GLIBC__
+ 		header->cmsg_len = iv_msg_size;
++#else
++		header->cmsg_len = (socklen_t)iv_msg_size;
++#endif
+ 		alg_iv = (void*)CMSG_DATA(header);
+ 		alg_iv->ivlen = tfm->info.ivsize;
+ 		memcpy(alg_iv->iv, handle->cipher.iv, tfm->info.ivsize);
+@@ -244,8 +252,11 @@ ssize_t _kcapi_common_send_data(struct kcapi_handle *handle,
+ 	msg.msg_controllen = 0;
+ 	msg.msg_flags = 0;
+ 	msg.msg_iov = iov;
++#ifdef __GLIBC__
+ 	msg.msg_iovlen = iovlen;
+-
++#else
++	msg.msg_iovlen = (int)iovlen;
++#endif
+ 	ret = sendmsg(*_kcapi_get_opfd(handle), &msg, (int)flags);
+ 	if (ret < 0)
+ 		ret = -errno;
+@@ -542,8 +553,11 @@ ssize_t _kcapi_common_recv_data(struct kcapi_handle *handle,
+ 	msg.msg_controllen = 0;
+ 	msg.msg_flags = 0;
+ 	msg.msg_iov = iov;
++#ifdef __GLIBC__
+ 	msg.msg_iovlen = iovlen;
+-
++#else
++	msg.msg_iovlen = (int)iovlen;
++#endif
+ 	ret = recvmsg(*_kcapi_get_opfd(handle), &msg, 0);
+ 	if (ret < 0)
+ 		ret = -errno;
+-- 
+2.34.1
+
diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi_1.3.1.bb b/meta-oe/recipes-crypto/libkcapi/libkcapi_1.3.1.bb
index f10d684701..1bd587f0bc 100644
--- a/meta-oe/recipes-crypto/libkcapi/libkcapi_1.3.1.bb
+++ b/meta-oe/recipes-crypto/libkcapi/libkcapi_1.3.1.bb
@@ -5,7 +5,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=80c467906eb826339c7f09e61808ed23"
 
 S = "${WORKDIR}/git"
 SRCREV = "2936ecd060c299157ac880650ba2c9fd94d27bb1"
-SRC_URI = "git://github.com/smuellerDD/libkcapi.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/smuellerDD/libkcapi.git;branch=master;protocol=https \
+           file://0001-kcapi-kernel-if-Adjust-for-musl-msghdr-struct-compat.patch \
+          "
 
 inherit autotools
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-16 23:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 23:24 [PATCH 1/2] [meta-oe]inotify-tools: Fix build on musl Khem Raj
2021-12-16 23:24 ` [meta-oe][PATCH 2/2] libkcapi: Fix build with musl 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.