pub struct Process {Show 13 fields
pub parent: AtomicU64,
pub children: Mutex<Vec<Arc<Process>>>,
pub tasks: Mutex<Vec<AxTaskRef>>,
pub fd_manager: FdManager,
pub is_zombie: AtomicBool,
pub exit_code: AtomicI32,
pub memory_set: Mutex<Arc<Mutex<MemorySet>>>,
pub heap_bottom: AtomicU64,
pub heap_top: AtomicU64,
pub signal_modules: Mutex<BTreeMap<u64, SignalModule>>,
pub robust_list: Mutex<BTreeMap<u64, FutexRobustList>>,
pub blocked_by_vfork: Mutex<bool>,
pub file_path: Mutex<String>,
/* private fields */
}
Expand description
The process control block
Fields§
§parent: AtomicU64
父进程号
children: Mutex<Vec<Arc<Process>>>
子进程
tasks: Mutex<Vec<AxTaskRef>>
所管理的线程
fd_manager: FdManager
文件描述符管理器
is_zombie: AtomicBool
进程状态
exit_code: AtomicI32
退出状态码
memory_set: Mutex<Arc<Mutex<MemorySet>>>
地址空间
heap_bottom: AtomicU64
用户堆基址,任何时候堆顶都不能比这个值小,理论上讲是一个常量
heap_top: AtomicU64
当前用户堆的堆顶,不能小于基址,不能大于基址加堆的最大大小
signal_modules: Mutex<BTreeMap<u64, SignalModule>>
信号处理模块 第一维代表TaskID,第二维代表对应的信号处理模块
robust_list: Mutex<BTreeMap<u64, FutexRobustList>>
robust list存储模块 用来存储线程对共享变量的使用地址 具体使用交给了用户空间
blocked_by_vfork: Mutex<bool>
是否被vfork阻塞
file_path: Mutex<String>
该进程可执行文件所在的路径
Implementations§
source§impl Process
impl Process
sourcepub fn get_parent(&self) -> u64
pub fn get_parent(&self) -> u64
get the parent process id
sourcepub fn set_parent(&self, parent: u64)
pub fn set_parent(&self, parent: u64)
set the parent process id
sourcepub fn get_exit_code(&self) -> i32
pub fn get_exit_code(&self) -> i32
get the exit code of the process
sourcepub fn set_exit_code(&self, exit_code: i32)
pub fn set_exit_code(&self, exit_code: i32)
set the exit code of the process
sourcepub fn get_zombie(&self) -> bool
pub fn get_zombie(&self) -> bool
whether the process is a zombie process
sourcepub fn set_zombie(&self, status: bool)
pub fn set_zombie(&self, status: bool)
set the process as a zombie process
sourcepub fn get_heap_top(&self) -> u64
pub fn get_heap_top(&self) -> u64
get the heap top of the process
sourcepub fn set_heap_top(&self, top: u64)
pub fn set_heap_top(&self, top: u64)
set the heap top of the process
sourcepub fn get_heap_bottom(&self) -> u64
pub fn get_heap_bottom(&self) -> u64
get the heap bottom of the process
sourcepub fn set_heap_bottom(&self, bottom: u64)
pub fn set_heap_bottom(&self, bottom: u64)
set the heap bottom of the process
sourcepub fn set_vfork_block(&self, value: bool)
pub fn set_vfork_block(&self, value: bool)
set the process as blocked by vfork
sourcepub fn set_file_path(&self, path: String)
pub fn set_file_path(&self, path: String)
set the executable file path of the process
sourcepub fn get_file_path(&self) -> String
pub fn get_file_path(&self) -> String
get the executable file path of the process
sourcepub fn get_code_if_exit(&self) -> Option<i32>
pub fn get_code_if_exit(&self) -> Option<i32>
若进程运行完成,则获取其返回码 若正在运行(可能上锁或没有上锁),则返回None
source§impl Process
impl Process
source§impl Process
impl Process
与地址空间相关的进程方法
Auto Trait Implementations§
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