pub struct Process {Show 17 fields
vm: VirtualMemoryMapper,
context: ProcessContext,
id: u64,
parent_id: u64,
open_filesystem_nodes: BTreeMap<usize, FilesystemNode>,
file_index_allocator: GoingUpAllocator,
argv: Vec<String>,
file_path: PathBuf,
current_dir: Directory,
stack_ptr_end: usize,
stack_size: usize,
heap_start: usize,
heap_size: usize,
heap_max: usize,
priority: PriorityLevel,
exit_code: i32,
children_exits: BTreeMap<u64, i32>,
}
Fields§
§vm: VirtualMemoryMapper
§context: ProcessContext
§id: u64
§parent_id: u64
§open_filesystem_nodes: BTreeMap<usize, FilesystemNode>
§file_index_allocator: GoingUpAllocator
§argv: Vec<String>
§file_path: PathBuf
§current_dir: Directory
§stack_ptr_end: usize
§stack_size: usize
§heap_start: usize
§heap_size: usize
§heap_max: usize
§priority: PriorityLevel
§exit_code: i32
§children_exits: BTreeMap<u64, i32>
Implementations§
Source§impl Process
impl Process
pub fn allocate_process( parent_id: u64, elf: &Elf, file: &mut File, argv: Vec<String>, current_dir: Directory, ) -> Result<Self, ProcessError>
Sourcepub unsafe fn switch_to_this_vm(&mut self)
pub unsafe fn switch_to_this_vm(&mut self)
§Safety
Check virtual_memory_mapper::VirtualMemoryMapper::switch_to_this
for more info
pub fn id(&self) -> u64
pub fn parent_id(&self) -> u64
pub fn is_user_address_mapped(&self, address: usize) -> bool
pub fn finish_stdio(&mut self)
pub fn push_fs_node<F: Into<FilesystemNode>>(&mut self, file: F) -> usize
pub fn attach_fs_node_to_fd<F: Into<FilesystemNode>>( &mut self, fd: usize, file: F, ) -> bool
pub fn get_fs_node(&mut self, fd: usize) -> Option<&mut FilesystemNode>
pub fn take_fs_node(&mut self, fd: usize) -> Option<FilesystemNode>
pub fn put_fs_node(&mut self, fd: usize, file: FilesystemNode)
Sourcepub fn exit(&mut self, exit_code: i32)
pub fn exit(&mut self, exit_code: i32)
Sets the exit_code and prepare to release the resources held by this process
The scheduler will handle the state
of the process
pub fn add_child_exit(&mut self, pid: u64, exit_code: i32)
pub fn get_child_exit(&mut self, pid: u64) -> Option<i32>
Sourcepub fn add_to_heap(&mut self, increment: isize) -> Option<usize>
pub fn add_to_heap(&mut self, increment: isize) -> Option<usize>
Add/Remove to/from the heap and return the previous end of the heap before the change
If this is an Add
, it will return the address of the new block
If this is a Remove
, the result will generally be useless
Use with 0
to get the current heap end
pub fn get_current_dir(&self) -> &Directory
pub fn set_current_dir(&mut self, current_dir: Directory)
pub fn get_priority(&self) -> PriorityLevel
pub fn set_priority(&mut self, priority: PriorityLevel)
pub fn file_path(&self) -> &Path
Source§impl Process
impl Process
fn prepare_stack( vm: &mut VirtualMemoryMapper, argv: &[String], rsp: u64, stack_top: u64, ) -> (u64, u64, u64)
fn write_process_meta( vm: &mut VirtualMemoryMapper, process_meta_addr: usize, process_meta: ProcessMetadata, )
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Process
impl !RefUnwindSafe for Process
impl Send for Process
impl Sync for Process
impl Unpin for Process
impl !UnwindSafe for Process
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.