Function Reference
Spinlocks
- void spin_lock(spinlock_t *lock): acquires the specified lock, spinning if needed until it is available.
- void spin_lock_irq(spinlock_t *lock): like spin_lock, but also disables interrupts on the local processor.
- void spin_lock_irqsave(spinlock_t *lock, unsigned long flags): like spin_lock_irq, but also saves the current interrupt state in flags.
- void spin_lock_bh(spinlock_t *lock): like spin_lock, but also disables the execution of all softirqs.
- void spin_unlock(spinlock_t *lock), void spin_unlock_irq(spinlock_t *lock), void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) and void spin_unlock_bh(spinlock_t *lock): the corresponding versions of the above, but they release the lock.
- void spin_trylock(spinlock_t *lock): returns nonzero if lock is currently held and zero otherwise.
- void read_lock(rwlock_t *lock) and void read_unlock(rwlock_t *lock): lock/unlock the read version of a read/write spinlock.
- void write_lock(rwlock_t *lock) and void write_unlock(rwlock_t *lock): lock/unlock the write version of a read/write spinlock.
Semaphores
- void sema_init(struct semaphore *sem, int val): initializes the given semaphore to the given usage count.
- void down(struct semaphore *sem): attempts to acquire the given semaphore, blocking if unavailable.
- int down_interruptible(struct semaphore *sem): like down, but also returns -EINTR if a signal is received.
- int down_trylock(struct semaphore *sem): like down, but returns nonzero immediately if the semaphore is not available.
- void up(struct semaphore *sem): releases the given semaphore.
- void init_rwsem(struct rw_semaphore *rwsem): initializes the given read/write semaphore to 1.
- void down_read(struct rw_semaphore *rwsem) and void up_read(struct rw_semaphore *rwsem): up/down for reading the given read/write semaphore.
- void down_write(struct rw_semaphore *rwsem) and void up_write(struct rw_semaphore *rwsem): up/down for writing the given read/write semaphore.
Big Kernel Lock
- void lock_kernel(): tries to acquire the big kernel lock (BKL).
- void unlock_kernel(): releases the BKL.
- int kernel_locked(): returns true if the BKL is currently acquired and false if not.
Preemption Disabling
- void preempt_disable(): increments the preemption counter.
- void preempt_enable(): decrements the preemption counter and allows a preemptive reschedule if needed.
- void preempt_enable_no_resched(): decrements the preemption counter.
- int preempt_get_count(): returns the current value of the preemption counter.
Copyright © 1994 - 2019 Linux Journal. All rights reserved.