Struct Xv6Riscv64Abi

Source
pub struct Xv6Riscv64Abi {
    fd_to_handle: [Option<u32>; 1024],
    free_fds: Vec<usize>,
}

Fields§

§fd_to_handle: [Option<u32>; 1024]

File descriptor to handle mapping table (fd -> handle) None means the fd is not allocated

§free_fds: Vec<usize>

Free file descriptor list for O(1) allocation/deallocation

Implementations§

Source§

impl Xv6Riscv64Abi

Source

pub fn allocate_fd(&mut self, handle: u32) -> Result<usize, &'static str>

Allocate a new file descriptor and map it to a handle

Source

pub fn get_handle(&self, fd: usize) -> Option<u32>

Get handle from file descriptor

Source

pub fn remove_fd(&mut self, fd: usize) -> Option<u32>

Remove file descriptor mapping

Source

pub fn find_fd_by_handle(&self, handle: u32) -> Option<usize>

Find file descriptor by handle (linear search)

Source

pub fn remove_handle(&mut self, handle: u32) -> Option<usize>

Remove handle mapping (requires linear search)

Source

pub fn init_std_fds( &mut self, stdin_handle: u32, stdout_handle: u32, stderr_handle: u32, )

Initialize standard file descriptors (stdin, stdout, stderr)

Source

pub fn fd_count(&self) -> usize

Get total number of allocated file descriptors

Source

pub fn allocated_fds(&self) -> Vec<usize>

Get the list of allocated file descriptors (for debugging)

Trait Implementations§

Source§

impl AbiModule for Xv6Riscv64Abi

Source§

fn name() -> &'static str

Source§

fn get_name(&self) -> String

Source§

fn clone_boxed(&self) -> Box<dyn AbiModule>

Clone this ABI module into a boxed trait object Read more
Source§

fn handle_syscall( &mut self, trapframe: &mut Trapframe, ) -> Result<usize, &'static str>

Source§

fn can_execute_binary( &self, file_object: &KernelObject, file_path: &str, current_abi: Option<&dyn AbiModule>, ) -> Option<u8>

Determine if a binary can be executed by this ABI and return confidence Read more
Source§

fn execute_binary( &self, file_object: &KernelObject, argv: &[&str], _envp: &[&str], task: &mut Task, trapframe: &mut Trapframe, ) -> Result<(), &'static str>

Binary execution (each ABI supports its own binary format) Read more
Source§

fn get_default_cwd(&self) -> &str

Get default working directory for this ABI
Source§

fn setup_overlay_environment( &self, target_vfs: &Arc<VfsManager>, base_vfs: &Arc<VfsManager>, system_path: &str, config_path: &str, ) -> Result<(), &'static str>

Setup overlay environment for this ABI (read-only base + writable layer) Read more
Source§

fn setup_shared_resources( &self, target_vfs: &Arc<VfsManager>, base_vfs: &Arc<VfsManager>, ) -> Result<(), &'static str>

Setup shared resources accessible across all ABIs Read more
Source§

fn initialize_from_existing_handles( &self, task: &mut Task, ) -> Result<(), &'static str>

Handle conversion when switching ABIs
Source§

fn normalize_env_to_scarlet(&self, _envp: &mut Vec<String>)

Convert environment variables from this ABI to Scarlet canonical format (in-place) Read more
Source§

fn denormalize_env_from_scarlet(&self, _envp: &mut Vec<String>)

Convert environment variables from Scarlet canonical format to this ABI’s format (in-place) Read more
Source§

impl Clone for Xv6Riscv64Abi

Source§

fn clone(&self) -> Xv6Riscv64Abi

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Default for Xv6Riscv64Abi

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Xv6Riscv64Abi

§

impl RefUnwindSafe for Xv6Riscv64Abi

§

impl Send for Xv6Riscv64Abi

§

impl Sync for Xv6Riscv64Abi

§

impl Unpin for Xv6Riscv64Abi

§

impl UnwindSafe for Xv6Riscv64Abi

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.