Compare commits

...

1 Commits

Author SHA1 Message Date
EDiasAlberto
987a71ec40 Fix rox checking and make filesys_lock global 2024-11-12 16:00:19 +00:00
3 changed files with 6 additions and 5 deletions

View File

@@ -8,6 +8,7 @@
#include <string.h>
#include "userprog/gdt.h"
#include "userprog/pagedir.h"
#include "userprog/syscall.h"
#include "userprog/tss.h"
#include "filesys/directory.h"
#include "filesys/file.h"

View File

@@ -13,7 +13,6 @@
#include <stdio.h>
#include <syscall-nr.h>
static struct lock filesys_lock;
static unsigned fd_counter = MIN_USER_FD;
struct open_file
@@ -143,9 +142,7 @@ syscall_exec (const char *cmd_line)
{
validate_user_pointer (cmd_line, 1);
lock_acquire (&filesys_lock);
pid_t pid = process_execute(cmd_line);
lock_release (&filesys_lock);
return pid;
}

View File

@@ -2,11 +2,14 @@
#define USERPROG_SYSCALL_H
#include <hash.h>
#include "threads/synch.h"
#define MIN_USER_FD 2
typedef int pid_t;
struct lock filesys_lock;
void syscall_init (void);
unsigned fd_hash (const struct hash_elem *element, void *aux);