diff options
author | Anton Kling <anton@kling.gg> | 2024-02-19 18:52:30 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-02-19 18:52:30 +0100 |
commit | 239e33019117f4ab59dd26550d7969e45c290166 (patch) | |
tree | de180effd804573d07acf8ac495fa7defc1edd70 /kernel/sched | |
parent | 61c443579150a4714c132ecb1ac18779535f91c9 (diff) |
Kernel/VFS: Cleanup of file descriptor halts
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/scheduler.c | 17 | ||||
-rw-r--r-- | kernel/sched/scheduler.h | 11 |
2 files changed, 13 insertions, 15 deletions
diff --git a/kernel/sched/scheduler.c b/kernel/sched/scheduler.c index 8cb5af7..5a95c4c 100644 --- a/kernel/sched/scheduler.c +++ b/kernel/sched/scheduler.c @@ -119,6 +119,10 @@ process_t *create_process(process_t *p, u32 esp, u32 eip) { r->tcb = kcalloc(1, sizeof(struct TCB)); r->tcb->CR3 = r->cr3->physical_address; + list_init(&r->read_list); + list_init(&r->write_list); + list_init(&r->disconnect_list); + // Temporarily switch to the page directory to be able to place the // "entry_instruction_pointer" onto the stack. @@ -155,12 +159,6 @@ process_t *create_process(process_t *p, u32 esp, u32 eip) { } else { r->file_descriptors[i] = NULL; } - if (i < 20) - r->signal_handlers[i] = NULL; - r->read_halt_inode[i] = NULL; - r->write_halt_inode[i] = NULL; - r->disconnect_halt_inode[i] = NULL; - r->maps[i] = NULL; } return r; } @@ -332,8 +330,7 @@ int is_halted(process_t *process) { if (process->halts[i]) return 1; - if (isset_fdhalt(process->read_halt_inode, process->write_halt_inode, - process->disconnect_halt_inode)) { + if (isset_fdhalt(process)) { return 1; } return 0; @@ -349,7 +346,7 @@ process_t *next_task(process_t *c) { if (1 == loop) { return s; } - loop = 1; + // loop = 1; } c = c->next; if (!c) @@ -387,8 +384,8 @@ void switch_task() { if (!current_task) { return; } - disable_interrupts(); + disable_interrupts(); current_task = next_task((process_t *)current_task); active_directory = current_task->cr3; diff --git a/kernel/sched/scheduler.h b/kernel/sched/scheduler.h index 0580ba0..f185e0f 100644 --- a/kernel/sched/scheduler.h +++ b/kernel/sched/scheduler.h @@ -1,9 +1,11 @@ +typedef struct Process process_t; #ifndef SCHEDULER_H #define SCHEDULER_H #include <fs/ext2.h> #include <fs/vfs.h> #include <halts.h> #include <ipc.h> +#include <lib/list.h> #include <lib/stack.h> #include <mmu.h> #include <signal.h> @@ -37,8 +39,6 @@ typedef struct { uintptr_t handler_ip; } signal_t; -typedef struct Process process_t; - typedef struct TCB { uint32_t ESP; uint32_t CR3; @@ -64,9 +64,10 @@ struct Process { PageDirectory *cr3; struct IpcMailbox ipc_mailbox; vfs_fd_t *file_descriptors[100]; - vfs_inode_t *read_halt_inode[100]; - vfs_inode_t *write_halt_inode[100]; - vfs_inode_t *disconnect_halt_inode[100]; + + struct list read_list; + struct list write_list; + struct list disconnect_list; struct stack restore_context_stack; struct stack signal_stack; |