summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile18
-rw-r--r--share/man/man9/hz.991
-rw-r--r--share/man/man9/hzto.957
-rw-r--r--share/man/man9/inittodr.94
-rw-r--r--share/man/man9/microtime.977
-rw-r--r--share/man/man9/psignal.9129
-rw-r--r--share/man/man9/sleep.9183
-rw-r--r--share/man/man9/timeout.990
8 files changed, 640 insertions, 9 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 59a48ac2252..ae189176ab2 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,15 +1,14 @@
-# $OpenBSD: Makefile,v 1.9 1999/08/19 08:12:10 millert Exp $
+# $OpenBSD: Makefile,v 1.10 1999/09/01 20:52:11 espie Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
-MAN= boot.9 copy.9 disk.9 doshutdownhooks.9 fetch.9 intro.9 inittodr.9 \
- malloc.9 md5.9 panic.9 resettodr.9 random.9 shutdownhook_establish.9 \
- spl.9 store.9 style.9 time.9 vm_allocate.9 vm_map_copy.9 \
- vm_deallocate.9 vm_map_inherit.9 vm_map_protect.9
+MAN= boot.9 copy.9 disk.9 doshutdownhooks.9 fetch.9 hz.9 hzto.9 intro.9 \
+ inittodr.9 malloc.9 md5.9 microtime.9 panic.9 psignal.9 resettodr.9 \
+ random.9 shutdownhook_establish.9 sleep.9 spl.9 store.9 style.9 \
+ time.9 timeout.9 vm_allocate.9 vm_map_copy.9 vm_deallocate.9 \
+ vm_map_inherit.9 vm_map_protect.9
-MLINKS+=shutdownhook_establish.9 shutdownhook_disestablish.9
-MLINKS+=time.9 boottime.9 time.9 mono_time.9 time.9 runtime.9
MLINKS+=copy.9 copyin.9 copy.9 copyout.9 copy.9 copystr.9 \
copy.9 copyinstr.9 copy.9 copyoutstr.9
MLINKS+=disk.9 disk_init.9 disk.9 disk_attach.9 disk.9 disk_detatch.9 \
@@ -18,12 +17,17 @@ MLINKS+=disk.9 disk_init.9 disk.9 disk_attach.9 disk.9 disk_detatch.9 \
MLINKS+=fetch.9 fubyte.9 fetch.9 fuibyte.9 fetch.9 fusword.9 \
fetch.9 fuswintr.9 fetch.9 fuword.9 fetch.9 fuiword.9
MLINKS+=md5.9 MD5Init.9 md5.9 MD5Transform.9
+MLINKS+=psignal.9 pgsignal.9 psignal.9 gsignal.9
+MLINKS+=shutdownhook_establish.9 shutdownhook_disestablish.9
+MLINKS+=sleep.9 tsleep.9 sleep.9 wakeup.9
MLINKS+=spl.9 spl0.9 spl.9 splbio.9 spl.9 splclock.9 spl.9 splhigh.9 \
spl.9 splimp.9 spl.9 splnet.9 spl.9 splsched.9 spl.9 splserial.9 \
spl.9 splsoftclock.9 spl.9 splsoftnet.9 spl.9 splsoftserial.9 \
spl.9 splstatclock.9 spl.9 spltty.9 spl.9 splx.9
MLINKS+=store.9 subyte.9 store.9 suibyte.9 store.9 susword.9 \
store.9 suswintr.9 store.9 suword.9 store.9 suiword.9
+MLINKS+=time.9 boottime.9 time.9 mono_time.9 time.9 runtime.9
+MLINKS+=timeout.9 untimeout.9
MLINKS+=vm_map_copy.9 vm_copy.9
MLINKS+=vm_map_inherit.9 vm_inherit.9
MLINKS+=vm_map_protect.9 vm_protect.9
diff --git a/share/man/man9/hz.9 b/share/man/man9/hz.9
new file mode 100644
index 00000000000..47886bf94bb
--- /dev/null
+++ b/share/man/man9/hz.9
@@ -0,0 +1,91 @@
+.\" $OpenBSD: hz.9,v 1.1 1999/09/01 20:52:11 espie Exp $
+.\"
+.\" Copyright (c) 1999 Marc Espie
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Marc Espie
+.\" for the OpenBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd August 31, 1999
+.Dt HZ 9
+.Os
+.Sh NAME
+.Nm hz ,
+.Nm tick ,
+.Nm tickadj ,
+.Nm stathz ,
+.Nm profhz
+.Nd system time model.
+.Sh SYNOPSIS
+.Va extern int hz;
+.br
+.Va extern int tick;
+.br
+.Va extern int tickadj;
+.br
+.Va extern int stathz;
+.br
+.Va extern int stathz;
+.Sh DESCRIPTION
+The system is driven by
+.Xr hardclock 9
+interrupts, which occur at
+.Va hz
+frequency, and are used to keep track of real time.
+.Pp
+On systems where another independent clock is available, it is set at
+.Va stathz
+frequency, and used to gather timing statistics. Otherwise,
+.Va stathz
+is set to
+.Va hz .
+.Pp
+If profiling is enabled, the second clock may be run at a higher rate
+.Va profhz ,
+which must be a multiple of
+.Va stathz .
+.Pp
+Normally,
+.Xr hardclock 9
+increments
+.Va time
+by
+.Va tick
+each time it is called.
+If the system clock has drifted,
+.Xr adjtime 2
+may be used to skew this increment, but by no more
+than ten times
+.Va tickadj .
+.Pp
+Those systems variables are available as a struct clockinfo from
+.Xr sysctl 3 .
+.Sh SEE ALSO
+.Xr adjtime 2 ,
+.Xr clock_getres 2 ,
+.Xr sysctl 3 ,
+.Xr hardclock 9 ,
+.Xr microtime 9
diff --git a/share/man/man9/hzto.9 b/share/man/man9/hzto.9
new file mode 100644
index 00000000000..35bd4ea0792
--- /dev/null
+++ b/share/man/man9/hzto.9
@@ -0,0 +1,57 @@
+.\" $OpenBSD: hzto.9,v 1.1 1999/09/01 20:52:12 espie Exp $
+.\"
+.\" Copyright (c) 1999 Marc Espie
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Marc Espie
+.\" for the OpenBSD Project.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd August 31, 1999
+.Dt HZTO 9
+.Os
+.Sh NAME
+.Nm hzto
+.Nd translate absolute time to timeout delay.
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/time.h>
+.Fd #include <sys/systm.h>
+.Ft int
+.Fn hzto "struct timeval *tv"
+.Sh DESCRIPTION
+The
+.Fn hzto
+function computes the number of
+.Va hz
+until the specified time occurs. This is mainly used to translate a timeval
+into a suitable argument for
+.Xr timeout 9 .
+.Sh CODE REFERENCES
+This function is implemented in the file
+.Pa sys/kern/kern_clock.c .
+.Sh SEE ALSO
+.Xr hz 9 ,
+.Xr timeout 9
diff --git a/share/man/man9/inittodr.9 b/share/man/man9/inittodr.9
index 3ed0d82df42..12b3c684bf5 100644
--- a/share/man/man9/inittodr.9
+++ b/share/man/man9/inittodr.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: inittodr.9,v 1.5 1999/07/09 13:35:34 aaron Exp $
+.\" $OpenBSD: inittodr.9,v 1.6 1999/09/01 20:52:13 espie Exp $
.\" $NetBSD: inittodr.9,v 1.2 1996/03/27 21:16:06 jtc Exp $
.\"
.\" Copyright (c) 1994 Christopher G. Demetriou
@@ -44,7 +44,7 @@ The
.Fn inittodr
function determines the time and sets the system clock.
It tries to pick the correct time using a set of heuristics that examine
-the system's battery backed clock and the time reported by the file
+the system's battery-backed clock and the time reported by the file
system, as given in
.Fa base .
Those heuristics include:
diff --git a/share/man/man9/microtime.9 b/share/man/man9/microtime.9
new file mode 100644
index 00000000000..d1a2ff4b373
--- /dev/null
+++ b/share/man/man9/microtime.9
@@ -0,0 +1,77 @@
+.\" $NetBSD: microtime.9,v 1.2 1999/03/16 00:40:47 garbled Exp $
+.\"
+.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jeremy Cooper.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd Sep 14, 1998
+.Dt MICROTIME 9
+.Os
+.Sh NAME
+.Nm microtime
+.Nd realtime system clock
+.Sh SYNOPSIS
+.Fd #include <sys/time.h>
+.Ft void
+.Fo "microtime"
+.Fa "struct timeval *tv"
+.Fc
+.Sh DESCRIPTION
+.Fn microtime
+returns the current value of the system realtime clock in the structure
+pointed to by the argument
+.Fa tv .
+The system realtime clock is guaranteed to be monotonically increasing
+at all times.
+As such,
+all calls to
+.Fn microtime
+are guaranteed to return a system time greater than or equal to the
+system time returned in any previous calls.
+.Sh SEE ALSO
+.Xr hz 9 ,
+.Xr hardclock 9 ,
+.Xr inittodr 9 ,
+.Xr time 9 ,
+.Xr settimeofday 9
+.Sh CODE REFERENCES
+The implementation of the
+.Fn microtime
+function is machine dependent,
+hence its location in the source code tree varies from architecture to
+architecture.
+.Sh BUGS
+Despite the guarantee that the system realtime clock will always be
+monotonically increasing,
+it is always possible for the system clock to be manually reset by the
+system administrator to any date.
diff --git a/share/man/man9/psignal.9 b/share/man/man9/psignal.9
new file mode 100644
index 00000000000..2d2d97dccb0
--- /dev/null
+++ b/share/man/man9/psignal.9
@@ -0,0 +1,129 @@
+.\" $NetBSD: psignal.9,v 1.5 1999/03/16 00:40:47 garbled Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 22, 1996
+.Dt PSIGNAL 9
+.Os
+.Sh NAME
+.Nm psignal ,
+.Nm pgsignal ,
+.Nm gsignal
+.Nd post signal to a process
+.Sh SYNOPSIS
+.Ft void
+.Fn "psignal" "struct proc *p" "int signum"
+.Ft void
+.Fn "pgsignal" "struct pgrp *pgrp" "int signum" "int checkctty"
+.Ft void
+.Fn "gsignal" "int pgid" "int signum"
+.Sh DESCRIPTION
+These functions post a signal to one or more processes.
+The argument
+.Fa signum
+common to all three functions should be in the range
+.Bq 1- Ns Dv NSIG .
+.Pp
+The
+.Fn psignal
+function posts signal number
+.Fa signum
+to the process represented by the process structure
+.Fa p .
+With a few exceptions noted below, the target process signal disposition is
+updated and is marked as runnable, so further handling of the signal is done
+in the context of the target process after a context switch.
+Note that
+.Fn psignal
+does not by itself cause a context switch to happen.
+.Pp
+The target process is not marked as runnable in the following cases:
+.Bl -bullet -offset indent
+.It
+The target process is sleeping uninterruptibly.
+The signal will be
+noticed when the process returns from the system call or trap.
+.It
+The target process is currently ignoring the signal.
+.It
+If a stop signal is sent to a sleeping process that takes the
+default action
+.Pq see Xr sigaction 2 ,
+the process is stopped without awakening it.
+.It
+.Dv SIGCONT
+restarts a stopped process
+.Pq or puts them back to sleep
+regardless of the signal action
+.Pq e.g., blocked or ignored .
+.El
+.Pp
+If the target process is being traced,
+.Fn psignal
+behaves as if the target process were taking the default action for
+.Fa signum .
+This allows the tracing process to be notified of the signal.
+.Pp
+The
+.Fn pgsignal
+function posts signal number
+.Fa signum
+to each member of the process group described by
+.Fa pgrp .
+If
+.Fa checkctty
+is non-zero, the signal will be posted only to processes that have
+a controlling terminal.
+If
+.Fa pgrp
+is
+.Dv NULL
+no action is taken.
+.Pp
+The
+.Fn gsignal
+function posts signal number
+.Fa signum
+to each member of the process group identified by the group id
+.Fa pgid .
+If
+.Fa pgid
+is zero no action is taken.
+.Sh CODE REFERENCES
+These functions are implemented in
+.Pa /usr/src/sys/kern/kern_sig.c .
+.Sh SEE ALSO
+.Xr sigaction 2 ,
+.Xr tsleep 9
diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9
new file mode 100644
index 00000000000..a30bb43c95a
--- /dev/null
+++ b/share/man/man9/sleep.9
@@ -0,0 +1,183 @@
+.\" $NetBSD: sleep.9,v 1.11 1999/03/24 06:15:12 mycroft Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 23, 1996
+.Dt SLEEP 9
+.Os
+.Sh NAME
+.Nm sleep ,
+.Nm tsleep ,
+.Nm wakeup
+.Nd process context sleep and wakeup
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/proc.h>
+.Ft int
+.Fn "tsleep" "void *ident" "int priority" "const char *wmesg" "int timo"
+.Ft void
+.Fn "sleep" "void *ident" "int priority"
+.Ft void
+.Fn "wakeup" "void *ident"
+.Sh DESCRIPTION
+These functions implement voluntary context switching.
+.Fn tsleep
+and
+.Fn sleep
+are used throughout the kernel whenever processing in the current context
+can not continue for any of the following reasons:
+.Bl -bullet -offset indent
+.It
+The current process needs to await the results of a pending I/O operation.
+.It
+The current process needs resources
+.Pq e.g. memory
+which are temporarily unavailable.
+.It
+The current process wants access to data structures which are locked by
+other processes.
+.El
+.Pp
+The function
+.Fn wakeup
+is used to notify sleeping processes of possible changes to the condition
+that caused them to go to sleep.
+Typically, an awakened process will -- after it has acquired a context
+again -- retry the action that blocked its operation to see if the
+.Dq blocking
+condition has cleared.
+.Pp
+The
+.Va bpendsleep
+label can be used as a break-point to debug a process coming back from
+.Fn tsleep .
+.Pp
+The
+.Fn tsleep
+function takes the following arguments:
+.Bl -tag -width priority
+.It Fa ident
+An identifier of the
+.Dq wait channel
+representing the resource for which the current process needs to wait.
+This typically is the virtual address of some kernel data structure related
+to the resource for which the process is contending.
+The same identifier must be used in a call to
+.Fn wakeup
+to get the process going again.
+.Fa ident
+should not be
+.Dv NULL .
+.It Fa priority
+The process priority to be used when the process is awakened and put on
+the queue of runnable processes.
+This mechanism is used to optimize
+.Dq throughput
+of processes executing in kernel mode.
+If the flag
+.Dv PCATCH
+is OR'ed into
+.Fa priority
+the process checks for posted signals before and after sleeping.
+.It Fa wmesg
+A pointer to a character string indicating the reason a process is sleeping.
+The kernel does not use the string, but makes it available
+.Pq through the process structure field Li p_wmesg
+for user level utilities such as
+.Xr ps 1 .
+.It Fa timo
+If non-zero, the process will sleep for at most
+.Li timo/hz
+seconds.
+If this amount of time elapses and no
+.Fn wakeup "ident"
+has occurred, and no signal
+.Pq if Dv PCATCH No was set
+was posted,
+.Fn tsleep
+will return
+.Er EWOULDBLOCK .
+.El
+.Pp
+The
+.Fn sleep
+function puts the process in an uninterruptible sleep.
+It is functionally equivalent to:
+.Bd -literal -offset indent
+tsleep(ident, priority & PRIMASK, 0, 0)
+.Ed
+.Pp
+The
+.Fn wakeup
+function will mark all processes which are currently sleeping on the identifier
+.Fa ident
+as runnable.
+Eventually, each of the processes will resume execution in the kernel
+context, causing a return from
+.Fn [t]sleep .
+Note that processes returning from sleep should always re-evaluate the
+conditions that blocked them, since a call to
+.Fn wakeup
+merely signals a
+.Em possible
+change to the blocking conditions.
+For example, when two or more processes are waiting for an exclusive lock,
+only one of them will succeed in acquiring the lock when it is released.
+All others will have to go back to sleep and wait for the next opportunity.
+.Sh RETURN VALUES
+.Fn tsleep
+returns 0 if it returns as a result of a
+.Fn wakeup .
+If a
+.Fn tsleep
+returns as a result of a signal, the return value is
+.Er ERESTART
+if the signal has the
+.Dv SA_RESTART
+property
+.Pq see Xr sigaction 2 ,
+and
+.Er EINTR
+otherwise.
+If
+.Fn tsleep
+returns as a result of a timeout, the return value is
+.Er EWOULDBLOCK .
+.Sh CODE REFERENCES
+These functions are implemented in the file
+.Pa sys/kern/kern_synch.c .
+.Sh SEE ALSO
+.Xr hz 9 ,
+.Xr timeout 9
diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9
new file mode 100644
index 00000000000..34c14755992
--- /dev/null
+++ b/share/man/man9/timeout.9
@@ -0,0 +1,90 @@
+.\" $NetBSD: timeout.9,v 1.7 1999/03/16 00:40:48 garbled Exp $
+.\"
+.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Paul Kranenburg.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 23, 1996
+.Dt TIMEOUT 9
+.Os
+.Sh NAME
+.Nm timeout ,
+.Nm untimeout
+.Nd execute a function after a specified length of time
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/systm.h>
+.Ft void
+.Fn "timeout" "void (*ftn)(void *)" "void *arg" "int ticks"
+.Ft void
+.Fn "untimeout" "void (*ftn)(void *)" "void *arg"
+.Sh DESCRIPTION
+The function
+.Fn timeout
+schedules a call to the function given by the argument
+.Fa ftn
+to take place after
+.Fa ticks Ns No /hz
+seconds.
+Non-positive values of
+.Fa ticks
+are silently converted to the value
+.Sq 1 .
+.Fa ftn
+should be a pointer to a function that takes a
+.Fa void *
+argument, to which the argument
+.Fa arg
+will be passed.
+.Pp
+The function
+.Fn untimeout
+cancels the first scheduled call
+.Pq i.e. the one with the shortest delay left
+that matches the
+.Aq Fa ftn , Ns Fa arg
+pair.
+If a match can not be found in the callout queue, nothing happens.
+.Pp
+The callout queue is statically sized, dependent on the
+.Va MAXUSERS
+parameter.
+.Sh CODE REFERENCES
+These functions are implemented in the file
+.Pa sys/kern/kern_clock.c .
+.Sh SEE ALSO
+.Xr hz 9 ,
+.Xr sleep 9
+.Sh BUGS
+.Fn untimeout
+should probably remove all matches from the queue.