From 2e8b474d4219e7faaac3823e73c8d528c2698a37 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 14 Mar 2024 13:09:59 +0100 Subject: random changes made --- kernel/lib/list.c | 5 ++++- kernel/lib/list.h | 2 +- kernel/lib/stack.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'kernel/lib') diff --git a/kernel/lib/list.c b/kernel/lib/list.c index 12104d8..9cdcd01 100644 --- a/kernel/lib/list.c +++ b/kernel/lib/list.c @@ -16,13 +16,16 @@ void list_reset(struct list *list) { list->tail_index = -1; } -int list_add(struct list *list, void *entry) { +int list_add(struct list *list, void *entry, int *index) { if (list->tail_index > 100 - 1) { kprintf("Error: list has run out of space\n"); assert(0); } list->tail_index++; list->entries[list->tail_index] = entry; + if(index) { + *index = list->tail_index; + } return 1; } diff --git a/kernel/lib/list.h b/kernel/lib/list.h index 8c3cce4..6ab9e0b 100644 --- a/kernel/lib/list.h +++ b/kernel/lib/list.h @@ -8,6 +8,6 @@ struct list { int list_init(struct list *list); void list_reset(struct list *list); void list_free(struct list *list); -int list_add(struct list *list, void *entry); +int list_add(struct list *list, void *entry, int *index); int list_get(const struct list *list, int index, void **out); #endif diff --git a/kernel/lib/stack.c b/kernel/lib/stack.c index 7f31867..7283b35 100644 --- a/kernel/lib/stack.c +++ b/kernel/lib/stack.c @@ -1,3 +1,4 @@ +#include #include #include #include -- cgit v1.2.3