diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-02-05 15:40:28 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-02-05 15:40:28 +0100 |
| commit | 62b9f1b6b3fed01652153c5259427db97fe75e2c (patch) | |
| tree | 277d419da1b212a7c5316f03c8747b3a76e0f505 | |
| parent | e6b5b05535778b4b6e9131f473b95c9f2e106c60 (diff) | |
| download | pintos-62b9f1b6b3fed01652153c5259427db97fe75e2c.tar.gz | |
add fd to struct thread
| -rw-r--r-- | src/threads/thread.c | 1 | ||||
| -rw-r--r-- | src/threads/thread.h | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/threads/thread.c b/src/threads/thread.c index 92d1aa8..43dd8e3 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -13,6 +13,7 @@ #include "threads/vaddr.h" #ifdef USERPROG #include "userprog/process.h" +#include "threads/malloc.h" #endif /* Random value for struct thread's `magic' member. diff --git a/src/threads/thread.h b/src/threads/thread.h index 0039560..b209036 100644 --- a/src/threads/thread.h +++ b/src/threads/thread.h @@ -80,6 +80,12 @@ typedef int tid_t; only because they are mutually exclusive: only a thread in the ready state is on the run queue, whereas only a thread in the blocked state is on a semaphore wait list. */ +struct fd + { + bool active; + struct file *file; + }; + struct thread { /* Owned by thread.c. */ @@ -95,6 +101,10 @@ struct thread #ifdef USERPROG /* Owned by userprog/process.c. */ uint32_t *pagedir; /* Page directory. */ + + int num_files; + int max_files; + struct fd *files; /* Pointer to array of file descriptors. */ #endif /* Owned by thread.c. */ |
