| 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;
|
| +}
|
| +
|
| +
|
|
|