#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

int main(int argc, char const *argv[]) {

  pid_t id_fork = fork();
  pid_t pid  = getpid();
  pid_t ppid = getppid();
  pid_t uid  = getuid();
  pid_t euid = geteuid();
  pid_t gid  = getgid();
  pid_t egid = getegid();
  char cwd[1024];
  getcwd(cwd,1024);

  int x = 2;

if(id_fork==0){
    wait(1);
    x+=3;
  }else{
    x=x*5;
}
printf("Valeur de Fork : %d\nIci x vaut : %d\nJe suis le processus de pid      : %d\nMon père est le processus de pid : %d\nMon uid                          : %d\nMon euid                         : %d\nMon gid                          : %d\nMon egid                         : %d\nMon repertoire de travail est : %s\n",id_fork,x,pid,ppid,uid,euid,gid,egid,cwd);

  return 0;
}
