bb6f3a5e06356a96bb4f316851183edaa404fa6b
9 void show_proc_pids() {
10 pid_t current_pid
= getpid();
11 pid_t parent_pid
= getppid();
13 printf("[%d] Mon PID: %d\n", current_pid
, current_pid
);
14 printf("[%d] PID du parent: %d\n", current_pid
, parent_pid
);
23 if (pipe(pipefd
) == -1) {
24 printf("Pipe creation erreur\n");
28 const char* str_fmt
= "[%d] Coucou papa !\n";
32 printf("Erreur de clonage\n");
34 } else if (cpid
== 0) {
38 write(pipefd
[1], str_fmt
, strlen(str_fmt
));
45 read(pipefd
[0], &buf
, strlen(str_fmt
));
46 printf(&buf
, getpid());
52 /* unreachable code */