From 460808eb13ce9d7442ee9ffdd697d692b5963079 Mon Sep 17 00:00:00 2001
From: Alex Stratford <alexander3.stratford@live.uwe.ac.uk>
Date: Tue, 3 Dec 2019 18:38:19 +0000
Subject: [PATCH] Removed syscall_exit.c and fixed merge request issues

---
 userprog/syscall_filesize.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/userprog/syscall_filesize.c b/userprog/syscall_filesize.c
index cdf87d0..ebfbf76 100644
--- a/userprog/syscall_filesize.c
+++ b/userprog/syscall_filesize.c
@@ -1,13 +1,20 @@
+/*
+ * Returns the size, in bytes, of the file open as fd.
+ *
+ * Authored by Alex Stratford
+ */
+
 #include "system_calls.h"
 #include "filesys/file.h"
 
-int syscall_filesize(struct intr_frame *file_descriptor) {
+int syscall_filesize(struct intr_frame *f) {
+	// pop off first int argument from interrupt frame
+	int file_descriptor = *((int*)f->esp + 1);
     // Described in system_calls.h, stores file descriptors mapped to files
 	struct file_map *file_map = get_file(file_descriptor); 
-	int size;
 	if (file_map == NULL) // Checking if file is empty or non-existent
 		return -1; // Returning failure state
 	// Using the file_length function in file.h to get the length and store it
-	size = file_length(file_map->file); 
-	return size;
+	int size = file_length(file_map->file); 
+	f->eax = size;
 }
\ No newline at end of file
-- 
GitLab