The include file that defines semaphores and the operations on them.
#include<asm/semaphore.h>
Two macros for declaring and initializing a semaphore used in mutual exclusion
mode.
DECLARE_MUTEX(name);
DECLARE_MUTEX_LOCKED(name);
Lock and unlock a semaphore. down puts the calling process into an uninterruptible sleep if need be; down_interruptible, instead, can be interrupted by a signal. down_trylock does not sleep; instead, it returns immediately if the
semaphore is unavailable. Code that locks a semaphore must eventually unlock
it with up.
void down(struct semaphore *sem); int down_interruptible(struct semaphore *sem); int down_trylock(struct semaphore *sem); void up(struct semaphore *sem);
The reader/writer version of semaphores and the function that initializes it.
The include file describing the Linux completion mechanism, and the normal
methods for initializing completions. INIT_COMPLETION should be used only to
reinitialize a completion that has been previously used.
Atomically access integer variables. The atomic_t variables must be accessed
only through these functions.
#include<asm/atomic.h>
atomic_t v = ATOMIC_INIT(value);
void atomic_set(atomic_t *v,int i); int atomic_read(atomic_t *v); void atomic_add(int i, atomic_t *v); void atomic_sub(int i, atomic_t *v); void atomic_inc(atomic_t *v); void atomic_dec(atomic_t *v); int atomic_inc_and_test(atomic_t *v); int atomic_dec_and_test(atomic_t *v); int atomic_sub_and_test(int i, atomic_t *v); int atomic_add_negative(int i, atomic_t *v); int atomic_add_return(int i, atomic_t *v); int atomic_sub_return(int i, atomic_t *v); int atomic_inc_return(atomic_t *v); int atomic_dec_return(atomic_t *v);
Atomically access bit values; they can be used for flags or lock variables. Using
these functions prevents any race condition related to concurrent access to the
bit.
#include<asm/bitops.h>
void set_bit(nr,void*addr); void clear_bit(nr,void*addr); void change_bit(nr,void*addr);
test_bit(nr,void*addr); int test_and_set_bit(nr,void*addr); int test_and_clear_bit(nr,void*addr); int test_and_change_bit(nr,void*addr);
The include file defining seqlocks and the two ways of initializing them.