Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: src/untrusted/irt/irt_fdio.c

Issue 24889002: Provides some of the missing POSIX file syscalls Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/trusted/service_runtime/sys_filename.c ('k') | src/untrusted/irt/irt_filename.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/nacl/syscall_bindings_trampoline.h" 9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h"
9 10
10 static int nacl_irt_close(int fd) { 11 static int nacl_irt_close(int fd) {
11 return -NACL_SYSCALL(close)(fd); 12 return -NACL_SYSCALL(close)(fd);
12 } 13 }
13 14
14 static int nacl_irt_read(int fd, void *buf, size_t count, size_t *nread) { 15 static int nacl_irt_read(int fd, void *buf, size_t count, size_t *nread) {
15 int rv = NACL_GC_WRAP_SYSCALL(NACL_SYSCALL(read)(fd, buf, count)); 16 int rv = NACL_GC_WRAP_SYSCALL(NACL_SYSCALL(read)(fd, buf, count));
16 if (rv < 0) 17 if (rv < 0)
17 return -rv; 18 return -rv;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 58
58 static int nacl_irt_getdents(int fd, struct dirent *buf, size_t count, 59 static int nacl_irt_getdents(int fd, struct dirent *buf, size_t count,
59 size_t *nread) { 60 size_t *nread) {
60 int rv = NACL_GC_WRAP_SYSCALL(NACL_SYSCALL(getdents)(fd, buf, count)); 61 int rv = NACL_GC_WRAP_SYSCALL(NACL_SYSCALL(getdents)(fd, buf, count));
61 if (rv < 0) 62 if (rv < 0)
62 return -rv; 63 return -rv;
63 *nread = rv; 64 *nread = rv;
64 return 0; 65 return 0;
65 } 66 }
66 67
68 static int nacl_irt_fchdir(int fd) {
69 return -NACL_SYSCALL(fchdir)(fd);
70 }
71
72 static int nacl_irt_fchmod(int fd, mode_t mode) {
73 return -NACL_SYSCALL(fchmod)(fd, mode);
74 }
75
76 static int nacl_irt_fsync(int fd) {
77 return -NACL_SYSCALL(fsync)(fd);
78 }
79
80 static int nacl_irt_fdatasync(int fd) {
81 return -NACL_SYSCALL(fdatasync)(fd);
82 }
83
84 static int nacl_irt_ftruncate(int fd, off_t length) {
85 return -NACL_SYSCALL(ftruncate)(fd, length);
86 }
87
67 const struct nacl_irt_fdio nacl_irt_fdio = { 88 const struct nacl_irt_fdio nacl_irt_fdio = {
68 nacl_irt_close, 89 nacl_irt_close,
69 nacl_irt_dup, 90 nacl_irt_dup,
70 nacl_irt_dup2, 91 nacl_irt_dup2,
71 nacl_irt_read, 92 nacl_irt_read,
72 nacl_irt_write, 93 nacl_irt_write,
73 nacl_irt_seek, 94 nacl_irt_seek,
74 nacl_irt_fstat, 95 nacl_irt_fstat,
75 nacl_irt_getdents, 96 nacl_irt_getdents,
76 }; 97 };
98
99 const struct nacl_irt_dev_fdio nacl_irt_dev_fdio = {
100 nacl_irt_close,
101 nacl_irt_dup,
102 nacl_irt_dup2,
103 nacl_irt_read,
104 nacl_irt_write,
105 nacl_irt_seek,
106 nacl_irt_fstat,
107 nacl_irt_getdents,
108 nacl_irt_fchdir,
109 nacl_irt_fchmod,
110 nacl_irt_fsync,
111 nacl_irt_fdatasync,
112 nacl_irt_ftruncate,
113 };
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/sys_filename.c ('k') | src/untrusted/irt/irt_filename.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698