summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/cpu/os.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r--arch/sandbox/cpu/os.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index f6d0e8457d..cb469e0510 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -58,9 +58,29 @@ off_t os_lseek(int fd, off_t offset, int whence)
return lseek(fd, offset, whence);
}
-int os_open(const char *pathname, int flags)
+int os_open(const char *pathname, int os_flags)
{
- return open(pathname, flags);
+ int flags;
+
+ switch (os_flags & OS_O_MASK) {
+ case OS_O_RDONLY:
+ default:
+ flags = O_RDONLY;
+ break;
+
+ case OS_O_WRONLY:
+ flags = O_WRONLY;
+ break;
+
+ case OS_O_RDWR:
+ flags = O_RDWR;
+ break;
+ }
+
+ if (os_flags & OS_O_CREAT)
+ flags |= O_CREAT;
+
+ return open(pathname, flags, 0777);
}
int os_close(int fd)
OpenPOWER on IntegriCloud