summaryrefslogtreecommitdiff
path: root/test/waitsys.c
blob: 9f1534cbf97c3837ed880aac3ec3ea7b4a25b12b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
        }
        
}