CeDOS - Commit dd756f50

kernel: sched: Add return value to process_wait Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
Celina Sophie Kalus
Fri, 25 Jul 2025 19:26:26 +0200
2 files changed, 19 insertions(+), 17 deletions(-)
M kernel/sched/sched.ckernel/sched/sched.c

@@ -275,15 +275,17 @@ crit_exit();

return success; } -void sched_wait(PROCESS_ID pid) { - assert(pid != current_pid); +int sched_wait(PROCESS_ID pid) { + assert(pid != current_pid); - while (1) { - PROCESS *p = get_process(pid); - if (p == NULL || p->state == PSTATE_TERMINATED) { break; } + while (1) { + PROCESS *p = get_process(pid); + if (p == NULL || p->state == PSTATE_TERMINATED) { break; } - sched_yield(); - } + sched_yield(); + } + + return 0; } int sched_start(void) {
M kernel/sched/sched.hkernel/sched/sched.h

@@ -17,16 +17,16 @@ /*!

* Structure of the process stack when the scheduler is executed. */ typedef struct { - uint32_t edi; - uint32_t esi; - uint32_t ebp; - uint32_t esp; + uint32_t edi; + uint32_t esi; + uint32_t ebp; + uint32_t esp; uint32_t edx; - uint32_t ecx; - uint32_t ebx; - uint32_t eax; + uint32_t ecx; + uint32_t ebx; + uint32_t eax; uint32_t eip; - uint32_t cs; + uint32_t cs; uint32_t eflags; }__attribute__((packed)) SCHED_FRAME;

@@ -94,10 +94,10 @@ /*!

* Wait for a process to terminate. * \param pid Process ID of the process to wait for. */ -void sched_wait(PROCESS_ID pid); +int sched_wait(PROCESS_ID pid); /*! * The scheduler. */ void sched_interrupt_c(SCHED_FRAME * volatile frame, uint32_t volatile ebp); -#endif+#endif