sem.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _LINUX_SEM_H
  2. #define _LINUX_SEM_H
  3. #include <linux/atomic.h>
  4. #include <linux/rcupdate.h>
  5. #include <linux/cache.h>
  6. #include <uapi/linux/sem.h>
  7. struct task_struct;
  8. /* One sem_array data structure for each set of semaphores in the system. */
  9. struct sem_array {
  10. struct kern_ipc_perm ____cacheline_aligned_in_smp
  11. sem_perm; /* permissions .. see ipc.h */
  12. time_t sem_ctime; /* last change time */
  13. struct sem *sem_base; /* ptr to first semaphore in array */
  14. struct list_head pending_alter; /* pending operations */
  15. /* that alter the array */
  16. struct list_head pending_const; /* pending complex operations */
  17. /* that do not alter semvals */
  18. struct list_head list_id; /* undo requests on this array */
  19. int sem_nsems; /* no. of semaphores in array */
  20. int complex_count; /* pending complex operations */
  21. bool complex_mode; /* no parallel simple ops */
  22. };
  23. #ifdef CONFIG_SYSVIPC
  24. struct sysv_sem {
  25. struct sem_undo_list *undo_list;
  26. };
  27. extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
  28. extern void exit_sem(struct task_struct *tsk);
  29. #else
  30. struct sysv_sem {
  31. /* empty */
  32. };
  33. static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
  34. {
  35. return 0;
  36. }
  37. static inline void exit_sem(struct task_struct *tsk)
  38. {
  39. return;
  40. }
  41. #endif
  42. #endif /* _LINUX_SEM_H */