Chromium Code Reviews| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 CHECK_REAL(close); | 283 CHECK_REAL(close); |
| 284 return REAL(close)(fd); | 284 return REAL(close)(fd); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void _real_exit(int status) { | 287 void _real_exit(int status) { |
| 288 CHECK_REAL(exit); | 288 CHECK_REAL(exit); |
| 289 REAL(exit)(status); | 289 REAL(exit)(status); |
| 290 } | 290 } |
| 291 | 291 |
| 292 int _real_fstat(int fd, struct stat* buf) { | 292 int _real_fstat(int fd, struct stat* buf) { |
| 293 CHECK_REAL(fstat); | 293 CHECK_REAL(fstat); |
|
binji
2014/09/17 23:30:45
here too?
| |
| 294 return REAL(fstat)(fd, buf); | 294 return REAL(fstat)(fd, buf); |
| 295 } | 295 } |
| 296 | 296 |
| 297 int _real_isatty(int fd, int* result) { | 297 int _real_isatty(int fd, int* result) { |
| 298 CHECK_REAL(isatty); | 298 CHECK_REAL(isatty); |
| 299 // The real isatty function can be NULL (for example if we are running | 299 // The real isatty function can be NULL (for example if we are running |
| 300 // withing chrome). | 300 // withing chrome). |
| 301 if (REAL(isatty) == NULL) { | 301 if (REAL(isatty) == NULL) { |
| 302 *result = 0; | 302 *result = 0; |
| 303 return ENOTTY; | 303 return ENOTTY; |
| 304 } | 304 } |
| 305 return REAL(isatty)(fd, result); | 305 return REAL(isatty)(fd, result); |
| 306 } | 306 } |
| 307 | 307 |
| 308 int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t* nread) { | 308 int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t* nread) { |
| 309 CHECK_REAL(getdents); | 309 CHECK_REAL(getdents); |
| 310 return REAL(getdents)(fd, static_cast<dirent*>(nacl_buf), nacl_count, nread); | 310 return REAL(getdents)(fd, static_cast<dirent*>(nacl_buf), nacl_count, nread); |
| 311 } | 311 } |
| 312 | 312 |
| 313 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { | 313 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { |
| 314 CHECK_REAL(seek); | 314 CHECK_REAL(seek); |
|
binji
2014/09/17 23:30:45
here too?
| |
| 315 return REAL(seek)(fd, offset, whence, new_offset); | 315 return REAL(seek)(fd, offset, whence, new_offset); |
| 316 } | 316 } |
| 317 | 317 |
| 318 int _real_mkdir(const char* pathname, mode_t mode) { | 318 int _real_mkdir(const char* pathname, mode_t mode) { |
| 319 CHECK_REAL(mkdir); | 319 CHECK_REAL_NOSYS(mkdir); |
| 320 return REAL(mkdir)(pathname, mode); | 320 return REAL(mkdir)(pathname, mode); |
| 321 } | 321 } |
| 322 | 322 |
| 323 int _real_mmap(void** addr, | 323 int _real_mmap(void** addr, |
| 324 size_t length, | 324 size_t length, |
| 325 int prot, | 325 int prot, |
| 326 int flags, | 326 int flags, |
| 327 int fd, | 327 int fd, |
| 328 off_t offset) { | 328 off_t offset) { |
| 329 CHECK_REAL(mmap); | 329 CHECK_REAL(mmap); |
| 330 return REAL(mmap)(addr, length, prot, flags, fd, offset); | 330 return REAL(mmap)(addr, length, prot, flags, fd, offset); |
| 331 } | 331 } |
| 332 | 332 |
| 333 int _real_munmap(void* addr, size_t length) { | 333 int _real_munmap(void* addr, size_t length) { |
| 334 CHECK_REAL(munmap); | 334 CHECK_REAL(munmap); |
| 335 return REAL(munmap)(addr, length); | 335 return REAL(munmap)(addr, length); |
| 336 } | 336 } |
| 337 | 337 |
| 338 int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { | 338 int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { |
| 339 CHECK_REAL(open); | 339 CHECK_REAL_NOSYS(open); |
| 340 return REAL(open)(pathname, oflag, mode, newfd); | 340 return REAL(open)(pathname, oflag, mode, newfd); |
| 341 } | 341 } |
| 342 | 342 |
| 343 int _real_open_resource(const char* file, int* fd) { | 343 int _real_open_resource(const char* file, int* fd) { |
| 344 return ENOSYS; | 344 return ENOSYS; |
| 345 } | 345 } |
| 346 | 346 |
| 347 int _real_read(int fd, void* buf, size_t count, size_t* nread) { | 347 int _real_read(int fd, void* buf, size_t count, size_t* nread) { |
| 348 CHECK_REAL(read); | 348 CHECK_REAL(read); |
| 349 return REAL(read)(fd, buf, count, nread); | 349 return REAL(read)(fd, buf, count, nread); |
| 350 } | 350 } |
| 351 | 351 |
| 352 int _real_rmdir(const char* pathname) { | 352 int _real_rmdir(const char* pathname) { |
| 353 CHECK_REAL(rmdir); | 353 CHECK_REAL_NOSYS(rmdir); |
| 354 return REAL(rmdir)(pathname); | 354 return REAL(rmdir)(pathname); |
| 355 } | 355 } |
| 356 | 356 |
| 357 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { | 357 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { |
| 358 CHECK_REAL(write); | 358 CHECK_REAL(write); |
| 359 return REAL(write)(fd, buf, count, nwrote); | 359 return REAL(write)(fd, buf, count, nwrote); |
| 360 } | 360 } |
| 361 | 361 |
| 362 int _real_getcwd(char* pathname, size_t len) { | 362 int _real_getcwd(char* pathname, size_t len) { |
| 363 CHECK_REAL_NOSYS(getcwd); | 363 CHECK_REAL_NOSYS(getcwd); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 379 if (s_wrapped) { | 379 if (s_wrapped) { |
| 380 LOG_TRACE("kernel_wrap_uninit"); | 380 LOG_TRACE("kernel_wrap_uninit"); |
| 381 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 381 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
| 382 s_wrapped = false; | 382 s_wrapped = false; |
| 383 } | 383 } |
| 384 } | 384 } |
| 385 | 385 |
| 386 EXTERN_C_END | 386 EXTERN_C_END |
| 387 | 387 |
| 388 #endif // defined(__native_client__) && !defined(__GLIBC__) ... | 388 #endif // defined(__native_client__) && !defined(__GLIBC__) ... |
| OLD | NEW |