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

Unified Diff: src/trusted/service_runtime/sys_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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/service_runtime/sys_fdio.h ('k') | src/trusted/service_runtime/sys_filename.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/sys_fdio.c
diff --git a/src/trusted/service_runtime/sys_fdio.c b/src/trusted/service_runtime/sys_fdio.c
index 5d0146ee4076cdfc8512e2b41a1d498765bbcac5..e0a3004fd2f7c1e97bf5ae84311897870d511a89 100644
--- a/src/trusted/service_runtime/sys_fdio.c
+++ b/src/trusted/service_runtime/sys_fdio.c
@@ -480,3 +480,128 @@ int32_t NaClSysFstat(struct NaClAppThread *natp,
cleanup:
return retval;
}
+
+int32_t NaClSysFchdir(struct NaClAppThread *natp,
+ int d) {
+ struct NaClApp *nap = natp->nap;
+ struct NaClDesc *ndp;
+ int32_t retval = -NACL_ABI_EINVAL;
+
+ NaClLog(3,
+ ("Entered NaClSysFchdir(0x%08"NACL_PRIxPTR", %d)\n"),
+ (uintptr_t) natp, d);
+
+ ndp = NaClGetDesc(nap, d);
+ if (NULL == ndp) {
+ retval = -NACL_ABI_EBADF;
+ goto cleanup;
+ }
+
+ retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
+ Fchdir)(ndp);
+
+ NaClDescUnref(ndp);
+cleanup:
+ return retval;
+}
+
+int32_t NaClSysFchmod(struct NaClAppThread *natp,
+ int d,
+ int mode) {
+ struct NaClApp *nap = natp->nap;
+ struct NaClDesc *ndp;
+ int32_t retval = -NACL_ABI_EINVAL;
+
+ NaClLog(3,
+ ("Entered NaClSysFchmod(0x%08"NACL_PRIxPTR", %d, 0x%x)\n"),
+ (uintptr_t) natp, d, mode);
+
+ ndp = NaClGetDesc(nap, d);
+ if (NULL == ndp) {
+ retval = -NACL_ABI_EBADF;
+ goto cleanup;
+ }
+
+ retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
+ Fchmod)(ndp, mode);
+
+ NaClDescUnref(ndp);
+cleanup:
+ return retval;
+}
+
+int32_t NaClSysFsync(struct NaClAppThread *natp,
+ int d) {
+ struct NaClApp *nap = natp->nap;
+ struct NaClDesc *ndp;
+ int32_t retval = -NACL_ABI_EINVAL;
+
+ NaClLog(3,
+ ("Entered NaClSysFsync(0x%08"NACL_PRIxPTR", %d)\n"),
+ (uintptr_t) natp, d);
+
+ ndp = NaClGetDesc(nap, d);
+ if (NULL == ndp) {
+ retval = -NACL_ABI_EBADF;
+ goto cleanup;
+ }
+
+ retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
+ Fsync)(ndp);
+
+ NaClDescUnref(ndp);
+cleanup:
+ return retval;
+}
+
+int32_t NaClSysFdatasync(struct NaClAppThread *natp,
+ int d) {
+ struct NaClApp *nap = natp->nap;
+ struct NaClDesc *ndp;
+ int32_t retval = -NACL_ABI_EINVAL;
+
+ NaClLog(3,
+ ("Entered NaClSysFdatasync(0x%08"NACL_PRIxPTR", %d)\n"),
+ (uintptr_t) natp, d);
+
+ ndp = NaClGetDesc(nap, d);
+ if (NULL == ndp) {
+ retval = -NACL_ABI_EBADF;
+ goto cleanup;
+ }
+
+ retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
+ Fdatasync)(ndp);
+
+ NaClDescUnref(ndp);
+cleanup:
+ return retval;
+}
+
+int32_t NaClSysFtruncate(struct NaClAppThread *natp,
+ int d,
+ nacl_abi_off_t length) {
+ struct NaClApp *nap = natp->nap;
+ struct NaClDesc *ndp;
+ int32_t retval = -NACL_ABI_EINVAL;
+
+ NaClLog(3,
+ ("Entered NaClSysFtruncate(0x%08"NACL_PRIxPTR", %d,"
+ " 0x%"NACL_PRIx64")\n"),
+ (uintptr_t) natp, d, length);
+
+ ndp = NaClGetDesc(nap, d);
+ if (NULL == ndp) {
+ retval = -NACL_ABI_EBADF;
+ goto cleanup;
+ }
+
+ retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
+ Ftruncate)(ndp, length);
+
+ NaClDescUnref(ndp);
+cleanup:
+ return retval;
+}
+
+
« no previous file with comments | « src/trusted/service_runtime/sys_fdio.h ('k') | src/trusted/service_runtime/sys_filename.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698