Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
syscall seek
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jan 10, 2021
1 parent 71add67 commit 8556c8e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/userprog/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,13 @@ static int read(int fd, void *buffer, unsigned size)
system and do not require any special effort in system call implementation. */
static void seek(int fd, unsigned position)
{
// todo
struct open_file *f = get_file_by_fd(fd);

USER_ASSERT(f != NULL);

lock_acquire(&file_lock);
file_seek(f->file, position);
lock_release(&file_lock);
}

/* Returns the position of the next byte to be read or written in open
Expand Down

0 comments on commit 8556c8e

Please sign in to comment.