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

Side by Side Diff: src/trusted/service_runtime/sys_fdio.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 unified diff | Download patch
« no previous file with comments | « src/trusted/service_runtime/sys_fdio.h ('k') | src/trusted/service_runtime/sys_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) 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 if (!NaClCopyOutToUser(nap, nasp, &result, sizeof result)) { 422 if (!NaClCopyOutToUser(nap, nasp, &result, sizeof result)) {
423 retval = -NACL_ABI_EFAULT; 423 retval = -NACL_ABI_EFAULT;
424 } 424 }
425 } 425 }
426 426
427 NaClDescUnref(ndp); 427 NaClDescUnref(ndp);
428 cleanup: 428 cleanup:
429 return retval; 429 return retval;
430 } 430 }
431
432 int32_t NaClSysFchdir(struct NaClAppThread *natp,
433 int d) {
434 struct NaClApp *nap = natp->nap;
435 struct NaClDesc *ndp;
436 int32_t retval = -NACL_ABI_EINVAL;
437
438 NaClLog(3,
439 ("Entered NaClSysFchdir(0x%08"NACL_PRIxPTR", %d)\n"),
440 (uintptr_t) natp, d);
441
442 ndp = NaClAppGetDesc(nap, d);
443 if (NULL == ndp) {
444 retval = -NACL_ABI_EBADF;
445 goto cleanup;
446 }
447
448 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
449 Fchdir)(ndp);
450
451 NaClDescUnref(ndp);
452 cleanup:
453 return retval;
454 }
455
456 int32_t NaClSysFchmod(struct NaClAppThread *natp,
457 int d,
458 int mode) {
459 struct NaClApp *nap = natp->nap;
460 struct NaClDesc *ndp;
461 int32_t retval = -NACL_ABI_EINVAL;
462
463 NaClLog(3,
464 ("Entered NaClSysFchmod(0x%08"NACL_PRIxPTR", %d, 0x%x)\n"),
465 (uintptr_t) natp, d, mode);
466
467 ndp = NaClAppGetDesc(nap, d);
468 if (NULL == ndp) {
469 retval = -NACL_ABI_EBADF;
470 goto cleanup;
471 }
472
473 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
474 Fchmod)(ndp, mode);
475
476 NaClDescUnref(ndp);
477 cleanup:
478 return retval;
479 }
480
481 int32_t NaClSysFsync(struct NaClAppThread *natp,
482 int d) {
483 struct NaClApp *nap = natp->nap;
484 struct NaClDesc *ndp;
485 int32_t retval = -NACL_ABI_EINVAL;
486
487 NaClLog(3,
488 ("Entered NaClSysFsync(0x%08"NACL_PRIxPTR", %d)\n"),
489 (uintptr_t) natp, d);
490
491 ndp = NaClAppGetDesc(nap, d);
492 if (NULL == ndp) {
493 retval = -NACL_ABI_EBADF;
494 goto cleanup;
495 }
496
497 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
498 Fsync)(ndp);
499
500 NaClDescUnref(ndp);
501 cleanup:
502 return retval;
503 }
504
505 int32_t NaClSysFdatasync(struct NaClAppThread *natp,
506 int d) {
507 struct NaClApp *nap = natp->nap;
508 struct NaClDesc *ndp;
509 int32_t retval = -NACL_ABI_EINVAL;
510
511 NaClLog(3,
512 ("Entered NaClSysFdatasync(0x%08"NACL_PRIxPTR", %d)\n"),
513 (uintptr_t) natp, d);
514
515 ndp = NaClAppGetDesc(nap, d);
516 if (NULL == ndp) {
517 retval = -NACL_ABI_EBADF;
518 goto cleanup;
519 }
520
521 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
522 Fdatasync)(ndp);
523
524 NaClDescUnref(ndp);
525 cleanup:
526 return retval;
527 }
528
529 int32_t NaClSysFtruncate(struct NaClAppThread *natp,
530 int d,
531 nacl_abi_off_t length) {
532 struct NaClApp *nap = natp->nap;
533 struct NaClDesc *ndp;
534 int32_t retval = -NACL_ABI_EINVAL;
535
536 NaClLog(3,
537 ("Entered NaClSysFtruncate(0x%08"NACL_PRIxPTR", %d,"
538 " 0x%"NACL_PRIx64")\n"),
539 (uintptr_t) natp, d, length);
540
541 ndp = NaClAppGetDesc(nap, d);
542 if (NULL == ndp) {
543 retval = -NACL_ABI_EBADF;
544 goto cleanup;
545 }
546
547 retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
548 Ftruncate)(ndp, length);
549
550 NaClDescUnref(ndp);
551 cleanup:
552 return retval;
553 }
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/sys_fdio.h ('k') | src/trusted/service_runtime/sys_filename.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698