X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fnative_client_sdk%2Fsrc%2Flibraries%2Fnacl_io%2Fkernel_wrap_bionic.cc;h=621e0bd5e922efbe9aaa09698d6c6f16c3c00d32;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=2754bebbc119edaf38d7446744fef651495b4c74;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc b/src/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc index 2754beb..621e0bd 100644 --- a/src/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc +++ b/src/native_client_sdk/src/libraries/nacl_io/kernel_wrap_bionic.cc @@ -264,8 +264,8 @@ int WRAP(munmap)(void* addr, size_t length) { return REAL(munmap)(addr, length); } -int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) { - *newfd = ki_open(pathname, oflag); +int WRAP(open)(const char* pathname, int oflag, mode_t mode, int* newfd) { + *newfd = ki_open(pathname, oflag, mode); ERRNO_RTN(*newfd); } @@ -338,8 +338,11 @@ static void assign_real_pointers() { } #define CHECK_REAL(func) \ - if (!REAL(func)) \ - assign_real_pointers(); + if (!REAL(func)) { \ + assign_real_pointers(); \ + if (!REAL(func)) \ + return ENOSYS; \ + } // "real" functions, i.e. the unwrapped original functions. @@ -431,7 +434,7 @@ int _real_lseek(int fd, int64_t offset, int whence, int64_t* new_offset) { int _real_lstat(const char* path, struct stat* buf) { struct nacl_abi_stat st; - CHECK_REAL(fstat); + CHECK_REAL(lstat); int err = REAL(lstat)(path, (struct stat*)&st); if (err) { @@ -463,9 +466,9 @@ int _real_munmap(void* addr, size_t length) { return REAL(munmap)(addr, length); } -int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) { +int _real_open(const char* pathname, int oflag, mode_t mode, int* newfd) { CHECK_REAL(open); - return REAL(open)(pathname, oflag, cmode, newfd); + return REAL(open)(pathname, oflag, mode, newfd); } int _real_open_resource(const char* file, int* fd) { @@ -498,7 +501,13 @@ int _real_write(int fd, const void* buf, size_t count, size_t* nwrote) { return REAL(write)(fd, buf, count, nwrote); } +int _real_getcwd(char* pathname, size_t len) { + CHECK_REAL(getcwd); + return REAL(getcwd)(pathname, len); +} + static bool s_wrapped = false; + void kernel_wrap_init() { if (!s_wrapped) { assign_real_pointers(); @@ -516,4 +525,4 @@ void kernel_wrap_uninit() { EXTERN_C_END -#endif // defined(__native_client__) && defined(__GLIBC__) +#endif // defined(__native_client__) && defined(__BIONIC__)