blob: baaaa4b53baaedf2778daffacae257b7788819a5 [file] [log] [blame]
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(-)
--- a/src/malloc_hook_mmap_linux.h
+++ b/src/malloc_hook_mmap_linux.h
@@ -45,6 +45,10 @@
#include <sys/syscall.h>
#include <unistd.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, siz
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 {