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

Side by Side 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, 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_fdio.h ('k') | src/trusted/service_runtime/sys_filename.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_fdio.h" 7 #include "native_client/src/trusted/service_runtime/sys_fdio.h"
8 8
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 if (!NaClCopyOutToUser(nap, (uintptr_t) nasp, 473 if (!NaClCopyOutToUser(nap, (uintptr_t) nasp,
474 &result, sizeof result)) { 474 &result, sizeof result)) {
475 retval = -NACL_ABI_EFAULT; 475 retval = -NACL_ABI_EFAULT;
476 } 476 }
477 } 477 }
478 478
479 NaClDescUnref(ndp); 479 NaClDescUnref(ndp);
480 cleanup: 480 cleanup:
481 return retval; 481 return retval;
482 } 482 }
483
484 int32_t NaClSysFchdir(struct NaClAppThread *natp,
485 int d) {
486 struct NaClApp *nap = natp->nap;
487 struct NaClDesc *ndp;
488 int32_t retval = -NACL_ABI_EINVAL;
489
490 NaClLog(3,
491 ("Entered NaClSysFchdir(0x%08"NACL_PRIxPTR", %d)\n"),
492 (uintptr_t) natp, d);
493
494 ndp = NaClGetDesc(nap, d);
495 if (NULL == ndp) {
496 retval = -NACL_ABI_EBADF;
497 goto cleanup;
498 }
499
500 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
501 Fchdir)(ndp);
502
503 NaClDescUnref(ndp);
504 cleanup:
505 return retval;
506 }
507
508 int32_t NaClSysFchmod(struct NaClAppThread *natp,
509 int d,
510 int mode) {
511 struct NaClApp *nap = natp->nap;
512 struct NaClDesc *ndp;
513 int32_t retval = -NACL_ABI_EINVAL;
514
515 NaClLog(3,
516 ("Entered NaClSysFchmod(0x%08"NACL_PRIxPTR", %d, 0x%x)\n"),
517 (uintptr_t) natp, d, mode);
518
519 ndp = NaClGetDesc(nap, d);
520 if (NULL == ndp) {
521 retval = -NACL_ABI_EBADF;
522 goto cleanup;
523 }
524
525 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
526 Fchmod)(ndp, mode);
527
528 NaClDescUnref(ndp);
529 cleanup:
530 return retval;
531 }
532
533 int32_t NaClSysFsync(struct NaClAppThread *natp,
534 int d) {
535 struct NaClApp *nap = natp->nap;
536 struct NaClDesc *ndp;
537 int32_t retval = -NACL_ABI_EINVAL;
538
539 NaClLog(3,
540 ("Entered NaClSysFsync(0x%08"NACL_PRIxPTR", %d)\n"),
541 (uintptr_t) natp, d);
542
543 ndp = NaClGetDesc(nap, d);
544 if (NULL == ndp) {
545 retval = -NACL_ABI_EBADF;
546 goto cleanup;
547 }
548
549 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
550 Fsync)(ndp);
551
552 NaClDescUnref(ndp);
553 cleanup:
554 return retval;
555 }
556
557 int32_t NaClSysFdatasync(struct NaClAppThread *natp,
558 int d) {
559 struct NaClApp *nap = natp->nap;
560 struct NaClDesc *ndp;
561 int32_t retval = -NACL_ABI_EINVAL;
562
563 NaClLog(3,
564 ("Entered NaClSysFdatasync(0x%08"NACL_PRIxPTR", %d)\n"),
565 (uintptr_t) natp, d);
566
567 ndp = NaClGetDesc(nap, d);
568 if (NULL == ndp) {
569 retval = -NACL_ABI_EBADF;
570 goto cleanup;
571 }
572
573 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
574 Fdatasync)(ndp);
575
576 NaClDescUnref(ndp);
577 cleanup:
578 return retval;
579 }
580
581 int32_t NaClSysFtruncate(struct NaClAppThread *natp,
582 int d,
583 nacl_abi_off_t length) {
584 struct NaClApp *nap = natp->nap;
585 struct NaClDesc *ndp;
586 int32_t retval = -NACL_ABI_EINVAL;
587
588 NaClLog(3,
589 ("Entered NaClSysFtruncate(0x%08"NACL_PRIxPTR", %d,"
590 " 0x%"NACL_PRIx64")\n"),
591 (uintptr_t) natp, d, length);
592
593 ndp = NaClGetDesc(nap, d);
594 if (NULL == ndp) {
595 retval = -NACL_ABI_EBADF;
596 goto cleanup;
597 }
598
599 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
600 Ftruncate)(ndp, length);
601
602 NaClDescUnref(ndp);
603 cleanup:
604 return retval;
605 }
606
607
OLDNEW
« 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