68 return (
int64_t)(low | (high << 32));
92#define AT_FDCWD (-100)
93#define AT_SYMLINK_NOFOLLOW 0x100
94#define AT_REMOVEDIR 0x200
95#define AT_SYMLINK_FOLLOW 0x400
96#define AT_EACCESS 0x200
syscall_ret_t sys_futex(struct registers *regs)
SYS_futex: args: uaddr (an aligned 32-bit word), op, val, timeout.
Definition futex.c:144
int dirfd(DIR *dir)
the file descriptor under a directory stream.
unsigned int uint32_t
Definition fb.h:17
__INTPTR_TYPE__ intptr_t
Definition stdint.h:18
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
int int32_t
Definition stdint.h:14
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
__INT64_TYPE__ int64_t
Definition stdint.h:16
syscall_ret_t sys_sigprocmask(struct registers *regs)
SYS_sigprocmask: read and change the blocked mask.
Definition signal.c:751
syscall_ret_t sys_sigreturn(struct registers *regs)
SYS_sigreturn: return from a signal handler (called by the restorer).
Definition signal.c:831
syscall_ret_t sys_tgkill(struct registers *regs)
SYS_tgkill: send a signal to one thread.
Definition signal.c:690
syscall_ret_t sys_alarm(struct registers *regs)
SYS_alarm: send SIGALRM after a number of seconds (0 cancels).
Definition signal.c:895
syscall_ret_t sys_kill(struct registers *regs)
SYS_kill: send a signal.
Definition signal.c:638
syscall_ret_t sys_sigpending(struct registers *regs)
SYS_sigpending: the signals that are pending and blocked.
Definition signal.c:794
syscall_ret_t sys_sigaction(struct registers *regs)
SYS_sigaction: read and change what a process does with a signal.
Definition signal.c:715
syscall_ret_t sys_sigsuspend(struct registers *regs)
SYS_sigsuspend: wait for a signal with a temporary mask.
Definition signal.c:807
saved register state pushed onto the stack by ISR stubs.
Definition isr.h:41
uint32_t ecx
Definition isr.h:43
uint32_t esi
Definition isr.h:43
uint32_t ebx
Definition isr.h:43
uint32_t edi
Definition isr.h:43
uint32_t edx
Definition isr.h:43
syscall_ret_t sys_geteuid(struct registers *regs)
Definition sys_cred.c:24
syscall_ret_t sys_fchmod(struct registers *regs)
SYS_fchmod: args: EBX = fd, ECX = mode.
Definition sys_cred.c:171
syscall_ret_t sys_setuid(struct registers *regs)
SYS_setuid: args: EBX = uid.
Definition sys_cred.c:91
syscall_ret_t sys_seteuid(struct registers *regs)
Definition sys_cred.c:107
syscall_ret_t sys_chown(struct registers *regs)
SYS_chown: args: path, uid, gid (-1 keeps one).
Definition sys_cred.c:247
syscall_ret_t sys_getgid(struct registers *regs)
Definition sys_cred.c:30
syscall_ret_t sys_setegid(struct registers *regs)
Definition sys_cred.c:113
syscall_ret_t sys_fchown(struct registers *regs)
SYS_fchown: args: fd, uid, gid.
Definition sys_cred.c:269
syscall_ret_t sys_chmod(struct registers *regs)
SYS_chmod: args: path, mode (07777 bits).
Definition sys_cred.c:151
syscall_ret_t sys_umask(struct registers *regs)
SYS_umask: args: EBX = mask.
Definition sys_cred.c:293
syscall_ret_t sys_fchownat(struct registers *regs)
SYS_fchownat: args: dirfd, path, uid, gid, flags (AT_SYMLINK_NOFOLLOW).
Definition sys_cred.c:256
syscall_ret_t sys_getuid(struct registers *regs)
Definition sys_cred.c:18
syscall_ret_t sys_fchmodat(struct registers *regs)
SYS_fchmodat: args: dirfd, path, mode, flags (AT_SYMLINK_NOFOLLOW is refused: a link has no mode of i...
Definition sys_cred.c:160
syscall_ret_t sys_setgid(struct registers *regs)
SYS_setgid: args: EBX = gid.
Definition sys_cred.c:101
syscall_ret_t sys_getegid(struct registers *regs)
Definition sys_cred.c:36
syscall_ret_t sys_pollkey(struct registers *regs)
SYS_pollkey: non-blocking keyboard poll for interactive graphics programs.
Definition sys_fb.c:23
syscall_ret_t sys_linkat(struct registers *regs)
SYS_linkat: give a file one more name (a hard link).
Definition sys_fs.c:405
int32_t resolve_user_path(const char *user_path, char *resolved, uint32_t size)
copy a path string in from user memory and resolve it against the current process's cwd.
Definition sys_fs.c:13
syscall_ret_t sys_unlinkat(struct registers *regs)
SYS_unlinkat: remove a file or (AT_REMOVEDIR) a directory, relative to a directory.
Definition sys_fs.c:316
syscall_ret_t sys_fstatat(struct registers *regs)
SYS_fstatat: stat a path relative to a directory.
Definition sys_fs.c:120
syscall_ret_t sys_mkdir(struct registers *regs)
SYS_mkdir: create a directory.
Definition sys_fs.c:256
syscall_ret_t sys_faccessat(struct registers *regs)
SYS_faccessat: access, relative to a directory.
Definition sys_fs.c:223
syscall_ret_t sys_readlinkat(struct registers *regs)
SYS_readlinkat: read the target of a symbolic link.
Definition sys_fs.c:370
syscall_ret_t sys_renameat(struct registers *regs)
SYS_renameat: rename, each path relative to its own directory.
Definition sys_fs.c:169
int32_t set_new_owner(const char *path, uint32_t mode)
give a file the caller has just created its mode (taken through the umask) and the caller's effective...
Definition sys_fs.c:72
syscall_ret_t sys_utimensat(struct registers *regs)
SYS_utimensat: set a file's access and modification times.
Definition sys_fs.c:540
syscall_ret_t sys_getdents(struct registers *regs)
SYS_getdents: read directory entries.
Definition sys_fs.c:625
syscall_ret_t sys_rename(struct registers *regs)
SYS_rename: rename a file or directory.
Definition sys_fs.c:159
syscall_ret_t sys_access(struct registers *regs)
SYS_access: check that a file exists and may be accessed.
Definition sys_fs.c:213
syscall_ret_t sys_mknodat(struct registers *regs)
SYS_mknodat: make a named pipe, a device node or an empty file.
Definition sys_fs.c:447
int32_t resolve_user_path_at(int32_t dirfd, const char *user_path, char *resolved, uint32_t size, bool follow)
as resolve_user_path, with a relative path taken in the directory open as dirfd (AT_FDCWD: the workin...
Definition sys_fs.c:18
syscall_ret_t sys_stat(struct registers *regs)
SYS_stat: get file metadata.
Definition sys_fs.c:110
syscall_ret_t sys_unlink(struct registers *regs)
SYS_unlink: remove a file.
Definition sys_fs.c:296
syscall_ret_t sys_symlinkat(struct registers *regs)
SYS_symlinkat: make a symbolic link.
Definition sys_fs.c:329
syscall_ret_t sys_mkdirat(struct registers *regs)
SYS_mkdirat: mkdir relative to a directory.
Definition sys_fs.c:266
syscall_ret_t sys_rmdir(struct registers *regs)
SYS_rmdir: remove a directory.
Definition sys_fs.c:306
syscall_ret_t sys_fcntl(struct registers *regs)
SYS_fcntl: control an open file descriptor.
Definition sys_io.c:364
syscall_ret_t sys_openat(struct registers *regs)
SYS_openat: open relative to a directory.
Definition sys_io.c:199
syscall_ret_t sys_write(struct registers *regs)
SYS_write: write bytes to a file descriptor.
Definition sys_io.c:18
syscall_ret_t sys_ftruncate(struct registers *regs)
SYS_ftruncate: cut or grow an open file to a length.
Definition sys_io.c:248
syscall_ret_t sys_open(struct registers *regs)
Definition sys_io.c:189
syscall_ret_t sys_poll(struct registers *regs)
SYS_poll: wait until one of a set of descriptors is ready.
Definition sys_io.c:506
syscall_ret_t sys_read(struct registers *regs)
SYS_read: read bytes from a file descriptor.
Definition sys_io.c:49
syscall_ret_t sys_pwrite(struct registers *regs)
SYS_pwrite: write at an offset without moving the file offset.
Definition sys_io.c:428
syscall_ret_t sys_pread(struct registers *regs)
SYS_pread: read at an offset without moving the file offset.
Definition sys_io.c:409
syscall_ret_t sys_fstat(struct registers *regs)
SYS_fstat: get the metadata of an open file.
Definition sys_io.c:330
syscall_ret_t sys_close(struct registers *regs)
SYS_close: close an open file descriptor.
Definition sys_io.c:210
syscall_ret_t sys_fsync(struct registers *regs)
SYS_fsync: write an open file's data to disk.
Definition sys_io.c:448
syscall_ret_t sys_pipe(struct registers *regs)
SYS_pipe: create a pipe (pair of connected file descriptors).
Definition sys_io.c:296
syscall_ret_t sys_lseek(struct registers *regs)
SYS_lseek: set the file offset.
Definition sys_io.c:223
syscall_ret_t sys_flock(struct registers *regs)
SYS_flock: an advisory lock on a whole file (kernel/vfs/flock.h).
Definition sys_io.c:549
syscall_ret_t sys_dup2(struct registers *regs)
SYS_dup2: make new_fd another descriptor for old_fd's open file.
Definition sys_io.c:267
syscall_ret_t sys_getcwd(struct registers *regs)
SYS_getcwd: copy the current working directory into a user buffer.
Definition sys_misc.c:18
syscall_ret_t sys_chdir(struct registers *regs)
SYS_chdir: change the current working directory.
Definition sys_misc.c:75
syscall_ret_t sys_chroot(struct registers *regs)
SYS_chroot: make a directory the caller's root: its paths start there, and ".." stops there (root onl...
Definition sys_misc.c:47
syscall_ret_t sys_ioctl(struct registers *regs)
SYS_ioctl: issue a device-control request on an open file descriptor.
Definition sys_misc.c:126
syscall_ret_t sys_getrandom(struct registers *regs)
SYS_getrandom: random bytes.
Definition sys_misc.c:178
syscall_ret_t sys_reboot(struct registers *regs)
SYS_reboot: restart (RB_AUTOBOOT) or turn off (RB_POWER_OFF) the machine.
Definition sys_misc.c:151
syscall_ret_t sys_set_tls(struct registers *regs)
SYS_set_tls: set the calling thread's thread pointer, which user code reaches its thread-local storag...
Definition sys_proc.c:364
syscall_ret_t sys_exit(struct registers *regs)
SYS_exit: terminate the current process.
Definition sys_proc.c:27
syscall_ret_t sys_sbrk(struct registers *regs)
Definition sys_proc.c:582
syscall_ret_t sys_waitpid(struct registers *regs)
SYS_waitpid: wait for a child process to exit and reap it.
Definition sys_proc.c:407
syscall_ret_t sys_getsid(struct registers *regs)
SYS_getsid: the session of a process (pid 0: the caller).
Definition sys_proc.c:876
syscall_ret_t sys_getppid(struct registers *regs)
SYS_getppid: return the parent's pid, or 0 if the parent has exited.
Definition sys_proc.c:485
syscall_ret_t sys_getpgid(struct registers *regs)
SYS_getpgid: the process group of a process (pid 0: the caller).
Definition sys_proc.c:848
syscall_ret_t sys_clone(struct registers *regs)
SYS_clone: make a thread of the current process.
Definition sys_proc.c:308
syscall_ret_t sys_getpid(struct registers *regs)
SYS_getpid: return the current process ID (the thread group's id).
Definition sys_proc.c:384
syscall_ret_t sys_gettid(struct registers *regs)
SYS_gettid: the calling thread's id (the pid for a single thread).
Definition sys_proc.c:375
syscall_ret_t sys_mprotect(struct registers *regs)
Definition sys_proc.c:791
syscall_ret_t sys_execve(struct registers *regs)
SYS_execve: replace the calling process's program.
Definition sys_proc.c:234
syscall_ret_t sys_getpriority(struct registers *regs)
SYS_getpriority: the nice value of processes.
Definition sys_proc.c:975
syscall_ret_t sys_exit_group(struct registers *regs)
SYS_exit_group: end every thread of the current process.
Definition sys_proc.c:277
syscall_ret_t sys_fork(struct registers *regs)
SYS_fork: create a child process that is a copy of the caller.
Definition sys_proc.c:263
syscall_ret_t sys_mmap(struct registers *regs)
Definition sys_proc.c:696
syscall_ret_t sys_sched_yield(struct registers *regs)
SYS_sched_yield: let other ready processes run first.
Definition sys_proc.c:495
syscall_ret_t sys_setpgid(struct registers *regs)
SYS_setpgid: move a process into a process group.
Definition sys_proc.c:820
syscall_ret_t sys_munmap(struct registers *regs)
Definition sys_proc.c:754
syscall_ret_t sys_setpriority(struct registers *regs)
SYS_setpriority: set the nice value (-20 to 19) of processes; it sets the length of their time slice.
Definition sys_proc.c:988
syscall_ret_t sys_setsid(struct registers *regs)
SYS_setsid: start a new session, with the caller as the leader of it and of a new process group,...
Definition sys_proc.c:859
syscall_ret_t sys_exec(struct registers *regs)
SYS_exec: start an ELF binary as a child process (spawn, not execve).
Definition sys_proc.c:199
syscall_ret_t sys_shm_create(struct registers *regs)
SYS_shm_create: make a shared memory object (kernel/memory/shm.h).
Definition sys_proc.c:713
syscall_ret_t sys_socket(struct registers *regs)
SYS_socket: make an unconnected socket.
Definition sys_socket.c:174
syscall_ret_t sys_socketpair(struct registers *regs)
SYS_socketpair: make two connected sockets.
Definition sys_socket.c:214
syscall_ret_t sys_listen(struct registers *regs)
SYS_listen: let a bound socket take connections.
Definition sys_socket.c:293
syscall_ret_t sys_getsockopt(struct registers *regs)
SYS_getsockopt: read a socket option (an int value).
Definition sys_socket.c:784
syscall_ret_t sys_connect(struct registers *regs)
SYS_connect: connect to the listening socket with a name.
Definition sys_socket.c:316
syscall_ret_t sys_getsockname(struct registers *regs)
SYS_getsockname: the local address of a socket.
Definition sys_socket.c:729
syscall_ret_t sys_setsockopt(struct registers *regs)
SYS_setsockopt: set a socket option (an int value).
Definition sys_socket.c:750
syscall_ret_t sys_recvmsg(struct registers *regs)
SYS_recvmsg: receive data, and the files passed with it.
Definition sys_socket.c:615
syscall_ret_t sys_sendmsg(struct registers *regs)
SYS_sendmsg: send data, and pass open files with SCM_RIGHTS.
Definition sys_socket.c:469
syscall_ret_t sys_accept(struct registers *regs)
SYS_accept: take the next connection of a listening socket (accept4).
Definition sys_socket.c:349
syscall_ret_t sys_shutdown(struct registers *regs)
SYS_shutdown: stop the reading or the writing on a socket.
Definition sys_socket.c:819
syscall_ret_t sys_bind(struct registers *regs)
SYS_bind: give a socket a name.
Definition sys_socket.c:263
syscall_ret_t sys_getpeername(struct registers *regs)
SYS_getpeername: the address a socket is connected to.
Definition sys_socket.c:739
syscall_ret_t sys_uname(struct registers *regs)
SYS_uname: the name of the system, its release and version, and the machine.
Definition sys_uname.c:50
syscall_ret_t sys_sethostname(struct registers *regs)
SYS_sethostname: set the host name (root only).
Definition sys_uname.c:29
syscall_ret_t(*) syscall_fn_t(struct registers *regs)
Definition syscall_internal.h:77
intptr_t syscall_ret_t
syscall function pointer type.
Definition syscall_internal.h:76
syscall_ret_t sys_clock_gettime(struct registers *regs)
SYS_clock_gettime: read a clock.
Definition clock.c:88
uintptr_t syscall_arg_t
one syscall argument or return value: pointer-width, so a user address passes through unchanged.
Definition syscall_internal.h:14
syscall_ret_t sys_nanosleep(struct registers *regs)
SYS_nanosleep: sleep for a time span.
Definition clock.c:131
syscall_ret_t sys_clock_settime(struct registers *regs)
SYS_clock_settime: set the realtime clock (root only).
Definition clock.c:66
syscall_ret_t sys_times(struct registers *regs)
SYS_times: the CPU time of the calling process and its reaped children.
Definition clock.c:177