This commit is contained in:
2021-03-01 16:39:46 +01:00
parent 0453269f24
commit 5b651516d2
35 changed files with 1013 additions and 14 deletions

View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main()
{
if (fork() == 0)
{ // child proc
printf("%d: child created by parent %d; executing 'p4'...\n", getpid(), getppid());
execl("p4", "p4", NULL);
}
else
{ // parent proc
printf("%d: parent process\n", getpid());
}
fork();
printf("%d: terminating\n", getpid());
wait(NULL);
}