diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/waitsys.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 <signal.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/wait.h> + +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 |