summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-01-11 12:06:47 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-01-11 12:06:47 +0000
commit657163916ee09d1049950a4d59beaa7b13e616ba (patch)
treee57172867a5e25093cc9247243a780bdfac277de
parentec086ae3d9e87adfe7c4834c27d35d0bab2486f9 (diff)
Document rw_enter and rw_exit.
Requested and ok by dlg@, ok jmc@
-rw-r--r--share/man/man9/Makefile8
-rw-r--r--share/man/man9/rwlock.939
2 files changed, 43 insertions, 4 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 2be1ccc9aba..b3d14ccce78 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.120 2007/01/11 09:17:03 jmc Exp $
+# $OpenBSD: Makefile,v 1.121 2007/01/11 12:06:46 art Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -255,8 +255,10 @@ MLINKS+=rssadapt.9 ieee80211_rssadapt_choose.9 \
rssadapt.9 ieee80211_rssadapt_lower_rate.9 \
rssadapt.9 ieee80211_rssadapt_raise_rate.9 \
rssadapt.9 ieee80211_rssadapt_updatestats.9
-MLINKS+=rwlock.9 rw_init.9 rwlock.9 rw_enter_read.9 rwlock.9 rw_enter_write.9 \
- rwlock.9 rw_exit_read.9 rwlock.9 rw_exit_write.9
+MLINKS+=rwlock.9 rw_init.9 rwlock.9 rw_enter.9 rwlock.9 rw_exit.9 \
+ rwlock.9 rw_enter_read.9 rwlock.9 rw_enter_write.9 \
+ rwlock.9 rw_exit_read.9 rwlock.9 rw_exit_write.9
+
MLINKS+=sensor_attach.9 sensordev_install.9 \
sensor_attach.9 sensordev_deinstall.9 \
sensor_attach.9 sensordev_get.9 \
diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9
index 70b10371b72..1cb5d462f0c 100644
--- a/share/man/man9/rwlock.9
+++ b/share/man/man9/rwlock.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rwlock.9,v 1.3 2006/08/16 10:19:00 dlg Exp $
+.\" $OpenBSD: rwlock.9,v 1.4 2007/01/11 12:06:46 art Exp $
.\"
.\" Copyright (c) 2006 Pedro Martelletto <pedro@openbsd.org>
.\" All rights reserved.
@@ -21,6 +21,8 @@
.Sh NAME
.Nm rwlock ,
.Nm rw_init ,
+.Nm rw_enter ,
+.Nm rw_exit ,
.Nm rw_enter_read ,
.Nm rw_enter_write ,
.Nm rw_exit_read ,
@@ -30,6 +32,10 @@
.Fd #include <sys/rwlock.h>
.Ft void
.Fn rw_init "struct rwlock *rwl" "const char *name"
+.Ft int
+.Fn rw_enter "struct rwlock *rwl" "int flags"
+.Ft void
+.Fn rw_exit "struct rwlock *rwl"
.Ft void
.Fn rw_enter_read "struct rwlock *rwl"
.Ft void
@@ -54,6 +60,36 @@ argument specifies the name of the lock, which is used as the wait message
if the process needs to sleep.
.Pp
The
+.Fn rw_enter
+function acquires a lock.
+The
+.Fa flags
+argument specifies what kind of lock should be obtained and also
+modifies the operation.
+The possible flags are:
+.Pp
+.Bl -tag -offset indent -width RW_DOWNGRADEXXX -compact
+.It Dv RW_READ
+Acquire a shared lock.
+.It Dv RW_WRITE
+Acquire an exclusive lock.
+.It Dv RW_INTR
+When waiting for a lock, allow signals to interrupt the sleep.
+.It Dv RW_NOSLEEP
+Do not wait for busy locks, fail with
+.Dv EBUSY
+instead.
+.It Dv RW_SLEEPFAIL
+Wait for busy locks, but do not obtain them, fail with
+.Dv EAGAIN
+instead.
+.El
+.Pp
+The
+.Fn rw_exit
+function is used to release a held lock.
+.Pp
+The
.Fn rw_enter_read
function acquires a read lock, sleeping if necessary.
.Pp
@@ -75,6 +111,7 @@ A write lock, however, can only be acquired when there are no read locks held,
granting exclusive access to a single process.
.Sh SEE ALSO
.Xr lockmgr 9 ,
+.Xr mutex 9 ,
.Xr spl 9
.Sh HISTORY
The