pub struct ThreadsScheme {
states: SpinLock<BTreeMap<u64, OpState>>,
}Fields§
§states: SpinLock<BTreeMap<u64, OpState>>Implementations§
Source§impl ThreadsScheme
impl ThreadsScheme
fn alloc_file_id(op: Op) -> u64
fn state_for(&self, file_id: u64) -> Result<(Op, OpState), SyscallError>
fn take_state(&self, file_id: u64) -> Result<OpState, SyscallError>
Sourcefn parse_join(path: &str) -> Result<u32, SyscallError>
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.
Sourcefn handle_kill_open(path: &str) -> Result<(), SyscallError>
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.
Sourcefn root_listing(&self) -> Result<String, SyscallError>
fn root_listing(&self) -> Result<String, SyscallError>
Directory listing of the calling process’ threads (pattern procfs).
Sourcefn handle_create_write(&self, buf: &[u8]) -> Result<u32, SyscallError>
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
impl Default for ThreadsScheme
Source§impl Scheme for ThreadsScheme
impl Scheme for ThreadsScheme
Source§fn open(
&self,
path: &str,
_flags: OpenFlags,
) -> Result<OpenResult, SyscallError>
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>
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>
fn write( &self, file_id: u64, _offset: u64, buf: &[u8], ) -> Result<usize, SyscallError>
Write bytes to an open file.
Source§fn readdir(&self, _file_id: u64) -> Result<Vec<DirEntry>, SyscallError>
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>
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>
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 truncate(&self, file_id: u64, new_size: u64) -> Result<(), SyscallError>
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>
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>
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>
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>
fn create_directory( &self, path: &str, mode: u32, ) -> Result<OpenResult, SyscallError>
Create a new directory.
Source§fn rename(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
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>
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>
fn fchmod(&self, file_id: u64, mode: u32) -> Result<(), SyscallError>
Change permission bits on an open file handle.
Source§fn link(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
fn link(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
Create a hard link.
Auto Trait Implementations§
impl !Freeze for ThreadsScheme
impl !RefUnwindSafe for ThreadsScheme
impl Send for ThreadsScheme
impl Sync for ThreadsScheme
impl Unpin for ThreadsScheme
impl UnsafeUnpin for ThreadsScheme
impl UnwindSafe for ThreadsScheme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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