From 62b9f1b6b3fed01652153c5259427db97fe75e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 5 Feb 2021 15:40:28 +0100 Subject: add fd to struct thread --- src/threads/thread.c | 1 + src/threads/thread.h | 10 ++++++++++ 2 files changed, 11 insertions(+) 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. */ -- cgit v1.2.1