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

Fixes build on 32-bit systems.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12203>
This commit is contained in:
Icecream95 2021-08-01 23:11:41 +12:00 committed by Marge Bot
parent 9b23aaf3cf
commit dfd30035b9
1 changed files with 14 additions and 2 deletions

View File

@ -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);
}