From: Ben Pfaff Date: Sat, 24 Mar 2007 01:01:06 +0000 (+0000) Subject: Rename execute_thread() to start_process(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e4e1224e6f9ee05aff0a95ab90ad197aeff9740;p=pintos-anon Rename execute_thread() to start_process(). Thanks to Godmar Back for pointing out that it could be better named. --- diff --git a/solutions/p2.patch b/solutions/p2.patch index 0940c14..00711a2 100644 --- a/solutions/p2.patch +++ b/solutions/p2.patch @@ -129,12 +129,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c #include "threads/thread.h" #include "threads/vaddr.h" - static thread_func execute_thread NO_RETURN; + static thread_func start_process NO_RETURN; -static bool load (const char *cmdline, void (**eip) (void), void **esp); +static bool load (const char *cmd_line, void (**eip) (void), void **esp); + +/* Data structure shared between process_execute() in the -+ invoking thread and execute_thread() in the newly invoked ++ invoking thread and start_process() in the newly invoked + thread. */ +struct exec_info + { @@ -167,12 +167,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c + sema_init (&exec.load_done, 0); /* Create a new thread to execute FILE_NAME. */ -- tid = thread_create (file_name, PRI_DEFAULT, execute_thread, fn_copy); +- tid = thread_create (file_name, PRI_DEFAULT, start_process, fn_copy); - if (tid == TID_ERROR) - palloc_free_page (fn_copy); + strlcpy (thread_name, file_name, sizeof thread_name); + strtok_r (thread_name, " ", &save_ptr); -+ tid = thread_create (thread_name, PRI_DEFAULT, execute_thread, &exec); ++ tid = thread_create (thread_name, PRI_DEFAULT, start_process, &exec); + if (tid != TID_ERROR) + { + sema_down (&exec.load_done); @@ -188,15 +188,15 @@ diff -u src/userprog/process.c~ src/userprog/process.c /* A thread function that loads a user process and starts it running. */ static void --execute_thread (void *file_name_) -+execute_thread (void *exec_) +-start_process (void *file_name_) ++start_process (void *exec_) { - char *file_name = file_name_; + struct exec_info *exec = exec_; struct intr_frame if_; bool success; -@@ -58,10 +78,29 @@ execute_thread (void *file_name_) +@@ -58,10 +78,29 @@ start_process (void *file_name_) if_.gs = if_.fs = if_.es = if_.ds = if_.ss = SEL_UDSEG; if_.cs = SEL_UCSEG; if_.eflags = FLAG_IF | FLAG_MBS; @@ -229,7 +229,7 @@ diff -u src/userprog/process.c~ src/userprog/process.c if (!success) thread_exit (); -@@ -75,18 +113,47 @@ execute_thread (void *file_name_) +@@ -75,18 +113,47 @@ start_process (void *file_name_) NOT_REACHED (); } diff --git a/solutions/p3.patch b/solutions/p3.patch index c7c9df8..3e7fb8b 100644 --- a/solutions/p3.patch +++ b/solutions/p3.patch @@ -358,12 +358,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c +#include "vm/page.h" +#include "vm/frame.h" - static thread_func execute_thread NO_RETURN; + static thread_func start_process NO_RETURN; -static bool load (const char *cmdline, void (**eip) (void), void **esp); +static bool load (const char *cmd_line, void (**eip) (void), void **esp); + +/* Data structure shared between process_execute() in the -+ invoking thread and execute_thread() in the newly invoked ++ invoking thread and start_process() in the newly invoked + thread. */ +struct exec_info + { @@ -396,12 +396,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c + sema_init (&exec.load_done, 0); /* Create a new thread to execute FILE_NAME. */ -- tid = thread_create (file_name, PRI_DEFAULT, execute_thread, fn_copy); +- tid = thread_create (file_name, PRI_DEFAULT, start_process, fn_copy); - if (tid == TID_ERROR) - palloc_free_page (fn_copy); + strlcpy (thread_name, file_name, sizeof thread_name); + strtok_r (thread_name, " ", &save_ptr); -+ tid = thread_create (thread_name, PRI_DEFAULT, execute_thread, &exec); ++ tid = thread_create (thread_name, PRI_DEFAULT, start_process, &exec); + if (tid != TID_ERROR) + { + sema_down (&exec.load_done); @@ -417,15 +417,15 @@ diff -u src/userprog/process.c~ src/userprog/process.c /* A thread function that loads a user process and starts it running. */ static void --execute_thread (void *file_name_) -+execute_thread (void *exec_) +-start_process (void *file_name_) ++start_process (void *exec_) { - char *file_name = file_name_; + struct exec_info *exec = exec_; struct intr_frame if_; bool success; -@@ -59,10 +81,28 @@ execute_thread (void *file_name_) +@@ -59,10 +81,28 @@ start_process (void *file_name_) if_.gs = if_.fs = if_.es = if_.ds = if_.ss = SEL_UDSEG; if_.cs = SEL_UCSEG; if_.eflags = FLAG_IF | FLAG_MBS; @@ -457,7 +457,7 @@ diff -u src/userprog/process.c~ src/userprog/process.c if (!success) thread_exit (); -@@ -76,18 +116,47 @@ execute_thread (void *file_name_) +@@ -76,18 +116,47 @@ start_process (void *file_name_) NOT_REACHED (); } diff --git a/solutions/p4.patch b/solutions/p4.patch index 5d0f19a..9a778fb 100644 --- a/solutions/p4.patch +++ b/solutions/p4.patch @@ -2305,12 +2305,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c +#include "vm/page.h" +#include "vm/frame.h" - static thread_func execute_thread NO_RETURN; + static thread_func start_process NO_RETURN; -static bool load (const char *cmdline, void (**eip) (void), void **esp); +static bool load (const char *cmd_line, void (**eip) (void), void **esp); + +/* Data structure shared between process_execute() in the -+ invoking thread and execute_thread() in the newly invoked ++ invoking thread and start_process() in the newly invoked + thread. */ +struct exec_info + { @@ -2347,12 +2347,12 @@ diff -u src/userprog/process.c~ src/userprog/process.c + sema_init (&exec.load_done, 0); /* Create a new thread to execute FILE_NAME. */ -- tid = thread_create (file_name, PRI_DEFAULT, execute_thread, fn_copy); +- tid = thread_create (file_name, PRI_DEFAULT, start_process, fn_copy); - if (tid == TID_ERROR) - palloc_free_page (fn_copy); + strlcpy (thread_name, file_name, sizeof thread_name); + strtok_r (thread_name, " ", &save_ptr); -+ tid = thread_create (thread_name, PRI_DEFAULT, execute_thread, &exec); ++ tid = thread_create (thread_name, PRI_DEFAULT, start_process, &exec); + if (tid != TID_ERROR) + { + sema_down (&exec.load_done); @@ -2373,8 +2373,8 @@ diff -u src/userprog/process.c~ src/userprog/process.c /* A thread function that loads a user process and starts it running. */ static void --execute_thread (void *file_name_) -+execute_thread (void *exec_) +-start_process (void *file_name_) ++start_process (void *exec_) { - char *file_name = file_name_; + struct exec_info *exec = exec_; @@ -2416,7 +2416,7 @@ diff -u src/userprog/process.c~ src/userprog/process.c if (!success) thread_exit (); -@@ -76,18 +128,47 @@ execute_thread (void *file_name_) +@@ -76,18 +128,47 @@ start_process (void *file_name_) NOT_REACHED (); } diff --git a/src/threads/intr-stubs.S b/src/threads/intr-stubs.S index b34c142..334d8cc 100644 --- a/src/threads/intr-stubs.S +++ b/src/threads/intr-stubs.S @@ -44,7 +44,7 @@ intr_entry: stack, and returns to the caller. This is a separate function because it is called directly when - we launch a new user process (see execute_thread() in + we launch a new user process (see start_process() in userprog/process.c). */ .globl intr_exit .func intr_exit diff --git a/src/userprog/process.c b/src/userprog/process.c index 675dc25..6c6003c 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -18,7 +18,7 @@ #include "threads/thread.h" #include "threads/vaddr.h" -static thread_func execute_thread NO_RETURN; +static thread_func start_process NO_RETURN; static bool load (const char *cmdline, void (**eip) (void), void **esp); /* Starts a new thread running a user program loaded from @@ -39,7 +39,7 @@ process_execute (const char *file_name) strlcpy (fn_copy, file_name, PGSIZE); /* Create a new thread to execute FILE_NAME. */ - tid = thread_create (file_name, PRI_DEFAULT, execute_thread, fn_copy); + tid = thread_create (file_name, PRI_DEFAULT, start_process, fn_copy); if (tid == TID_ERROR) palloc_free_page (fn_copy); return tid; @@ -48,7 +48,7 @@ process_execute (const char *file_name) /* A thread function that loads a user process and starts it running. */ static void -execute_thread (void *file_name_) +start_process (void *file_name_) { char *file_name = file_name_; struct intr_frame if_; diff --git a/ta-advice/HW2 b/ta-advice/HW2 index 95049b3..658ff78 100644 --- a/ta-advice/HW2 +++ b/ta-advice/HW2 @@ -318,7 +318,7 @@ B1(iv): solution's structure: /* Data structure shared between process_execute() in the - invoking thread and execute_thread() in the newly invoked + invoking thread and start_process() in the newly invoked thread. */ struct exec_info {