Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <errno.h>
  3. #include <unistd.h>
  4. #include <sys/types.h>
  5. #include <sys/wait.h>
  6. #include <sys/stat.h>
  7. #include <sys/ipc.h>
  8. #include <sys/shm.h>
  9. #include <pwd.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <time.h>
  13. #include <sys/shm.h>
  14. #include <sys/sem.h>
  15. #include <sys/msg.h>
  16.  
  17. #include <stdio.h>
  18. #include <sys/shm.h>
  19. #include <sys/sem.h>
  20.  
  21. int main()
  22. {
  23.  
  24. int semid;
  25. struct sembuf op;
  26. semid = semget(0x234, 1, 0700);
  27. if (semid == -1)
  28. {
  29. perror("semget");
  30. exit(1);
  31. }
  32. puts("Wystartowal program B");
  33. op.sem_flg = SEM_UNDO;
  34. op.sem_num = 0;
  35. op.sem_op = -1;
  36. if (semop(semid, &op, 1) == -1)
  37. {
  38. perror("semop");
  39. exit(1);
  40. };
  41. puts("KONIEC B");
  42. //if (semctl(semid,IPC_RMID,0) == -1)
  43. // {
  44. // perror("semctl");
  45. // exit(1);
  46. // }
  47. return(0);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement