diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-03-12 16:13:28 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-03-12 16:13:28 +0100 |
| commit | 2c58ceb889efd1483f3986827134135d6d977a4a (patch) | |
| tree | 48a04d194701dd7683452906545d02c4efeecbcb /src/userprog/syscall.c | |
| parent | 915fb8305c47881142bd7a70982148ee14f8f6a2 (diff) | |
| download | pintos-2c58ceb889efd1483f3986827134135d6d977a4a.tar.gz | |
implement wait
Diffstat (limited to 'src/userprog/syscall.c')
| -rw-r--r-- | src/userprog/syscall.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 177cf02..52526aa 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -88,12 +88,16 @@ exit (int status) thread->parent->exit_status = status; lock_release (&thread->parent->l); - printf("%s: exit(%d)\n", thread->name, status); - thread_exit (); } static int +wait (tid_t child_tid) +{ + return process_wait (child_tid); +} + +static int read (int fd_i, void *buf, unsigned size) { struct thread *thread = thread_current (); @@ -178,6 +182,10 @@ syscall_handler (struct intr_frame *f UNUSED) // exec f->eax = exec (INTR_ESP (1, char *)); break; + case 3: + // wait + f->eax = wait (INTR_ESP (1, tid_t)); + break; case 4: // create f->eax = create (INTR_ESP (1, char *), INTR_ESP (2, off_t)); |
