From 3cfbe198e08695002e53392d2f4ab02cacaf5113 Mon Sep 17 00:00:00 2001 From: EDiasAlberto Date: Fri, 8 Nov 2024 16:10:46 +0000 Subject: [PATCH] Implement syscall for seek w/ S. --- src/userprog/syscall.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 57a5018..102458f 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -249,9 +249,15 @@ syscall_write (int fd, const void *buffer, unsigned size) } static void -syscall_seek (int fd UNUSED, unsigned position UNUSED) +syscall_seek (int fd, unsigned position) { - //TODO + struct open_file *file_info = fd_get_file (fd); + if (file_info != NULL) + { + lock_acquire (&filesys_lock); + file_seek (file_info->file, position); + lock_release (&filesys_lock); + } } static unsigned