From 2c58ceb889efd1483f3986827134135d6d977a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 12 Mar 2021 16:13:28 +0100 Subject: implement wait --- src/userprog/syscall.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/userprog/syscall.c') 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,11 +88,15 @@ 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) { @@ -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)); -- cgit v1.2.1