| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return 0; | 265 return 0; |
| 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 mode, int* newfd) { |
| 276 *newfd = ki_open(pathname, oflag); | 276 *newfd = ki_open(pathname, oflag, mode); |
| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 off_t offset) { | 599 off_t offset) { |
| 600 CHECK_REAL(mmap); | 600 CHECK_REAL(mmap); |
| 601 return REAL(mmap)(addr, length, prot, flags, fd, offset); | 601 return REAL(mmap)(addr, length, prot, flags, fd, offset); |
| 602 } | 602 } |
| 603 | 603 |
| 604 int _real_munmap(void* addr, size_t length) { | 604 int _real_munmap(void* addr, size_t length) { |
| 605 CHECK_REAL(munmap); | 605 CHECK_REAL(munmap); |
| 606 return REAL(munmap)(addr, length); | 606 return REAL(munmap)(addr, length); |
| 607 } | 607 } |
| 608 | 608 |
| 609 int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) { | 609 int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { |
| 610 CHECK_REAL(open); | 610 CHECK_REAL(open); |
| 611 return REAL(open)(pathname, oflag, cmode, newfd); | 611 return REAL(open)(pathname, oflag, mode, newfd); |
| 612 } | 612 } |
| 613 | 613 |
| 614 int _real_open_resource(const char* file, int* fd) { | 614 int _real_open_resource(const char* file, int* fd) { |
| 615 CHECK_REAL(open_resource); | 615 CHECK_REAL(open_resource); |
| 616 return REAL(open_resource)(file, fd); | 616 return REAL(open_resource)(file, fd); |
| 617 } | 617 } |
| 618 | 618 |
| 619 int _real_read(int fd, void* buf, size_t count, size_t* nread) { | 619 int _real_read(int fd, void* buf, size_t count, size_t* nread) { |
| 620 CHECK_REAL(read); | 620 CHECK_REAL(read); |
| 621 return REAL(read)(fd, buf, count, nread); | 621 return REAL(read)(fd, buf, count, nread); |
| (...skipping 28 matching lines...) Expand all 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 |