| 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-newlib build. | 8 // compiled, even on a non-newlib build. |
| 9 #if defined(__native_client__) && !defined(__GLIBC__) && !defined(__BIONIC__) | 9 #if defined(__native_client__) && !defined(__GLIBC__) && !defined(__BIONIC__) |
| 10 | 10 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 CHECK_REAL(getdents); | 304 CHECK_REAL(getdents); |
| 305 return REAL(getdents)(fd, static_cast<dirent*>(nacl_buf), nacl_count, nread); | 305 return REAL(getdents)(fd, static_cast<dirent*>(nacl_buf), nacl_count, nread); |
| 306 } | 306 } |
| 307 | 307 |
| 308 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { | 308 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { |
| 309 CHECK_REAL(seek); | 309 CHECK_REAL(seek); |
| 310 return REAL(seek)(fd, offset, whence, new_offset); | 310 return REAL(seek)(fd, offset, whence, new_offset); |
| 311 } | 311 } |
| 312 | 312 |
| 313 int _real_mkdir(const char* pathname, mode_t mode) { | 313 int _real_mkdir(const char* pathname, mode_t mode) { |
| 314 return ENOSYS; | 314 CHECK_REAL(mkdir); |
| 315 return REAL(mkdir)(pathname, mode); |
| 315 } | 316 } |
| 316 | 317 |
| 317 int _real_mmap(void** addr, | 318 int _real_mmap(void** addr, |
| 318 size_t length, | 319 size_t length, |
| 319 int prot, | 320 int prot, |
| 320 int flags, | 321 int flags, |
| 321 int fd, | 322 int fd, |
| 322 off_t offset) { | 323 off_t offset) { |
| 323 CHECK_REAL(mmap); | 324 CHECK_REAL(mmap); |
| 324 return REAL(mmap)(addr, length, prot, flags, fd, offset); | 325 return REAL(mmap)(addr, length, prot, flags, fd, offset); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 337 int _real_open_resource(const char* file, int* fd) { | 338 int _real_open_resource(const char* file, int* fd) { |
| 338 return ENOSYS; | 339 return ENOSYS; |
| 339 } | 340 } |
| 340 | 341 |
| 341 int _real_read(int fd, void* buf, size_t count, size_t* nread) { | 342 int _real_read(int fd, void* buf, size_t count, size_t* nread) { |
| 342 CHECK_REAL(read); | 343 CHECK_REAL(read); |
| 343 return REAL(read)(fd, buf, count, nread); | 344 return REAL(read)(fd, buf, count, nread); |
| 344 } | 345 } |
| 345 | 346 |
| 346 int _real_rmdir(const char* pathname) { | 347 int _real_rmdir(const char* pathname) { |
| 347 return ENOSYS; | 348 CHECK_REAL(rmdir); |
| 349 return REAL(rmdir)(pathname); |
| 348 } | 350 } |
| 349 | 351 |
| 350 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { | 352 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { |
| 351 CHECK_REAL(write); | 353 CHECK_REAL(write); |
| 352 return REAL(write)(fd, buf, count, nwrote); | 354 return REAL(write)(fd, buf, count, nwrote); |
| 353 } | 355 } |
| 354 | 356 |
| 355 static bool s_wrapped = false; | 357 static bool s_wrapped = false; |
| 356 | 358 |
| 357 void kernel_wrap_init() { | 359 void kernel_wrap_init() { |
| 358 if (!s_wrapped) { | 360 if (!s_wrapped) { |
| 359 LOG_TRACE("kernel_wrap_init"); | 361 LOG_TRACE("kernel_wrap_init"); |
| 360 assign_real_pointers(); | 362 assign_real_pointers(); |
| 361 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) | 363 EXPAND_SYMBOL_LIST_OPERATION(USE_WRAP) |
| 362 s_wrapped = true; | 364 s_wrapped = true; |
| 363 } | 365 } |
| 364 } | 366 } |
| 365 | 367 |
| 366 void kernel_wrap_uninit() { | 368 void kernel_wrap_uninit() { |
| 367 if (s_wrapped) { | 369 if (s_wrapped) { |
| 368 LOG_TRACE("kernel_wrap_uninit"); | 370 LOG_TRACE("kernel_wrap_uninit"); |
| 369 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 371 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
| 370 s_wrapped = false; | 372 s_wrapped = false; |
| 371 } | 373 } |
| 372 } | 374 } |
| 373 | 375 |
| 374 EXTERN_C_END | 376 EXTERN_C_END |
| 375 | 377 |
| 376 #endif // defined(__native_client__) && !defined(__GLIBC__) ... | 378 #endif // defined(__native_client__) && !defined(__GLIBC__) ... |
| OLD | NEW |