OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/src/untrusted/irt/irt.h" | 7 #include "native_client/src/untrusted/irt/irt.h" |
8 #include "native_client/src/untrusted/irt/irt_dev.h" | 8 #include "native_client/src/untrusted/irt/irt_dev.h" |
9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" | 9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 static int nacl_irt_getcwd(char *pathname, size_t len) { | 36 static int nacl_irt_getcwd(char *pathname, size_t len) { |
37 return -NACL_SYSCALL(getcwd)(pathname, len); | 37 return -NACL_SYSCALL(getcwd)(pathname, len); |
38 } | 38 } |
39 | 39 |
40 static int nacl_irt_unlink(const char *pathname) { | 40 static int nacl_irt_unlink(const char *pathname) { |
41 return -NACL_SYSCALL(unlink)(pathname); | 41 return -NACL_SYSCALL(unlink)(pathname); |
42 } | 42 } |
43 | 43 |
| 44 static int nacl_irt_truncate(const char *path, off_t length) { |
| 45 return -NACL_SYSCALL(truncate)(path, length); |
| 46 } |
| 47 |
| 48 static int nacl_irt_lstat(const char *path, struct stat *buf) { |
| 49 return -NACL_SYSCALL(lstat)(path, buf); |
| 50 } |
| 51 |
| 52 static int nacl_irt_link(const char *oldpath, const char *newpath) { |
| 53 return -NACL_SYSCALL(link)(oldpath, newpath); |
| 54 } |
| 55 |
| 56 static int nacl_irt_rename(const char *oldpath, const char *newpath) { |
| 57 return -NACL_SYSCALL(rename)(oldpath, newpath); |
| 58 } |
| 59 |
| 60 static int nacl_irt_symlink(const char* oldpath, const char* newpath) { |
| 61 return -NACL_SYSCALL(symlink)(oldpath, newpath); |
| 62 } |
| 63 |
| 64 static int nacl_irt_chmod(const char *path, mode_t mode) { |
| 65 return -NACL_SYSCALL(chmod)(path, mode); |
| 66 } |
| 67 |
| 68 static int nacl_irt_access(const char *path, int mode) { |
| 69 return -NACL_SYSCALL(access)(path, mode); |
| 70 } |
| 71 |
| 72 static int nacl_irt_readlink(const char *path, char *buf, size_t count, |
| 73 size_t *nread) { |
| 74 int rv = NACL_SYSCALL(readlink)(path, buf, count); |
| 75 if (rv < 0) |
| 76 return -rv; |
| 77 *nread = rv; |
| 78 return 0; |
| 79 } |
| 80 |
| 81 static int nacl_irt_utimes(const char* filename, const struct timeval* times) { |
| 82 return -NACL_SYSCALL(utimes)(filename, times); |
| 83 } |
| 84 |
44 const struct nacl_irt_filename nacl_irt_filename = { | 85 const struct nacl_irt_filename nacl_irt_filename = { |
45 nacl_irt_open, | 86 nacl_irt_open, |
46 nacl_irt_stat, | 87 nacl_irt_stat, |
47 }; | 88 }; |
48 | 89 |
49 const struct nacl_irt_dev_filename_v0_2 nacl_irt_dev_filename = { | 90 const struct nacl_irt_dev_filename_v0_2 nacl_irt_dev_filename_v0_2 = { |
50 nacl_irt_open, | 91 nacl_irt_open, |
51 nacl_irt_stat, | 92 nacl_irt_stat, |
52 nacl_irt_mkdir, | 93 nacl_irt_mkdir, |
| 94 nacl_irt_rmdir, |
| 95 nacl_irt_chdir, |
| 96 nacl_irt_getcwd, |
| 97 nacl_irt_unlink, |
| 98 }; |
| 99 |
| 100 const struct nacl_irt_dev_filename nacl_irt_dev_filename = { |
| 101 nacl_irt_open, |
| 102 nacl_irt_stat, |
| 103 nacl_irt_mkdir, |
53 nacl_irt_rmdir, | 104 nacl_irt_rmdir, |
54 nacl_irt_chdir, | 105 nacl_irt_chdir, |
55 nacl_irt_getcwd, | 106 nacl_irt_getcwd, |
56 nacl_irt_unlink, | 107 nacl_irt_unlink, |
| 108 nacl_irt_truncate, |
| 109 nacl_irt_lstat, |
| 110 nacl_irt_link, |
| 111 nacl_irt_rename, |
| 112 nacl_irt_symlink, |
| 113 nacl_irt_chmod, |
| 114 nacl_irt_access, |
| 115 nacl_irt_readlink, |
| 116 nacl_irt_utimes, |
57 }; | 117 }; |
OLD | NEW |