Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_SEM_H |
| 2 | #define _LINUX_SEM_H |
| 3 | |
Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 4 | #include <linux/atomic.h> |
Manfred Spraul | 380af1b | 2008-07-25 01:48:06 -0700 | [diff] [blame] | 5 | #include <linux/rcupdate.h> |
Manfred Spraul | 31a7c47 | 2010-05-26 14:43:42 -0700 | [diff] [blame] | 6 | #include <linux/cache.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 7 | #include <uapi/linux/sem.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
Tim Schmielau | 8c65b4a | 2005-11-07 00:59:43 -0800 | [diff] [blame] | 9 | struct task_struct; |
| 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | /* One sem_array data structure for each set of semaphores in the system. */ |
| 12 | struct sem_array { |
Manfred Spraul | 31a7c47 | 2010-05-26 14:43:42 -0700 | [diff] [blame] | 13 | struct kern_ipc_perm ____cacheline_aligned_in_smp |
| 14 | sem_perm; /* permissions .. see ipc.h */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | time_t sem_ctime; /* last change time */ |
| 16 | struct sem *sem_base; /* ptr to first semaphore in array */ |
Manfred Spraul | 1a82e9e | 2013-07-08 16:01:23 -0700 | [diff] [blame] | 17 | struct list_head pending_alter; /* pending operations */ |
| 18 | /* that alter the array */ |
| 19 | struct list_head pending_const; /* pending complex operations */ |
| 20 | /* that do not alter semvals */ |
Manfred Spraul | 4daa28f | 2008-07-25 01:48:04 -0700 | [diff] [blame] | 21 | struct list_head list_id; /* undo requests on this array */ |
Manfred Spraul | b97e820 | 2009-12-15 16:47:32 -0800 | [diff] [blame] | 22 | int sem_nsems; /* no. of semaphores in array */ |
| 23 | int complex_count; /* pending complex operations */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
Manfred Spraul | f567a18 | 2011-11-02 13:38:56 -0700 | [diff] [blame] | 26 | #ifdef CONFIG_SYSVIPC |
| 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | struct sysv_sem { |
| 29 | struct sem_undo_list *undo_list; |
| 30 | }; |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk); |
| 33 | extern void exit_sem(struct task_struct *tsk); |
| 34 | |
| 35 | #else |
Manfred Spraul | f567a18 | 2011-11-02 13:38:56 -0700 | [diff] [blame] | 36 | |
| 37 | struct sysv_sem { |
| 38 | /* empty */ |
| 39 | }; |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk) |
| 42 | { |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | static inline void exit_sem(struct task_struct *tsk) |
| 47 | { |
| 48 | return; |
| 49 | } |
| 50 | #endif |
| 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #endif /* _LINUX_SEM_H */ |