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 __BIONIC__. | 5 #include <sys/types.h> // Include something that will define __BIONIC__. |
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-bionic build. | 8 // compiled, even on a non-bionic build. |
9 | 9 |
10 #if defined(__native_client__) && defined(__BIONIC__) | 10 #if defined(__native_client__) && defined(__BIONIC__) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 return 0; | 257 return 0; |
258 } | 258 } |
259 | 259 |
260 int WRAP(munmap)(void* addr, size_t length) { | 260 int WRAP(munmap)(void* addr, size_t length) { |
261 // Always let the real munmap run on the address range. It is not an error if | 261 // Always let the real munmap run on the address range. It is not an error if |
262 // there are no mapped pages in that range. | 262 // there are no mapped pages in that range. |
263 ki_munmap(addr, length); | 263 ki_munmap(addr, length); |
264 return REAL(munmap)(addr, length); | 264 return REAL(munmap)(addr, length); |
265 } | 265 } |
266 | 266 |
267 int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) { | 267 int WRAP(open)(const char* pathname, int oflag, mode_t mode, int* newfd) { |
268 *newfd = ki_open(pathname, oflag); | 268 *newfd = ki_open(pathname, oflag, mode); |
269 ERRNO_RTN(*newfd); | 269 ERRNO_RTN(*newfd); |
270 } | 270 } |
271 | 271 |
272 int WRAP(open_resource)(const char* file, int* fd) { | 272 int WRAP(open_resource)(const char* file, int* fd) { |
273 *fd = ki_open_resource(file); | 273 *fd = ki_open_resource(file); |
274 ERRNO_RTN(*fd); | 274 ERRNO_RTN(*fd); |
275 } | 275 } |
276 | 276 |
277 int WRAP(poll)(struct pollfd* fds, nfds_t nfds, int timeout, int* count) { | 277 int WRAP(poll)(struct pollfd* fds, nfds_t nfds, int timeout, int* count) { |
278 *count = ki_poll(fds, nfds, timeout); | 278 *count = ki_poll(fds, nfds, timeout); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 int64_t offset) { | 461 int64_t offset) { |
462 CHECK_REAL(mmap); | 462 CHECK_REAL(mmap); |
463 return REAL(mmap)(addr, length, prot, flags, fd, offset); | 463 return REAL(mmap)(addr, length, prot, flags, fd, offset); |
464 } | 464 } |
465 | 465 |
466 int _real_munmap(void* addr, size_t length) { | 466 int _real_munmap(void* addr, size_t length) { |
467 CHECK_REAL(munmap); | 467 CHECK_REAL(munmap); |
468 return REAL(munmap)(addr, length); | 468 return REAL(munmap)(addr, length); |
469 } | 469 } |
470 | 470 |
471 int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) { | 471 int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { |
472 CHECK_REAL(open); | 472 CHECK_REAL(open); |
473 return REAL(open)(pathname, oflag, cmode, newfd); | 473 return REAL(open)(pathname, oflag, mode, newfd); |
474 } | 474 } |
475 | 475 |
476 int _real_open_resource(const char* file, int* fd) { | 476 int _real_open_resource(const char* file, int* fd) { |
477 CHECK_REAL(open_resource); | 477 CHECK_REAL(open_resource); |
478 return REAL(open_resource)(file, fd); | 478 return REAL(open_resource)(file, fd); |
479 } | 479 } |
480 | 480 |
481 int _real_read(int fd, void* buf, size_t count, size_t* nread) { | 481 int _real_read(int fd, void* buf, size_t count, size_t* nread) { |
482 CHECK_REAL(read); | 482 CHECK_REAL(read); |
483 return REAL(read)(fd, buf, count, nread); | 483 return REAL(read)(fd, buf, count, nread); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 void kernel_wrap_uninit() { | 521 void kernel_wrap_uninit() { |
522 if (s_wrapped) { | 522 if (s_wrapped) { |
523 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 523 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
524 s_wrapped = false; | 524 s_wrapped = false; |
525 } | 525 } |
526 } | 526 } |
527 | 527 |
528 EXTERN_C_END | 528 EXTERN_C_END |
529 | 529 |
530 #endif // defined(__native_client__) && defined(__BIONIC__) | 530 #endif // defined(__native_client__) && defined(__BIONIC__) |
OLD | NEW |