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

Side by Side 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, 4 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2013 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/trusted/service_runtime/sys_filename.h" 7 #include "native_client/src/trusted/service_runtime/sys_filename.h"
8 8
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 result_size = buffer_size; 507 result_size = buffer_size;
508 if (!NaClCopyOutToUser(nap, buffer, realpath, result_size)) 508 if (!NaClCopyOutToUser(nap, buffer, realpath, result_size))
509 return -NACL_ABI_EFAULT; 509 return -NACL_ABI_EFAULT;
510 510
511 return result_size; 511 return result_size;
512 } 512 }
513 513
514 int32_t NaClSysUtimes(struct NaClAppThread *natp, 514 int32_t NaClSysUtimes(struct NaClAppThread *natp,
515 uint32_t path, 515 uint32_t path,
516 uint32_t times) { 516 uint32_t times) {
517 struct NaClApp *nap = natp->nap; 517 struct NaClApp *nap = natp->nap;
518 char pathname[NACL_CONFIG_PATH_MAX]; 518 char kern_path[NACL_CONFIG_PATH_MAX];
519 int32_t retval = -NACL_ABI_EINVAL; 519 struct nacl_abi_timeval kern_times[2];
520 int32_t retval = -NACL_ABI_EINVAL;
520 521
521 if (!NaClAclBypassChecks) 522 NaClLog(3,
522 return -NACL_ABI_EACCES; 523 ("Entered NaClSysUtimes(0x%08"NACL_PRIxPTR", 0x%08"NACL_PRIxPTR","
524 " 0x%08"NACL_PRIxPTR")\n"),
525 (uintptr_t) natp, (uintptr_t) path, (uintptr_t) times);
523 526
524 retval = CopyPathFromUser(nap, pathname, sizeof pathname, path); 527 if (!NaClAclBypassChecks) {
525 if (0 != retval) 528 retval = -NACL_ABI_EACCES;
526 return retval; 529 goto cleanup;
530 }
527 531
528 if (times == 0) 532 retval = CopyPathFromUser(nap, kern_path, sizeof kern_path, path);
529 return -NACL_ABI_EACCES; 533 if (0 != retval) {
534 goto cleanup;
535 }
530 536
531 /* TODO(sbc): implement in terms of NaClHost function. */ 537 if (times != 0 &&
532 return -NACL_ABI_ENOSYS; 538 !NaClCopyInFromUser(nap, &kern_times, (uintptr_t) times,
539 sizeof(struct nacl_abi_timeval) * 2)) {
540 retval = -NACL_ABI_EFAULT;
541 goto cleanup;
542 }
543
544 retval = NaClHostDescUtimes(kern_path, (times != 0) ? kern_times : NULL);
545 cleanup:
546 return retval;
533 } 547 }
OLDNEW
« 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