The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | **************************************************************************** |
| 11 | ****************************************************************************/ |
| 12 | #ifndef __ASM_ARM_SEMAPHORE_H |
| 13 | #define __ASM_ARM_SEMAPHORE_H |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 14 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 15 | #include <linux/linkage.h> |
| 16 | #include <linux/spinlock.h> |
| 17 | #include <linux/wait.h> |
| 18 | #include <linux/rwsem.h> |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 19 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 20 | #include <asm/atomic.h> |
| 21 | #include <asm/locks.h> |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 22 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 23 | struct semaphore { |
| 24 | atomic_t count; |
| 25 | int sleepers; |
| 26 | wait_queue_head_t wait; |
| 27 | }; |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 28 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 29 | #define __SEMAPHORE_INIT(name, cnt) { .count = ATOMIC_INIT(cnt), .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), } |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 30 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 31 | #define __DECLARE_SEMAPHORE_GENERIC(name,count) struct semaphore name = __SEMAPHORE_INIT(name,count) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 32 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 33 | #define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) |
| 34 | #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) |
Ben Cheng | 4b29af0 | 2012-03-07 16:14:53 -0800 | [diff] [blame] | 35 | |
The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 36 | #endif |