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

Commit

Permalink
syscall create
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jan 10, 2021
1 parent 99f40af commit fd3dd0d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/userprog/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "userprog/pagedir.h"
#include "userprog/process.h"
#include "devices/shutdown.h"
#include "filesys/filesys.h"

#define USER_ASSERT(CONDITION) \
if (CONDITION) \
Expand Down Expand Up @@ -306,8 +307,13 @@ static void halt(void)
would require a open system call. */
static bool create(const char *file, unsigned initial_size)
{
// todo
return false;
USER_ASSERT(is_valid_str(file));

lock_acquire(&file_lock);
bool ret = filesys_create(file, initial_size);
lock_release(&file_lock);

return ret;
}

/* Deletes the file called FILE. Returns true if successful, false
Expand Down

0 comments on commit fd3dd0d

Please sign in to comment.