#[repr(u16)]pub enum SyscallTable {
Show 47 variants
SysPExit = 0,
SysTYield = 1,
SysFSOpenAll = 2,
SysFSOpen = 25,
SysFSRemovePath = 28,
SysFDirIterOpen = 8,
SysRDestroy = 5,
SysDirIterClose = 9,
SysDirIterNext = 10,
SysIOWrite = 3,
SysIORead = 4,
SysIOPoll = 45,
SysFSCreate = 6,
SysFSCreateDir = 7,
SysIOSync = 16,
SysIOTruncate = 17,
SysIOCommand = 12,
SysRClone = 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,
SysMemShmCreate = 42,
SysMemShmOpen = 43,
SysSockCreate = 37,
SysSockBind = 38,
SysSockListen = 39,
SysSockAccept = 40,
SysSockConnect = 41,
SysSockSendTo = 46,
SysSockRecvFrom = 47,
SysVTTYAlloc = 44,
}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]
SysIOPoll = 45
Given a set of resources, waits for any of them to become ready for I/O (with specified events), returns the events that occurred causing the thread to wake up.
A single poll entry’s layout is defined in crate::poll::PollEntry.
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)
SysRClone = 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 Resource (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:
SysMemShmCreate = 42
Create a Shared Memory Descriptor, returning a key that points to it, The life time of that descriptor is bound to the calling process or the thread if a flag was specified.
The returned Key can then be opened from another process using SyscallTable::SysMemShmOpen and then SyscallTable::SysMemMapped,
instead of calling [SysMemShmOpen] afterwards this returns an Optional Resource ID that can be mapped directly using [SysMemMap] from the calling process,
but the desired Process to communicate with, should use SyscallTable::SysMemShmOpen to get it’s own copy.
The lifetime of the key is extended for each SyscallTable::SysMemShmOpen, so that it isn’t dropped until all the threads/processes that owns it are dropped.
SysMemShmOpen = 43
Creates a Resource that can be SyscallTable::SysMemMapped to a Shared Memory Descriptor,
Takes in a key that was created using SyscallTable::SysMemShmCreate.
The lifetime of the Resource is bound to the process or a single thread if a flag was specified
SysSockCreate = 37
Creates a Socket Descriptor resource
That resource just describes properties of the socket, and then can be upgraded using a [SyscallTable::SysSocketBind] to a Server Socket,
or can be used to connect to one
SysSockBind = 38
Binds a Server Socket or binds and upgrades a Socket Descriptor created SyscallTable::SysSockCreate to a Server Socket Resource
and binds it to an address
SysSockListen = 39
Configures a Server Socket’s, binded with SyscallTable::SysSockBind, listening queue, by default the socket cannot hold any pending connections before calling this
SysSockAccept = 40
Accepts a pending connection request from the listening queue configured with SyscallTable::SysSockListen takes in a Server Socket,
the pending connection request has been made using SyscallTable::SysSockConnect, returns a Resource describing the server’s end of the connection
SysSockConnect = 41
Takes in a Socket Descriptor created with SyscallTable::SysSockCreate, and a Server Socket address
and attempts to connect to a Server Socket binded using SyscallTable::SysSockBind,
returns a Resource describing the client’s end of the connection
SysSockSendTo = 46
Given a socket sends data to another socket’s address using the given socket with given flags, sends data to a connected socket if the target address is None
SysSockRecvFrom = 47
Given a socket, receive data from it with given flags then get the address that we received from if possible.
SysVTTYAlloc = 44
Allocates a single new pair of Mother VTTY interface and a child VTTY Interface. TODO: Write VTTY docs.
Trait Implementations§
Source§impl Clone for SyscallTable
impl Clone for SyscallTable
Source§fn clone(&self) -> SyscallTable
fn clone(&self) -> SyscallTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyscallTable
impl Debug for SyscallTable
Source§impl PartialEq for SyscallTable
impl PartialEq for SyscallTable
Source§fn eq(&self, other: &SyscallTable) -> bool
fn eq(&self, other: &SyscallTable) -> bool
self and other values to be equal, and is used by ==.