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_otime; /* last semop time */ |
| 16 | time_t sem_ctime; /* last change time */ |
| 17 | struct sem *sem_base; /* ptr to first semaphore in array */ |
Manfred Spraul | a1193f8 | 2008-07-25 01:48:06 -0700 | [diff] [blame] | 18 | struct list_head sem_pending; /* pending operations to be processed */ |
Manfred Spraul | 4daa28f | 2008-07-25 01:48:04 -0700 | [diff] [blame] | 19 | struct list_head list_id; /* undo requests on this array */ |
Manfred Spraul | b97e820 | 2009-12-15 16:47:32 -0800 | [diff] [blame] | 20 | int sem_nsems; /* no. of semaphores in array */ |
| 21 | int complex_count; /* pending complex operations */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | }; |
| 23 | |
Manfred Spraul | f567a18 | 2011-11-02 13:38:56 -0700 | [diff] [blame] | 24 | #ifdef CONFIG_SYSVIPC |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | struct sysv_sem { |
| 27 | struct sem_undo_list *undo_list; |
| 28 | }; |
| 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk); |
| 31 | extern void exit_sem(struct task_struct *tsk); |
| 32 | |
| 33 | #else |
Manfred Spraul | f567a18 | 2011-11-02 13:38:56 -0700 | [diff] [blame] | 34 | |
| 35 | struct sysv_sem { |
| 36 | /* empty */ |
| 37 | }; |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk) |
| 40 | { |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | static inline void exit_sem(struct task_struct *tsk) |
| 45 | { |
| 46 | return; |
| 47 | } |
| 48 | #endif |
| 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #endif /* _LINUX_SEM_H */ |