Guest User

Untitled

a guest
Oct 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <sys/types.h>
  4. #include <unistd.h>
  5. int main()
  6. {
  7. int childpid;
  8. //int status=1;
  9. //int zakonczono;
  10. printf("startuje proces macierzysty pid %d\n",getpid());
  11. if ((childpid = fork()) == -1)
  12. {
  13. perror("nie moge forknac");
  14. exit(1);
  15. }
  16. else
  17. if (childpid ==0 )
  18. {
  19. printf("Proces potomny o pidzie %d z rodzica %d\n",getpid(),getppid());
  20. }
  21. else
  22. {
  23. printf("Proces macierzysty o pidzie %d i dziecku %d\n",getpid(),childpid);
  24. }
  25. return 0;
  26. }
Add Comment
Please, Sign In to add comment