From 10d52f4f24f80835d28d8278df84d8bd500bd347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 12 Mar 2021 16:14:21 +0100 Subject: add simple wait test --- src/examples/Makefile | 3 ++- src/examples/wait.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/examples/wait.c (limited to 'src/examples') diff --git a/src/examples/Makefile b/src/examples/Makefile index 13c09fc..515bb74 100644 --- a/src/examples/Makefile +++ b/src/examples/Makefile @@ -8,7 +8,7 @@ PROGS = cat cmp cp echo halt hex-dump ls mcat mcp mkdir pwd rm shell \ sumargv lab2test lab1test lab1test2 pfs pfs_reader pfs_writer dummy longrun \ child parent create-bad printf -PROGS += create read lab3test1 lab4test1 lab3test2 args +PROGS += create read lab3test1 lab4test1 lab3test2 args wait create_SRC = create.c read_SRC = read.c @@ -16,6 +16,7 @@ lab3test1_SRC = lab3test1.c lab4test1_SRC = lab4test1.c lab3test2_SRC = lab3test2.c args_SRC = args.c +wait_SRC = wait.c # Added test programs printf_SRC = printf.c diff --git a/src/examples/wait.c b/src/examples/wait.c new file mode 100644 index 0000000..ab0ea90 --- /dev/null +++ b/src/examples/wait.c @@ -0,0 +1,13 @@ +#include +#include + +int +main (int argc, char **argv) +{ + printf ("hello\n"); + if (argc != 1) { + int child = exec("wait"); + printf("%d: %d\n", child, wait(child)); + } + exit(1); +} -- cgit v1.2.1