#[repr(u16)]pub enum SyscallNum {
Show 36 variants
SysPExit = 0,
SysTYield = 1,
SysFSOpenAll = 2,
SysFSOpen = 25,
SysFSRemovePath = 28,
SysFDirIterOpen = 8,
SysRDestroy = 5,
SysDirIterClose = 9,
SysDirIterNext = 10,
SysIOWrite = 3,
SysIORead = 4,
SysFSCreate = 6,
SysFSCreateDir = 7,
SysIOSync = 16,
SysIOTruncate = 17,
SysIOCommand = 12,
SysRDup = 26,
SysFSize = 22,
SysFAttrs = 24,
SysFGetDirEntry = 23,
SysPCHDir = 14,
SysPGetCWD = 15,
SysPSbrk = 18,
SysPSpawn = 19,
SysTSpawn = 29,
SysTExit = 30,
SysTSleep = 31,
SysPWait = 11,
SysTWait = 32,
SysPTryCleanUp = 33,
SysTFutWait = 34,
SysTFutWake = 35,
SysShutdown = 20,
SysReboot = 21,
SysUptime = 27,
SysMemMap = 36,
}Expand description
defines Syscall numbers
Variants§
SysPExit = 0
SysTYield = 1
Yields execution to the next thread in the current CPU
SysFSOpenAll = 2
Opens a file or directory with all permissions
SysFSOpen = 25
Opens a file or directory with given mode (permissions and flags)
SysFSRemovePath = 28
Deletes a path
SysFDirIterOpen = 8
Given a Directory resource, opens a Directory Iterator
SysRDestroy = 5
Destroys (closes) an open resource whether it is a file, directory, directory iterator, or any other resource
SysDirIterClose = 9
Legacy system call to close a directory iterator, use [SysRDestroy] instead
SysDirIterNext = 10
Given a Directory Iterator Resource, returns the next DirEntry in the directory
SysIOWrite = 3
Performs a write operation on a given resource
If the resource is a file, writes the given buffer to the file, the writes are pending until [SysIOSync] is performed.
If the resource is a device, the behavior is device specific.
Otherwise, errors with [NotAFile]
SysIORead = 4
Performs a read operation on a given resource
If the resource is a file, reads the given buffer from the file.
If the resource is a device, the behavior is device specific.
Otherwise, errors with [NotAFile]
SysFSCreate = 6
Creates a new file
SysFSCreateDir = 7
Creates a new directory
SysIOSync = 16
Performs a Sync operation on a given resource
If the resource is a device, the behavior is device specific.
If the resource is a file, writes all pending data to the file.
Otherwise, does nothing or errors with [NotAFile]
SysIOTruncate = 17
Truncates a file to a given size
SysIOCommand = 12
Sends a Command to a given resource that is a device
The behavior is device specific.
Takes 2 arguments: the command (can be as big as size of u16) and the argument (can be as big as size of u64)
SysRDup = 26
Duplicates a given resource, returns a new resource ID pointing to the same resource internally
Succeeds whether the resource is a file, directory, directory iterator or a device
SysFSize = 22
SysFAttrs = 24
SysFGetDirEntry = 23
SysPCHDir = 14
Changes the current working directory to the given path
SysPGetCWD = 15
Gets the current working directory, returns crate::errors::ErrorStatus::Generic if the given buffer
is too small to hold the path, always returns the current working directory length whether or not the buffer is small
SysPSbrk = 18
Extends the current process’s address space by the given amount, amount can be negative to shrink the address space
Basically maps (or unmaps) the given amount of memory Returns the new data break (address space end)
SysPSpawn = 19
Spawns a new process
SysTSpawn = 29
Spawns a thread inside the current process with the given entry point
SysTExit = 30
Exits the current thread, takes an exit code so that it can act as [SysPExit] if it’s the last thread in the process (otherwise it is unused)
SysTSleep = 31
Sleeps the current thread for the given amount of milliseconds, max is u64::MAX
SysPWait = 11
Waits for a child process with a given PID to exit, cleans it up and returns the exit code
SysTWait = 32
Waits for a child thread with a given TID to exit
SysPTryCleanUp = 33
like [SysPWait] without the waiting part, cleans up the given process and returns the exit code
returns crate::errors::ErrorStatus::InvalidPid if the process doesn’t exist
returns crate::errors::ErrorStatus::Generic if the process exists but hasn’t exited yet
SysTFutWait = 34
Performs a WAIT(addr, val) on the current thread, also takes a timeout
SysTFutWake = 35
Performs a WAKE(addr, n) on the current thread, wakes n threads waiting on the given address
SysShutdown = 20
SysReboot = 21
SysUptime = 27
returns the Uptime of the system in milliseconds
SysMemMap = 36
Maps N pages after a given address to memory that may be shared with a Device or a File
The given address is a just a hint unless specified (not yet implemented) with the flag crate::mem::MemMapFlags::FIXED, in that case unlike mmap in linux you cannot map colliding regions
The address can be null telling the kernel to choose it’s own hint
The given reosurce (the resource to map) is ignored unless otherwise specified with the flag crate::mem::MemMapFlags::MAP_RESOURCE
Returns A Resource that tracks that Memory Mapping and the mappings start address,
By default the resource is a global resource meaning it lives as long as the process,
The resource’s lifetime can be thread bound with the flag F_LOCAL, when the thread exits the resource will be dropped
To Manually Drop the resource aside from relaying on lifetimes use SyscallTable::SysRDestroy,
To Sync the Memory with the associated File or Device you can either destroy it, let it die or use SyscallTable::SysIOSync
Other flags include:
Trait Implementations§
Source§impl Clone for SyscallTable
impl Clone for SyscallTable
Source§fn clone(&self) -> SyscallTable
fn clone(&self) -> SyscallTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more