tools/include/linux/rwsem.h

Source file repositories/reference/linux-study-clean/tools/include/linux/rwsem.h

File Facts

System
Linux kernel
Corpus path
tools/include/linux/rwsem.h
Extension
.h
Size
920 bytes
Lines
45
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rw_semaphore {
	pthread_rwlock_t lock;
};

static inline int init_rwsem(struct rw_semaphore *sem)
{
	return pthread_rwlock_init(&sem->lock, NULL);
}

static inline int exit_rwsem(struct rw_semaphore *sem)
{
	return pthread_rwlock_destroy(&sem->lock);
}

static inline int down_read(struct rw_semaphore *sem)
{
	return pthread_rwlock_rdlock(&sem->lock);
}

static inline int up_read(struct rw_semaphore *sem)
{
	return pthread_rwlock_unlock(&sem->lock);
}

static inline int down_write(struct rw_semaphore *sem)
{
	return pthread_rwlock_wrlock(&sem->lock);
}

static inline int up_write(struct rw_semaphore *sem)
{
	return pthread_rwlock_unlock(&sem->lock);
}

#define down_read_nested(sem, subclass)		down_read(sem)
#define down_write_nested(sem, subclass)	down_write(sem)

#endif /* _TOOLS_RWSEM_H */

Annotation

Implementation Notes