Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 696674a800cb6d2070897a565b92d7e63022a8f1 Mon Sep 17 00:00:00 2001 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 16 Jul 2017 15:51:28 -0700 |
| 4 | Subject: [PATCH] fix build with musl libc |
| 5 | |
| 6 | Patch from https://github.com/gperftools/gperftools/pull/765/ |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | --- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 10 | src/malloc_hook_mmap_linux.h | 6 +++++- |
| 11 | 1 file changed, 5 insertions(+), 1 deletion(-) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 12 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | --- a/src/malloc_hook_mmap_linux.h |
| 14 | +++ b/src/malloc_hook_mmap_linux.h |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 15 | @@ -45,6 +45,10 @@ |
| 16 | #include <sys/syscall.h> |
| 17 | #include <unistd.h> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | |
| 19 | +#ifndef __GLIBC__ |
| 20 | +typedef off64_t __off64_t; |
| 21 | +#endif |
| 22 | + |
| 23 | // The x86-32 case and the x86-64 case differ: |
| 24 | // 32b has a mmap2() syscall, 64b does not. |
| 25 | // 64b and 32b have different calling conventions for mmap(). |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 26 | @@ -175,7 +179,7 @@ extern "C" void* mmap64(void *start, siz |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 27 | return result; |
| 28 | } |
| 29 | |
| 30 | -# if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) |
| 31 | +# if defined(__GLIBC__) && (!defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH)) |
| 32 | |
| 33 | extern "C" void* mmap(void *start, size_t length, int prot, int flags, |
| 34 | int fd, off_t offset) __THROW { |