diff --git a/src/userprog/process.c b/src/userprog/process.c index adffb00..9d4b3fc 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -38,7 +38,7 @@ static bool load (const char *cmdline, void (**eip) (void), void **esp); before process_execute() returns. Returns the new process's thread id, or TID_ERROR if the thread cannot be created. */ tid_t -process_execute (const char *file_name) +process_execute (const char *cmd) { char *fn_copy; tid_t tid; @@ -51,10 +51,10 @@ process_execute (const char *file_name) /* Imposing implicit limit that the command line arguments 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. */ - 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) palloc_free_page (fn_copy); 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 running. */ static void -start_process (void *file_name_) +start_process (void *cmd) { struct intr_frame if_; bool success; @@ -74,7 +74,7 @@ start_process (void *file_name_) /* Retrieve first argument of command, which is the file name of the process. */ char *saveptr; - char *file_name = strtok_r (file_name_, " ", &saveptr); + char *file_name = strtok_r (cmd, " ", &saveptr); if (strlen (file_name) > FNAME_MAX_LEN) file_name[FNAME_MAX_LEN + 1] = '\n'; @@ -92,14 +92,14 @@ start_process (void *file_name_) /* If load failed, quit. */ if (!success) { - palloc_free_page (file_name_); + palloc_free_page (cmd); thread_exit (); } /* Initialize user process stack and free page used to store the command that executed the process. */ 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 (!success)