diff mbox series

[3/9] virglrenderer: Replace lseek64 with lseek

Message ID 20221221175551.1940464-3-raj.khem@gmail.com
State Accepted, archived
Commit 677e979255ea84933a9e91d993171b207ff3deb6
Headers show
Series [1/9] libbsd: Fix build with largefile support | expand

Commit Message

Khem Raj Dec. 21, 2022, 5:55 p.m. UTC
Fix build with musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../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
diff mbox series

Patch

diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer/0001-Replace-lseek64-with-lseek.patch b/meta/recipes-graphics/virglrenderer/virglrenderer/0001-Replace-lseek64-with-lseek.patch
new file mode 100644
index 0000000000..a0278abd28
--- /dev/null
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer/0001-Replace-lseek64-with-lseek.patch
@@ -0,0 +1,45 @@ 
+From a60f0658001d2e8e15ad980731d4130808d37d56 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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;
+       }
diff --git a/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb b/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb
index 3480eb954d..5d483431a7 100644
--- a/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb
+++ b/meta/recipes-graphics/virglrenderer/virglrenderer_0.10.3.bb
@@ -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"