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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 return REAL(close)(fd); | 540 return REAL(close)(fd); |
541 } | 541 } |
542 | 542 |
543 void _real_exit(int status) { | 543 void _real_exit(int status) { |
544 CHECK_REAL(exit); | 544 CHECK_REAL(exit); |
545 REAL(exit)(status); | 545 REAL(exit)(status); |
546 } | 546 } |
547 | 547 |
548 int _real_fstat(int fd, struct stat* buf) { | 548 int _real_fstat(int fd, struct stat* buf) { |
549 struct nacl_abi_stat st; | 549 struct nacl_abi_stat st; |
550 CHECK_REAL(fstat); | 550 CHECK_REAL(fstat); |
binji
2014/09/17 23:30:45
here too?
| |
551 int err = REAL(fstat)(fd, &st); | 551 int err = REAL(fstat)(fd, &st); |
552 if (err) { | 552 if (err) { |
553 errno = err; | 553 errno = err; |
554 return -1; | 554 return -1; |
555 } | 555 } |
556 | 556 |
557 nacl_stat_to_stat(&st, buf); | 557 nacl_stat_to_stat(&st, buf); |
558 return 0; | 558 return 0; |
559 } | 559 } |
560 | 560 |
(...skipping 26 matching lines...) Expand all Loading... | |
587 *nread = offset; | 587 *nread = offset; |
588 return 0; | 588 return 0; |
589 } | 589 } |
590 | 590 |
591 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { | 591 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) { |
592 CHECK_REAL(seek); | 592 CHECK_REAL(seek); |
593 return REAL(seek)(fd, offset, whence, new_offset); | 593 return REAL(seek)(fd, offset, whence, new_offset); |
594 } | 594 } |
595 | 595 |
596 int _real_mkdir(const char* pathname, mode_t mode) { | 596 int _real_mkdir(const char* pathname, mode_t mode) { |
597 CHECK_REAL(mkdir); | 597 CHECK_REAL_NOSYS(mkdir); |
598 return REAL(mkdir)(pathname, mode); | 598 return REAL(mkdir)(pathname, mode); |
599 } | 599 } |
600 | 600 |
601 int _real_mmap(void** addr, | 601 int _real_mmap(void** addr, |
602 size_t length, | 602 size_t length, |
603 int prot, | 603 int prot, |
604 int flags, | 604 int flags, |
605 int fd, | 605 int fd, |
606 off_t offset) { | 606 off_t offset) { |
607 CHECK_REAL(mmap); | 607 CHECK_REAL(mmap); |
608 return REAL(mmap)(addr, length, prot, flags, fd, offset); | 608 return REAL(mmap)(addr, length, prot, flags, fd, offset); |
609 } | 609 } |
610 | 610 |
611 int _real_munmap(void* addr, size_t length) { | 611 int _real_munmap(void* addr, size_t length) { |
612 CHECK_REAL(munmap); | 612 CHECK_REAL(munmap); |
613 return REAL(munmap)(addr, length); | 613 return REAL(munmap)(addr, length); |
614 } | 614 } |
615 | 615 |
616 int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { | 616 int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { |
617 CHECK_REAL(open); | 617 CHECK_REAL_NOSYS(open); |
618 return REAL(open)(pathname, oflag, mode, newfd); | 618 return REAL(open)(pathname, oflag, mode, newfd); |
619 } | 619 } |
620 | 620 |
621 int _real_open_resource(const char* file, int* fd) { | 621 int _real_open_resource(const char* file, int* fd) { |
622 CHECK_REAL(open_resource); | 622 CHECK_REAL_NOSYS(open_resource); |
623 return REAL(open_resource)(file, fd); | 623 return REAL(open_resource)(file, fd); |
624 } | 624 } |
625 | 625 |
626 int _real_read(int fd, void* buf, size_t count, size_t* nread) { | 626 int _real_read(int fd, void* buf, size_t count, size_t* nread) { |
627 CHECK_REAL(read); | 627 CHECK_REAL(read); |
628 return REAL(read)(fd, buf, count, nread); | 628 return REAL(read)(fd, buf, count, nread); |
629 } | 629 } |
630 | 630 |
631 int _real_rmdir(const char* pathname) { | 631 int _real_rmdir(const char* pathname) { |
632 CHECK_REAL(rmdir); | 632 CHECK_REAL_NOSYS(rmdir); |
633 return REAL(rmdir)(pathname); | 633 return REAL(rmdir)(pathname); |
634 } | 634 } |
635 | 635 |
636 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { | 636 int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { |
637 CHECK_REAL(write); | 637 CHECK_REAL(write); |
638 return REAL(write)(fd, buf, count, nwrote); | 638 return REAL(write)(fd, buf, count, nwrote); |
639 } | 639 } |
640 | 640 |
641 int _real_getcwd(char* pathname, size_t len) { | 641 int _real_getcwd(char* pathname, size_t len) { |
642 CHECK_REAL_NOSYS(getcwd); | 642 CHECK_REAL_NOSYS(getcwd); |
(...skipping 14 matching lines...) Expand all Loading... | |
657 if (s_wrapped) { | 657 if (s_wrapped) { |
658 LOG_TRACE("kernel_wrap_uninit"); | 658 LOG_TRACE("kernel_wrap_uninit"); |
659 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) | 659 EXPAND_SYMBOL_LIST_OPERATION(USE_REAL) |
660 s_wrapped = false; | 660 s_wrapped = false; |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 EXTERN_C_END | 664 EXTERN_C_END |
665 | 665 |
666 #endif // defined(__native_client__) && defined(__GLIBC__) | 666 #endif // defined(__native_client__) && defined(__GLIBC__) |
OLD | NEW |