2 * Acess2 POSIX Emulation Layer
6 * - POSIX->Acess VFS call translation
13 int open(const char *path, int openmode, ...)
15 mode_t create_mode = 0;
18 switch( openmode & O_RDWR )
22 case O_RDONLY: openflags |= OPENFLAG_READ; break;
23 case O_WRONLY: openflags |= OPENFLAG_WRITE; break;
24 case O_RDWR: openflags |= OPENFLAG_READ|OPENFLAG_WRITE; break;
27 if( openmode & O_CREAT ) {
28 openflags |= OPENFLAG_CREATE;
30 va_start(args, openmode);
31 create_mode = va_arg(args, mode_t);
35 return _SysOpen(path, openflags, create_mode);
38 int creat(const char *path, mode_t mode)
40 // TODO: Make native call to do this cheaper
41 int fd = _SysOpen(path, OPENFLAG_CREATE, mode);
42 if( fd == -1 ) return -1;
53 ssize_t write(int fd, const void *buf, size_t count)
55 return _SysWrite(fd, buf, count);
58 ssize_t read(int fd, void *buf, size_t count)
60 return _SysRead(fd, buf, count);
65 return _SysClone(CLONE_VM, 0);
68 int execv(const char *b, char *v[])
70 return _SysExecVE(b, v, NULL);