12#include <aquila/syscall.h>
29#include <aquila/errno.h>
30#include <aquila/dirent.h>
31#include <aquila/utsname.h>
32#include <aquila/fcntl.h>
33#include <aquila/mman.h>
34#include <aquila/time.h>
35#include <aquila/ioctl.h>
36#include <aquila/wait.h>
37#include <aquila/poll.h>
55int upath_get(
const char *upath,
char **path);
60long sys_fstat(
int fildes,
struct aquila_stat *buf);
62long sys_link(
const char *oldpath,
const char *newpath);
63long sys_linkat(
int olddirfd,
const char *oldpath,
int newdirfd,
const char *newpath,
int flags);
67long sys_read(
int fildes,
void *buf,
size_t nbytes);
68long sys_stat(
const char *path,
struct aquila_stat *buf);
69long sys_fstatat(
int dirfd,
const char *path,
struct aquila_stat *buf,
int flags);
75long sys_mount(
struct aquila_mount_args *args);
83long sys_lstat(
const char *path,
struct aquila_stat *buf);
95long sys_utimensat(
int dirfd,
const char *path,
const struct aquila_timespec times[2],
int flags);
97long sys_symlinkat(
const char *utarget,
int dirfd,
const char *upath);
98long sys_readlinkat(
int dirfd,
const char *upath,
char *buf,
size_t size);
99long sys_renameat(
int olddirfd,
const char *oldpath,
int newdirfd,
const char *newpath);
107long sys_execve(
const char *path,
char *
const argp[],
char *
const envp[]);
122long sys_mmap(
struct aquila_mmap_args *uargs,
void **ret);
135long sys_sigaction(
int sig,
const struct aquila_sigaction *act,
struct aquila_sigaction *oact);
140long sys_setitimer(
int which,
const struct aquila_itimer *
new,
struct aquila_itimer *old);
141long sys_nanosleep(
const struct aquila_timespec *req,
struct aquila_timespec *rem);
145long sys_socket(
int domain,
int type,
int protocol);
146long sys_accept(
int fd,
const struct sockaddr *addr, socklen_t *len);
147long sys_bind(
int fd,
const struct sockaddr *addr, socklen_t len);
148long sys_connect(
int fd,
const struct sockaddr *addr, socklen_t len);
150long sys_send(
struct aquila_socket_io_args *us);
151long sys_recv(
struct aquila_socket_io_args *us);
155long sys_setsockopt(
int fd,
int level,
int name,
const void *val, socklen_t len);
159long sys_select(
struct aquila_select_args *args);
160long sys_poll(
struct pollfd *fds, nfds_t nfds,
int timeout_ms);
#define LOGGER_DECLARE(name)
__PTRDIFF_TYPE__ ptrdiff_t
A device driver: its operations, any of which may be NULL.
A file descriptor: the open file it refers to (fs/file.c, shared with the descriptors that dup() and ...
An open file (POSIX's "open file description", fs/file.c).
struct file * fd_file(int fd)
Finds the open file that a descriptor of the current process refers to, and holds it until the system...
int upath_get(const char *upath, char **path)
Copies a path from user memory into a new kernel buffer.
long sys_utimensat(int dirfd, const char *path, const struct aquila_timespec times[2], int flags)
Implements utimensat() (and futimens()): sets a file's access and modification times.
long sys_mkdir(const char *path, mode_t mode)
Implements mkdir(): makes a directory.
long sys_access(const char *path, int mode)
Implements access(): says whether the process may read, write or execute a file.
long sys_fcntl(int fd, int cmd, uintptr_t arg)
Implements fcntl(): duplicates a descriptor, or reads and sets the descriptor's flags (FD_CLOEXEC) or...
long sys_linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags)
Implements linkat(): link(), with paths relative to directories.
long sys_ioctl(int fd, int request, void *argp)
Implements ioctl(): a device's, a socket's, or a terminal's request.
long sys_fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags)
Implements fchownat(): chown(), with the path relative to a directory.
long sys_umask(mode_t mask)
Implements umask(): sets the permissions that new files don't get.
long sys_open(const char *path, int oflags, mode_t mode)
Implements open(): opens a file on a new descriptor, creating it with O_CREAT.
long sys_chdir(const char *upath)
Implements chdir(): changes the working directory.
long sys_flock(int fd, int op)
Implements flock(): takes or releases an advisory lock on an open file.
long sys_symlinkat(const char *utarget, int dirfd, const char *upath)
Implements symlinkat(): makes a symbolic link.
long sys_close(int fildes)
Implements close(): frees a descriptor.
long sys_lseek(int fildes, off_t offset, int whence)
Implements lseek(): moves an open file's offset.
long sys_sync(void)
Implements sync(): writes out what the devices' caches hold.
long sys_pipe(int fd[2])
Implements pipe(): makes a pipe, its read end and its write end open on two new descriptors.
long sys_renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath)
Implements renameat() (and rename()): moves a file to another name, replacing what was there.
long sys_fstatat(int dirfd, const char *path, struct aquila_stat *buf, int flags)
Implements fstatat(): stat(), with the path relative to a directory.
long sys_unlinkat(int dirfd, const char *path, int flags)
Implements unlinkat(): unlink(), or rmdir() with AT_REMOVEDIR, with the path relative to a directory.
long sys_lchown(const char *path, uid_t owner, gid_t group)
Implements lchown(): chown() of a symbolic link itself.
long sys_ftruncate(int fildes, off_t len)
Implements ftruncate(): sets an open file's size.
long sys_readlinkat(int dirfd, const char *upath, char *buf, size_t size)
Implements readlinkat(): what a symbolic link points to (not NUL-terminated).
long sys_write(int fd, void *buf, size_t nbytes)
Implements write().
long sys_readdir(int fd, struct dirent *dirent)
Reads a directory's next entry, for the C library's readdir().
long sys_isatty(int fildes)
Says whether a descriptor refers to a character device, the only kind of file that can be a terminal.
long sys_fchmod(int fd, mode_t mode)
Implements fchmod(): changes an open file's permissions.
long sys_getcwd(char *buf, size_t size)
Implements getcwd(): the working directory's path.
long sys_read(int fildes, void *buf, size_t nbytes)
Implements read().
long sys_chown(const char *path, uid_t owner, gid_t group)
Implements chown(): changes a file's owner and group.
long sys_chmod(const char *path, mode_t mode)
Implements chmod(): changes a file's permissions.
long sys_fchmodat(int dirfd, const char *path, mode_t mode, int flags)
Implements fchmodat(): chmod(), with the path relative to a directory.
long sys_mknodat(int dirfd, const char *path, uint32_t mode, uint32_t dev)
Implements mknodat(): mknod(), with the path relative to a directory.
long sys_fchown(int fd, uid_t owner, gid_t group)
Implements fchown(): changes an open file's owner and group.
long sys_lstat(const char *path, struct aquila_stat *buf)
Implements lstat(): a file's attributes, a symbolic link's own.
long sys_stat(const char *path, struct aquila_stat *buf)
Implements stat(): a file's attributes, following a symbolic link.
long sys_openat(int dirfd, const char *path, int oflags, mode_t mode)
Implements openat(): open(), with the path relative to a directory.
long sys_link(const char *oldpath, const char *newpath)
Implements link(): a new name for a file.
long sys_faccessat(int dirfd, const char *path, int mode, int flags)
Implements faccessat(): access(), with the path relative to a directory.
long sys_rmdir(const char *path)
Implements rmdir(): removes an empty directory.
long sys_fchdir(int fd)
Implements fchdir(): changes the working directory to an open directory.
long sys_mknod(const char *path, uint32_t mode, uint32_t dev)
Implements mknod(): makes a file, a directory, a FIFO, or (only root) a device file.
long sys_unlink(const char *path)
Implements unlink(): removes a name of a file (not a directory's).
long sys_mount(struct aquila_mount_args *args)
Implements mount(): mounts a file system on a directory.
long sys_fstat(int fildes, struct aquila_stat *buf)
Implements fstat(): an open file's attributes.
long sys_getpeername(int fd, struct sockaddr *addr, socklen_t *len)
Implements getpeername(): the address of a socket's peer.
long sys_getsockname(int fd, struct sockaddr *addr, socklen_t *len)
Implements getsockname(): a socket's local address.
long sys_connect(int fd, const struct sockaddr *addr, socklen_t len)
Implements connect(): connects a socket to a peer.
long sys_socket(int domain, int type, int protocol)
Implements socket(): makes a socket, open on a new descriptor.
long sys_accept(int fd, const struct sockaddr *addr, socklen_t *len)
Implements accept(): takes a connection from a listening socket, open on a new descriptor.
long sys_getsockopt(int fd, int level, int name, void *val, socklen_t *len)
Implements getsockopt(): reads a socket option.
long sys_recv(struct aquila_socket_io_args *us)
Implements recv() and recvfrom().
long sys_send(struct aquila_socket_io_args *us)
Implements send() and sendto().
long sys_shutdown(int fd, int how)
Implements shutdown(): shuts down reading, writing or both on a socket, which stays open.
long sys_setsockopt(int fd, int level, int name, const void *val, socklen_t len)
Implements setsockopt(): sets a socket option.
long sys_listen(int fd, int backlog)
Implements listen(): makes a socket accept connections.
long sys_bind(int fd, const struct sockaddr *addr, socklen_t len)
Implements bind(): gives a socket its local address.
long sys_select(struct aquila_select_args *args)
Implements select() and pselect(): waits until a descriptor of the sets can be read or written,...
long sys_poll(struct pollfd *fds, nfds_t nfds, int timeout_ms)
Implements poll(): waits until one of the descriptors can be read or written, or the timeout passes,...
long sys_setuid(uid_t uid)
Implements setuid(): sets the process's user ID.
long sys_uname(struct utsname *name)
Implements uname(): the system's name, release, version and machine, and the host name.
long sys_thread_self(void)
Returns the calling thread's ID, for pthread_self().
long sys_setgid(gid_t gid)
Implements setgid(): sets the process's group ID.
long sys_getgid(void)
Implements getgid().
long sys_getpid(void)
Implements getpid().
long sys_setpgid(pid_t pid, pid_t pgid)
Implements setpgid(): moves a process (the caller or one of its children) into a process group of its...
long sys_getpgrp(void)
Implements getpgrp().
long sys_sethostname(const char *name, size_t len)
Implements sethostname().
long sys_thread_exit(void *value_ptr)
Ends the calling thread (for pthread_exit()).
long sys_getrandom(void *buf, size_t len, unsigned flags)
Implements getrandom() (and the C library's getentropy()): fills a buffer with random bytes.
long sys_fork(void)
Implements fork(): makes a child process, a copy of the caller.
long sys_setsid(void)
Implements setsid(): makes the calling process the leader of a new session and process group.
long sys_munmap(void *addr, size_t len)
Implements munmap(): removes a mapping.
long sys_mmap(struct aquila_mmap_args *uargs, void **ret)
Implements mmap(): maps anonymous memory or a file into the calling process.
long sys_sbrk(ptrdiff_t incr)
Implements sbrk(): grows or shrinks the heap.
long sys_times(struct aquila_tms *buf)
Implements times(): the CPU times of the process and of its children that it waited for,...
long sys_thread_create(struct aquila_thread_args *__uthread)
Makes a new thread in the calling process (for pthread_create()), and makes it ready to run.
long sys_getppid(void)
Implements getppid().
long sys_waitpid(int pid, int *stat_loc, int options)
Implements waitpid(): waits for a child to end (or stop, or continue, if asked), and reaps it if it e...
long sys_reboot(unsigned cmd)
Implements reboot(): restarts, halts or powers off the machine, or sets what Ctrl+Alt+Del does.
long sys_getuid(void)
Implements getuid().
long sys_thread_join(int tid, void **value_ptr)
Waits for a thread of the calling process to end, and frees it (for pthread_join()).
long sys_execve(const char *path, char *const argp[], char *const envp[])
Implements execve(): runs another program in the calling process.
long sys_sysconf(int name)
Implements sysconf(): not supported; the C library answers it.
long sys_exit(int code)
Implements _exit(): ends the calling process.
long sys_sigreturn(void)
Implements sigreturn(): a signal handler returns, and the registers and signal mask that its frame sa...
long sys_clock_gettime(int clock, struct aquila_timespec *ts)
Implements clock_gettime(): reads a clock.
long sys_setitimer(int which, const struct aquila_itimer *new, struct aquila_itimer *old)
Implements setitimer(): sets the real time timer, which sends SIGALRM, and reads the old one.
long sys_sigaction(int sig, const struct aquila_sigaction *act, struct aquila_sigaction *oact)
Implements sigaction(): reads a signal's action, and sets a new one.
long sys_kill(pid_t pid, int sig)
Implements kill(): sends a signal to a process or a process group.
long sys_gettimeofday(struct timeval *tv, struct timezone *tz)
Implements gettimeofday(): the time of day.
long sys_nanosleep(const struct aquila_timespec *req, struct aquila_timespec *rem)
Implements nanosleep(): sleeps for a time.
long sys_sigmask(int how, const sigset_t *set, sigset_t *oldset)
Implements sigprocmask(): reads and changes the process's signal mask.
long sys_sigsuspend(const sigset_t *set)
Implements sigsuspend(): replaces the signal mask and waits for a signal.