Advertisement
Len_i_nieuk

init

May 27th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 KB | None | 0 0
  1. // Misiu malowany, powiedź mi co ja mam źle w tym programie z procesem init, kompilator wariuje i w ogóle nie jest mi wstanie tego wywołać :/ dwa pokazuje mi error w przydaku gdy Getpgid( tutaj chce dać pid ) ;
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <sys/types.h>
  5. #include <unistd.h>
  6.  
  7. int mian()
  8. {
  9.     pid_t pid=fork();
  10.  
  11.  for(int i=0;i<3;i++)
  12.     switch(pid)
  13.     {
  14.     case -1:
  15.     perror("Blad funkcji fork()");
  16.     exit(2);
  17.     case 0:
  18.     printf("Getuid: %u\n",getuid());
  19.     printf("Getgid: %u\n",getgid());
  20.     printf("Getpid: %u\n",getpid());
  21.     printf("Getppid: %u\n",getppid());
  22.     printf("Getpgrp: %u\n",getpgrp());
  23.     sleep(3);
  24.     break;
  25.     default:
  26.     _exit(2);
  27.     break;
  28.     };
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement