2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
7 #include "native_client/src/untrusted/irt/irt.h"
8 #include "native_client/src/untrusted/irt/irt_dev.h"
9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h"
11 static int nacl_irt_open(const char *pathname, int oflag, mode_t cmode,
13 int rv = NACL_GC_WRAP_SYSCALL(NACL_SYSCALL(open)(pathname, oflag, cmode));
20 static int nacl_irt_stat(const char *pathname, struct stat *st) {
21 return -NACL_SYSCALL(stat)(pathname, st);
24 static int nacl_irt_mkdir(const char *pathname, mode_t mode) {
25 return -NACL_SYSCALL(mkdir)(pathname, mode);
28 static int nacl_irt_rmdir(const char *pathname) {
29 return -NACL_SYSCALL(rmdir)(pathname);
32 static int nacl_irt_chdir(const char *pathname) {
33 return -NACL_SYSCALL(chdir)(pathname);
36 static int nacl_irt_getcwd(char *pathname, size_t len) {
37 return -NACL_SYSCALL(getcwd)(pathname, len);
40 static int nacl_irt_unlink(const char *pathname) {
41 return -NACL_SYSCALL(unlink)(pathname);
44 static int nacl_irt_truncate(const char *pathname, off_t length) {
45 return -NACL_SYSCALL(truncate)(pathname, &length);
48 static int nacl_irt_lstat(const char *pathname, struct stat *st) {
49 return -NACL_SYSCALL(lstat)(pathname, st);
52 static int nacl_irt_link(const char *oldpath, const char *newpath) {
53 return -NACL_SYSCALL(link)(oldpath, newpath);
56 static int nacl_irt_rename(const char *oldpath, const char *newpath) {
57 return -NACL_SYSCALL(rename)(oldpath, newpath);
60 static int nacl_irt_symlink(const char *oldpath, const char *newpath) {
61 return -NACL_SYSCALL(symlink)(oldpath, newpath);
64 static int nacl_irt_chmod(const char *path, mode_t mode) {
65 return -NACL_SYSCALL(chmod)(path, mode);
68 static int nacl_irt_access(const char *path, int amode) {
69 return -NACL_SYSCALL(access)(path, amode);
72 static int nacl_irt_readlink(const char *path, char *buf, size_t bufsize,
74 int rv = NACL_SYSCALL(readlink)(path, buf, bufsize);
81 static int nacl_irt_utimes(const char *filename, const struct timeval *times) {
82 return -NACL_SYSCALL(utimes)(filename, times);
85 const struct nacl_irt_filename nacl_irt_filename = {
90 const struct nacl_irt_dev_filename_v0_2 nacl_irt_dev_filename_v0_2 = {
100 const struct nacl_irt_dev_filename nacl_irt_dev_filename = {