From 696674a800cb6d2070897a565b92d7e63022a8f1 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 16 Jul 2017 15:51:28 -0700
Subject: [PATCH] fix build with musl libc

Patch from https://github.com/gperftools/gperftools/pull/765/

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/malloc_hook_mmap_linux.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h
index e2efb05..66b3110 100644
--- a/src/malloc_hook_mmap_linux.h
+++ b/src/malloc_hook_mmap_linux.h
@@ -46,6 +46,10 @@
 #include <errno.h>
 #include "base/linux_syscall_support.h"
 
+#ifndef __GLIBC__
+typedef off64_t   __off64_t;
+#endif
+
 // The x86-32 case and the x86-64 case differ:
 // 32b has a mmap2() syscall, 64b does not.
 // 64b and 32b have different calling conventions for mmap().
@@ -175,7 +179,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
   return result;
 }
 
-# if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH)
+# if defined(__GLIBC__) && (!defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH))
 
 extern "C" void* mmap(void *start, size_t length, int prot, int flags,
                       int fd, off_t offset) __THROW {
-- 
2.17.1

