diff --git a/userprog/syscall.c b/userprog/syscall.c index c41e06f9dfd9f5eb441d76342dbb900811cc0449..e08f21a5955ada96170c0966f37edad2ebe3074e 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c @@ -82,15 +82,15 @@ syscall_handler (struct intr_frame *f UNUSED) static struct list *file_list; +// Goes through all the files in the file_list and looks for the 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) + struct list_elem *list_element; + *list_element = *list_begin(file_list); + while ((curr_file->file_descriptor != f->file_descriptor) && + (is_tail(curr_file->list_element) == false) ) { - list_next(*curr_file->list_element); + *list_element = curr_file->list_element; + list_next(list_element); } - f->file = NULL; } \ No newline at end of file