pub struct LinuxRiscv64Abi {
namespace: Arc<TaskNamespace>,
fd_to_handle: Vec<Option<u32>>,
fd_flags: Vec<u32>,
file_status_flags: Vec<u32>,
free_fds: Vec<usize>,
pub signal_state: Arc<Mutex<SignalState>>,
thread_state: LinuxThreadState,
posix_timers: BTreeMap<u64, PosixTimer>,
next_timer_id: u64,
}Fields§
§namespace: Arc<TaskNamespace>Task namespace for Linux PID/TID management
fd_to_handle: Vec<Option<u32>>File descriptor to handle mapping table (fd -> handle) None means the fd is not allocated Vec to avoid stack overflow during initialization
fd_flags: Vec<u32>File descriptor flags (e.g., FD_CLOEXEC) Vec to avoid stack overflow during initialization
file_status_flags: Vec<u32>File status flags (e.g., O_NONBLOCK) for F_GETFL/F_SETFL Vec to avoid stack overflow during initialization
free_fds: Vec<usize>Free file descriptor list for O(1) allocation/deallocation
signal_state: Arc<Mutex<SignalState>>Signal handling state
thread_state: LinuxThreadStateLinux-specific per-task thread state (isolated inside ABI)
posix_timers: BTreeMap<u64, PosixTimer>POSIX timers created via timer_create
next_timer_id: u64Next timer identifier (Linux timer_t)
Implementations§
Source§impl LinuxRiscv64Abi
impl LinuxRiscv64Abi
pub fn thread_state(&self) -> &LinuxThreadState
pub fn thread_state_mut(&mut self) -> &mut LinuxThreadState
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 allocate_specific_fd(
&mut self,
fd: usize,
handle: u32,
) -> Result<(), &'static str>
pub fn allocate_specific_fd( &mut self, fd: usize, handle: u32, ) -> Result<(), &'static str>
Allocate a specific 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 remove_fd(&mut self, fd: usize) -> Option<u32>
pub fn remove_fd(&mut self, fd: usize) -> Option<u32>
Remove file descriptor mapping and clear its flags
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 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 get_fd_flags(&self, fd: usize) -> Option<u32>
pub fn get_fd_flags(&self, fd: usize) -> Option<u32>
Get file descriptor flags
Sourcepub fn set_fd_flags(
&mut self,
fd: usize,
flags: u32,
) -> Result<(), &'static str>
pub fn set_fd_flags( &mut self, fd: usize, flags: u32, ) -> Result<(), &'static str>
Set file descriptor flags
Sourcepub fn get_file_status_flags(&self, fd: usize) -> Option<u32>
pub fn get_file_status_flags(&self, fd: usize) -> Option<u32>
Get file status flags (F_GETFL)
Sourcepub fn set_file_status_flags(
&mut self,
fd: usize,
flags: u32,
) -> Result<(), &'static str>
pub fn set_file_status_flags( &mut self, fd: usize, flags: u32, ) -> Result<(), &'static str>
Set file status flags (F_SETFL)
Sourcepub fn allocated_fds(&self) -> Vec<usize>
pub fn allocated_fds(&self) -> Vec<usize>
Get the list of allocated file descriptors (for debugging)
Sourcepub fn process_signals(&self, trapframe: &mut Trapframe) -> bool
pub fn process_signals(&self, trapframe: &mut Trapframe) -> bool
Process pending signals and handle them according to Linux semantics Returns true if execution should be interrupted (signal handler called or process terminated)
Sourcepub fn handle_event_direct(&self, event: &Event)
pub fn handle_event_direct(&self, event: &Event)
Handle incoming event from Scarlet event system and convert to signal if applicable
Sourcepub fn has_pending_signals(&self) -> bool
pub fn has_pending_signals(&self) -> bool
Check if there are pending signals ready for delivery
Sourcepub fn allocate_posix_timer_id(&mut self) -> u64
pub fn allocate_posix_timer_id(&mut self) -> u64
Allocate a unique timer identifier for POSIX timers
Sourcepub fn store_posix_timer(&mut self, timer: PosixTimer)
pub fn store_posix_timer(&mut self, timer: PosixTimer)
Store a POSIX timer definition tracked by this ABI instance
Sourcepub fn get_posix_timer(&self, id: u64) -> Option<&PosixTimer>
pub fn get_posix_timer(&self, id: u64) -> Option<&PosixTimer>
Retrieve a reference to a stored POSIX timer
Sourcepub fn remove_posix_timer(&mut self, id: u64) -> Option<PosixTimer>
pub fn remove_posix_timer(&mut self, id: u64) -> Option<PosixTimer>
Remove a POSIX timer from this ABI instance
Trait Implementations§
Source§impl AbiModule for LinuxRiscv64Abi
impl AbiModule for LinuxRiscv64Abi
fn name() -> &'static str
fn get_name(&self) -> String
Source§fn clone_boxed(&self) -> Box<dyn AbiModule + Send + Sync>
fn clone_boxed(&self) -> Box<dyn AbiModule + Send + Sync>
fn handle_syscall( &mut self, trapframe: &mut Trapframe, ) -> Result<usize, &'static str>
Source§fn handle_event(
&self,
event: Event,
target_task_id: u32,
) -> Result<(), &'static str>
fn handle_event( &self, event: Event, target_task_id: u32, ) -> Result<(), &'static str>
Source§fn on_task_cloned(
&mut self,
_parent_task: &Task,
_child_task: &Task,
_flags: CloneFlags,
) -> Result<(), &'static str>
fn on_task_cloned( &mut self, _parent_task: &Task, _child_task: &Task, _flags: CloneFlags, ) -> Result<(), &'static str>
Source§fn on_task_exit(&mut self, task: &Task)
fn on_task_exit(&mut self, task: &Task)
Source§fn get_task_namespace(&self) -> Arc<TaskNamespace>
fn get_task_namespace(&self) -> Arc<TaskNamespace>
Source§fn can_execute_binary(
&self,
file_object: &KernelObject,
file_path: &str,
current_abi: Option<&(dyn AbiModule + Send + Sync)>,
) -> Option<u8>
fn can_execute_binary( &self, file_object: &KernelObject, file_path: &str, current_abi: Option<&(dyn AbiModule + Send + Sync)>, ) -> Option<u8>
Source§fn execute_binary(
&self,
file_object: &KernelObject,
argv: &[&str],
envp: &[&str],
task: &Task,
trapframe: &mut Trapframe,
) -> Result<(), &'static str>
fn execute_binary( &self, file_object: &KernelObject, argv: &[&str], envp: &[&str], task: &Task, trapframe: &mut Trapframe, ) -> Result<(), &'static str>
Source§fn get_default_cwd(&self) -> &str
fn get_default_cwd(&self) -> &str
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>
Source§fn initialize_from_existing_handles(
&mut self,
_task: &Task,
) -> Result<(), &'static str>
fn initialize_from_existing_handles( &mut self, _task: &Task, ) -> Result<(), &'static str>
Source§fn normalize_env_to_scarlet(&self, _envp: &mut Vec<String>)
fn normalize_env_to_scarlet(&self, _envp: &mut Vec<String>)
Source§fn denormalize_env_from_scarlet(&self, _envp: &mut Vec<String>)
fn denormalize_env_from_scarlet(&self, _envp: &mut Vec<String>)
Source§fn choose_load_address(
&self,
_elf_type: u16,
_target: LoadTarget,
) -> Option<u64>
fn choose_load_address( &self, _elf_type: u16, _target: LoadTarget, ) -> Option<u64>
Source§fn get_interpreter_path(&self, requested_interpreter: &str) -> String
fn get_interpreter_path(&self, requested_interpreter: &str) -> String
Source§fn get_runtime_config(
&self,
_file_object: &KernelObject,
_file_path: &str,
) -> Option<RuntimeConfig>
fn get_runtime_config( &self, _file_object: &KernelObject, _file_path: &str, ) -> Option<RuntimeConfig>
Source§fn set_tls_pointer(&mut self, _ptr: usize)
fn set_tls_pointer(&mut self, _ptr: usize)
Source§fn get_tls_pointer(&self) -> Option<usize>
fn get_tls_pointer(&self) -> Option<usize>
Source§fn set_clear_child_tid(&mut self, _ptr: usize)
fn set_clear_child_tid(&mut self, _ptr: usize)
Source§impl Clone for LinuxRiscv64Abi
impl Clone for LinuxRiscv64Abi
Source§fn clone(&self) -> LinuxRiscv64Abi
fn clone(&self) -> LinuxRiscv64Abi
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LinuxRiscv64Abi
impl !RefUnwindSafe for LinuxRiscv64Abi
impl Send for LinuxRiscv64Abi
impl Sync for LinuxRiscv64Abi
impl Unpin for LinuxRiscv64Abi
impl !UnwindSafe for LinuxRiscv64Abi
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
§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)
clone_to_uninit)