This commit is contained in:
2023-12-10 15:48:26 +01:00
parent cdbec2b91f
commit 7a18fddeb4
44 changed files with 1977 additions and 10 deletions

View File

@@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(void){
pid_t x, x1, x2, x3;
x1 = fork();
if (x1 == 0){
x2=fork();
if (x2 == 0)
x = fork();
x3=fork();
}
}

View File

@@ -0,0 +1 @@
La commande "kill -TERM 30544" provoque l'arrêt forcé du processus 30544, à cause du signal de terminaison envoyé

View File

@@ -0,0 +1,38 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <fcntl.h>
#define BUF_SIZE 128
int main(void){
pid_t x, x1, x2, x3;
int p[2];
char buf;
assert(pipe(p) != -1);
x1 = fork();
if (x1 == 0){
x2=fork();
if (x2 == 0){
x = fork();
if (x == 0){
close(p[0]);
dup2(p[1], 1);
close(p[1]);
printf("%d", getpid());
}
x3=fork();
}
sleep(1);
}
if (x1 > 0){
close(p[1]);
while(read(p[0], &buf, sizeof(char)) > 0)
write(1, &buf, sizeof(char));
}
close(p[0]);
printf("\n");
return EXIT_SUCCESS;
}