blob: baaaa4b53baaedf2778daffacae257b7788819a5 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 696674a800cb6d2070897a565b92d7e63022a8f1 Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Jul 2017 15:51:28 -0700
4Subject: [PATCH] fix build with musl libc
5
6Patch from https://github.com/gperftools/gperftools/pull/765/
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
Andrew Geissler82c905d2020-04-13 13:39:40 -050010 src/malloc_hook_mmap_linux.h | 6 +++++-
11 1 file changed, 5 insertions(+), 1 deletion(-)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050012
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013--- a/src/malloc_hook_mmap_linux.h
14+++ b/src/malloc_hook_mmap_linux.h
Andrew Geissler32b11992021-03-31 13:37:05 -050015@@ -45,6 +45,10 @@
16 #include <sys/syscall.h>
17 #include <unistd.h>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050018
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 Geissler32b11992021-03-31 13:37:05 -050026@@ -175,7 +179,7 @@ extern "C" void* mmap64(void *start, siz
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 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 {