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
impl Xv6Riscv64Abi
Sourcepub fn allocate_fd(&mut self, handle: u32) -> Result<usize, &'static str>
pub fn allocate_fd(&mut self, handle: u32) -> Result<usize, &'static str>
Allocate a new file descriptor and map it to a handle
Sourcepub fn get_handle(&self, fd: usize) -> Option<u32>
pub fn get_handle(&self, fd: usize) -> Option<u32>
Get handle from file descriptor
Sourcepub fn find_fd_by_handle(&self, handle: u32) -> Option<usize>
pub fn find_fd_by_handle(&self, handle: u32) -> Option<usize>
Find file descriptor by handle (linear search)
Sourcepub fn remove_handle(&mut self, handle: u32) -> Option<usize>
pub fn remove_handle(&mut self, handle: u32) -> Option<usize>
Remove handle mapping (requires linear search)
Sourcepub fn init_std_fds(
&mut self,
stdin_handle: u32,
stdout_handle: u32,
stderr_handle: u32,
)
pub fn init_std_fds( &mut self, stdin_handle: u32, stdout_handle: u32, stderr_handle: u32, )
Initialize standard file descriptors (stdin, stdout, stderr)
Sourcepub fn allocated_fds(&self) -> Vec<usize>
pub fn allocated_fds(&self) -> Vec<usize>
Get the list of allocated file descriptors (for debugging)
Trait Implementations§
Source§impl AbiModule for Xv6Riscv64Abi
impl AbiModule for Xv6Riscv64Abi
fn name() -> &'static str
fn get_name(&self) -> String
Source§fn clone_boxed(&self) -> Box<dyn AbiModule>
fn clone_boxed(&self) -> Box<dyn AbiModule>
Clone this ABI module into a boxed trait object Read more
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>
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>
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
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>
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
Setup shared resources accessible across all ABIs Read more
Source§fn initialize_from_existing_handles(
&self,
task: &mut Task,
) -> Result<(), &'static str>
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>)
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>)
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
impl Clone for Xv6Riscv64Abi
Source§fn clone(&self) -> Xv6Riscv64Abi
fn clone(&self) -> Xv6Riscv64Abi
Returns a copy of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)