| OLD | NEW |
| 1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // (which we're overriding with our mmap64() and mmap() wrappers) so we can't | 35 // (which we're overriding with our mmap64() and mmap() wrappers) so we can't |
| 36 // just call through to them. | 36 // just call through to them. |
| 37 | 37 |
| 38 #ifndef __linux | 38 #ifndef __linux |
| 39 # error Should only be including malloc_hook_mmap_linux.h on linux systems. | 39 # error Should only be including malloc_hook_mmap_linux.h on linux systems. |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 #include <unistd.h> | 42 #include <unistd.h> |
| 43 #if defined(__ANDROID__) | 43 #if defined(__ANDROID__) |
| 44 #include <sys/syscall.h> | 44 #include <sys/syscall.h> |
| 45 #ifndef ANDROID_NON_SDK_BUILD | |
| 46 #include <sys/linux-syscalls.h> | 45 #include <sys/linux-syscalls.h> |
| 47 #endif | |
| 48 #else | 46 #else |
| 49 #include <syscall.h> | 47 #include <syscall.h> |
| 50 #endif | 48 #endif |
| 51 #include <sys/mman.h> | 49 #include <sys/mman.h> |
| 52 #include <errno.h> | 50 #include <errno.h> |
| 53 #include "base/linux_syscall_support.h" | 51 #include "base/linux_syscall_support.h" |
| 54 | 52 |
| 55 // SYS_mmap2, SYS_munmap, SYS_mremap and __off64_t are not defined in Android. | 53 // SYS_mmap2, SYS_munmap, SYS_mremap and __off64_t are not defined in Android. |
| 56 #if defined(__ANDROID__) | 54 #if defined(__ANDROID__) |
| 57 #if defined(__NR_mmap) && !defined(SYS_mmap) | 55 #if defined(__NR_mmap) && !defined(SYS_mmap) |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 int result; | 259 int result; |
| 262 if (!MallocHook::InvokeMunmapReplacement(start, length, &result)) { | 260 if (!MallocHook::InvokeMunmapReplacement(start, length, &result)) { |
| 263 result = syscall(SYS_munmap, start, length); | 261 result = syscall(SYS_munmap, start, length); |
| 264 } | 262 } |
| 265 return result; | 263 return result; |
| 266 } | 264 } |
| 267 | 265 |
| 268 #undef MALLOC_HOOK_HAVE_DO_MMAP64 | 266 #undef MALLOC_HOOK_HAVE_DO_MMAP64 |
| 269 | 267 |
| 270 #endif // #ifdef MALLOC_HOOK_HAVE_DO_MMAP64 | 268 #endif // #ifdef MALLOC_HOOK_HAVE_DO_MMAP64 |
| OLD | NEW |