Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: third_party/tcmalloc/vendor/src/malloc_hook_mmap_linux.h

Issue 9316021: Update the tcmalloc vendor branch to r144 (gperftools 2.0). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reuploading Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/vendor/src/malloc_hook_mmap_linux.h
diff --git a/third_party/tcmalloc/vendor/src/malloc_hook_mmap_linux.h b/third_party/tcmalloc/vendor/src/malloc_hook_mmap_linux.h
index 0026589b2dccf02858c11666b166495060149b26..dc79f8bb11e8cc3845b6bbce470e4124b462127e 100644
--- a/third_party/tcmalloc/vendor/src/malloc_hook_mmap_linux.h
+++ b/third_party/tcmalloc/vendor/src/malloc_hook_mmap_linux.h
@@ -48,7 +48,21 @@
// 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().
-#if defined(__i386__) || defined(__PPC__)
+
+// I test for 64-bit first so I don't have to do things like
+// '#if (defined(__mips__) && !defined(__MIPS64__))' as a mips32 check.
+#if defined(__x86_64__) || defined(__PPC64__) || (defined(_MIPS_SIM) && _MIPS_SIM == _ABI64)
+
+static inline void* do_mmap64(void *start, size_t length,
+ int prot, int flags,
+ int fd, __off64_t offset) __THROW {
+ return sys_mmap(start, length, prot, flags, fd, offset);
+}
+
+#define MALLOC_HOOK_HAVE_DO_MMAP64 1
+
+#elif defined(__i386__) || defined(__PPC__) || defined(__mips__) || \
+ defined(__arm__)
static inline void* do_mmap64(void *start, size_t length,
int prot, int flags,
@@ -85,29 +99,26 @@ static inline void* do_mmap64(void *start, size_t length,
goto out;
}
+#ifdef __NR_mmap
{
// Fall back to old 32-bit offset mmap() call
// Old syscall interface cannot handle six args, so pass in an array
- int32 args[6] = { (int32) start, length, prot, flags, fd, (off_t) offset };
+ int32 args[6] = { (int32) start, (int32) length, prot, flags, fd,
+ (off_t) offset };
result = (void *)syscall(SYS_mmap, args);
}
+#else
+ // Some Linux ports like ARM EABI Linux has no mmap, just mmap2.
+ result = MAP_FAILED;
+#endif
+
out:
return result;
}
#define MALLOC_HOOK_HAVE_DO_MMAP64 1
-#elif defined(__x86_64__) || defined(__PPC64__) // #if defined(__i386__) || ...
-
-static inline void* do_mmap64(void *start, size_t length,
- int prot, int flags,
- int fd, __off64_t offset) __THROW {
- return (void *)syscall(SYS_mmap, start, length, prot, flags, fd, offset);
-}
-
-#define MALLOC_HOOK_HAVE_DO_MMAP64 1
-
-#endif // #if defined(__i386__) || defined(__PPC__)
+#endif // #if defined(__x86_64__)
#ifdef MALLOC_HOOK_HAVE_DO_MMAP64
« no previous file with comments | « third_party/tcmalloc/vendor/src/malloc_hook_mmap_freebsd.h ('k') | third_party/tcmalloc/vendor/src/memfs_malloc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698