| 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 |
| 45 #include <sys/linux-syscalls.h> | 46 #include <sys/linux-syscalls.h> |
| 47 #endif |
| 46 #else | 48 #else |
| 47 #include <syscall.h> | 49 #include <syscall.h> |
| 48 #endif | 50 #endif |
| 49 #include <sys/mman.h> | 51 #include <sys/mman.h> |
| 50 #include <errno.h> | 52 #include <errno.h> |
| 51 #include "base/linux_syscall_support.h" | 53 #include "base/linux_syscall_support.h" |
| 52 | 54 |
| 53 // SYS_mmap2, SYS_munmap, SYS_mremap and __off64_t are not defined in Android. | 55 // SYS_mmap2, SYS_munmap, SYS_mremap and __off64_t are not defined in Android. |
| 54 #if defined(__ANDROID__) | 56 #if defined(__ANDROID__) |
| 55 #ifndef SYS_mmap2 | 57 #ifndef SYS_mmap2 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 int result; | 258 int result; |
| 257 if (!MallocHook::InvokeMunmapReplacement(start, length, &result)) { | 259 if (!MallocHook::InvokeMunmapReplacement(start, length, &result)) { |
| 258 result = syscall(SYS_munmap, start, length); | 260 result = syscall(SYS_munmap, start, length); |
| 259 } | 261 } |
| 260 return result; | 262 return result; |
| 261 } | 263 } |
| 262 | 264 |
| 263 #undef MALLOC_HOOK_HAVE_DO_MMAP64 | 265 #undef MALLOC_HOOK_HAVE_DO_MMAP64 |
| 264 | 266 |
| 265 #endif // #ifdef MALLOC_HOOK_HAVE_DO_MMAP64 | 267 #endif // #ifdef MALLOC_HOOK_HAVE_DO_MMAP64 |
| OLD | NEW |