blob: 14cc91b4471ae58d4f8a568944e26ae88cbed5a4 (
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
26
27
28
|
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("forktest: pid %d\n", getpid());
int pid = fork();
if (pid < 0)
{
printf("fork failed\n");
return 1;
}
if (pid == 0)
{
printf(" child: pid %d, exec-ing membrk\n", getpid());
exec("/usr/bin/membrk", 0);
printf(" child: exec failed\n");
return 127;
}
printf(" parent: forked child %d, waiting...\n", pid);
int status = -1;
int reaped = wait(&status);
printf(" parent: child %d exited with status %d\n", reaped, status);
return 0;
}
|