SCR/SCR3.1/gdf.c

35 lines
436 B
C
Raw Normal View History

2023-12-10 15:48:26 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
int main(void){
pid_t x1,x2,x3,x4;
x1=fork();
if (x1 == 0){
x2=fork();
if (x2>0) {
sleep(10);
kill(x2,SIGINT);
}
if (x2 == 0) {
x3=fork();
if (x3 == 0)
x4=fork();
if (x3 > 0){
sleep(5);
kill(x3,SIGINT);
}
}
}
if (x1 > 0)
x4=fork();
while(1) {
printf(" %d\n", getpid());
sleep(1);
}
}