Update process execution related function argument names to be more accurate
This commit is contained in:
@@ -38,7 +38,7 @@ static bool load (const char *cmdline, void (**eip) (void), void **esp);
|
|||||||
before process_execute() returns. Returns the new process's
|
before process_execute() returns. Returns the new process's
|
||||||
thread id, or TID_ERROR if the thread cannot be created. */
|
thread id, or TID_ERROR if the thread cannot be created. */
|
||||||
tid_t
|
tid_t
|
||||||
process_execute (const char *file_name)
|
process_execute (const char *cmd)
|
||||||
{
|
{
|
||||||
char *fn_copy;
|
char *fn_copy;
|
||||||
tid_t tid;
|
tid_t tid;
|
||||||
@@ -51,10 +51,10 @@ process_execute (const char *file_name)
|
|||||||
|
|
||||||
/* Imposing implicit limit that the command line arguments
|
/* Imposing implicit limit that the command line arguments
|
||||||
including the user program name fit within a single page. */
|
including the user program name fit within a single page. */
|
||||||
strlcpy (fn_copy, file_name, PGSIZE);
|
strlcpy (fn_copy, cmd, PGSIZE);
|
||||||
|
|
||||||
/* Create a new thread to execute FILE_NAME. */
|
/* Create a new thread to execute FILE_NAME. */
|
||||||
tid = thread_create (file_name, PRI_DEFAULT, start_process, fn_copy);
|
tid = thread_create (cmd, PRI_DEFAULT, start_process, fn_copy);
|
||||||
if (tid == TID_ERROR)
|
if (tid == TID_ERROR)
|
||||||
palloc_free_page (fn_copy);
|
palloc_free_page (fn_copy);
|
||||||
return tid;
|
return tid;
|
||||||
@@ -66,7 +66,7 @@ static void *push_to_stack (void **esp, void *data, size_t data_size);
|
|||||||
/* A thread function that loads a user process and starts it
|
/* A thread function that loads a user process and starts it
|
||||||
running. */
|
running. */
|
||||||
static void
|
static void
|
||||||
start_process (void *file_name_)
|
start_process (void *cmd)
|
||||||
{
|
{
|
||||||
struct intr_frame if_;
|
struct intr_frame if_;
|
||||||
bool success;
|
bool success;
|
||||||
@@ -74,7 +74,7 @@ start_process (void *file_name_)
|
|||||||
/* Retrieve first argument of command, which is the file name
|
/* Retrieve first argument of command, which is the file name
|
||||||
of the process. */
|
of the process. */
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
char *file_name = strtok_r (file_name_, " ", &saveptr);
|
char *file_name = strtok_r (cmd, " ", &saveptr);
|
||||||
if (strlen (file_name) > FNAME_MAX_LEN)
|
if (strlen (file_name) > FNAME_MAX_LEN)
|
||||||
file_name[FNAME_MAX_LEN + 1] = '\n';
|
file_name[FNAME_MAX_LEN + 1] = '\n';
|
||||||
|
|
||||||
@@ -92,14 +92,14 @@ start_process (void *file_name_)
|
|||||||
/* If load failed, quit. */
|
/* If load failed, quit. */
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
palloc_free_page (file_name_);
|
palloc_free_page (cmd);
|
||||||
thread_exit ();
|
thread_exit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize user process stack and free page used to store the
|
/* Initialize user process stack and free page used to store the
|
||||||
command that executed the process. */
|
command that executed the process. */
|
||||||
success = process_init_stack (saveptr, &if_.esp, file_name);
|
success = process_init_stack (saveptr, &if_.esp, file_name);
|
||||||
palloc_free_page (file_name_);
|
palloc_free_page (cmd);
|
||||||
|
|
||||||
/* If stack initialization failed, free resources and quit. */
|
/* If stack initialization failed, free resources and quit. */
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|||||||
Reference in New Issue
Block a user