xref: /DragonOS/kernel/src/process/utils.rs (revision b5b571e02693d91eb6918d3b7561e088c3e7ee81)
1*b5b571e0SLoGin use crate::process::ProcessManager;
2*b5b571e0SLoGin 
3*b5b571e0SLoGin use super::{ProcessFlags, __PROCESS_MANAGEMENT_INIT_DONE};
4*b5b571e0SLoGin 
current_pcb_flags() -> ProcessFlags5*b5b571e0SLoGin pub fn current_pcb_flags() -> ProcessFlags {
6*b5b571e0SLoGin     if unsafe { !__PROCESS_MANAGEMENT_INIT_DONE } {
7*b5b571e0SLoGin         return ProcessFlags::empty();
8*b5b571e0SLoGin     }
9*b5b571e0SLoGin     return *ProcessManager::current_pcb().flags();
10*b5b571e0SLoGin }
11*b5b571e0SLoGin 
current_pcb_preempt_count() -> usize12*b5b571e0SLoGin pub fn current_pcb_preempt_count() -> usize {
13*b5b571e0SLoGin     if unsafe { !__PROCESS_MANAGEMENT_INIT_DONE } {
14*b5b571e0SLoGin         return 0;
15*b5b571e0SLoGin     }
16*b5b571e0SLoGin     return ProcessManager::current_pcb().preempt_count();
17*b5b571e0SLoGin }
18