diff --git a/src/threads/thread.c b/src/threads/thread.c index 457f7b9..04380dd 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -1,5 +1,6 @@ #include "threads/thread.h" #include +#include #include #include #include @@ -15,6 +16,7 @@ #include "threads/vaddr.h" #ifdef USERPROG #include "userprog/process.h" +#include "userprog/syscall.h" #endif /* Random value for struct thread's `magic' member. @@ -660,6 +662,7 @@ init_thread (struct thread *t, const char *name, int nice, int priority, t->priority = t->base_priority; t->exit_status = -1; + hash_init (&t->open_files, fd_hash, fd_less, NULL); old_level = intr_disable (); list_push_back (&all_list, &t->allelem); diff --git a/src/threads/thread.h b/src/threads/thread.h index 1c05030..d17b4d7 100644 --- a/src/threads/thread.h +++ b/src/threads/thread.h @@ -2,6 +2,7 @@ #define THREADS_THREAD_H #include +#include #include #include #include "threads/fixed-point.h" @@ -116,6 +117,7 @@ struct thread #ifdef USERPROG /* Owned by userprog/process.c. */ uint32_t *pagedir; /* Page directory. */ + struct hash open_files; /* Hash Table of FD -> Struct File */ #endif /* Owned by thread.c. */