Compare commits
1 Commits
vm/page-sw
...
rox-check-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
987a71ec40 |
@@ -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"
|
||||
@@ -81,8 +82,8 @@ process_execute (const char *cmd)
|
||||
of the process. */
|
||||
char *file_name = strtok_r (cmd_copy, " ", &data->cmd_saveptr);
|
||||
|
||||
/* Validates that the current file to be executed is a valid file */
|
||||
if (filesys_open (file_name) == NULL)
|
||||
/* Validates that the current file to be executed is a valid file */
|
||||
if (filesys_open (file_name) == NULL)
|
||||
return TID_ERROR;
|
||||
|
||||
/* Create a new thread to execute the command, by initializing
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user