blob: 7c5618a3a2e5377bccd163cceaca1ef6464cf24f [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
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 Cheng4b29af02012-03-07 16:14:53 -080014
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015#include <linux/linkage.h>
16#include <linux/spinlock.h>
17#include <linux/wait.h>
18#include <linux/rwsem.h>
Ben Cheng4b29af02012-03-07 16:14:53 -080019
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020#include <asm/atomic.h>
21#include <asm/locks.h>
Ben Cheng4b29af02012-03-07 16:14:53 -080022
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080023struct semaphore {
24 atomic_t count;
25 int sleepers;
26 wait_queue_head_t wait;
27};
Ben Cheng4b29af02012-03-07 16:14:53 -080028
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029#define __SEMAPHORE_INIT(name, cnt) { .count = ATOMIC_INIT(cnt), .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait), }
Ben Cheng4b29af02012-03-07 16:14:53 -080030
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031#define __DECLARE_SEMAPHORE_GENERIC(name,count) struct semaphore name = __SEMAPHORE_INIT(name,count)
Ben Cheng4b29af02012-03-07 16:14:53 -080032
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080033#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
34#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
Ben Cheng4b29af02012-03-07 16:14:53 -080035
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080036#endif