diff options
author | Anton Kling <anton@kling.gg> | 2024-04-15 20:34:58 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-04-15 20:34:58 +0200 |
commit | 62ba2a9ab01e5f2a9b1cd325af8d3112702b7713 (patch) | |
tree | 0926fbbc9d8c0058ee0f37e4f8691a554ca647e3 /kernel/sched | |
parent | 3acd8cf6c8e41c1e1228c60ac5c4ea0f69e7aff5 (diff) |
Bug fix and cleanup.
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/scheduler.c | 18 | ||||
-rw-r--r-- | kernel/sched/scheduler.h | 2 |
2 files changed, 5 insertions, 15 deletions
diff --git a/kernel/sched/scheduler.c b/kernel/sched/scheduler.c index 6f36a76..f56ff56 100644 --- a/kernel/sched/scheduler.c +++ b/kernel/sched/scheduler.c @@ -102,12 +102,13 @@ void insert_eip_on_stack(u32 cr3, u32 address, u32 value); process_t *create_process(process_t *p, u32 esp, u32 eip) { process_t *r; r = kcalloc(1, sizeof(process_t)); - r->pid = next_pid++; + r->pid = next_pid; + next_pid++; if (!p) { assert(1 == next_pid); - strncpy(r->program_name, "[kernel]", sizeof(current_task->program_name)); + strlcpy(r->program_name, "[kernel]", sizeof(current_task->program_name)); } else { - strncpy(r->program_name, "[Not yet named]", + strlcpy(r->program_name, "[Not yet named]", sizeof(current_task->program_name)); } @@ -182,8 +183,6 @@ void tasking_init(void) { int i = 0; void free_process(process_t *p) { - kprintf("pid: %x\n", p->pid); - kprintf("Exiting process: %s\n", p->program_name); // free_process() will purge all contents such as allocated frames // out of the current process. This will be called by exit() and // exec*(). @@ -304,7 +303,7 @@ int exec(const char *filename, char **argv, int dealloc_argv, return 0; } - strncpy(current_task->program_name, filename, + strlcpy(current_task->program_name, filename, sizeof(current_task->program_name)); current_task->data_segment_end = align_page((void *)end_of_code); @@ -405,13 +404,6 @@ int is_halted(process_t *process) { } } - if (process->is_halted) { - if (ipc_has_data(process)) { - kprintf("ipc had data\n"); - return 0; - } - } - int queue_block = 1; int wait_empty = 1; for (int i = 0;; i++) { diff --git a/kernel/sched/scheduler.h b/kernel/sched/scheduler.h index bdf32d4..04259c2 100644 --- a/kernel/sched/scheduler.h +++ b/kernel/sched/scheduler.h @@ -3,7 +3,6 @@ typedef struct Process process_t; #define SCHEDULER_H #include <fs/ext2.h> #include <fs/vfs.h> -#include <ipc.h> #include <lib/list.h> #include <lib/stack.h> #include <mmu.h> @@ -61,7 +60,6 @@ struct Process { void *signal_handlers[32]; void *interrupt_handler; PageDirectory *cr3; - struct IpcMailbox ipc_mailbox; struct list file_descriptors; |