From 8fdff36c653c3b4e5add8bf4d19d3489c3ef17e5 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sat, 11 Sep 2021 09:54:58 +0200 Subject: [PATCH] changed EABORT to ETIMEOUT for marking timeouts --- kinclude/ktypes.h | 8 +++++--- kinclude/sched.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kinclude/ktypes.h b/kinclude/ktypes.h index 642ccc5..f67edc8 100644 --- a/kinclude/ktypes.h +++ b/kinclude/ktypes.h @@ -13,7 +13,7 @@ enum error_code { ENOMEM = 3, // not enough memory ENOBUFS = 4, // no space left in buffer ESRCH = 5, // no such process - EABORT = 6 + ETIMEOUT= 6 // timeout while waiting }; /* @@ -33,16 +33,18 @@ struct loaded_binary; struct process_control_block { int pid; + // state information int pc; int regs[31]; int exit_code; // scheduling information enum process_status status; struct process_control_block* waiting_for_process; - struct loaded_binary* binary; unsigned long long int asleep_until; - // parent + // hierarchical information + struct loaded_binary* binary; struct process_control_block* parent; + // memory management information void* stack_top; }; diff --git a/kinclude/sched.c b/kinclude/sched.c index ac0ee12..89cb29a 100644 --- a/kinclude/sched.c +++ b/kinclude/sched.c @@ -103,7 +103,7 @@ struct process_control_block* scheduler_select_free() if (pcb->asleep_until != 0) { if (pcb->asleep_until < mtime) { // if the timeout ran out, set an error code - pcb->regs[REG_A0 + 1] = EABORT; + pcb->regs[REG_A0 + 1] = ETIMEOUT; pcb->status = PROC_RDY; return pcb; }