4 #include <linux/atomic.h>
5 #include <linux/rcupdate.h>
6 #include <linux/cache.h>
7 #include <uapi/linux/sem.h>
11 /* One semaphore structure for each semaphore in the system. */
13 int semval; /* current value */
15 * PID of the process that last modified the semaphore. For
16 * Linux, specifically these are:
18 * - semctl, via SETVAL and SETALL.
19 * - at task exit when performing undo adjustments (see exit_sem).
22 spinlock_t lock; /* spinlock for fine-grained semtimedop */
23 struct list_head pending_alter; /* pending single-sop operations */
24 /* that alter the semaphore */
25 struct list_head pending_const; /* pending single-sop operations */
26 /* that do not alter the semaphore*/
27 time_t sem_otime; /* candidate for sem_otime */
28 } ____cacheline_aligned_in_smp;
30 /* One sem_array data structure for each set of semaphores in the system. */
32 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */
33 time_t sem_ctime; /* last change time */
34 struct list_head pending_alter; /* pending operations */
35 /* that alter the array */
36 struct list_head pending_const; /* pending complex operations */
37 /* that do not alter semvals */
38 struct list_head list_id; /* undo requests on this array */
39 int sem_nsems; /* no. of semaphores in array */
40 int complex_count; /* pending complex operations */
41 unsigned int use_global_lock;/* >0: global lock required */
49 struct sem_undo_list *undo_list;
52 extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
53 extern void exit_sem(struct task_struct *tsk);
61 static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
66 static inline void exit_sem(struct task_struct *tsk)
72 #endif /* _LINUX_SEM_H */