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

Commit

Permalink
syscall close
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jan 10, 2021
1 parent 3f9d415 commit 75b5a33
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/userprog/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,5 +474,12 @@ static unsigned tell(int fd)
for each one. */
static void close(int fd)
{
// todo
struct open_file *f = get_file_by_fd(fd);

lock_acquire(&file_lock);
file_close(f->file);
lock_release(&file_lock);

list_remove(&f->elem);
free(f);
}

0 comments on commit 75b5a33

Please sign in to comment.