2 * Acess2 POSIX Emulation Layer
6 * - POSIX->Acess VFS call translation
13 int unlink(const char *pathname)
15 return _SysUnlink(pathname);
18 int open(const char *path, int openmode, ...)
20 mode_t create_mode = 0;
23 switch( openmode & O_RDWR )
27 case O_RDONLY: openflags |= OPENFLAG_READ; break;
28 case O_WRONLY: openflags |= OPENFLAG_WRITE; break;
29 case O_RDWR: openflags |= OPENFLAG_READ|OPENFLAG_WRITE; break;
32 if( openmode & O_CREAT ) {
33 openflags |= OPENFLAG_CREATE;
35 va_start(args, openmode);
36 create_mode = va_arg(args, mode_t);
40 return _SysOpen(path, openflags, create_mode);
43 int creat(const char *path, mode_t mode)
45 // TODO: Make native call to do this cheaper
46 int fd = _SysOpen(path, OPENFLAG_CREATE, mode);
47 if( fd == -1 ) return -1;
58 ssize_t write(int fd, const void *buf, size_t count)
60 return _SysWrite(fd, buf, count);
63 ssize_t read(int fd, void *buf, size_t count)
65 return _SysRead(fd, buf, count);
68 int seek(int fd, int whence, off_t dest)
70 return _SysSeek(fd, whence, dest);
80 return _SysClone(CLONE_VM, 0);
83 int execv(const char *b, char *v[])
85 return _SysExecVE(b, v, NULL);
88 int dup2(int oldfd, int newfd)
90 // NOTE: Acess's CopyFD doesn't cause offset sharing
91 return _SysCopyFD(oldfd, newfd);