Struct os::task::TaskControlBlock
source · pub struct TaskControlBlock {
pub pid: PidHandle,
pub kernel_stack: KernelStack,
inner: UPSafeCell<TaskControlBlockInner>,
}
Expand description
Task control block structure
Directly save the contents that will not change during running
Fields§
§pid: PidHandle
Process identifier
kernel_stack: KernelStack
Kernel stack corresponding to PID
inner: UPSafeCell<TaskControlBlockInner>
Mutable
Implementations§
source§impl TaskControlBlock
impl TaskControlBlock
sourcepub fn inner_exclusive_access(&self) -> RefMut<'_, TaskControlBlockInner>
pub fn inner_exclusive_access(&self) -> RefMut<'_, TaskControlBlockInner>
Get the mutable reference of the inner TCB
sourcepub fn get_user_token(&self) -> usize
pub fn get_user_token(&self) -> usize
Get the address of app’s page table
source§impl TaskControlBlock
impl TaskControlBlock
sourcepub fn new(elf_data: &[u8]) -> Self
pub fn new(elf_data: &[u8]) -> Self
Create a new process
At present, it is only used for the creation of initproc
sourcepub fn exec(&self, elf_data: &[u8])
pub fn exec(&self, elf_data: &[u8])
Load a new elf to replace the original application address space and start execution
sourcepub fn change_program_brk(&self, size: i32) -> Option<usize>
pub fn change_program_brk(&self, size: i32) -> Option<usize>
change the location of the program break. return None if failed.
Auto Trait Implementations§
impl !Freeze for TaskControlBlock
impl !RefUnwindSafe for TaskControlBlock
impl Send for TaskControlBlock
impl Sync for TaskControlBlock
impl Unpin for TaskControlBlock
impl !UnwindSafe for TaskControlBlock
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