From 369b6484db835bf42f84b469a9c03631cfc06c4d Mon Sep 17 00:00:00 2001 From: fadhil riyanto Date: Fri, 27 Sep 2024 20:06:57 +0700 Subject: test fork Signed-off-by: fadhil riyanto --- test/waitsys.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/waitsys.c diff --git a/test/waitsys.c b/test/waitsys.c new file mode 100644 index 0000000..9f1534c --- /dev/null +++ b/test/waitsys.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +int main(void) +{ + pid_t parentpid = getpid(); + + pid_t child_pid = fork(); + + if (child_pid == 0) { + + sleep(10); + printf("child process created\n"); + _exit(0); + } else { + printf("this is parent\n"); + + int status; + wait(&status); + sleep(20); + } + +} \ No newline at end of file -- cgit v1.2.3