wasmux
Version:
WebAssembly toolchain for compiling libc and kernel into system-level WASM modules
151 lines (122 loc) • 3.8 kB
Plain Text
/*
*
* Copyright (C) 2024-2025 Yurii Yakubin (yurii.yakubin@gmail.com)
*
*/
@SCRIPT_INCLUDES@
extern "C" {
// File descriptors
// Retry expression if it fails with EINTR
int access(const char* path, int mode);
int link(const char* oldpath, const char* newpath);
int unlink(const char* path);
ssize_t readlink(const char* path, char* buf, size_t len);
int symlink(const char* target, const char* path);
int linkat(int olddirfd, const char* oldpath, int newdirfd, const char* newpath, int flags);
int unlinkat(int dirfd, const char* path, int flags);
int dup(int oldfd);
int dup2(int oldfd, int newfd);
int dup3(int oldfd, int newfd, int flags);
int pipe(int fds[2]);
int pipe2(int fds[2], int flags);
int fdatasync(int fd);
ssize_t read(int fd, void* buf, size_t count);
ssize_t write(int fd, const void* buf, size_t count);
off_t lseek(int fd, off_t offset, int whence);
int close(int fd);
int fsync(int fd);
int chdir(const char* path);
int rmdir(const char* path);
int fchdir(int fd);
int fchown(int fd, uid_t owner, gid_t group);
int chown(const char* path, uid_t owner, gid_t group);
int lchown(const char* path, uid_t owner, gid_t group);
int truncate(const char* path, off_t length);
int ftruncate(int fd, off_t length);
ssize_t pread(int fd, void* data, size_t size, off_t offset);
ssize_t pwrite(int fd, const void* data, size_t size, off_t offset);
long fpathconf(int fd, int name);
long pathconf(const char* path, int name);
unsigned sleep(unsigned seconds);
int usleep(useconds_t usec);
unsigned alarm(unsigned seconds);
enum __pathconf_enum {
_PC_PATH_MAX,
};
enum __sysconf_enum {
_SC_OPEN_MAX ,
_SC_GETGR_R_SIZE_MAX,
_SC_GETPW_R_SIZE_MAX,
_SC_LOGIN_NAME_MAX,
_SC_PAGESIZE,
_SC_NPROCESSORS_ONLN,
_SC_PAGE_SIZE = _SC_PAGESIZE,
};
long sysconf(int name);
void _exit(int status) __attribute__((noreturn));
char* getcwd(char* buf, size_t size);
char* crypt(const char* key, const char* salt);
pid_t getpid(void);
pid_t gettid(void);
pid_t getppid(void);
uid_t getuid(void);
uid_t geteuid(void);
gid_t getgid(void);
gid_t getegid(void);
int setuid(uid_t uid);
int setgid(gid_t gid);
int seteuid(uid_t euid);
int setegid(gid_t egid);
int setpgid(pid_t pid, pid_t pgid);
int setresuid(uid_t ruid, uid_t euid, uid_t suid);
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
pid_t setsid(void);
pid_t getpgrp(void);
char* getlogin(void);
int getpagesize(void);
int gethostname(char* name, size_t len);
int sethostname(const char* name, size_t len);
int getgroups(int size, gid_t* list);
int getentropy(void* data, size_t size);
int pause(void);
void sync(void);
int vhangup(void);
int brk(void* addr);
void* sbrk(intptr_t inc);
pid_t fork(void);
pid_t vfork(void);
int execl(const char* path, const char* arg, ...);
int execle(const char* path, const char* arg, ...);
int execlp(const char* path, const char* arg, ...);
int execv(const char* path, char* const argv[]);
int execvp(const char* path, char* const argv[]);
int execve(const char* path, char* const argv[], char* const envp[]);
long syscall(long number, ...);
}