Add ContextStatus::HardBlocked.

This commit is contained in:
4lDO2
2023-06-30 14:49:08 +02:00
parent 23fede5db0
commit afa61601c4
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -35,10 +35,27 @@ int_like!(ContextId, AtomicContextId, usize, AtomicUsize);
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Status {
Runnable,
// TODO: Rename to SoftBlocked and move status_reason to this variant.
/// Not currently runnable, typically due to some blocking syscall, but it can be trivially
/// unblocked by e.g. signals.
Blocked,
/// Not currently runnable, and cannot be runnable until manually unblocked, depending on what
/// reason.
HardBlocked { reason: HardBlockedReason },
Stopped(usize),
Exited(usize),
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum HardBlockedReason {
AwaitingMmap,
// TODO: PageFaultOom?
// TODO: NotYetStarted/ManuallyBlocked (when new contexts are created)
// TODO: ptrace_stop?
}
#[derive(Copy, Clone, Debug)]
pub struct WaitpidKey {
+1 -1
View File
@@ -43,7 +43,7 @@ pub fn resource() -> Result<Vec<u8>> {
context::Status::Runnable => {
stat_string.push('R');
},
context::Status::Blocked => if context.wake.is_some() {
context::Status::Blocked | context::Status::HardBlocked { .. } => if context.wake.is_some() {
stat_string.push('S');
} else {
stat_string.push('B');