summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2007-11-28 23:24:07 +0000
committerart <art@openbsd.org>2007-11-28 23:24:07 +0000
commit16c19d6f21eb53b2c9fddfc26349dade3df5831b (patch)
treeac79b4c4a621f97c2147e78ee69bb739ec4046ce
parentAdd msleep. This is identical to tsleep but it takes a mutex as a (diff)
downloadwireguard-openbsd-16c19d6f21eb53b2c9fddfc26349dade3df5831b.tar.xz
wireguard-openbsd-16c19d6f21eb53b2c9fddfc26349dade3df5831b.zip
<oga> art write me a manpage
<art> What? Write it yourself. <oga> sudo art write me a manpage. <art> ok Document msleep(9).
-rw-r--r--share/man/man9/Makefile4
-rw-r--r--share/man/man9/tsleep.921
2 files changed, 21 insertions, 4 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 6b952a8c0b2..3a78a60932e 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.136 2007/11/14 11:16:27 mglocker Exp $
+# $OpenBSD: Makefile,v 1.137 2007/11/28 23:24:07 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.
@@ -273,7 +273,7 @@ MLINKS+=sensor_attach.9 sensordev_install.9 \
sensor_attach.9 sensor_task_register.9 \
sensor_attach.9 sensor_task_unregister.9
MLINKS+=shutdownhook_establish.9 shutdownhook_disestablish.9
-MLINKS+=tsleep.9 wakeup.9
+MLINKS+=tsleep.9 wakeup.9 tsleep.9 msleep.9
MLINKS+=spl.9 spl0.9 spl.9 splassert.9 spl.9 splbio.9 spl.9 splclock.9 \
spl.9 splhigh.9 spl.9 spllowersoftclock.9 \
spl.9 splnet.9 spl.9 splsched.9 spl.9 splserial.9 spl.9 splsoftclock.9 \
diff --git a/share/man/man9/tsleep.9 b/share/man/man9/tsleep.9
index bfd09213fcc..9be4f9e14e1 100644
--- a/share/man/man9/tsleep.9
+++ b/share/man/man9/tsleep.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tsleep.9,v 1.1 2007/09/14 16:16:08 mk Exp $
+.\" $OpenBSD: tsleep.9,v 1.2 2007/11/28 23:24:07 art Exp $
.\" $NetBSD: sleep.9,v 1.11 1999/03/24 06:15:12 mycroft Exp $
.\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,11 +35,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: September 14 2007 $
+.Dd $Mdocdate: November 28 2007 $
.Dt TSLEEP 9
.Os
.Sh NAME
.Nm tsleep ,
+.Nm msleep ,
.Nm wakeup
.Nd process context sleep and wakeup
.Sh SYNOPSIS
@@ -47,6 +48,8 @@
.Fd #include <sys/proc.h>
.Ft int
.Fn "tsleep" "void *ident" "int priority" "const char *wmesg" "int timo"
+.Ft int
+.Fn "msleep" "void *ident" "struct mutex *mtx" "int priority" "const char *wmesg" "int timo"
.Ft void
.Fn "wakeup" "void *ident"
.Sh DESCRIPTION
@@ -128,6 +131,20 @@ will return
.El
.Pp
The
+.Fn msleep
+function behaves just like
+.Fn tsleep ,
+but takes an additional
+.Fa mtx
+argument which is a mutex that will be unlocked when the process is safely
+on the sleep queue.
+The mutex will be relocked at the end of tsleep unless the
+.Dv PNORELOCK
+flag is set in the
+.Fa priority
+argument.
+.Pp
+The
.Fn wakeup
function will mark all processes which are currently sleeping on the identifier
.Fa ident