20#ifndef FILE_SYSCALLS_H
21#define FILE_SYSCALLS_H
24#include "ResolvedPath.h"
26#include "modules/system/vfs/File.h"
27#include "modules/system/vfs/Filesystem.h"
28#include "modules/system/vfs/VFS.h"
41int posix_close(
int fd);
42int posix_open(
const char* name,
int flags,
int mode);
43int posix_read(
int fd,
char* ptr,
int len);
44int posix_write(
int fd,
char* ptr,
int len,
bool nocheck =
false);
45ssize_t posix_pread64(
int fd,
char* ptr,
size_t len, off_t offset);
46ssize_t posix_pwrite64(
int fd,
const char* ptr,
size_t len, off_t offset);
47ssize_t posix_preadv(
int fd,
const struct iovec* iov,
int iovcnt, off_t offset);
48ssize_t posix_pwritev(
int fd,
const struct iovec* iov,
int iovcnt, off_t offset);
49ssize_t posix_preadv2(
int fd,
const struct iovec* iov,
int iovcnt, off_t offset,
int flags);
50ssize_t posix_pwritev2(
int fd,
const struct iovec* iov,
int iovcnt, off_t offset,
int flags);
51off_t posix_lseek(
int file, off_t ptr,
int dir);
52int posix_link(
char* old,
char* _new);
53int posix_unlink(
char* name);
54int posix_stat(
const char* file,
struct stat* st);
55int posix_fstat(
int fd,
struct stat* st);
56int posix_lstat(
char* file,
struct stat* st);
57int posix_rename(
const char* src,
const char* dst);
58int posix_symlink(
char* target,
char* link);
60int posix_writev(
int fd,
const struct iovec* iov,
int iovcnt);
61int posix_readv(
int fd,
const struct iovec* iov,
int iovcnt);
63int posix_getcwd(
char* buf,
size_t maxlen);
64int posix_readlink(
const char* path,
char* buf,
unsigned int bufsize);
65int posix_realpath(
const char* path,
char* buf,
size_t bufsize);
67int posix_getdents(
int fd,
struct linux_dirent* ents,
int count);
68int posix_getdents64(
int fd,
struct dirent* ents,
int count);
70int posix_ioctl(
int fd,
size_t operation,
void* buf);
72int posix_chmod(
const char* path, mode_t mode);
73int posix_chown(
const char* path, uid_t owner, gid_t group);
74int posix_fchmod(
int fd, mode_t mode);
75int posix_fchown(
int fd, uid_t owner, gid_t group);
76int posix_chdir(
const char* path);
77int posix_fchdir(
int fd);
80int posix_dup2(
int fd1,
int fd2);
81int posix_dup3(
int oldfd,
int newfd,
int flags);
83int posix_fcntl(
int fd,
int cmd,
void* arg);
85int posix_mkdir(
const char* name,
int mode);
86int posix_rmdir(
const char* path);
88int posix_isatty(
int fd);
90void* posix_mmap(
void* addr,
size_t len,
int prot,
int flags,
int fd, off_t off);
91int posix_msync(
void* p,
size_t len,
int flags);
92int posix_munmap(
void* addr,
size_t len);
93int posix_mprotect(
void* addr,
size_t len,
int prot);
95int posix_access(
const char* name,
int amode);
97int posix_ftruncate(
int a, off_t b);
99int posix_fsync(
int fd);
101int posix_fstatvfs(
int fd,
struct statvfs* buf);
102int posix_statvfs(
const char* path,
struct statvfs* buf);
104int posix_utime(
const char* path,
const struct utimbuf* times);
105int posix_utimes(
const char* path,
const struct timeval* times);
107int posix_chroot(
const char* path);
108int posix_flock(
int fd,
int operation);
110bool normalisePath(
String& nameToOpen,
const char* name,
bool* onDevFs = 0);
116int posix_openat(
int dirfd,
const char* pathname,
int flags, mode_t mode);
117int posix_mkdirat(
int dirfd,
const char* pathname, mode_t mode);
118int posix_fchownat(
int dirfd,
const char* pathname, uid_t owner, gid_t group,
int flags);
119int posix_futimesat(
int dirfd,
const char* pathname,
const struct timeval* times);
120int posix_fstatat(
int dirfd,
const char* pathname,
struct stat* buf,
int flags);
121int posix_unlinkat(
int dirfd,
const char* pathname,
int flags);
122int posix_renameat(
int olddirfd,
const char* oldpath,
int newdirfd,
const char* newpath);
123int posix_linkat(
int olddirfd,
const char* oldpath,
int newdirfd,
const char* newpath,
int flags);
124int posix_symlinkat(
const char* oldpath,
int newdirfd,
const char* newpath);
125int posix_readlinkat(
int dirfd,
const char* pathname,
char* buf,
size_t bufsiz);
126int posix_fchmodat(
int dirfd,
const char* pathname, mode_t mode,
int flags);
127int posix_faccessat(
int dirfd,
const char* pathname,
int mode,
int flags);
129int posix_mknod(
const char* pathname, mode_t mode, dev_t dev);
131int posix_statfs(
const char* path,
struct statfs* buf);
132int posix_fstatfs(
int fd,
struct statfs* buf);
134int posix_mount(
const char*,
const char*,
const char*,
size_t,
const void*);
136void generate_mtab(
String& result);
138int pedigree_get_mount(
char* mount_buf,
char* info_buf,
size_t n);