diff mbox

[3/6] libdrm: fix the Android 64bit build

Message ID 1422557230-22155-4-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov Jan. 29, 2015, 6:47 p.m. UTC
With 64bit bionic mmap now handles 64bit offset, thus we no longer
need the __mmap2 trick.

Fix from Chih-Wei Huang, over at the google forums.

Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 libdrm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stéphane Marchesin Jan. 29, 2015, 7 p.m. UTC | #1
On Thu, Jan 29, 2015 at 10:47 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> With 64bit bionic mmap now handles 64bit offset, thus we no longer
> need the __mmap2 trick.
>
> Fix from Chih-Wei Huang, over at the google forums.
>
> Cc: Chih-Wei Huang <cwhuang@android-x86.org>
> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
> ---
>  libdrm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libdrm.h b/libdrm.h
> index acfada5..6c3cd59 100644
> --- a/libdrm.h
> +++ b/libdrm.h
> @@ -45,7 +45,7 @@
>
>  #include <sys/mman.h>
>
> -#if defined(ANDROID)
> +#if defined(ANDROID) && !defined(__LP64__)
>  #include <errno.h> /* for EINVAL */
>
>  extern void *__mmap2(void *, size_t, int, int, int, size_t);

It seems like you're be better off just using mmap64 instead of __mpap2?

Stéphane
Emil Velikov Jan. 29, 2015, 7:22 p.m. UTC | #2
On 29/01/15 19:00, Stéphane Marchesin wrote:
> On Thu, Jan 29, 2015 at 10:47 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> With 64bit bionic mmap now handles 64bit offset, thus we no longer
>> need the __mmap2 trick.
>>
>> Fix from Chih-Wei Huang, over at the google forums.
>>
>> Cc: Chih-Wei Huang <cwhuang@android-x86.org>
>> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
>> ---
>>  libdrm.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libdrm.h b/libdrm.h
>> index acfada5..6c3cd59 100644
>> --- a/libdrm.h
>> +++ b/libdrm.h
>> @@ -45,7 +45,7 @@
>>
>>  #include <sys/mman.h>
>>
>> -#if defined(ANDROID)
>> +#if defined(ANDROID) && !defined(__LP64__)
>>  #include <errno.h> /* for EINVAL */
>>
>>  extern void *__mmap2(void *, size_t, int, int, int, size_t);
> 
> It seems like you're be better off just using mmap64 instead of __mpap2?
> 
I was thinking about that but decided against it due to:

 - For 64bit platforms - mmap64 maps directly to mmap [1].

 - For other platforms (kitkat at least) mmap64 does a costly (according
to the man page) syscall (don't recall the name).

 - Some systems may be lacking mmap64.

Quite a noobie on the topic so I might be completely wrong :)

Thanks
Emil

[1]
https://android.googlesource.com/platform/bionic.git/+/38fcbbb35a40c46e96b4df10d670d1c132910854%5E2%5E!/
diff mbox

Patch

diff --git a/libdrm.h b/libdrm.h
index acfada5..6c3cd59 100644
--- a/libdrm.h
+++ b/libdrm.h
@@ -45,7 +45,7 @@ 
 
 #include <sys/mman.h>
 
-#if defined(ANDROID)
+#if defined(ANDROID) && !defined(__LP64__)
 #include <errno.h> /* for EINVAL */
 
 extern void *__mmap2(void *, size_t, int, int, int, size_t);