Skip to content

Instantly share code, notes, and snippets.

@ncopa
Created January 22, 2016 12:19
Show Gist options
  • Save ncopa/520055e642043684da2d to your computer and use it in GitHub Desktop.
Save ncopa/520055e642043684da2d to your computer and use it in GitHub Desktop.
diff --git a/src/third_party/gperftools-2.2/src/base/linux_syscall_support.h b/src/third_party/gperftools-2.2/src/base/linux_syscall_support.h
index 9b6c35d..2f7503f 100644
--- a/src/third_party/gperftools-2.2/src/base/linux_syscall_support.h
+++ b/src/third_party/gperftools-2.2/src/base/linux_syscall_support.h
@@ -2165,9 +2165,9 @@ struct kernel_stat {
int, t, int, p)
#endif
#if defined(__x86_64__)
- /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */
+ /* Need to make sure off64_t isn't truncated to 32-bits under x32. */
LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
- __off64_t o) {
+ off64_t o) {
LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l),
LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f),
LSS_SYSCALL_ARG(d), (uint64_t)(o));
@@ -2204,7 +2204,7 @@ struct kernel_stat {
LSS_INLINE _syscall6(void*, mmap, void*, s,
size_t, l, int, p,
int, f, int, d,
- __off64_t, o)
+ off64_t, o)
LSS_INLINE int LSS_NAME(sigaction)(int signum,
const struct kernel_sigaction *act,
struct kernel_sigaction *oldact) {
diff --git a/src/third_party/gperftools-2.2/src/config-10gen-linux.h b/src/third_party/gperftools-2.2/src/config-10gen-linux.h
index 6c3f28b..faa9f51 100644
--- a/src/third_party/gperftools-2.2/src/config-10gen-linux.h
+++ b/src/third_party/gperftools-2.2/src/config-10gen-linux.h
@@ -143,7 +143,9 @@
#define HAVE_STRING_H 1
/* Define to 1 if the system has the type `struct mallinfo'. */
+#if defined(HAVE_MALLINFO)
#define HAVE_STRUCT_MALLINFO 1
+#endif
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#define HAVE_SYS_CDEFS_H 1
@@ -197,7 +199,7 @@
#define HAVE___ATTRIBUTE__ 1
/* Define to 1 if compiler supports __environ */
-#define HAVE___ENVIRON 1
+/* undef HAVE___ENVIRON */
/* Define to 1 if the system has the type `__int64'. */
/* #undef HAVE___INT64 */
diff --git a/src/third_party/gperftools-2.2/src/malloc_hook_mmap_linux.h b/src/third_party/gperftools-2.2/src/malloc_hook_mmap_linux.h
index 8e5a3b0..140b1eb 100755
--- a/src/third_party/gperftools-2.2/src/malloc_hook_mmap_linux.h
+++ b/src/third_party/gperftools-2.2/src/malloc_hook_mmap_linux.h
@@ -56,7 +56,7 @@
static inline void* do_mmap64(void *start, size_t length,
int prot, int flags,
- int fd, __off64_t offset) __THROW {
+ int fd, off64_t offset) __THROW {
return sys_mmap(start, length, prot, flags, fd, offset);
}
@@ -67,7 +67,7 @@ static inline void* do_mmap64(void *start, size_t length,
static inline void* do_mmap64(void *start, size_t length,
int prot, int flags,
- int fd, __off64_t offset) __THROW {
+ int fd, off64_t offset) __THROW {
void *result;
// Try mmap2() unless it's not supported
@@ -137,9 +137,11 @@ static inline void* do_mmap64(void *start, size_t length,
# undef mmap
extern "C" {
+#ifndef mmap64
void* mmap64(void *start, size_t length, int prot, int flags,
- int fd, __off64_t offset ) __THROW
+ int fd, off64_t offset ) __THROW
ATTRIBUTE_SECTION(malloc_hook);
+#endif
void* mmap(void *start, size_t length,int prot, int flags,
int fd, off_t offset) __THROW
ATTRIBUTE_SECTION(malloc_hook);
@@ -152,8 +154,9 @@ extern "C" {
ATTRIBUTE_SECTION(malloc_hook);
}
+#ifndef mmap64
extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
- int fd, __off64_t offset) __THROW {
+ int fd, off64_t offset) __THROW {
MallocHook::InvokePreMmapHook(start, length, prot, flags, fd, offset);
void *result;
if (!MallocHook::InvokeMmapReplacement(
@@ -163,6 +166,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
MallocHook::InvokeMmapHook(result, start, length, prot, flags, fd, offset);
return result;
}
+#endif
# if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH)
@@ -202,7 +206,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size,
return result;
}
-#ifndef __UCLIBC__
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
// libc's version:
extern "C" void* __sbrk(ptrdiff_t increment);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment