Skip to contentSkip to conversation

libbsd: Fix build with largefile support

PATCH New Khem Raj 1 participant 9 messages Dec 21, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/9 libbsd: Fix build with largefile support

---
 ...e-off64_t-with-off_t-in-funopen_seek.patch | 34 +++++++++++++++++++
 meta/recipes-support/libbsd/libbsd_0.11.7.bb  |  4 ++-
 2 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libbsd/libbsd/0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch
meta/recipes-support/libbsd/libbsd/0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch new file +34 -0
new file mode 100644
index 0000000000..45ecef041b
@@ -0,0 +1,34 @@
+From 9c4e5f8984e46344c9e150764b8aa0a7a70b6cb5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 09:02:22 -0800
+Subject: [PATCH] funopen: Replace off64_t with off_t in funopen_seek
+
+AC_SYS_LARGEFILE in configure.ac is setting needed defines to make
+64bit off_t on relevant platforms.
+
+Fixes build on musl
+
+| ../../../../../../../../workspace/sources/libbsd/src/funopen.c:68:28: error: unknown type name 'off64_t'; did you mean 'off_t'?
+| funopen_seek(void *cookie, off64_t *offset, int whence)
+|                            ^~~~~~~
+|                            off_t
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/libbsd/libbsd/-/merge_requests/24]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/funopen.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/funopen.c b/src/funopen.c
+index 1e6f43a..a9b40e8 100644
+--- a/src/funopen.c
++++ b/src/funopen.c
+@@ -65,7 +65,7 @@ funopen_write(void *cookie, const char *buf, size_t size)
+ }
+ 
+ static int
+-funopen_seek(void *cookie, off64_t *offset, int whence)
++funopen_seek(void *cookie, off_t *offset, int whence)
+ {
+ 	struct funopen_cookie *cookiewrap = cookie;
+ 	off_t soff = *offset;
meta/recipes-support/libbsd/libbsd_0.11.7.bb +3 -1
index 7a1deed1f6..a9f7a00469 100644
@@ -32,7 +32,9 @@ LICENSE:${PN} = "BSD-3-Clause & ISC & PD"
 LIC_FILES_CHKSUM = "file://COPYING;md5=75e85c5a558f86d10fbd5abc567ea5e6"
 SECTION = "libs"
 
-SRC_URI = "https://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz"
+SRC_URI = "https://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
+           file://0001-funopen-Replace-off64_t-with-off_t-in-funopen_seek.patch \
+           "
 
 SRC_URI[sha256sum] = "9baa186059ebbf25c06308e9f991fda31f7183c0f24931826d83aa6abd8a0261"
 
Signature · 1 line
2.39.0
author
#1 lore raw

PATCH 2/9 gpgme: Fix with with largefile support

---
 ...ix-io.c-Use-off_t-instead-of-off64_t.patch | 42 +++++++++++++++++++
 meta/recipes-support/gpgme/gpgme_1.18.0.bb    |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-support/gpgme/gpgme/0001-posix-io.c-Use-off_t-instead-of-off64_t.patch
meta/recipes-support/gpgme/gpgme/0001-posix-io.c-Use-off_t-instead-of-off64_t.patch new file +42 -0
new file mode 100644
index 0000000000..be58c42128
@@ -0,0 +1,42 @@
+From be33cf1812b4c2a3ed85fb2532992bfb2b27b3be Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 08:44:13 -0800
+Subject: [PATCH] posix-io.c: Use off_t instead of off64_t
+
+configure.ac checks for largefile support via AC_SYS_LARGEFILE already,
+therefore use off_t and ino_t instead of 64bit variants. Musl e.g. does
+not define them without _LARGEFILE64_SOURCE and error is not seen on
+glibc because _GNU_SOURCE defines _LARGEFILE64_SOURCE
+
+Fixes errors like below on 32-bit musl systems
+
+../../../../../../../../workspace/sources/gpgme/src/posix-io.c:77:3: error: unknown type name 'ino64_t'; did you mean 'int64_t'?
+  ino64_t d_ino;
+  ^~~~~~~
+  int64_t
+                        ^
+../../../../../../../../workspace/sources/gpgme/src/posix-io.c:78:3: error: unknown type name 'off64_t'; did you mean 'off_t'?
+  off64_t d_off;
+  ^~~~~~~
+
+Upstream-Status: Submitted [https://lists.gnupg.org/pipermail/gnupg-devel/2022-December/035222.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/posix-io.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/posix-io.c b/src/posix-io.c
+index 0d0a98b..286a626 100644
+--- a/src/posix-io.c
++++ b/src/posix-io.c
+@@ -74,8 +74,8 @@
+  * define it ourselves.  */
+ struct linux_dirent64
+ {
+-  ino64_t d_ino;
+-  off64_t d_off;
++  ino_t d_ino;
++  off_t d_off;
+   unsigned short d_reclen;
+   unsigned char d_type;
+   char d_name[];
meta/recipes-support/gpgme/gpgme_1.18.0.bb +1 -0
index 40c41876fa..7ff4837d6f 100644
@@ -21,6 +21,7 @@ SRC_URI = "${GNUPG_MIRROR}/gpgme/${BP}.tar.bz2 \
            file://0007-python-Add-variables-to-tests.patch \
            file://0008-do-not-auto-check-var-PYTHON.patch \
            file://0001-use-closefrom-on-linux-and-glibc-2.34.patch \
+           file://0001-posix-io.c-Use-off_t-instead-of-off64_t.patch \
            "
 
 SRC_URI[sha256sum] = "361d4eae47ce925dba0ea569af40e7b52c645c4ae2e65e5621bf1b6cdd8b0e9e"
Signature · 1 line
2.39.0
author
#2 lore raw

PATCH 3/9 virglrenderer: Replace lseek64 with lseek

In reply to Khem Raj

Fix build with musl

---
 .../0001-Replace-lseek64-with-lseek.patch     | 45 +++++++++++++++++++
 .../virglrenderer/virglrenderer_0.10.3.bb     |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta/recipes-graphics/virglrenderer/virglrenderer/0001-Replace-lseek64-with-lseek.patch
meta/recipes-graphics/virglrenderer/virglrenderer/0001-Replace-lseek64-with-lseek.patch new file +45 -0
new file mode 100644
index 0000000000..a0278abd28
@@ -0,0 +1,45 @@
+From a60f0658001d2e8e15ad980731d4130808d37d56 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 12:58:57 -0800
+Subject: [PATCH] Replace lseek64 with lseek
+
+meson defined _FILE_OFFSET_BITS=64 unconditionally, this implies that
+lseek and lseek64 are both same since they are using 64bit off_t,
+replacing lseek64 with lseek also helps in compiling with latest musl C
+library which has removed these from _GNU_SOURCE namespace unlike glibc
+where _GNU_SOURCE also implies _LARGEFILE64_SOURCE and the definition of
+lseek64 is still available.
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1003]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/proxy/proxy_context.c | 2 +-
+ src/venus/vkr_context.c   | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/proxy/proxy_context.c b/src/proxy/proxy_context.c
+index f2a035b..f20f7c8 100644
+--- a/src/proxy/proxy_context.c
++++ b/src/proxy/proxy_context.c
+@@ -319,7 +319,7 @@ validate_resource_fd_shm(int fd, uint64_t expected_size)
+       return false;
+    }
+ 
+-   const uint64_t size = lseek64(fd, 0, SEEK_END);
++   const uint64_t size = lseek(fd, 0, SEEK_END);
+    if (size != expected_size) {
+       proxy_log("failed to validate shm size(%" PRIu64 ") expected(%" PRIu64 ")", size,
+                 expected_size);
+diff --git a/src/venus/vkr_context.c b/src/venus/vkr_context.c
+index 9ecb9cd..1e5dc68 100644
+--- a/src/venus/vkr_context.c
++++ b/src/venus/vkr_context.c
+@@ -359,7 +359,7 @@ vkr_context_get_blob_locked(struct virgl_context *base,
+          return ret;
+ 
+       if (fd_type == VIRGL_RESOURCE_FD_DMABUF &&
+-          (uint64_t)lseek64(fd, 0, SEEK_END) < blob_size) {
++          (uint64_t)lseek(fd, 0, SEEK_END) < blob_size) {
+          close(fd);
+          return -EINVAL;
+       }
meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb +1 -0
index 3480eb954d..5d483431a7 100644
@@ -12,6 +12,7 @@ DEPENDS = "libdrm libepoxy virtual/egl virtual/libgbm"
 SRCREV = "0922041ec6730122e0fec11404e6859e2efc4bc0"
 SRC_URI = "git://gitlab.freedesktop.org/virgl/virglrenderer.git;branch=master;protocol=https \
            file://0001-meson.build-use-python3-directly-for-python.patch \
+           file://0001-Replace-lseek64-with-lseek.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.39.0
author
#3 lore raw

PATCH 4/9 nfs-utils: Replace statfs64 with statfs

In reply to Khem Raj

Fixes LFS64 builds

---
 .../0001-Replace-statfs64-with-statfs.patch   | 171 ++++++++++++++++++
 .../nfs-utils/nfs-utils_2.6.2.bb              |   1 +
 2 files changed, 172 insertions(+)
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch new file +171 -0
new file mode 100644
index 0000000000..40ceff9ae9
@@ -0,0 +1,171 @@
+From e89652b853ca7de671093ae44305fa3435e13d3d Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 13:29:43 -0800
+Subject: [PATCH] Replace statfs64 with statfs
+
+autoconf AC_SYS_LARGEFILE is used by configure to add needed defines
+when needed for enabling 64bit off_t, therefore replacing statfs64 with
+statfs should be functionally same. Additionally this helps compiling
+with latest musl where 64bit LFS functions like statfs64 and friends are
+now moved under _LARGEFILE64_SOURCE feature test macro, this works on
+glibc systems because _GNU_SOURCE macros also enables
+_LARGEFILE64_SOURCE indirectly. This is not case with musl and this
+latest issue is exposed.
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-nfs/[email protected]/T/#u]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ support/export/cache.c      | 14 +++++++-------
+ support/include/nfsd_path.h |  6 +++---
+ support/misc/nfsd_path.c    | 24 ++++++++++++------------
+ utils/exportfs/exportfs.c   |  4 ++--
+ 4 files changed, 24 insertions(+), 24 deletions(-)
+
+diff --git a/support/export/cache.c b/support/export/cache.c
+index a5823e9..2497d4f 100644
+--- a/support/export/cache.c
++++ b/support/export/cache.c
+@@ -346,27 +346,27 @@ static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid)
+ 
+ 	/* Possible sources of uuid are
+ 	 * - blkid uuid
+-	 * - statfs64 uuid
++	 * - statfs uuid
+ 	 *
+-	 * On some filesystems (e.g. vfat) the statfs64 uuid is simply an
++	 * On some filesystems (e.g. vfat) the statfs uuid is simply an
+ 	 * encoding of the device that the filesystem is mounted from, so
+ 	 * it we be very bad to use that (as device numbers change).  blkid
+ 	 * must be preferred.
+-	 * On other filesystems (e.g. btrfs) the statfs64 uuid contains
++	 * On other filesystems (e.g. btrfs) the statfs uuid contains
+ 	 * important info that the blkid uuid cannot contain:  This happens
+ 	 * when multiple subvolumes are exported (they have the same
+-	 * blkid uuid but different statfs64 uuids).
++	 * blkid uuid but different statfs uuids).
+ 	 * We rely on get_uuid_blkdev *knowing* which is which and not returning
+-	 * a uuid for filesystems where the statfs64 uuid is better.
++	 * a uuid for filesystems where the statfs uuid is better.
+ 	 *
+ 	 */
+-	struct statfs64 st;
++	struct statfs st;
+ 	char fsid_val[17];
+ 	const char *blkid_val = NULL;
+ 	const char *val;
+ 	int rc;
+ 
+-	rc = nfsd_path_statfs64(path, &st);
++	rc = nfsd_path_statfs(path, &st);
+ 
+ 	if (type == 0 && rc == 0) {
+ 		const unsigned long *bad;
+diff --git a/support/include/nfsd_path.h b/support/include/nfsd_path.h
+index 3b73aad..aa1e1dd 100644
+--- a/support/include/nfsd_path.h
++++ b/support/include/nfsd_path.h
+@@ -7,7 +7,7 @@
+ #include <sys/stat.h>
+ 
+ struct file_handle;
+-struct statfs64;
++struct statfs;
+ 
+ void 		nfsd_path_init(void);
+ 
+@@ -18,8 +18,8 @@ char *		nfsd_path_prepend_dir(const char *dir, const char *pathname);
+ int 		nfsd_path_stat(const char *pathname, struct stat *statbuf);
+ int 		nfsd_path_lstat(const char *pathname, struct stat *statbuf);
+ 
+-int		nfsd_path_statfs64(const char *pathname,
+-				   struct statfs64 *statbuf);
++int		nfsd_path_statfs(const char *pathname,
++				   struct statfs *statbuf);
+ 
+ char *		nfsd_realpath(const char *path, char *resolved_path);
+ 
+diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c
+index 65e53c1..c3dea4f 100644
+--- a/support/misc/nfsd_path.c
++++ b/support/misc/nfsd_path.c
+@@ -184,46 +184,46 @@ nfsd_path_lstat(const char *pathname, struct stat *statbuf)
+ 	return nfsd_run_stat(nfsd_wq, nfsd_lstatfunc, pathname, statbuf);
+ }
+ 
+-struct nfsd_statfs64_data {
++struct nfsd_statfs_data {
+ 	const char *pathname;
+-	struct statfs64 *statbuf;
++	struct statfs *statbuf;
+ 	int ret;
+ 	int err;
+ };
+ 
+ static void
+-nfsd_statfs64func(void *data)
++nfsd_statfsfunc(void *data)
+ {
+-	struct nfsd_statfs64_data *d = data;
++	struct nfsd_statfs_data *d = data;
+ 
+-	d->ret = statfs64(d->pathname, d->statbuf);
++	d->ret = statfs(d->pathname, d->statbuf);
+ 	if (d->ret < 0)
+ 		d->err = errno;
+ }
+ 
+ static int
+-nfsd_run_statfs64(struct xthread_workqueue *wq,
++nfsd_run_statfs(struct xthread_workqueue *wq,
+ 		  const char *pathname,
+-		  struct statfs64 *statbuf)
++		  struct statfs *statbuf)
+ {
+-	struct nfsd_statfs64_data data = {
++	struct nfsd_statfs_data data = {
+ 		pathname,
+ 		statbuf,
+ 		0,
+ 		0
+ 	};
+-	xthread_work_run_sync(wq, nfsd_statfs64func, &data);
++	xthread_work_run_sync(wq, nfsd_statfsfunc, &data);
+ 	if (data.ret < 0)
+ 		errno = data.err;
+ 	return data.ret;
+ }
+ 
+ int
+-nfsd_path_statfs64(const char *pathname, struct statfs64 *statbuf)
++nfsd_path_statfs(const char *pathname, struct statfs *statbuf)
+ {
+ 	if (!nfsd_wq)
+-		return statfs64(pathname, statbuf);
+-	return nfsd_run_statfs64(nfsd_wq, pathname, statbuf);
++		return statfs(pathname, statbuf);
++	return nfsd_run_statfs(nfsd_wq, pathname, statbuf);
+ }
+ 
+ struct nfsd_realpath_data {
+diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
+index 0897b22..6d79a5b 100644
+--- a/utils/exportfs/exportfs.c
++++ b/utils/exportfs/exportfs.c
+@@ -513,7 +513,7 @@ validate_export(nfs_export *exp)
+ 	 */
+ 	struct stat stb;
+ 	char *path = exportent_realpath(&exp->m_export);
+-	struct statfs64 stf;
++	struct statfs stf;
+ 	int fs_has_fsid = 0;
+ 
+ 	if (stat(path, &stb) < 0) {
+@@ -528,7 +528,7 @@ validate_export(nfs_export *exp)
+ 	if (!can_test())
+ 		return;
+ 
+-	if (!statfs64(path, &stf) &&
++	if (!statfs(path, &stf) &&
+ 	    (stf.f_fsid.__val[0] || stf.f_fsid.__val[1]))
+ 		fs_has_fsid = 1;
+ 
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.2.bb +1 -0
index 4b5c28c27b..21df1803c5 100644
@@ -32,6 +32,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
            file://clang-warnings.patch \
            file://0005-mountd-Check-for-return-of-stat-function.patch \
            file://0006-Fix-function-prototypes.patch \
+           file://0001-Replace-statfs64-with-statfs.patch \
            "
 SRC_URI[sha256sum] = "5200873e81c4d610e2462fc262fe18135f2dbe78b7979f95accd159ae64d5011"
 
Signature · 1 line
2.39.0
author
#4 lore raw

PATCH 5/9 alsa-utils: Replace off64_t with off_t

In reply to Khem Raj
---
 ...lay-axfer-Replace-off64_t-with-off_t.patch | 272 ++++++++++++++++++
 .../alsa/alsa-utils_1.2.8.bb                  |   4 +-
 2 files changed, 275 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-multimedia/alsa/alsa-utils/0001-aplay-axfer-Replace-off64_t-with-off_t.patch
meta/recipes-multimedia/alsa/alsa-utils/0001-aplay-axfer-Replace-off64_t-with-off_t.patch new file +272 -0
new file mode 100644
index 0000000000..356c5964ae
@@ -0,0 +1,272 @@
+From 03553ccc6284a437576349b5a3c2ed0d7d4265e1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 14:04:10 -0800
+Subject: [PATCH] aplay,axfer: Replace off64_t with off_t
+
+Also replace lseek64 with lseek.
+
+_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses
+AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is
+same as lseek64.
+
+Additionally this fixes buils with latest musl where these lfs64
+functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE
+macro alone. This makes the builds fail on 32-bit platforms even though
+default off_t on musl is 64-bit always.
+
+Upstream-Status: Submitted [https://github.com/alsa-project/alsa-utils/pull/183]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ aplay/aplay.c               | 44 ++++++++++++++++++-------------------
+ axfer/container-voc.c       |  2 +-
+ axfer/container.c           |  6 ++---
+ axfer/container.h           |  2 +-
+ axfer/test/container-test.c |  4 ++--
+ axfer/test/mapper-test.c    |  2 +-
+ 6 files changed, 30 insertions(+), 30 deletions(-)
+
+diff --git a/aplay/aplay.c b/aplay/aplay.c
+index 6ce7191..bd93be3 100644
+--- a/aplay/aplay.c
++++ b/aplay/aplay.c
+@@ -141,7 +141,7 @@ static long term_c_lflag = -1;
+ static int dump_hw_params = 0;
+ 
+ static int fd = -1;
+-static off64_t pbrec_count = LLONG_MAX, fdcount;
++static off_t pbrec_count = LLONG_MAX, fdcount;
+ static int vocmajor, vocminor;
+ 
+ static char *pidfile_name = NULL;
+@@ -2356,7 +2356,7 @@ static void voc_play(int fd, int ofs, char *name)
+ 	u_char *data, *buf;
+ 	char was_extended = 0, output = 0;
+ 	u_short *sp, repeat = 0;
+-	off64_t filepos = 0;
++	off_t filepos = 0;
+ 
+ #define COUNT(x)	nextblock -= x; in_buffer -= x; data += x
+ #define COUNT1(x)	in_buffer -= x; data += x
+@@ -2490,7 +2490,7 @@ static void voc_play(int fd, int ofs, char *name)
+ 				d_printf("Repeat loop %d times\n", repeat);
+ #endif
+ 				if (filepos >= 0) {	/* if < 0, one seek fails, why test another */
+-					if ((filepos = lseek64(fd, 0, 1)) < 0) {
++					if ((filepos = lseek(fd, 0, 1)) < 0) {
+ 						error(_("can't play loops; %s isn't seekable\n"), name);
+ 						repeat = 0;
+ 					} else {
+@@ -2512,7 +2512,7 @@ static void voc_play(int fd, int ofs, char *name)
+ 					else
+ 						d_printf("Neverending loop\n");
+ #endif
+-					lseek64(fd, filepos, 0);
++					lseek(fd, filepos, 0);
+ 					in_buffer = 0;	/* clear the buffer */
+ 					goto Fill_the_buffer;
+ 				}
+@@ -2578,9 +2578,9 @@ static void init_raw_data(void)
+ }
+ 
+ /* calculate the data count to read from/to dsp */
+-static off64_t calc_count(void)
++static off_t calc_count(void)
+ {
+-	off64_t count;
++	off_t count;
+ 
+ 	if (timelimit == 0)
+ 		if (sampleslimit == 0)
+@@ -2589,7 +2589,7 @@ static off64_t calc_count(void)
+ 			count = snd_pcm_format_size(hwparams.format, sampleslimit * hwparams.channels);
+ 	else {
+ 		count = snd_pcm_format_size(hwparams.format, hwparams.rate * hwparams.channels);
+-		count *= (off64_t)timelimit;
++		count *= (off_t)timelimit;
+ 	}
+ 	return count < pbrec_count ? count : pbrec_count;
+ }
+@@ -2750,7 +2750,7 @@ static void begin_au(int fd, size_t cnt)
+ /* closing .VOC */
+ static void end_voc(int fd)
+ {
+-	off64_t length_seek;
++	off_t length_seek;
+ 	VocBlockType bt;
+ 	size_t cnt;
+ 	char dummy = 0;		/* Write a Terminator */
+@@ -2770,15 +2770,15 @@ static void end_voc(int fd)
+ 	bt.datalen = (u_char) (cnt & 0xFF);
+ 	bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8);
+ 	bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
+-	if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
++	if (lseek(fd, length_seek, SEEK_SET) == length_seek)
+ 		xwrite(fd, &bt, sizeof(VocBlockType));
+ }
+ 
+ static void end_wave(int fd)
+ {				/* only close output */
+ 	WaveChunkHeader cd;
+-	off64_t length_seek;
+-	off64_t filelen;
++	off_t length_seek;
++	off_t filelen;
+ 	u_int rifflen;
+ 	
+ 	length_seek = sizeof(WaveHeader) +
+@@ -2788,20 +2788,20 @@ static void end_wave(int fd)
+ 	cd.length = fdcount > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(fdcount);
+ 	filelen = fdcount + 2*sizeof(WaveChunkHeader) + sizeof(WaveFmtBody) + 4;
+ 	rifflen = filelen > 0x7fffffff ? LE_INT(0x7fffffff) : LE_INT(filelen);
+-	if (lseek64(fd, 4, SEEK_SET) == 4)
++	if (lseek(fd, 4, SEEK_SET) == 4)
+ 		xwrite(fd, &rifflen, 4);
+-	if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
++	if (lseek(fd, length_seek, SEEK_SET) == length_seek)
+ 		xwrite(fd, &cd, sizeof(WaveChunkHeader));
+ }
+ 
+ static void end_au(int fd)
+ {				/* only close output */
+ 	AuHeader ah;
+-	off64_t length_seek;
++	off_t length_seek;
+ 	
+ 	length_seek = (char *)&ah.data_size - (char *)&ah;
+ 	ah.data_size = fdcount > 0xffffffff ? 0xffffffff : BE_INT(fdcount);
+-	if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
++	if (lseek(fd, length_seek, SEEK_SET) == length_seek)
+ 		xwrite(fd, &ah.data_size, sizeof(ah.data_size));
+ }
+ 
+@@ -2828,11 +2828,11 @@ static void header(int rtype, char *name)
+ 
+ /* playing raw data */
+ 
+-static void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name)
++static void playback_go(int fd, size_t loaded, off_t count, int rtype, char *name)
+ {
+ 	int l, r;
+-	off64_t written = 0;
+-	off64_t c;
++	off_t written = 0;
++	off_t c;
+ 
+ 	header(rtype, name);
+ 	set_params();
+@@ -3202,7 +3202,7 @@ static void capture(char *orig_name)
+ 	int filecount=0;	/* number of files written */
+ 	char *name = orig_name;	/* current filename */
+ 	char namebuf[PATH_MAX+2];
+-	off64_t count, rest;		/* number of bytes to capture */
++	off_t count, rest;		/* number of bytes to capture */
+ 	struct stat statbuf;
+ 
+ 	/* get number of bytes to capture */
+@@ -3273,7 +3273,7 @@ static void capture(char *orig_name)
+ 		/* capture */
+ 		fdcount = 0;
+ 		while (rest > 0 && recycle_capture_file == 0 && !in_aborting) {
+-			size_t c = (rest <= (off64_t)chunk_bytes) ?
++			size_t c = (rest <= (off_t)chunk_bytes) ?
+ 				(size_t)rest : chunk_bytes;
+ 			size_t f = c * 8 / bits_per_frame;
+ 			size_t read = pcm_read(audiobuf, f);
+@@ -3314,7 +3314,7 @@ static void capture(char *orig_name)
+ 	} while ((file_type == FORMAT_RAW && !timelimit && !sampleslimit) || count > 0);
+ }
+ 
+-static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t count, int rtype, char **names)
++static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off_t count, int rtype, char **names)
+ {
+ 	int r;
+ 	size_t vsize;
+@@ -3368,7 +3368,7 @@ static void playbackv_go(int* fds, unsigned int channels, size_t loaded, off64_t
+ 	}
+ }
+ 
+-static void capturev_go(int* fds, unsigned int channels, off64_t count, int rtype, char **names)
++static void capturev_go(int* fds, unsigned int channels, off_t count, int rtype, char **names)
+ {
+ 	size_t c;
+ 	ssize_t r;
+diff --git a/axfer/container-voc.c b/axfer/container-voc.c
+index ec0cfff..5941003 100644
+--- a/axfer/container-voc.c
++++ b/axfer/container-voc.c
+@@ -775,7 +775,7 @@ static int write_block_terminator(struct container_context *cntr)
+ static int write_data_size(struct container_context *cntr, uint64_t byte_count)
+ {
+ 	struct builder_state *state = cntr->private_data;
+-	off64_t offset;
++	off_t offset;
+ 	uint8_t size_field[3];
+ 	int err;
+ 
+diff --git a/axfer/container.c b/axfer/container.c
+index 8c88d5c..379b72f 100644
+--- a/axfer/container.c
++++ b/axfer/container.c
+@@ -113,11 +113,11 @@ enum container_format container_format_from_path(const char *path)
+ 	return CONTAINER_FORMAT_RAW;
+ }
+ 
+-int container_seek_offset(struct container_context *cntr, off64_t offset)
++int container_seek_offset(struct container_context *cntr, off_t offset)
+ {
+-	off64_t pos;
++	off_t pos;
+ 
+-	pos = lseek64(cntr->fd, offset, SEEK_SET);
++	pos = lseek(cntr->fd, offset, SEEK_SET);
+ 	if (pos < 0)
+ 		return -errno;
+ 	if (pos != offset)
+diff --git a/axfer/container.h b/axfer/container.h
+index 71017a6..f6ce689 100644
+--- a/axfer/container.h
++++ b/axfer/container.h
+@@ -107,7 +107,7 @@ int container_recursive_read(struct container_context *cntr, void *buf,
+ 			     unsigned int byte_count);
+ int container_recursive_write(struct container_context *cntr, void *buf,
+ 			      unsigned int byte_count);
+-int container_seek_offset(struct container_context *cntr, off64_t offset);
++int container_seek_offset(struct container_context *cntr, off_t offset);
+ 
+ extern const struct container_parser container_parser_riff_wave;
+ extern const struct container_builder container_builder_riff_wave;
+diff --git a/axfer/test/container-test.c b/axfer/test/container-test.c
+index e5b62dd..45b6c6a 100644
+--- a/axfer/test/container-test.c
++++ b/axfer/test/container-test.c
+@@ -153,7 +153,7 @@ static int callback(struct test_generator *gen, snd_pcm_access_t access,
+ 
+ 	for (i = 0; i < ARRAY_SIZE(entries); ++i) {
+ 		int fd;
+-		off64_t pos;
++		off_t pos;
+ 
+ 		frames_per_second = entries[i];
+ 
+@@ -172,7 +172,7 @@ static int callback(struct test_generator *gen, snd_pcm_access_t access,
+ 			     frames_per_second, frame_buffer, frame_count,
+ 			     trial->verbose);
+ 
+-		pos = lseek64(fd, 0, SEEK_SET);
++		pos = lseek(fd, 0, SEEK_SET);
+ 		if (pos < 0) {
+ 			err = -errno;
+ 			break;
+diff --git a/axfer/test/mapper-test.c b/axfer/test/mapper-test.c
+index 477871d..6a389e9 100644
+--- a/axfer/test/mapper-test.c
++++ b/axfer/test/mapper-test.c
+@@ -257,7 +257,7 @@ static int test_mapper(struct mapper_trial *trial, snd_pcm_access_t access,
+ 		goto end;
+ 
+ 	for (i = 0; i < cntr_count; ++i) {
+-		off64_t pos = lseek64(cntr_fds[i], 0, SEEK_SET);
++		off_t pos = lseek(cntr_fds[i], 0, SEEK_SET);
+ 		if (pos != 0) {
+ 			err = -EIO;
+ 			goto end;
meta/recipes-multimedia/alsa/alsa-utils_1.2.8.bb +3 -1
index b355deacc8..46d39b0de8 100644
@@ -24,7 +24,9 @@ PACKAGECONFIG[udev] = "--with-udev-rules-dir=`pkg-config --variable=udevdir udev
 PACKAGECONFIG[manpages] = "--enable-xmlto, --disable-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
 
 # alsa-utils specified in SRC_URI due to alsa-utils-scripts recipe
-SRC_URI = "https://www.alsa-project.org/files/pub/utils/alsa-utils-${PV}.tar.bz2"
+SRC_URI = "https://www.alsa-project.org/files/pub/utils/alsa-utils-${PV}.tar.bz2 \
+           file://0001-aplay-axfer-Replace-off64_t-with-off_t.patch \
+           "
 SRC_URI[sha256sum] = "e140fa604c351f36bd72167c8860c69d81b964ae6ab53992d6434dde38e9333c"
 
 # On build machines with python-docutils (not python3-docutils !!) installed
Signature · 1 line
2.39.0
author
#5 lore raw

PATCH 6/9 lttng-tools: Fix build with largefile support

In reply to Khem Raj
---
 ...pat-Define-off64_t-as-off_t-on-linux.patch | 35 +++++++++++++++++++
 .../lttng/lttng-tools_2.13.8.bb               |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch
meta/recipes-kernel/lttng/lttng-tools/0001-compat-Define-off64_t-as-off_t-on-linux.patch new file +35 -0
new file mode 100644
index 0000000000..e3d421f730
@@ -0,0 +1,35 @@
+From cc3e1abaa1e7ad85c6a299fe30a36e0cb732e1c8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 14:51:20 -0800
+Subject: [PATCH] compat: Define off64_t as off_t on linux
+
+This helps compile with latest musl, where off64_t is not defined
+unless _LARGEFILE64_SOURCE is defined, on glibc _LARGEFILE64_SOURCE is
+defined if _GNU_SOURCE is defined, so the problem is only seen with musl
+
+Upstream-Status: Submitted [https://github.com/lttng/lttng-tools/pull/164]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/common/compat/fcntl.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/common/compat/fcntl.h b/src/common/compat/fcntl.h
+index 5e566e50..d19a6ece 100644
+--- a/src/common/compat/fcntl.h
++++ b/src/common/compat/fcntl.h
+@@ -7,7 +7,6 @@
+ 
+ #ifndef _COMPAT_FCNTL_H
+ #define _COMPAT_FCNTL_H
+-
+ #include <fcntl.h>
+ #include <sys/types.h>
+ 
+@@ -22,6 +21,7 @@ typedef off64_t loff_t;
+ #endif
+ 
+ #ifdef __linux__
++typedef off_t off64_t;
+ extern int compat_sync_file_range(int fd, off64_t offset, off64_t nbytes,
+ 		unsigned int flags);
+ #define lttng_sync_file_range(fd, offset, nbytes, flags) \
meta/recipes-kernel/lttng/lttng-tools_2.13.8.bb +1 -0
index a814eb79f9..e64eeba635 100644
@@ -37,6 +37,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
            file://lttng-sessiond.service \
            file://determinism.patch \
            file://disable-tests.patch \
+           file://0001-compat-Define-off64_t-as-off_t-on-linux.patch \
            "
 
 SRC_URI[sha256sum] = "b1e959579b260790930b20f3c7aa7cefb8a40e0de80d4a777c2bf78c6b353dc1"
Signature · 1 line
2.39.0
author
#6 lore raw

PATCH 7/9 strace: Add knob to enable largefile support

In reply to Khem Raj
---
 ...toconf-macro-to-detect-largefile-sup.patch | 27 ++++++++++++
 ...002-tests-Replace-off64_t-with-off_t.patch | 43 +++++++++++++++++++
 meta/recipes-devtools/strace/strace_6.0.bb    |  2 +
 3 files changed, 72 insertions(+)
 create mode 100644 meta/recipes-devtools/strace/strace/0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch
 create mode 100644 meta/recipes-devtools/strace/strace/0002-tests-Replace-off64_t-with-off_t.patch
meta/recipes-devtools/strace/strace/0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch new file +27 -0
new file mode 100644
index 0000000000..76ca7a76a8
@@ -0,0 +1,27 @@
+From 470399f3636c412b74f9daf6ae430b13c3126f02 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 15:54:27 -0800
+Subject: [PATCH] configure: Use autoconf macro to detect largefile support
+
+Adds --enable-largefile/--disable-largefile configure knobs
+where default is to detect the support
+
+Upstream-Status: Submitted [https://github.com/strace/strace/pull/230]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 4797b42dd..7d57fb254 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -43,6 +43,8 @@ AC_PROG_INSTALL
+ AC_PROG_RANLIB
+ AC_PROG_LN_S
+ 
++AC_SYS_LARGEFILE
++
+ AC_USE_SYSTEM_EXTENSIONS
+ AX_CODE_COVERAGE
+ 
meta/recipes-devtools/strace/strace/0002-tests-Replace-off64_t-with-off_t.patch new file +43 -0

43 lines not on this page · raw message

meta/recipes-devtools/strace/strace_6.0.bb +2 -0
index 4fa3589d15..7679235b01 100644
@@ -13,6 +13,8 @@ SRC_URI = "https://strace.io/files/${PV}/strace-${PV}.tar.xz \
            file://ptest-spacesave.patch \
            file://0001-strace-fix-reproducibilty-issues.patch \
            file://skip-load.patch \
+           file://0001-configure-Use-autoconf-macro-to-detect-largefile-sup.patch \
+           file://0002-tests-Replace-off64_t-with-off_t.patch \
            "
 SRC_URI[sha256sum] = "92d720a666855e9f1c6a11512fd6e99674a82bbfe1442557815f2ce8e1293338"
 
Signature · 1 line
2.39.0
author
#7 lore raw

PATCH 8/9 numactl: Enable largefile support

In reply to Khem Raj
---
 ...onfigure-Check-for-largefile-support.patch | 27 ++++++++
 ...at64-fstat64-ftruncate64mmap64-with-.patch | 64 +++++++++++++++++++
 meta/recipes-support/numactl/numactl_git.bb   |  2 +
 3 files changed, 93 insertions(+)
 create mode 100644 meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch
 create mode 100644 meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch
meta/recipes-support/numactl/numactl/0001-configure-Check-for-largefile-support.patch new file +27 -0
new file mode 100644
index 0000000000..152eb2807b
@@ -0,0 +1,27 @@
+From 61f910f5d12d6f6a66223b5af6d74e30ace3a2e1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 15 Dec 2022 12:10:37 -0800
+Subject: [PATCH] configure: Check for largefile support
+
+This helps in using 64bit versions of off_t related functions
+
+Upstream-Status: Backport [https://github.com/numactl/numactl/pull/159]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 8510fc5..d74bc6e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -14,6 +14,9 @@ LT_INIT
+ 
+ AC_PROG_CC
+ 
++# Check for enabling LFS support
++AC_SYS_LARGEFILE
++
+ # Override CFLAGS so that we can specify custom CFLAGS for numademo.
+ AX_AM_OVERRIDE_VAR([CFLAGS])
+ 
meta/recipes-support/numactl/numactl/0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch new file +64 -0

64 lines not on this page · raw message

meta/recipes-support/numactl/numactl_git.bb +2 -0
index 23be0a3b4f..0f71258bc3 100644
@@ -18,6 +18,8 @@ SRC_URI = "git://github.com/numactl/numactl;branch=master;protocol=https \
            file://Makefile \
            file://run-ptest \
            file://0001-define-run-test-target.patch \
+           file://0001-configure-Check-for-largefile-support.patch \
+           file://0002-shm.c-Replace-stat64-fstat64-ftruncate64mmap64-with-.patch \
            "
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.39.0
author
#8 lore raw

PATCH 9/9 qemu: Fix build with largefile support

In reply to Khem Raj

drop using lfs64 specific functions and macros

---
 meta/recipes-devtools/qemu/qemu.inc           |   2 +
 ...-user-blk-Replace-lseek64-with-lseek.patch |  37 ++
 ...ce-use-of-lfs64-related-functions-an.patch | 358 ++++++++++++++++++
 3 files changed, 397 insertions(+)
 create mode 100644 meta/recipes-devtools/qemu/qemu/0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch
 create mode 100644 meta/recipes-devtools/qemu/qemu/0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch
meta/recipes-devtools/qemu/qemu.inc +2 -0
index 0b24540bf9..27e3a8e259 100644
@@ -28,6 +28,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \
            file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \
            file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \
+           file://0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch \
+           file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \
            file://arm-cpreg-fix.patch \
            file://CVE-2022-3165.patch \
            "
meta/recipes-devtools/qemu/qemu/0001-contrib-vhost-user-blk-Replace-lseek64-with-lseek.patch new file +37 -0
new file mode 100644
index 0000000000..1838c88f0e
@@ -0,0 +1,37 @@
+From 38f5c88bf296dbbc04dcd57f36d64695055a2d3f Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 16 Dec 2022 20:19:49 -0800
+Subject: [PATCH 1/2] contrib/vhost-user-blk: Replace lseek64 with lseek
+
+64bit off_t is already in use since build uses _FILE_OFFSET_BITS=64
+already. Using lseek/off_t also makes it work with latest must without
+using _LARGEFILE64_SOURCE macro. This macro is implied with _GNU_SOURCE
+when using glibc but not with musl.
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2022-12/msg02840.html]
+Signed-off-by: Khem Raj <[email protected]>
+Cc: Michael S. Tsirkin <[email protected]>
+CC: Raphael Norwitz <[email protected]>
+---
+ contrib/vhost-user-blk/vhost-user-blk.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
+index aa99877fcd..7941694e53 100644
+--- a/contrib/vhost-user-blk/vhost-user-blk.c
++++ b/contrib/vhost-user-blk/vhost-user-blk.c
+@@ -532,9 +532,9 @@ vub_get_blocksize(int fd)
+ static void
+ vub_initialize_config(int fd, struct virtio_blk_config *config)
+ {
+-    off64_t capacity;
++    off_t capacity;
+ 
+-    capacity = lseek64(fd, 0, SEEK_END);
++    capacity = lseek(fd, 0, SEEK_END);
+     config->capacity = capacity >> 9;
+     config->blk_size = vub_get_blocksize(fd);
+     config->size_max = 65536;
+-- 
+2.39.0
+
meta/recipes-devtools/qemu/qemu/0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch new file +358 -0

358 lines not on this page · raw message

Signature · 1 line
2.39.0