diff --git a/userprog/syscall.c b/userprog/syscall.c index 0d416297093bcec6ada3125813697f92197782a2..3a6db12fa2443bd197ede6db13a401f3533a665f 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c @@ -4,6 +4,7 @@ #include "system_calls.h" #include "threads/interrupt.h" #include "threads/thread.h" +#include "lib/kernel/list.h" // Dependencies for /* System call numbers. */ @@ -85,8 +86,17 @@ syscall_handler (struct intr_frame *f UNUSED) } } +static struct list *file_list; void file_search(struct file_map *f) { // TODO: Write file search + struct file_map *curr_file; + *curr_file->list_element = list_begin(file_list); + while ( + (curr_file->file_descriptor != f->file_descriptor) && + (*curr_file->list_element != file_list->tail) + ) { + list_next(*curr_file->list_element); + } f->file = NULL; } \ No newline at end of file