Skip to main content

ThreadsScheme

Struct ThreadsScheme 

Source
pub struct ThreadsScheme {
    states: SpinLock<BTreeMap<u64, OpState>>,
}

Fields§

§states: SpinLock<BTreeMap<u64, OpState>>

Implementations§

Source§

impl ThreadsScheme

Source

pub fn new() -> Self

Creates a new instance.

Source

fn alloc_file_id(op: Op) -> u64

Source

fn state_for(&self, file_id: u64) -> Result<(Op, OpState), SyscallError>

Source

fn take_state(&self, file_id: u64) -> Result<OpState, SyscallError>

Source

fn parse_join(path: &str) -> Result<u32, SyscallError>

Parse join/<tid> and validate kinship synchronously so errors surface at open time (self-join => EINVAL, missing/reaped child => ENOENT).

The blocking reap itself happens on read(), via thread_ops::join_task.

Source

fn handle_kill_open(path: &str) -> Result<(), SyscallError>

Parse kill/<tid>; the kill itself is performed by open() (Plan 9 style: opening the control file performs the action). Errors: ESRCH unknown tid, EPERM other thread group.

Source

fn root_listing(&self) -> Result<String, SyscallError>

Directory listing of the calling process’ threads (pattern procfs).

Source

fn handle_create_write(&self, buf: &[u8]) -> Result<u32, SyscallError>

Handle a write to /thread/create: parse the request, build the task with a kernel-owned stack, register it, and remember its TID.

Trait Implementations§

Source§

impl Default for ThreadsScheme

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Scheme for ThreadsScheme

Source§

fn open( &self, path: &str, _flags: OpenFlags, ) -> Result<OpenResult, SyscallError>

Open a file/resource at the given path within this scheme. Read more
Source§

fn read( &self, file_id: u64, offset: u64, buf: &mut [u8], ) -> Result<usize, SyscallError>

Read bytes from an open file.
Source§

fn write( &self, file_id: u64, _offset: u64, buf: &[u8], ) -> Result<usize, SyscallError>

Write bytes to an open file.
Source§

fn close(&self, file_id: u64) -> Result<(), SyscallError>

Close an open file.
Source§

fn stat(&self, file_id: u64) -> Result<FileStat, SyscallError>

Get metadata for an open file.
Source§

fn readdir(&self, _file_id: u64) -> Result<Vec<DirEntry>, SyscallError>

Read directory entries from an open directory handle.
Source§

fn async_read( &self, file_id: u64, offset: u64, user_buf_vaddr: u64, len: usize, _ring_id: u64, _user_data: u64, ) -> Result<AsyncSubmitResult, SyscallError>

Submit a read against a userspace buffer for async I/O. Read more
Source§

fn async_write( &self, file_id: u64, offset: u64, user_buf_vaddr: u64, len: usize, _ring_id: u64, _user_data: u64, ) -> Result<AsyncSubmitResult, SyscallError>

Submit a write sourced from a userspace buffer for async I/O. Read more
Source§

fn size(&self, file_id: u64) -> Result<u64, SyscallError>

Get file size (if supported).
Source§

fn truncate(&self, file_id: u64, new_size: u64) -> Result<(), SyscallError>

Truncate/resize a file (if supported).
Source§

fn truncate_by_path( &self, _path: &str, _new_size: u64, ) -> Result<(), SyscallError>

Truncate a file by path (avoids open/close round-trip). Read more
Source§

fn sync(&self, file_id: u64) -> Result<(), SyscallError>

Sync file to storage (if applicable).
Source§

fn create_file(&self, path: &str, mode: u32) -> Result<OpenResult, SyscallError>

Create a new regular file.
Source§

fn create_directory( &self, path: &str, mode: u32, ) -> Result<OpenResult, SyscallError>

Create a new directory.
Remove a file or directory.
Source§

fn rename(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>

Rename/move an entry within this scheme.
Source§

fn chmod(&self, path: &str, mode: u32) -> Result<(), SyscallError>

Change permission bits on a path.
Source§

fn fchmod(&self, file_id: u64, mode: u32) -> Result<(), SyscallError>

Change permission bits on an open file handle.
Create a hard link.
Create a symbolic link.
Read the target of a symbolic link.

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.