From 9b2c54449ce0441e164330563ce63ab584072123 Mon Sep 17 00:00:00 2001 From: blambert Date: Sun, 1 Aug 2010 14:21:10 +0000 Subject: [PATCH] document the rw_assert_ functions ok jmc@ --- share/man/man9/Makefile | 6 ++++-- share/man/man9/rwlock.9 | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index fcf9e0f46cd..b87f594177b 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.156 2009/09/08 06:01:41 deraadt Exp $ +# $OpenBSD: Makefile,v 1.157 2010/08/01 14:21:10 blambert Exp $ # $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -265,7 +265,9 @@ MLINKS+=rssadapt.9 ieee80211_rssadapt_choose.9 \ rssadapt.9 ieee80211_rssadapt_updatestats.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 + rwlock.9 rw_exit_read.9 rwlock.9 rw_exit_write.9 \ + rwlock.9 rw_assert_wrlock.9 rwlock.9 rw_assert_rdlock.9 \ + rwlock.9 rw_assert_unlocked.9 MLINKS+=sensor_attach.9 sensordev_install.9 \ sensor_attach.9 sensordev_deinstall.9 \ diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9 index 23e5e8e06c6..ae7056fae30 100644 --- a/share/man/man9/rwlock.9 +++ b/share/man/man9/rwlock.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rwlock.9,v 1.8 2007/12/09 20:54:01 jmc Exp $ +.\" $OpenBSD: rwlock.9,v 1.9 2010/08/01 14:21:10 blambert Exp $ .\" .\" Copyright (c) 2006 Pedro Martelletto .\" All rights reserved. @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 9 2007 $ +.Dd $Mdocdate: August 1 2010 $ .Dt RWLOCK 9 .Os .Sh NAME @@ -44,6 +44,12 @@ .Fn rw_exit_read "struct rwlock *rwl" .Ft void .Fn rw_exit_write "struct rwlock *rwl" +.Ft void +.Fn rw_assert_wrlock "struct rwlock *rwl" +.Ft void +.Fn rw_assert_rdlock "struct rwlock *rwl" +.Ft void +.Fn rw_assert_unlocked "struct rwlock *rwl" .Sh DESCRIPTION The .Nm @@ -112,6 +118,15 @@ Read locks can be acquired while the write lock is not held, and may coexist in distinct processes at any time. A write lock, however, can only be acquired when there are no read locks held, granting exclusive access to a single process. +.Pp +The +.Fn rw_assert_wrlock , +.Fn rw_assert_rdlock , +and +.Fn rw_assert_unlocked +functions check the status +.Fa rwl , +panicking if it is not write-, read-, or unlocked, respectively. .Sh SEE ALSO .Xr lockmgr 9 , .Xr mutex 9 , -- 2.20.1