OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <sys/types.h> // Include something that will define __GLIBC__. | 5 #include <sys/types.h> // Include something that will define __GLIBC__. |
6 | 6 |
7 // The entire file is wrapped in this #if. We do this so this .cc file can be | 7 // The entire file is wrapped in this #if. We do this so this .cc file can be |
8 // compiled, even on a non-glibc build. | 8 // compiled, even on a non-glibc build. |
9 #if defined(__native_client__) && defined(__GLIBC__) | 9 #if defined(__native_client__) && defined(__GLIBC__) |
10 | 10 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 | 267 |
268 int WRAP(munmap)(void* addr, size_t length) { | 268 int WRAP(munmap)(void* addr, size_t length) { |
269 // Always let the real munmap run on the address range. It is not an error if | 269 // Always let the real munmap run on the address range. It is not an error if |
270 // there are no mapped pages in that range. | 270 // there are no mapped pages in that range. |
271 ki_munmap(addr, length); | 271 ki_munmap(addr, length); |
272 return REAL(munmap)(addr, length); | 272 return REAL(munmap)(addr, length); |
273 } | 273 } |
274 | 274 |
275 int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) { | 275 int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) { |
276 *newfd = ki_open(pathname, oflag); | 276 *newfd = ki_open(pathname, oflag, cmode); |
277 RTN_ERRNO_IF(*newfd < 0); | 277 RTN_ERRNO_IF(*newfd < 0); |
278 return 0; | 278 return 0; |
279 } | 279 } |
280 | 280 |
281 int WRAP(open_resource)(const char* file, int* fd) { | 281 int WRAP(open_resource)(const char* file, int* fd) { |
282 *fd = ki_open_resource(file); | 282 *fd = ki_open_resource(file); |
283 RTN_ERRNO_IF(*fd < 0); | 283 RTN_ERRNO_IF(*fd < 0); |
284 return 0; | 284 return 0; |
285 } | 285 } |
286 | 286 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 if (s_wrapped) { | 650 if (s_wrapped) { |
651 LOG_TRACE("kernel_wrap_uninit"); | 651 LOG_TRACE("kernel_wrap_uninit"); |
652 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 652 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
653 s_wrapped = false; | 653 s_wrapped = false; |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 EXTERN_C_END | 657 EXTERN_C_END |
658 | 658 |
659 #endif // defined(__native_client__) && defined(__GLIBC__) | 659 #endif // defined(__native_client__) && defined(__GLIBC__) |
OLD | NEW |