[Mesa-dev] [PATCH shader-db 1/2] intel_stub: Wrap mmap64.

Ian Romanick idr at freedesktop.org
Mon Jun 4 23:30:07 UTC 2018


This fixes the problem I encountered.  Thanks!

Series is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 06/04/2018 04:26 PM, Kenneth Graunke wrote:
> Otherwise our fake GEM bo mappings don't work.
> ---
>  intel_stub.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/intel_stub.c b/intel_stub.c
> index ab046e5..a3316b1 100644
> --- a/intel_stub.c
> +++ b/intel_stub.c
> @@ -39,6 +39,8 @@
>  
>  static void *(*libc_mmap)(void *addr, size_t len, int prot, int flags,
>                            int fildes, off_t off);
> +static void *(*libc_mmap64)(void *addr, size_t len, int prot, int flags,
> +                            int fildes, off_t off);
>  static int (*libc_open)(const char *pathname, int flags, mode_t mode);
>  static int (*libc_open64)(const char *pathname, int flags, mode_t mode);
>  static int (*libc_close)(int fd);
> @@ -208,6 +210,19 @@ mmap(void *addr, size_t len, int prot, int flags,
>          }
>  }
>  
> +__attribute__ ((visibility ("default"))) void *
> +mmap64(void *addr, size_t len, int prot, int flags,
> +       int fildes, off_t off)
> +{
> +        if (fildes == drm_fd) {
> +                return libc_mmap64(NULL, len, prot, flags | MAP_ANONYMOUS,
> +                                   -1, 0);
> +        } else {
> +                return libc_mmap64(addr, len, prot, flags, fildes, off);
> +        }
> +}
> +
> +
>  __attribute__ ((visibility ("default"))) ssize_t
>  readlink(const char *pathname, char *buf, size_t bufsiz)
>  {
> @@ -305,5 +320,6 @@ init(void)
>  	libc__fxstat64 = dlsym(RTLD_NEXT, "__fxstat64");
>  	libc_ioctl = dlsym(RTLD_NEXT, "ioctl");
>  	libc_mmap = dlsym(RTLD_NEXT, "mmap");
> +	libc_mmap64 = dlsym(RTLD_NEXT, "mmap64");
>  	libc_readlink = dlsym(RTLD_NEXT, "readlink");
>  }
> 



More information about the mesa-dev mailing list