Old stuff/ecole_etude_fac_de_pau/licence_3/systeme-d-exploitation/tp2/3.c
(Deskargatu)
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int main(int argc, char** argv)
{
pid_t pid;
pid = fork();
if (pid == -1 ) { perror("error fork"); exit(-1); }
if (pid == 0)
{
printf("Le fils a pour pid : %d\n",getpid());
}
else{
if (argc>1)
{
if (! strcmp(argv[1],"synchro")) {
printf(" ordre d ordonnanceur\n");
wait(pid);
}
}
printf("le pere a pour pid: %d\n",getpid());
}
}