Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc |
| diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc |
| index ed2ab0c404d9368089c6aa2afbca2f2edbeac3b1..0cc3e9045fddc6e1cc4a02b7bd3fec372c3d232c 100644 |
| --- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc |
| +++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc |
| @@ -159,6 +159,7 @@ EXTERN_C_BEGIN |
| OP(socketpair); \ |
| OP(shutdown); \ |
| \ |
| + OP(chmod); \ |
| OP(access); \ |
| OP(unlink); \ |
| OP(fchdir); \ |
| @@ -166,6 +167,7 @@ EXTERN_C_BEGIN |
| OP(fsync); \ |
| OP(fdatasync); \ |
| OP(lstat); \ |
| + OP(link); \ |
| OP(readlink); \ |
| OP(utimes); |
| @@ -335,6 +337,10 @@ int WRAP(lstat)(const char* pathname, struct nacl_abi_stat* nacl_buf) { |
| return 0; |
| } |
| +int WRAP(link)(const char* pathname, const char* newpath) { |
| + ERRNO_RTN(ki_link(pathname, newpath)); |
| +} |
| + |
| int WRAP(readlink)(const char* pathname, |
| char* buf, |
| size_t count, |
| @@ -349,6 +355,10 @@ int WRAP(utimes)(const char *filename, const struct timeval *times) { |
| ERRNO_RTN(ki_utimes(filename, times)); |
| } |
| +int WRAP(chmod)(const char* pathname, mode_t mode) { |
| + ERRNO_RTN(ki_chmod(pathname, mode)); |
| +} |
| + |
| int WRAP(access)(const char* pathname, int amode) { |
| ERRNO_RTN(ki_access(pathname, amode)); |
| } |
| @@ -511,6 +521,11 @@ static void assign_real_pointers() { |
| if (!REAL(func)) \ |
| assign_real_pointers(); |
| +#define CHECK_REAL_NOSYS(func) \ |
| + CHECK_REAL(func) \ |
| + if (!REAL(func)) \ |
|
binji
2014/08/20 18:13:35
I'm not sure I understand. Why wouldn't there be a
Sam Clegg
2014/08/21 10:19:34
The real pointers will be NULL if the correspondin
|
| + return ENOSYS; |
| + |
| // "real" functions, i.e. the unwrapped original functions. |
| int _real_close(int fd) { |
| @@ -616,6 +631,11 @@ 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_NOSYS(getcwd); |
| + return REAL(getcwd)(pathname, len); |
| +} |
| + |
| static bool s_wrapped = false; |
| void kernel_wrap_init() { |
| if (!s_wrapped) { |