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

Unified Diff: src/trusted/service_runtime/sys_filename.c

Issue 1235633004: DON'T USE THIS -- Providing some missing POSIX File syscalls. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 5 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.c ('k') | src/untrusted/irt/irt_dev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/sys_filename.c
diff --git a/src/trusted/service_runtime/sys_filename.c b/src/trusted/service_runtime/sys_filename.c
index 41edc2385bf1e707f48f3337d16225ffb1a9164f..5f1a917a114e94482e99e69e988b4570baf0ee9c 100644
--- a/src/trusted/service_runtime/sys_filename.c
+++ b/src/trusted/service_runtime/sys_filename.c
@@ -514,20 +514,34 @@ int32_t NaClSysReadlink(struct NaClAppThread *natp,
int32_t NaClSysUtimes(struct NaClAppThread *natp,
uint32_t path,
uint32_t times) {
- struct NaClApp *nap = natp->nap;
- char pathname[NACL_CONFIG_PATH_MAX];
- int32_t retval = -NACL_ABI_EINVAL;
+ struct NaClApp *nap = natp->nap;
+ char kern_path[NACL_CONFIG_PATH_MAX];
+ struct nacl_abi_timeval kern_times[2];
+ int32_t retval = -NACL_ABI_EINVAL;
- if (!NaClAclBypassChecks)
- return -NACL_ABI_EACCES;
+ NaClLog(3,
+ ("Entered NaClSysUtimes(0x%08"NACL_PRIxPTR", 0x%08"NACL_PRIxPTR","
+ " 0x%08"NACL_PRIxPTR")\n"),
+ (uintptr_t) natp, (uintptr_t) path, (uintptr_t) times);
- retval = CopyPathFromUser(nap, pathname, sizeof pathname, path);
- if (0 != retval)
- return retval;
+ if (!NaClAclBypassChecks) {
+ retval = -NACL_ABI_EACCES;
+ goto cleanup;
+ }
- if (times == 0)
- return -NACL_ABI_EACCES;
+ retval = CopyPathFromUser(nap, kern_path, sizeof kern_path, path);
+ if (0 != retval) {
+ goto cleanup;
+ }
- /* TODO(sbc): implement in terms of NaClHost function. */
- return -NACL_ABI_ENOSYS;
+ if (times != 0 &&
+ !NaClCopyInFromUser(nap, &kern_times, (uintptr_t) times,
+ sizeof(struct nacl_abi_timeval) * 2)) {
+ retval = -NACL_ABI_EFAULT;
+ goto cleanup;
+ }
+
+ retval = NaClHostDescUtimes(kern_path, (times != 0) ? kern_times : NULL);
+cleanup:
+ return retval;
}
« no previous file with comments | « src/trusted/service_runtime/sys_fdio.c ('k') | src/untrusted/irt/irt_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698