43 lines
405 B
C
43 lines
405 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include <unistd.h>
|
||
|
#include<assert.h>
|
||
|
#include<sys/wait.h>
|
||
|
|
||
|
|
||
|
int main(int argc, char * argv[]){
|
||
|
|
||
|
int status;
|
||
|
|
||
|
pid_t p;
|
||
|
|
||
|
p = fork();
|
||
|
|
||
|
//Gestion des erreurs
|
||
|
if (p == -1) {
|
||
|
perror("ERREUR\n");
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
|
||
|
//Père
|
||
|
if (p>0) {
|
||
|
printf ("Le pid %d\n", getpid());
|
||
|
}
|
||
|
|
||
|
//Fils
|
||
|
if (p==0) {
|
||
|
|
||
|
}
|
||
|
|
||
|
wait (&status);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|