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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #endif | 47 #endif |
48 #else | 48 #else |
49 #include <syscall.h> | 49 #include <syscall.h> |
50 #endif | 50 #endif |
51 #include <sys/mman.h> | 51 #include <sys/mman.h> |
52 #include <errno.h> | 52 #include <errno.h> |
53 #include "base/linux_syscall_support.h" | 53 #include "base/linux_syscall_support.h" |
54 | 54 |
55 // 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. |
56 #if defined(__ANDROID__) | 56 #if defined(__ANDROID__) |
| 57 #if defined(__NR_mmap) && !defined(SYS_mmap) |
| 58 #define SYS_mmap __NR_mmap |
| 59 #endif |
57 #ifndef SYS_mmap2 | 60 #ifndef SYS_mmap2 |
58 #define SYS_mmap2 __NR_mmap2 | 61 #define SYS_mmap2 __NR_mmap2 |
59 #endif | 62 #endif |
60 #ifndef SYS_munmap | 63 #ifndef SYS_munmap |
61 #define SYS_munmap __NR_munmap | 64 #define SYS_munmap __NR_munmap |
62 #endif | 65 #endif |
63 #ifndef SYS_mremap | 66 #ifndef SYS_mremap |
64 #define SYS_mremap __NR_mremap | 67 #define SYS_mremap __NR_mremap |
65 #endif | 68 #endif |
66 typedef off64_t __off64_t; | 69 typedef off64_t __off64_t; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 int result; | 261 int result; |
259 if (!MallocHook::InvokeMunmapReplacement(start, length, &result)) { | 262 if (!MallocHook::InvokeMunmapReplacement(start, length, &result)) { |
260 result = syscall(SYS_munmap, start, length); | 263 result = syscall(SYS_munmap, start, length); |
261 } | 264 } |
262 return result; | 265 return result; |
263 } | 266 } |
264 | 267 |
265 #undef MALLOC_HOOK_HAVE_DO_MMAP64 | 268 #undef MALLOC_HOOK_HAVE_DO_MMAP64 |
266 | 269 |
267 #endif // #ifdef MALLOC_HOOK_HAVE_DO_MMAP64 | 270 #endif // #ifdef MALLOC_HOOK_HAVE_DO_MMAP64 |
OLD | NEW |