SyscallNum

Enum SyscallNum 

Source
#[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

Source§

fn clone(&self) -> SyscallTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SyscallTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SyscallTable

Source§

fn eq(&self, other: &SyscallTable) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<u16> for SyscallTable

Source§

type Error = ()

The type returned in the event of a conversion error.
Source§

fn try_from( value: u16, ) -> Result<SyscallTable, <SyscallTable as TryFrom<u16>>::Error>

Performs the conversion.
Source§

impl Copy for SyscallTable

Source§

impl Eq for SyscallTable

Source§

impl StructuralPartialEq for SyscallTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.