diff --git a/userprog/syscall.c b/userprog/syscall.c index a104087f96233896df559ed9c72e37c0c3ea2b14..e6abc56803da28b385bb69fa7b493d30496ddcc9 100644 --- a/userprog/syscall.c +++ b/userprog/syscall.c @@ -79,6 +79,9 @@ syscall_handler (struct intr_frame *f UNUSED) case SYSCALL_OPEN: syscall_open(f); break; + case SYSCALL_FILESIZE: + syscall_filesize(f); + break; default: printf ("WARNING: Invalid Syscall (%d)\n", syscall_number); thread_exit (); diff --git a/userprog/system_calls.h b/userprog/system_calls.h index 8dc87c9d325a52ee224a1597b3bfd7877553cf5a..ce7ae18823f34dd39916c550db655291e0f7c6d3 100644 --- a/userprog/system_calls.h +++ b/userprog/system_calls.h @@ -49,6 +49,11 @@ void syscall_write(struct intr_frame *f); */ void syscall_open(struct intr_frame *f); +/* + * Returns the size, in bytes, of the file open as fd. + */ +void syscall_filesize(struct intr_frame *f); + /* * Deletes the file called file. Returns true if successful, false otherwise. * A file may be removed regardless of whether it is open or closed, and