Mesa (main): drm-shim: Add a function for mmap64 rather than using an alias

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 10:32:44 UTC 2022


Module: Mesa
Branch: main
Commit: dfd30035b9003cecda1c9f739aef9b083c09180c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dfd30035b9003cecda1c9f739aef9b083c09180c

Author: Icecream95 <ixn at disroot.org>
Date:   Sun Aug  1 23:11:41 2021 +1200

drm-shim: Add a function for mmap64 rather than using an alias

Fixes build on 32-bit systems.

Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12203>

---

 src/drm-shim/drm_shim.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/drm-shim/drm_shim.c b/src/drm-shim/drm_shim.c
index 9566d42eeb3..2ba164c1017 100644
--- a/src/drm-shim/drm_shim.c
+++ b/src/drm-shim/drm_shim.c
@@ -70,6 +70,7 @@ REAL_FUNCTION_POINTER(fcntl);
 REAL_FUNCTION_POINTER(fopen);
 REAL_FUNCTION_POINTER(ioctl);
 REAL_FUNCTION_POINTER(mmap);
+REAL_FUNCTION_POINTER(mmap64);
 REAL_FUNCTION_POINTER(open);
 REAL_FUNCTION_POINTER(opendir);
 REAL_FUNCTION_POINTER(readdir);
@@ -209,6 +210,7 @@ init_shim(void)
    GET_FUNCTION_POINTER(fopen);
    GET_FUNCTION_POINTER(ioctl);
    GET_FUNCTION_POINTER(mmap);
+   GET_FUNCTION_POINTER(mmap64);
    GET_FUNCTION_POINTER(open);
    GET_FUNCTION_POINTER(opendir);
    GET_FUNCTION_POINTER(readdir);
@@ -705,5 +707,15 @@ mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
 
    return real_mmap(addr, length, prot, flags, fd, offset);
 }
-PUBLIC void *mmap64(void*, size_t, int, int, int, off_t)
-   __attribute__((alias("mmap")));
+
+PUBLIC void *
+mmap64(void* addr, size_t length, int prot, int flags, int fd, off64_t offset)
+{
+   init_shim();
+
+   struct shim_fd *shim_fd = drm_shim_fd_lookup(fd);
+   if (shim_fd)
+      return drm_shim_mmap(shim_fd, length, prot, flags, fd, offset);
+
+   return real_mmap64(addr, length, prot, flags, fd, offset);
+}



More information about the mesa-commit mailing list