Expand description
This module exposes SafaOS’s syscalls and their rust counterparts
Modules§
- types
- Contains documentation-only types for syscall arguments
Enums§
- Syscall
Num - defines Syscall numbers
Functions§
- chdir
- Changes the current work dir to
path - close
- Closes the file with the resource id
fd - create
- Creates the file with the path
path - createdir
- Creates the directory with the path
path - diriter_
close - Closes the directory iterator with the resource id
fd - diriter_
next - Gets the next directory entry from a directory iterator,
- diriter_
open - Opens a directory iterator for the directory with the resource id
dir_ri, returns the resource id of the directory iterator - dup
- Duplicates the resource refered to by the resource id
riand returns the new resource id - exit
- fattrs
- Gets the file attributes of the file with the resource id
fd - fsize
- Gets the size of the file with the resource id
fd - getcwd
- Retrives the current work dir
- getdirentry
- open
- Opens the path
pathand returns the resource id of the file descriptor - pspawn
- same as
unsafe_pspawnbut safe because it makes it clear thatargvis consumed` - read
- Reads
buf.len()bytes from the file with the resource idfdat offsetoffsetintobuf - reboot
- sbrk
- Increases the range of the process’s data break by
sizebytes returns the new break pointer - shutdown
- sync
- Syncs the resource with the resource id
ri - syschdir
- Changes the current working directory to the path
bufwith lengthbuf_len(expects given buffer to be utf-8) - sysclose
- Closes the file with the resource id
fd - syscreate_
dir - Creates the directory with the path
path - syscreate_
file - Creates the file with the path
pathpath must be valid utf-8 - sysdiriter_
close - Closes a directory iterator
- sysdiriter_
next - Gets the next directory entry from a directory iterator,
- sysdiriter_
open - Opens a directory iterator for the directory with the resource id
dir_ri - sysdup
- Duplicates the resource refered to by the resource id
riand puts the new resource id indest_ri - sysexit
- Exits the process with the exit code
code - sysfattrs
- Gets the file attributes of the file with the resource id
fdand puts them indest_attrs - sysfsize
- Gets the size of the file with the resource id
fdand puts it indest_size - sysgetcwd
- Gets the current working directory and puts it in
cwd_bufwith lengthcwd_buf_lenifdest_lenis not null, it will be set to the length of the cwd if the cwd is too long to fit incwd_buf, the syscall will returnErrorStatus::Generic(1) the cwd is currently maximumally 1024 bytes - sysgetdirentry
- Gets the directory entry for the path
pathand puts it indest_direntrypath must be valid utf-8 ifdest_direntryis not null, it will be set to the directory entry - sysopen
- Opens the file with the path
pathand puts the resource id indest_fd - sysread
- Reads
lenbytes from the file with the resource idfdat offsetoffsetintobuf - sysreboot
- Reboots the system
- syssbrk
- Increases the range of the process’s data break by
sizebytes and puts the new break pointer intarget_ptr - sysshutdown
- Shuts down the system
- syssync
- Syncs the resource with the resource id
fd - systruncate
- Truncates the file with the resource id
fdtolenbytes - syswait
- Waits for the process with the resource id
pidto exit ifexit_codeis not null, it will be set to the exit code of the process - syswrite
- Writes
lenbytes frombufto the file with the resource idfdat offsetoffset - sysyield
- Switches to the next process/thread
- truncate
- Truncates the file with the resource id
fdtolenbytes - unsafe_
pspawn ⚠ - spawns a new process
- wait
- Waits for the process with the resource id
pidto exit and returns the exit code of the process - write
- Writes
buf.len()bytes frombufto the file with the resource idfdat offsetoffsetand returns the number of bytes written - yield_
now