ajout fichiers TP
This commit is contained in:
BIN
Controle/Exercice 1/A
Executable file
BIN
Controle/Exercice 1/A
Executable file
Binary file not shown.
17
Controle/Exercice 1/A.c
Normal file
17
Controle/Exercice 1/A.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
char* arg[3] = {"B1", "1", NULL};
|
||||
if (!fork()) {
|
||||
execvp("B1", arg);
|
||||
} else {
|
||||
if (!fork()) {
|
||||
arg[1] = "2";
|
||||
execvp("B1", arg);
|
||||
}
|
||||
}
|
||||
sleep(5);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
BIN
Controle/Exercice 1/A.o
Normal file
BIN
Controle/Exercice 1/A.o
Normal file
Binary file not shown.
BIN
Controle/Exercice 1/B1
Executable file
BIN
Controle/Exercice 1/B1
Executable file
Binary file not shown.
17
Controle/Exercice 1/B1.c
Normal file
17
Controle/Exercice 1/B1.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
char* arg[2] = {NULL, NULL};
|
||||
if (!fork()) {
|
||||
if (argv[1][0] == '1') {
|
||||
arg[0] = "C1";
|
||||
} else {
|
||||
arg[0] = "C2";
|
||||
}
|
||||
execvp(arg[0], arg);
|
||||
}
|
||||
sleep(5);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
BIN
Controle/Exercice 1/B1.o
Normal file
BIN
Controle/Exercice 1/B1.o
Normal file
Binary file not shown.
BIN
Controle/Exercice 1/C1
Executable file
BIN
Controle/Exercice 1/C1
Executable file
Binary file not shown.
8
Controle/Exercice 1/C1.c
Normal file
8
Controle/Exercice 1/C1.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
sleep(5);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
BIN
Controle/Exercice 1/C1.o
Normal file
BIN
Controle/Exercice 1/C1.o
Normal file
Binary file not shown.
BIN
Controle/Exercice 1/C2
Executable file
BIN
Controle/Exercice 1/C2
Executable file
Binary file not shown.
8
Controle/Exercice 1/C2.c
Normal file
8
Controle/Exercice 1/C2.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
sleep(5);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
BIN
Controle/Exercice 1/C2.o
Normal file
BIN
Controle/Exercice 1/C2.o
Normal file
Binary file not shown.
18
Controle/Exercice 1/Makefile
Normal file
18
Controle/Exercice 1/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
CC=gcc
|
||||
|
||||
|
||||
A: A.o B1
|
||||
$(CC) -o A A.o
|
||||
|
||||
B1: B1.o C1 C2
|
||||
$(CC) -o B1 B1.o
|
||||
|
||||
C1: C1.o
|
||||
$(CC) -o C1 C1.o
|
||||
|
||||
C2: C2.o
|
||||
$(CC) -o C2 C2.o
|
||||
|
||||
|
||||
run:
|
||||
A
|
1
Controle/Exercice 1/ok.txt
Normal file
1
Controle/Exercice 1/ok.txt
Normal file
@@ -0,0 +1 @@
|
||||
watch -n 1 ps -o cmd -C A,B1,C1,C2 --forest dans un autre terminal
|
Reference in New Issue
Block a user