[Midnightbsd-cvs] src: man/man9: update section 9 of the manual
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Jan 20 14:31:08 EST 2009
Log Message:
-----------
update section 9 of the manual
Modified Files:
--------------
src/share/man/man9:
BUS_SETUP_INTR.9 (r1.1.1.1 -> r1.2)
DECLARE_GEOM_CLASS.9 (r1.1.1.1 -> r1.2)
EVENTHANDLER.9 (r1.1.1.1 -> r1.2)
Makefile (r1.2 -> r1.3)
SYSCALL_MODULE.9 (r1.1.1.1 -> r1.2)
VFS.9 (r1.1.1.1 -> r1.2)
VFS_LOCK_GIANT.9 (r1.1.1.1 -> r1.2)
VFS_ROOT.9 (r1.1.1.1 -> r1.2)
VFS_SET.9 (r1.1.1.1 -> r1.2)
VFS_SYNC.9 (r1.1.1.1 -> r1.2)
VOP_FSYNC.9 (r1.1.1.1 -> r1.2)
VOP_LISTEXTATTR.9 (r1.1.1.1 -> r1.2)
VOP_OPENCLOSE.9 (r1.1.1.1 -> r1.2)
VOP_REMOVE.9 (r1.1.1.1 -> r1.2)
VOP_RENAME.9 (r1.1.1.1 -> r1.2)
acl.9 (r1.1.1.1 -> r1.2)
alloc_unr.9 (r1.1.1.2 -> r1.2)
atomic.9 (r1.1.1.1 -> r1.2)
bios.9 (r1.1.1.1 -> r1.2)
bpf.9 (r1.1.1.1 -> r1.2)
buf.9 (r1.1.1.1 -> r1.2)
bus_alloc_resource.9 (r1.1.1.1 -> r1.2)
bus_dma.9 (r1.1.1.1 -> r1.2)
bus_space.9 (r1.1.1.1 -> r1.2)
condvar.9 (r1.1.1.1 -> r1.2)
contigmalloc.9 (r1.1.1.1 -> r1.2)
critical_enter.9 (r1.1.1.1 -> r1.2)
crypto.9 (r1.1.1.1 -> r1.2)
device_add_child.9 (r1.1.1.1 -> r1.2)
device_get_softc.9 (r1.1.1.1 -> r1.2)
device_set_driver.9 (r1.1.1.1 -> r1.2)
disk.9 (r1.1.1.1 -> r1.2)
driver.9 (r1.1.1.1 -> r1.2)
extattr.9 (r1.1.1.1 -> r1.2)
firmware.9 (r1.2 -> r1.3)
g_bio.9 (r1.1.1.1 -> r1.2)
g_consumer.9 (r1.1.1.1 -> r1.2)
hash.9 (r1.1 -> r1.2)
hashinit.9 (r1.1.1.1 -> r1.2)
ieee80211_ioctl.9 (r1.1.1.2 -> r1.2)
ifnet.9 (r1.1.1.1 -> r1.2)
ithread.9 (r1.1.1.1 -> r1.2)
kobj.9 (r1.1.1.1 -> r1.2)
ktr.9 (r1.1.1.1 -> r1.2)
lock.9 (r1.1.1.1 -> r1.2)
mac.9 (r1.1.1.1 -> r1.2)
make_dev.9 (r1.1.1.1 -> r1.2)
mbuf.9 (r1.2 -> r1.3)
memguard.9 (r1.1.1.1 -> r1.2)
mi_switch.9 (r1.1.1.1 -> r1.2)
microtime.9 (r1.1.1.1 -> r1.2)
module.9 (r1.1.1.1 -> r1.2)
mtx_pool.9 (r1.1.1.1 -> r1.2)
mutex.9 (r1.1.1.2 -> r1.2)
namei.9 (r1.1.1.1 -> r1.2)
p_candebug.9 (r1.1.1.1 -> r1.2)
pci.9 (r1.1.1.1 -> r1.2)
pfil.9 (r1.1.1.1 -> r1.2)
pmap_extract.9 (r1.1.1.1 -> r1.2)
pmap_remove.9 (r1.1.1.1 -> r1.2)
pmap_zero_page.9 (r1.2 -> r1.3)
printf.9 (r1.1.1.1 -> r1.2)
pseudofs.9 (r1.1.1.1 -> r1.2)
rman.9 (r1.1.1.1 -> r1.2)
rtentry.9 (r1.1.1.1 -> r1.2)
sbuf.9 (r1.1.1.1 -> r1.2)
securelevel_gt.9 (r1.1.1.1 -> r1.2)
selrecord.9 (r1.1.1.1 -> r1.2)
sema.9 (r1.1.1.1 -> r1.2)
sleep.9 (r1.2 -> r1.3)
sleepqueue.9 (r1.1.1.1 -> r1.2)
style.9 (r1.1.1.1 -> r1.2)
suser.9 (r1.1.1.1 -> r1.2)
sx.9 (r1.1.1.1 -> r1.2)
sysctl_add_oid.9 (r1.1.1.1 -> r1.2)
sysctl_ctx_init.9 (r1.1.1.1 -> r1.2)
taskqueue.9 (r1.1.1.1 -> r1.2)
thread_exit.9 (r1.1.1.1 -> r1.2)
time.9 (r1.1.1.1 -> r1.2)
timeout.9 (r1.1.1.1 -> r1.2)
uio.9 (r1.1.1.1 -> r1.2)
utopia.9 (r1.1.1.1 -> r1.2)
vflush.9 (r1.1.1.1 -> r1.2)
vgone.9 (r1.1.1.1 -> r1.2)
vhold.9 (r1.1.1.1 -> r1.2)
vm_map.9 (r1.1.1.1 -> r1.2)
vm_map_stack.9 (r1.1.1.1 -> r1.2)
vm_page_deactivate.9 (r1.1.1.1 -> r1.2)
vm_page_free.9 (r1.2 -> r1.3)
vm_page_grab.9 (r1.2 -> r1.3)
vm_page_hold.9 (r1.2 -> r1.3)
vm_page_insert.9 (r1.2 -> r1.3)
vm_page_io.9 (r1.2 -> r1.3)
vm_page_lookup.9 (r1.2 -> r1.3)
vm_page_protect.9 (r1.2 -> r1.3)
vm_page_rename.9 (r1.2 -> r1.3)
vm_page_sleep_busy.9 (r1.2 -> r1.3)
vm_page_wakeup.9 (r1.2 -> r1.3)
vm_page_wire.9 (r1.2 -> r1.3)
vm_page_zero_fill.9 (r1.2 -> r1.3)
vm_set_page_size.9 (r1.2 -> r1.3)
vn_fullpath.9 (r1.2 -> r1.3)
vn_isdisk.9 (r1.2 -> r1.3)
vnode.9 (r1.2 -> r1.3)
vput.9 (r1.2 -> r1.3)
vref.9 (r1.2 -> r1.3)
vrele.9 (r1.2 -> r1.3)
vslock.9 (r1.2 -> r1.3)
watchdog.9 (r1.2 -> r1.3)
zero_copy.9 (r1.2 -> r1.3)
zone.9 (r1.2 -> r1.3)
Added Files:
-----------
src/share/man/man9:
LOCK_PROFILING.9 (r1.1)
VOP_VPTOFH.9 (r1.1)
config_intrhook.9 (r1.1)
cr_cansee.9 (r1.1)
device_get_sysctl.9 (r1.1)
kqueue.9 (r1.1)
locking.9 (r1.1)
p_cansee.9 (r1.1)
priv.9 (r1.1)
redzone.9 (r1.1)
rwlock.9 (r1.1)
sf_buf.9 (r1.1)
socket.9 (r1.1)
stack.9 (r1.1)
sysctl.9 (r1.1)
usbdi.9 (r1.1)
vfs_getopt.9 (r1.1)
-------------- next part --------------
Index: printf.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/printf.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/printf.9 -L share/man/man9/printf.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/printf.9
+++ share/man/man9/printf.9
@@ -24,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/printf.9,v 1.6.2.1 2005/08/18 15:01:24 keramida Exp $
+.\" $FreeBSD: src/share/man/man9/printf.9,v 1.8 2006/09/08 14:05:03 ru Exp $
.\"
-.Dd August 10, 2004
+.Dd September 8, 2006
.Dt PRINTF 9
.Os
.Sh NAME
@@ -90,7 +90,7 @@
for example, \e10 gives octal and \e20 gives hexadecimal.
The arguments are made up of a sequence of bit identifiers.
Each bit identifier begins with an integer value which is the number of the
-bit this identifier describes.
+bit (starting from 1) this identifier describes.
The rest of the identifier is a string of characters containing the name of
the bit.
The string is terminated by either the bit number at the start of the next
@@ -140,7 +140,11 @@
.Fn uprintf
functions return the number of characters displayed.
.Sh EXAMPLES
-This example demonstrates the use of the \&%b and \&%D conversion specifiers.
+This example demonstrates the use of the
+.Cm \&%b
+and
+.Cm \&%D
+conversion specifiers.
The function
.Bd -literal -offset indent
void
Index: vm_page_hold.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_hold.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_hold.9 -L share/man/man9/vm_page_hold.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_hold.9
+++ share/man/man9/vm_page_hold.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_hold.9,v 1.4 2002/04/05 08:05:11 davidc Exp $
-.\" $MidnightBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_HOLD 9
Index: contigmalloc.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/contigmalloc.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/contigmalloc.9 -L share/man/man9/contigmalloc.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/contigmalloc.9
+++ share/man/man9/contigmalloc.9
@@ -23,9 +23,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/contigmalloc.9,v 1.6 2005/02/22 17:20:20 brueffer Exp $
+.\" $FreeBSD: src/share/man/man9/contigmalloc.9,v 1.7 2007/07/19 17:23:20 alc Exp $
.\"
-.Dd August 10, 2004
+.Dd July 19, 2007
.Dt CONTIGMALLOC 9
.Os
.Sh NAME
@@ -77,7 +77,14 @@
.Bl -tag -width indent
.It Dv M_ZERO
Causes the allocated physical memory to be zero filled.
+.It Dv M_NOWAIT
+Causes
+.Fn contigmalloc
+to return
+.Dv NULL
+if the request cannot be immediately fulfilled due to resource shortage.
.El
+.Pp
Other flags (if present) are ignored.
.Pp
The
@@ -88,10 +95,11 @@
The
.Fn contigmalloc
function does not sleep waiting for memory resources to be freed up,
-but instead scans available physical memory a small number of times
-for a suitably sized free address range before giving up.
-Memory allocation is done on a first-fit basis, starting from the
-top of the provided address range.
+but instead actively reclaims pages before giving up.
+However, unless
+.Dv M_NOWAIT
+is specified, it may select a page for reclamation that must first be
+written to backing storage, causing it to sleep.
.Sh RETURN VALUES
The
.Fn contigmalloc
--- /dev/null
+++ share/man/man9/vfs_getopt.9
@@ -0,0 +1,198 @@
+.\"
+.\" Copyright (C) 2007 Chad David <davidc at acns.ab.ca>. 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(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/vfs_getopt.9,v 1.2 2007/03/04 19:04:39 ru Exp $
+.\"
+.Dd February 28, 2007
+.Dt VFS_GETOPT 9
+.Os
+.Sh NAME
+.Nm vfs_getopt ,
+.Nm vfs_getopts ,
+.Nm vfs_flagopt ,
+.Nm vfs_scanopt ,
+.Nm vfs_copyopt ,
+.Nm vfs_filteropt
+.Nd "manipulate mount options and their values"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/mount.h
+.Ft int
+.Fo vfs_getopt
+.Fa "struct vfsoptlist *opts" "const char *name" "void **buf" "int *len"
+.Fc
+.Ft "char *"
+.Fn vfs_getops "struct vfsoptlist *opts" "const char *name" "int *error"
+.Ft int
+.Fo vfs_flagopt
+.Fa "struct vfsoptlist *opts" "const char *name" "u_int *flags" "u_int flag"
+.Fc
+.Ft int
+.Fo vfs_scanopt
+.Fa "struct vfsoptlist *opts" "const char *name" "const char *fmt" ...
+.Fc
+.Ft int
+.Fo vfs_copyopt
+.Fa "struct vfsoptlist *opts" "const char *name" "void *dest" "int len"
+.Fc
+.Ft int
+.Fo vfs_filteropt
+.Fa "struct vfsoptlist *opts" "const char **legal"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn vfs_getopt
+function sets
+.Fa buf
+to point to the value of the named mount option, and sets
+.Fa len
+to the length of the value if it is not
+.Dv NULL .
+The
+.Fa buf
+argument
+will point to the actual value, and does not need to be freed or released
+(and probably should not be modified).
+.Pp
+The
+.Fn vfs_getopts
+function
+returns the value of the specified option if it is a string (i.e.,
+.Dv NUL
+terminated).
+.Pp
+The
+.Fn vfs_flagopt
+function determines if an option exists.
+If the option does exist, and
+.Fa flags
+is not
+.Dv NULL ,
+.Fa flag
+is added to those already set in
+.Fa flags .
+If the option does not exist, and
+.Fa flags
+is not
+.Dv NULL ,
+.Fa flag
+is removed from those already set in
+.Fa flags .
+An example of typical usage is:
+.Bd -literal
+if (vfs_flagopt(mp->mnt_optnew, "wormlike", NULL, 0))
+ vfs_flagopt(mp->mnt_optnew, "appendok", &(mp->flags), F_APPENDOK);
+.Ed
+.Pp
+The
+.Fn vfs_scanopt
+function performs a
+.Xr vsscanf 3
+with the options value, using the given format,
+into the specified variable arguments.
+The value must be a string (i.e.,
+.Dv NUL
+terminated).
+.Pp
+The
+.Fn vfs_copyopt
+function creates a copy of the options value.
+The
+.Fa len
+argument must match the length of the options value exactly
+(i.e., a larger buffer will still cause
+.Fn vfs_copyout
+to fail with
+.Er EINVAL ) .
+.Pp
+The
+.Fn vfs_filteropt
+function ensures that no unknown options were specified.
+A option is valid if its name matches one of the names in the
+list of legal names.
+An option may be prefixed with 'no', and still be considered valid.
+.Sh RETURN VALUES
+The
+.Fn vfs_getopt
+function returns 0 if the option was found; otherwise,
+.Er ENOENT
+is returned.
+.Pp
+The
+.Fn vfs_getops
+function returns the specified option if it is found, and is
+.Dv NUL
+terminated.
+If the option was found, but is not
+.Dv NUL
+terminated,
+.Fa error
+is set to
+.Er EINVAL
+and
+.Dv NULL
+is returned.
+If the option was not found,
+.Fa error
+is set to 0, and
+.Dv NULL
+is returned.
+.Pp
+The
+.Fn vfs_flagopt
+function returns 1 if the option was found, and 0 if it was not.
+.Pp
+The
+.Fn vfs_scanopt
+function returns 0 if the option was not found, or was not
+.Dv NUL
+terminated; otherwise, the return value of
+.Xr vsscanf 3
+is returned.
+If
+.Xr vsscanf 3
+returns 0, it will be returned unchanged; therefore, a return value of 0 does
+not always mean the option does not exist, or is not a valid string.
+.Pp
+The
+.Fn vfs_copyopt
+function returns 0 if the copy was successful,
+.Er EINVAL
+if the option was found but the lengths did not match, and
+.Er ENOENT
+if the option was not found.
+.Pp
+The
+.Fn vfs_filteropt
+function returns 0 if all of the options are legal; otherwise,
+.Er EINVAL
+is returned.
+.Sh AUTHORS
+.An -nosplit
+This manual page was written by
+.An Chad David Aq davidc at FreeBSD.org
+and
+.An Ruslan Ermilov Aq ru at FreeBSD.org .
Index: device_add_child.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/device_add_child.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/device_add_child.9 -L share/man/man9/device_add_child.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/device_add_child.9
+++ share/man/man9/device_add_child.9
@@ -26,9 +26,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/device_add_child.9,v 1.19 2004/07/03 18:29:23 ru Exp $
+.\" $FreeBSD: src/share/man/man9/device_add_child.9,v 1.25 2006/09/12 15:48:22 imp Exp $
.\"
-.Dd May 13, 2004
+.Dd September 12, 2006
.Dt DEVICE_ADD_CHILD 9
.Os
.Sh NAME
@@ -67,8 +67,8 @@
as PCI) to allow each driver to check each device instance for a
match.
For busses which rely on supplied probe hints where only one
-driver can have a change of probing the device, the driver name should
-specified as the device name.
+driver can have a chance of probing the device, the driver name should
+be specified as the device name.
.Pp
Normally unit numbers will be chosen automatically by the system and a
unit number of
@@ -96,8 +96,10 @@
.Pp
When adding a device in the context of
.Xr DEVICE_IDENTIFY 9
-routine, some care must be taken to ensure that the device has not
-already been added to the tree.
+routine, the
+.Xr device_find_child 9
+routine should be used to ensure that the device has not already been
+added to the tree.
Because the device name and
.Vt devclass_t
are associated at probe time (not child addition time), previous
@@ -106,10 +108,18 @@
Authors of bus drivers must likewise be careful when adding children
when they are loaded and unloaded to avoid duplication of children
devices.
+.Pp
+Identify routines should use
+.Xr BUS_ADD_CHILD 9
+instead of
+.Xr device_add_child 9 .
.Sh RETURN VALUES
The new device if successful, NULL otherwise.
.Sh SEE ALSO
-.Xr device 9
+.Xr BUS_ADD_CHILD 9 ,
+.Xr device 9 ,
+.Xr device_find_child 9 ,
+.Xr DEVICE_IDENTIFY 9
.Sh AUTHORS
This manual page was written by
.An Doug Rabson .
Index: sysctl_ctx_init.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sysctl_ctx_init.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/sysctl_ctx_init.9 -L share/man/man9/sysctl_ctx_init.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/sysctl_ctx_init.9
+++ share/man/man9/sysctl_ctx_init.9
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sysctl_ctx_init.9,v 1.12 2004/07/03 18:29:24 ru Exp $
+.\" $FreeBSD: src/share/man/man9/sysctl_ctx_init.9,v 1.14 2007/07/27 19:55:42 remko Exp $
.\"
.Dd July 15, 2000
.Dt SYSCTL_CTX_INIT 9
@@ -135,7 +135,8 @@
as the oid number when creating an oid.
However, during registration of the oid in the tree,
this number is changed to the first available number
-greater than 99.
+greater than or equal to
+.Dv CTL_AUTO_START .
If the first step of context deletion fails,
re-registration of the oid does not change the already assigned oid number
(which is different from OID_AUTO).
@@ -225,6 +226,7 @@
.Sh SEE ALSO
.Xr queue 3 ,
.Xr sysctl 8 ,
+.Xr sysctl 9 ,
.Xr sysctl_add_oid 9 ,
.Xr sysctl_remove_oid 9
.Sh HISTORY
Index: extattr.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/extattr.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/extattr.9 -L share/man/man9/extattr.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/extattr.9
+++ share/man/man9/extattr.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/extattr.9,v 1.15 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/extattr.9,v 1.17 2007/03/06 08:13:21 mckusick Exp $
.\"
.Dd December 23, 1999
.Os
Index: securelevel_gt.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/securelevel_gt.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/securelevel_gt.9 -L share/man/man9/securelevel_gt.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/securelevel_gt.9
+++ share/man/man9/securelevel_gt.9
@@ -24,9 +24,9 @@
.\" 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.
-.\" $FreeBSD: src/share/man/man9/securelevel_gt.9,v 1.1 2004/03/07 15:22:08 josef Exp $
+.\" $FreeBSD: src/share/man/man9/securelevel_gt.9,v 1.2 2007/06/02 20:15:59 remko Exp $
.\"
-.Dd March 6, 2004
+.Dd June 2, 2007
.Dt SECURELEVEL_GT 9
.Os
.Sh NAME
@@ -68,4 +68,4 @@
.Er EPERM
if condition evaluated to true, and 0 otherwise.
.Sh SEE ALSO
-.Xr securelevel 8
+.Xr securelevel 7
Index: vm_page_zero_fill.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_zero_fill.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_zero_fill.9 -L share/man/man9/vm_page_zero_fill.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_zero_fill.9
+++ share/man/man9/vm_page_zero_fill.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_zero_fill.9,v 1.3 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_ZERO_FILL 9
Index: pseudofs.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/pseudofs.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/pseudofs.9 -L share/man/man9/pseudofs.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/pseudofs.9
+++ share/man/man9/pseudofs.9
@@ -23,9 +23,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/pseudofs.9,v 1.5 2004/07/03 18:29:24 ru Exp $
+.\" $FreeBSD: src/share/man/man9/pseudofs.9,v 1.6 2007/04/20 15:38:06 brueffer Exp $
.\"
-.Dd September 30, 2001
+.Dd April 20, 2007
.Dt PSEUDOFS 9
.Os
.Sh NAME
@@ -54,6 +54,7 @@
.\" Insert more info here
.Sh SEE ALSO
.Xr linprocfs 5 ,
+.Xr linsysfs 5 ,
.Xr procfs 5 ,
.Xr sbuf 9 ,
.Xr vnode 9
Index: VFS_SET.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VFS_SET.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VFS_SET.9 -L share/man/man9/VFS_SET.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VFS_SET.9
+++ share/man/man9/VFS_SET.9
@@ -24,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VFS_SET.9,v 1.9 2005/01/18 20:37:11 ru Exp $
+.\" $FreeBSD: src/share/man/man9/VFS_SET.9,v 1.11 2007/04/05 21:17:52 pjd Exp $
.\"
-.Dd December 2, 2001
+.Dd April 5, 2007
.Dt VFS_SET 9
.Os
.Sh NAME
@@ -70,6 +70,11 @@
Loopback file system layer.
.It Dv VFCF_UNICODE
File names are stored as Unicode.
+.It Dv VFCF_JAIL
+can be mounted from within a jail if
+.Va security.jail.mount_allowed
+sysctl is set to
+.Dv 1 .
.El
.Sh PSEUDOCODE
.Bd -literal
@@ -96,6 +101,8 @@
VFS_SET(myfs_vfsops, skelfs, 0);
.Ed
.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr jail 8 ,
.Xr DECLARE_MODULE 9 ,
.Xr vfsconf 9 ,
.Xr vfs_modevent 9
--- /dev/null
+++ share/man/man9/VOP_VPTOFH.9
@@ -0,0 +1,60 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 1996 Doug Rabson
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/VOP_VPTOFH.9,v 1.10 2007/02/16 14:27:59 pjd Exp $
+.\"
+.Dd February 16, 2007
+.Os
+.Dt VOP_VPTOFH 9
+.Sh NAME
+.Nm VOP_VPTOFH
+.Nd turn a vnode into an NFS filehandle
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.Ft int
+.Fn VOP_VPTOFH "struct vnode *vp" "struct fid *fhp"
+.Sh DESCRIPTION
+This is used by the NFS server to create an opaque filehandle which
+uniquely identifies the file and which can be used by an NFS client
+to access the file in the future.
+.Pp
+Its arguments are:
+.Bl -tag -width fhp
+.It Fa vp
+The vnode to make a filehandle for.
+.It Fa fhp
+Return parameter for the filehandle.
+.El
+.Sh SEE ALSO
+.Xr VFS 9 ,
+.Xr VFS_FHTOVP 9 ,
+.Xr vnode 9
+.Sh AUTHORS
+This manual page was written by
+.An Doug Rabson .
Index: pfil.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/pfil.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/pfil.9 -L share/man/man9/pfil.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/pfil.9
+++ share/man/man9/pfil.9
@@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/pfil.9,v 1.20 2005/01/21 08:36:40 ru Exp $
+.\" $FreeBSD: src/share/man/man9/pfil.9,v 1.22 2006/09/18 15:24:20 ru Exp $
.\"
.Dd September 29, 2004
.Dt PFIL 9
@@ -145,7 +145,7 @@
might sleep!
.Sh SEE ALSO
.Xr bpf 4 ,
-.Xr bridge 4
+.Xr if_bridge 4
.Sh HISTORY
The
.Nm
@@ -196,10 +196,12 @@
host byte order contrary to the above statements.
.Pp
The
-.Xr bridge 4
-diverts inbound
+.Xr if_bridge 4
+diverts
.Dv AF_INET
-traffic, but contrary to the above
+and
+.Dv AF_INET6
+traffic according to its sysctl settings, but contrary to the above
statements, the data is provided in host byte order.
.Pp
When a
Index: bios.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/bios.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/bios.9 -L share/man/man9/bios.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/bios.9
+++ share/man/man9/bios.9
@@ -1,4 +1,4 @@
-.\" $FreeBSD: src/share/man/man9/bios.9,v 1.13.10.1 2005/08/14 18:48:54 murray Exp $
+.\" $FreeBSD: src/share/man/man9/bios.9,v 1.16 2005/11/18 10:52:24 ru Exp $
.\"
.\" Copyright (c) 1997 Michael Smith
.\" All rights reserved.
@@ -24,13 +24,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd August 1, 1997
+.Dd August 9, 2005
.Dt BIOS 9
.Os
.Sh NAME
.Nm bios_sigsearch ,
.Nm bios32_SDlookup ,
-.Nm bios32
+.Nm bios32 ,
+.Nm bios_oem_strings
.Nd interact with PC BIOS
.Sh SYNOPSIS
.In sys/param.h
@@ -50,6 +51,23 @@
.Vt extern struct bios32_SDentry PCIbios ;
.Vt extern struct SMBIOS_table SMBIOStable ;
.Vt extern struct DMI_table DMItable ;
+.Ft int
+.Fn bios_oem_strings "struct bios_oem *oem" "u_char *buffer" "size_t maxlen"
+.Bd -literal
+struct bios_oem_signature {
+ char * anchor; /* search anchor string in BIOS memory */
+ size_t offset; /* offset from anchor (may be negative) */
+ size_t totlen; /* total length of BIOS string to copy */
+};
+struct bios_oem_range {
+ u_int from; /* shouldn't be below 0xe0000 */
+ u_int to; /* shouldn't be above 0xfffff */
+};
+struct bios_oem {
+ struct bios_oem_range range;
+ struct bios_oem_signature signature[];
+};
+.Ed
.Sh DESCRIPTION
These functions provide a general-purpose interface for dealing with
the BIOS functions and data encountered on x86 PC-architecture systems.
@@ -75,6 +93,46 @@
If the signature is found, its effective
physical address is returned.
If no signature is found, zero is returned.
+.It Fn bios_oem_strings
+Searches a given BIOS memory range for one or more strings,
+and composes a printable concatenation of those found.
+The routine expects a structure describing the BIOS address
+.Fa range
+(within
+.Li 0xe0000
+-
+.Li 0xfffff ) ,
+and a {
+.Dv NULL , Li 0 , 0
+} -terminated array of
+.Vt bios_oem_signature
+structures which define the
+.Va anchor
+string, an
+.Va offset
+from the beginning of the match (which may be negative), and
+.Va totlen
+number of bytes to be collected from BIOS memory starting at that offset.
+Unmatched anchors are ignored, whereas matches are copied from BIOS memory
+starting at their corresponding
+.Vt offset
+with unprintable characters being replaced with space, and consecutive spaces
+being suppressed.
+This composed string is stored in
+.Fa buffer
+up to the given
+.Fa maxlen
+bytes (including trailing
+.Ql \e0 ,
+and any trailing space surpressed).
+If an error is encountered, i.e.\& trying to read out of said BIOS range,
+other invalid input, or
+.Fa buffer
+overflow, a negative integer is returned, otherwise the
+length of the composed string is returned.
+In particular, a return
+value of 0 means that none of the given anchor strings were found in
+the specified BIOS memory range.
.It Fn BIOS_VADDRTOPADDR
Returns the effective physical address which corresponds to the kernel
virtual address
Index: vm_page_deactivate.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_deactivate.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/vm_page_deactivate.9 -L share/man/man9/vm_page_deactivate.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/vm_page_deactivate.9
+++ share/man/man9/vm_page_deactivate.9
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vm_page_deactivate.9,v 1.2 2001/08/08 10:04:08 ru Exp $
+.\" $FreeBSD: src/share/man/man9/vm_page_deactivate.9,v 1.3 2007/02/25 06:51:11 ru Exp $
.\"
.Dd July 24, 2001
.Dt VM_PAGE_DEACTIVATE 9
@@ -44,7 +44,6 @@
function moves the given page to the inactive queue as long as it is
unmanaged and is not wired.
.Sh SEE ALSO
-.Xr vm_page_unmanage 9 ,
.Xr vm_page_wire 9
.Sh AUTHORS
This manual page was written by
--- /dev/null
+++ share/man/man9/socket.9
@@ -0,0 +1,338 @@
+.\"-
+.\" Copyright (c) 2006 Robert N. M. Watson
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/socket.9,v 1.2 2006/12/16 10:32:10 rwatson Exp $
+.\"
+.Dd December 14, 2006
+.Dt SOCKET 9
+.Os
+.Sh NAME
+.Nm socket
+.Nd "kernel socket interface"
+.Sh SYNOPSIS
+.In sys/socket.h
+.In sys/socketvar.h
+.Ft int
+.Fn sobind "struct socket *so" "struct sockaddr *nam" "struct thread *td"
+.Ft void
+.Fn soclose "struct socket *so"
+.Ft int
+.Fn soconnect "struct socket *so" "struct sockaddr *nam" "struct thread *td"
+.Ft int
+.Fo socreate
+.Fa "int dom" "struct socket **aso" "int type" "int proto"
+.Fa "struct ucred *cred" "struct thread *td"
+.Fc
+.Ft int
+.Fn sogetopt "struct socket *so" "struct sockopt *sopt"
+.Ft int
+.Fo soreceive
+.Fa "struct socket *so" "struct sockaddr **psa" "struct uio *uio"
+.Fa "struct mbuf **mp0" "struct mbuf **controlp" "int *flagsp"
+.Fc
+.Ft int
+.Fn sosetopt "struct socket *so" "struct sockopt *sopt"
+.Ft int
+.Fo sosend
+.Fa "struct socket *so" "struct sockaddr *addr" "struct uio *uio"
+.Fa "struct mbuf *top" "struct mbuf *control" "int flags" "struct thread *td"
+.Fc
+.Ft int
+.Fn soshutdown "struct socket *so" "int how"
+.Sh DESCRIPTION
+The kernel
+.Nm
+programming interface permits in-kernel consumers to interact with
+local and network socket objects in a manner similar to that permitted using
+the
+.Xr socket 2
+user API.
+These interfaces are appropriate for use by distributed file systems and
+other network-aware kernel services.
+While the user API operates on file descriptors, the kernel interfaces
+operate directly on
+.Vt "struct socket"
+pointers.
+.Pp
+Except where otherwise indicated,
+.Nm
+functions may sleep, and are not appropriate for use in an
+.Xr ithread 9
+context or while holding non-sleepable kernel locks.
+.Ss Creating and Destroying Sockets
+A new socket may be created using
+.Fn socreate .
+As with
+.Xr socket 2 ,
+arguments specify the requested domain, type, and protocol via
+.Fa dom , type ,
+and
+.Fa proto .
+The socket is returned via
+.Fa aso
+on success.
+In addition, the credential used to authorize operations associated with the
+socket will be passed via
+.Fa cred
+(and will be cached for the lifetime of the socket), and the thread
+performing the operation via
+.Fa td .
+.Em Warning :
+authorization of the socket creation operation will be performed
+using the thread credential for some protocols (such as raw sockets).
+.Pp
+Sockets may be closed and freed using
+.Fn soclose ,
+which has similar semantics to
+.Xr close 2 .
+.Ss Connections and Addresses
+The
+.Fn sobind
+function is equivalent to the
+.Xr bind 2
+system call, and binds the socket
+.Fa so
+to the address
+.Fa nam .
+The operation would be authorized using the credential on thread
+.Fa td .
+.Pp
+The
+.Fn soconnect
+function is equivalent to the
+.Xr connect 2
+system call, and initiates a connection on the socket
+.Fa so
+to the address
+.Fa nam .
+The operation will be authorized using the credential on thread
+.Fa td .
+Unlike the user system call,
+.Fn soconnect
+returns immediately; the caller may
+.Xr msleep 9
+on
+.Fa so->so_timeo
+while holding the socket mutex and waiting for the
+.Dv SS_ISCONNECTING
+flag to clear or
+.Fa so->so_error
+to become non-zero.
+If
+.Fn soconnect
+fails, the caller must manually clear the
+.Dv SS_ISCONNECTING
+flag.
+.Pp
+The
+.Fn soshutdown
+function is equivalent to the
+.Xr shutdown 2
+system call, and causes part or all of a connection on a socket to be closed
+down.
+.Ss Socket Options
+The
+.Fn sogetopt
+function is equivalent to the
+.Xr getsockopt 2
+system call, and retrieves a socket option on socket
+.Fa so .
+The
+.Fn sosetopt
+function is equivalent to the
+.Xr setsockopt 2
+system call, and sets a socket option on socket
+.Fa so .
+.Pp
+The second argument in both
+.Fn sogetopt
+and
+.Fn sosetopt
+is the
+.Fa sopt
+pointer to a
+.Vt "struct sopt"
+describing the socket option operation.
+The caller-allocated structure must be zeroed, and then have its fields
+initialized to specify socket option operation arguments:
+.Bl -tag -width ".Va sopt_valsize"
+.It Va sopt_dir
+Set to
+.Dv SOPT_SET
+or
+.Dv SOPT_GET
+depending on whether this is a get or set operation.
+.It Va sopt_level
+Specify the level in the network stack the operation is targeted at; for
+example,
+.Dv SOL_SOCKET .
+.It Va sopt_name
+Specify the name of the socket option to set.
+.It Va sopt_val
+Kernel space pointer to the argument value for the socket option.
+.It Va sopt_valsize
+Size of the argument value in bytes.
+.El
+.Ss Socket I/O
+The
+.Fn soreceive
+function is equivalent to the
+.Xr recvmsg 2
+system call, and attempts to receive bytes of data from the socket
+.Fa so ,
+optionally blocking awaiting for data if none is ready to read.
+Data may be retrieved directly to kernel or user memory via the
+.Fa uio
+argument, or as an mbuf chain returned to the caller via
+.Fa mp0 ,
+avoiding a data copy.
+Only one of the
+.Fa uio
+or
+.Fa mp0
+pointers may be
+.Pf non- Dv NULL .
+The caller may optionally retrieve a socket address on a protocol with the
+.Dv PR_ADDR
+capability by providing storage via
+.Pf non- Dv NULL
+.Fa psa
+argument.
+The caller may optionally retrieve control data mbufs via a
+.Pf non- Dv NULL
+.Fa controlp
+argument.
+Optional flags may be passed to
+.Fn soreceive
+via a
+.Pf non- Dv NULL
+.Fa flagsp
+argument, and use the same flag name space as the
+.Xr recvmsg 2
+system call.
+.Pp
+The
+.Fn sosend
+function is equivalent to the
+.Xr sendmsg 2
+system call, and attempts to send bytes of data via the socket
+.Fa so ,
+optionally blocking if data cannot be immediately sent.
+Data may be sent directly from kernel or user memory via the
+.Fa uio
+argument, or as an mbuf chain via
+.Fa top ,
+avoiding a data copy.
+Only one of the
+.Fa uio
+or
+.Fa top
+pointers may be
+.Pf non- Dv NULL .
+An optional destination address may be specified via a
+.Pf non- Dv NULL
+.Fa addr
+argument, which may result in an implicit connect if supported by the
+protocol.
+The caller may optionally send control data mbufs via a
+.Pf non- Dv NULL
+.Fa control
+argument.
+Flags may be passed to
+.Fn sosend
+using the
+.Fa flags
+argument, and use the same flag name space as the
+.Xr sendmsg 2
+system call.
+.Pp
+Kernel callers running in
+.Xr ithread 9
+context, or with a mutex held, will wish to use non-blocking sockets and pass
+the
+.Dv MSG_DONTWAIT
+flag in order to prevent these functions from sleeping.
+.Sh SEE ALSO
+.Xr bind 2 ,
+.Xr close 2 ,
+.Xr connect 2 ,
+.Xr getsockopt 2 ,
+.Xr recv 2 ,
+.Xr send 2 ,
+.Xr setsockopt 2 ,
+.Xr shutdown 2 ,
+.Xr socket 2 ,
+.Xr ng_ksocket 4 ,
+.Xr ithread 9 ,
+.Xr msleep 9 ,
+.Xr ucred 9
+.Sh HISTORY
+The
+.Xr socket 2
+system call appeared in
+.Bx 4.2 .
+This manual page was introduced in
+.Fx 7.0 .
+.Sh AUTHORS
+This manual page was written by
+.An Robert Watson .
+.Sh BUGS
+The use of explicitly passed credentials, credentials hung from explicitly
+passed threads, the credential on
+.Dv curthread ,
+and the cached credential from
+socket creation time is inconsistent, and may lead to unexpected behaviour.
+It is possible that several of the
+.Fa td
+arguments should be
+.Fa cred
+arguments, or simply not be present at all.
+.Pp
+The caller may need to manually clear
+.Dv SS_ISCONNECTING
+if
+.Fn soconnect
+returns an error.
+.Pp
+The
+.Dv MSG_DONTWAIT
+flag is not implemented for
+.Fn sosend ,
+and may not always work with
+.Fn soreceive
+when zero copy sockets are enabled.
+.Pp
+This manual page does not describe how to register socket upcalls or monitor
+a socket for readability/writability without using blocking I/O.
+.Pp
+The
+.Fn soref
+and
+.Fn sorele
+functions are not described, and in most cases should not be used, due to
+confusing and potentially incorrect interactions when
+.Fn sorele
+is last called after
+.Fn soclose .
Index: time.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/time.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/time.9 -L share/man/man9/time.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/time.9
+++ share/man/man9/time.9
@@ -29,7 +29,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/time.9,v 1.16 2005/06/15 13:31:23 ru Exp $
+.\" $FreeBSD: src/share/man/man9/time.9,v 1.17 2006/03/02 19:47:41 ru Exp $
.\"
.Dd September 17, 2004
.Dt TIME 9
@@ -43,8 +43,8 @@
.In sys/time.h
.Pp
.Vt extern struct timeval boottime ;
-.Vt extern struct time_t time_second ;
-.Vt extern struct timeval time_uptime ;
+.Vt extern time_t time_second ;
+.Vt extern time_t time_uptime ;
.Sh DESCRIPTION
The
.Va boottime
@@ -71,7 +71,6 @@
functions can be used to get the current time more accurately and in an
atomic manner.
Similarly, the
-The
.Xr binuptime 9 ,
.Xr getbinuptime 9 ,
.Xr microuptime 9 ,
--- /dev/null
+++ share/man/man9/stack.9
@@ -0,0 +1,119 @@
+.\"
+.\" Copyright (c) 2007 Robert N. M. Watson
+.\" 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(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/stack.9,v 1.5.2.1 2007/12/04 15:22:31 rwatson Exp $
+.\"
+.Dd February 27, 2007
+.Dt STACK 9
+.Os
+.Sh NAME
+.Nm stack
+.Nd kernel thread stack tracing routines
+.Sh SYNOPSIS
+.In sys/param.h>
+.In sys/stack.h
+.Pp
+In kernel configuration files:
+.Cd "options DDB"
+.Ft struct stack *
+.Fn stack_create "void"
+.Ft void
+.Fn stack_destroy "struct stack *st"
+.Ft int
+.Fn stack_put "struct stack *st" "vm_offset_t pc"
+.Ft void
+.Fn stack_copy "struct stack *src" "struct stack dst"
+.Ft void
+.Fn stack_zero "struct stack *st"
+.Ft void
+.Fn stack_print "struct stack *st"
+.Ft void
+.Fn stack_sbuf_print "struct sbuf sb*" "struct stack *st"
+.Ft void
+.Fn stack_save "struct stack *st"
+.Sh DESCRIPTION
+The
+.Nm
+KPI allows querying of kernel stack trace information and the automated
+generation of kernel stack trace strings for the purposes of debugging and
+tracing.
+.Nm
+relies on the presence of
+.Xr DDB 4 ,
+and all use of these functions must be made conditional on
+.Nm DDB
+being compiled in the kernel.
+.Pp
+Each stack trace is described by a
+.Vt "struct stack" .
+Before a trace may be created or otherwise manipulated, storage for the trace
+must be allocated with
+.Fn stack_create ,
+which may sleep.
+Memory associated with a trace may be freed by calling
+.Fn stack_destroy .
+.Pp
+A trace of the current kernel thread's call stack may be captured using
+.Fn stack_save .
+.Pp
+.Fn stack_print
+may be used to print a stack trace using the kernel
+.Xr printf 9 .
+.Pp
+.Fn stack_sbuf_print
+may be used to construct a human-readable string, including conversion (where
+possible) from a simple kernel instruction pointer to a named symbol and
+offset.
+The argument
+.Ar sb
+must be an initialized
+.Dv struct sbuf
+as described in
+.Xr sbuf 9 .
+This function may sleep if an auto-extending
+.Dv struct sbuf
+is used.
+.Pp
+The utility functions
+.Nm stack_zero ,
+.Nm stack_copy ,
+and
+.Nm stack_put
+may be used to manipulate stack data structures directly.
+.Sh SEE ALSO
+.Xr DDB 4 ,
+.Xr printf 9 ,
+.Xr sbuf 9
+.Sh AUTHORS
+.An -nosplit
+The
+.Xr stack 9
+function suite was created by
+.An Antoine Brodin .
+.Pp
+This manual page was written by
+.An Robert Watson .
Index: alloc_unr.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/alloc_unr.9,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L share/man/man9/alloc_unr.9 -L share/man/man9/alloc_unr.9 -u -r1.1.1.2 -r1.2
--- share/man/man9/alloc_unr.9
+++ share/man/man9/alloc_unr.9
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/alloc_unr.9,v 1.2.2.1 2006/01/24 17:02:38 joel Exp $
+.\" $FreeBSD: src/share/man/man9/alloc_unr.9,v 1.3 2005/11/24 09:25:09 joel Exp $
.\"
.Dd March 23, 2005
.Dt ALLOC_UNR 9
Index: make_dev.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/make_dev.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/make_dev.9 -L share/man/man9/make_dev.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/make_dev.9
+++ share/man/man9/make_dev.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/make_dev.9,v 1.17 2005/03/28 10:28:57 brueffer Exp $
+.\" $FreeBSD: src/share/man/man9/make_dev.9,v 1.23 2007/05/09 05:05:50 brueffer Exp $
.\"
-.Dd March 28, 2005
+.Dd May 6, 2007
.Os
.Dt MAKE_DEV 9
.Sh NAME
@@ -38,14 +38,14 @@
.Sh SYNOPSIS
.In sys/param.h
.In sys/conf.h
-.Ft struct cdev
+.Ft struct cdev *
.Fn make_dev "struct cdevsw *cdevsw" "int minor" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
-.Ft struct cdev
-.Fn make_dev_alias "struct cdev pdev" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
.Ft void
-.Fn destroy_dev "struct cdev dev"
+.Fn destroy_dev "struct cdev *dev"
.Ft void
-.Fn dev_depends "struct cdev pdev" "struct cdev cdev"
+.Fn dev_depends "struct cdev *pdev" "struct cdev *cdev"
.Sh DESCRIPTION
The
.Fn make_dev
@@ -57,9 +57,19 @@
The device will be owned by
.Va uid ,
with the group ownership as
-.Va gid ,
-and with the name as specified in
-.Va name .
+.Va gid .
+The name is the expansion of
+.Va fmt
+and following arguments as
+.Xr printf 9
+would print it.
+The name determines its path under
+.Pa /dev
+or other
+.Xr devfs 5
+mount point and may contain slash
+.Ql /
+characters to denote subdirectories.
The permissions of the file specified in
.Va perms
are defined in
@@ -102,6 +112,24 @@
.Fn make_dev .
.Pp
The
+.Fa cdev
+returned by
+.Fn make_dev
+and
+.Fn make_dev_alias
+has two fields,
+.Fa si_drv1
+and
+.Fa si_drv2 ,
+that are available to store state.
+Both fields are of type
+.Ft void * .
+These are designed to replace the
+.Fa minor
+argument to
+.Fn make_dev .
+.Pp
+The
.Fn destroy_dev
function takes the returned
.Fa cdev
Index: ieee80211_ioctl.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/ieee80211_ioctl.9,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L share/man/man9/ieee80211_ioctl.9 -L share/man/man9/ieee80211_ioctl.9 -u -r1.1.1.2 -r1.2
--- share/man/man9/ieee80211_ioctl.9
+++ share/man/man9/ieee80211_ioctl.9
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/ieee80211_ioctl.9,v 1.3 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/ieee80211_ioctl.9,v 1.5 2007/07/01 10:25:06 thompsa Exp $
.\" $Id: ieee80211_ioctl.9,v 1.5 2004/03/04 12:33:27 bruce Exp $
.\"
.Dd March 2, 2004
@@ -55,11 +55,6 @@
.Fn ieee80211_cfgset
functions implement a legacy interface for getting and setting 802.11
interface attributes respectively.
-The interface is compatible with the RIDs implemented by the legacy
-.Xr owi 4
-driver and used by the
-.Xr wicontrol 8
-utility.
.Pp
.\"
The
@@ -79,9 +74,7 @@
to use this as the catch-all in a switch statement to avoid code duplication.
.\"
.Sh SEE ALSO
-.Xr owi 4 ,
.Xr ifconfig 8 ,
-.Xr wicontrol 8 ,
.Xr ieee80211 9 ,
.Xr ifnet 9
.Sh HISTORY
Index: sema.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sema.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/sema.9 -L share/man/man9/sema.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/sema.9
+++ share/man/man9/sema.9
@@ -24,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sema.9,v 1.9 2004/07/07 19:57:15 ru Exp $
+.\" $FreeBSD: src/share/man/man9/sema.9,v 1.11 2007/03/30 18:07:26 julian Exp $
.\"
-.Dd June 14, 2004
+.Dd February 1, 2006
.Dt SEMA 9
.Os
.Sh NAME
@@ -125,6 +125,8 @@
.El
.Sh SEE ALSO
.Xr condvar 9 ,
+.Xr locking 9 ,
.Xr mtx_pool 9 ,
.Xr mutex 9 ,
+.Xr rwlock 9 ,
.Xr sx 9
Index: vhold.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vhold.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/vhold.9 -L share/man/man9/vhold.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/vhold.9
+++ share/man/man9/vhold.9
@@ -24,13 +24,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vhold.9,v 1.3.2.1 2005/09/24 01:59:38 keramida Exp $
+.\" $FreeBSD: src/share/man/man9/vhold.9,v 1.5 2007/04/01 09:48:59 maxim Exp $
.\"
-.Dd November 21, 2001
+.Dd April 1, 2007
.Dt VHOLD 9
.Os
.Sh NAME
-.Nm vhold , vdrop
+.Nm vhold , vdrop , vdropl
.Nd "acquire/release a hold on a vnode"
.Sh SYNOPSIS
.In sys/param.h
@@ -39,6 +39,8 @@
.Fn vhold "struct vnode *vp"
.Ft void
.Fn vdrop "struct vnode *vp"
+.Ft void
+.Fn vdropl "struct vnode *vp"
.Sh DESCRIPTION
The
.Fn vhold
@@ -50,13 +52,29 @@
.Pp
The
.Fn vdrop
-function decrements the
+and
+.Fn vdropl
+functions decrement the
.Va v_holdcnt
of the vnode.
If the holdcount is less than or equal to zero prior to calling
-.Fn vdrop ,
+.Fn vdrop
+or
+.Fn vdropl ,
the system will panic.
If the vnode is no longer referenced, it will be freed.
+.Pp
+The difference between
+.Fn vdrop
+and
+.Fn vdropl
+is that
+.Fn vdrop
+locks the vnode interlock and then calls
+.Fn vdropl
+while
+.Fn vdropl
+expects the interlock to already be locked.
.Sh SEE ALSO
.Xr vbusy 9 ,
.Xr vfree 9
Index: module.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/module.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/module.9 -L share/man/man9/module.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/module.9
+++ share/man/man9/module.9
@@ -26,9 +26,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/module.9,v 1.10 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/module.9,v 1.11 2007/07/19 11:22:34 flz Exp $
.\"
-.Dd March 1, 2001
+.Dd July 19, 2007
.Dt MODULE 9
.Os
.Sh NAME
@@ -85,7 +85,7 @@
.Pp
The module should return
.Er EOPNOTSUPP
-for unrecognized values of
+for unsupported and unrecognized values of
.Fa what .
.Sh EXAMPLES
.Bd -literal
Index: rman.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/rman.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/rman.9 -L share/man/man9/rman.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/rman.9
+++ share/man/man9/rman.9
@@ -23,9 +23,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/rman.9,v 1.6 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/rman.9,v 1.9 2007/04/29 19:46:33 jmg Exp $
.\"
-.Dd March 15, 2005
+.Dd April 29, 2007
.Dt RMAN 9
.Os
.Sh NAME
@@ -139,7 +139,28 @@
function initializes the region descriptor, pointed to by the
.Fa rm
argument, for use with the resource management functions.
+It is required that the fields
+.Va rm_type
+and
+.Va rm_descr
+of
+.Vt "struct rman"
+be set before calling
+.Fn rman_init .
+The field
+.Va rm_type
+shall be set to
+.Dv RMAN_ARRAY .
+The field
+.Va rm_descr
+shall be set to a string that describes the resource to be managed.
It also initializes any mutexes associated with the structure.
+If
+.Fn rman_init
+fails to initalize the mutex, it will return
+.Er ENOMEM ; otherwise it will return 0 and
+.Fa rm
+will be initalized.
.Pp
The
.Fn rman_fini
@@ -167,10 +188,15 @@
and
.Fa end
arguments specify the bounds of the region.
-.Pp
-.Em NOTE :
-This interface is not robust against programming errors which
-add multiple copies of the same region.
+If successful,
+.Fn rman_manage_region
+will return 0.
+If the region overlaps with an existing region, it will return
+.Er EBUSY .
+.Er ENOMEM
+will be return when
+.Fn rman_manage_region
+failed to allocate memory for the region.
.Pp
The
.Fn rman_reserve_resource_bound
@@ -316,7 +342,6 @@
.Fn rman_get_device
function returns a pointer to the device which reserved the resource
.Fa r .
-.Pp
.Sh SEE ALSO
.Xr bus_activate_resource 9 ,
.Xr bus_alloc_resource 9 ,
Index: bus_space.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/bus_space.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/bus_space.9 -L share/man/man9/bus_space.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/bus_space.9
+++ share/man/man9/bus_space.9
@@ -56,7 +56,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/bus_space.9,v 1.2 2005/06/25 08:59:05 ru Exp $
+.\" $FreeBSD: src/share/man/man9/bus_space.9,v 1.4 2006/09/18 14:31:03 ru Exp $
.\"
.Dd June 13, 2005
.Dt BUS_SPACE 9
@@ -68,6 +68,10 @@
.Nm bus_space_copy_region_2 ,
.Nm bus_space_copy_region_4 ,
.Nm bus_space_copy_region_8 ,
+.Nm bus_space_copy_region_stream_1 ,
+.Nm bus_space_copy_region_stream_2 ,
+.Nm bus_space_copy_region_stream_4 ,
+.Nm bus_space_copy_region_stream_8 ,
.Nm bus_space_free ,
.Nm bus_space_map ,
.Nm bus_space_read_1 ,
@@ -78,20 +82,40 @@
.Nm bus_space_read_multi_2 ,
.Nm bus_space_read_multi_4 ,
.Nm bus_space_read_multi_8 ,
+.Nm bus_space_read_multi_stream_1 ,
+.Nm bus_space_read_multi_stream_2 ,
+.Nm bus_space_read_multi_stream_4 ,
+.Nm bus_space_read_multi_stream_8 ,
.Nm bus_space_read_region_1 ,
.Nm bus_space_read_region_2 ,
.Nm bus_space_read_region_4 ,
.Nm bus_space_read_region_8 ,
+.Nm bus_space_read_region_stream_1 ,
+.Nm bus_space_read_region_stream_2 ,
+.Nm bus_space_read_region_stream_4 ,
+.Nm bus_space_read_region_stream_8 ,
+.Nm bus_space_read_stream_1 ,
+.Nm bus_space_read_stream_2 ,
+.Nm bus_space_read_stream_4 ,
+.Nm bus_space_read_stream_8 ,
+.Nm bus_space_set_multi_1 ,
+.Nm bus_space_set_multi_2 ,
+.Nm bus_space_set_multi_4 ,
+.Nm bus_space_set_multi_8 ,
+.Nm bus_space_set_multi_stream_1 ,
+.Nm bus_space_set_multi_stream_2 ,
+.Nm bus_space_set_multi_stream_4 ,
+.Nm bus_space_set_multi_stream_8 ,
.Nm bus_space_set_region_1 ,
.Nm bus_space_set_region_2 ,
.Nm bus_space_set_region_4 ,
.Nm bus_space_set_region_8 ,
+.Nm bus_space_set_region_stream_1 ,
+.Nm bus_space_set_region_stream_2 ,
+.Nm bus_space_set_region_stream_4 ,
+.Nm bus_space_set_region_stream_8 ,
.Nm bus_space_subregion ,
.Nm bus_space_unmap ,
-.Nm bus_space_set_multi_1 ,
-.Nm bus_space_set_multi_2 ,
-.Nm bus_space_set_multi_4 ,
-.Nm bus_space_set_multi_8 ,
.Nm bus_space_write_1 ,
.Nm bus_space_write_2 ,
.Nm bus_space_write_4 ,
@@ -100,10 +124,22 @@
.Nm bus_space_write_multi_2 ,
.Nm bus_space_write_multi_4 ,
.Nm bus_space_write_multi_8 ,
+.Nm bus_space_write_multi_stream_1 ,
+.Nm bus_space_write_multi_stream_2 ,
+.Nm bus_space_write_multi_stream_4 ,
+.Nm bus_space_write_multi_stream_8 ,
.Nm bus_space_write_region_1 ,
.Nm bus_space_write_region_2 ,
.Nm bus_space_write_region_4 ,
-.Nm bus_space_write_region_8
+.Nm bus_space_write_region_8 ,
+.Nm bus_space_write_region_stream_1 ,
+.Nm bus_space_write_region_stream_2 ,
+.Nm bus_space_write_region_stream_4 ,
+.Nm bus_space_write_region_stream_8 ,
+.Nm bus_space_write_stream_1 ,
+.Nm bus_space_write_stream_2 ,
+.Nm bus_space_write_stream_4 ,
+.Nm bus_space_write_stream_8
.Nd "bus space manipulation functions"
.Sh SYNOPSIS
.In machine/bus.h
@@ -147,6 +183,22 @@
.Fo bus_space_read_8
.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
.Fc
+.Ft u_int8_t
+.Fo bus_space_read_stream_1
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft u_int16_t
+.Fo bus_space_read_stream_2
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft u_int32_t
+.Fo bus_space_read_stream_4
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
+.Ft u_int64_t
+.Fo bus_space_read_stream_8
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle" "bus_size_t offset"
+.Fc
.Ft void
.Fo bus_space_write_1
.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
@@ -168,6 +220,26 @@
.Fa "bus_size_t offset" "u_int64_t value"
.Fc
.Ft void
+.Fo bus_space_write_stream_1
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "u_int8_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_2
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "u_int16_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_4
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "u_int32_t value"
+.Fc
+.Ft void
+.Fo bus_space_write_stream_8
+.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
+.Fa "bus_size_t offset" "u_int64_t value"
+.Fc
+.Ft void
.Fo bus_space_barrier
.Fa "bus_space_tag_t space" "bus_space_handle_t handle"
.Fa "bus_size_t offset" "bus_size_t length" "int flags"
@@ -197,6 +269,30 @@
.Fa "bus_size_t count"
.Fc
.Ft void
+.Fo bus_space_read_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
.Fo bus_space_write_region_1
.Fa "bus_space_tag_t space"
.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
@@ -221,6 +317,30 @@
.Fa "bus_size_t count"
.Fc
.Ft void
+.Fo bus_space_write_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
.Fo bus_space_copy_region_1
.Fa "bus_space_tag_t space"
.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
@@ -245,6 +365,30 @@
.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
.Fc
.Ft void
+.Fo bus_space_copy_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_copy_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t srchandle" "bus_size_t srcoffset"
+.Fa "bus_space_handle_t dsthandle" "bus_size_t dstoffset" "bus_size_t count"
+.Fc
+.Ft void
.Fo bus_space_set_region_1
.Fa "bus_space_tag_t space"
.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t value"
@@ -269,6 +413,30 @@
.Fa "bus_size_t count"
.Fc
.Ft void
+.Fo bus_space_set_region_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int16_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int32_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_region_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
.Fo bus_space_read_multi_1
.Fa "bus_space_tag_t space"
.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
@@ -293,6 +461,30 @@
.Fa "bus_size_t count"
.Fc
.Ft void
+.Fo bus_space_read_multi_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_read_multi_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
.Fo bus_space_write_multi_1
.Fa "bus_space_tag_t space"
.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
@@ -317,6 +509,30 @@
.Fa "bus_size_t count"
.Fc
.Ft void
+.Fo bus_space_write_multi_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int16_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int32_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_write_multi_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t *datap"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
.Fo bus_space_set_multi_1
.Fa "bus_space_tag_t space"
.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t value"
@@ -340,6 +556,30 @@
.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t value"
.Fa "bus_size_t count"
.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_1
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int8_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_2
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int16_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_4
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int32_t value"
+.Fa "bus_size_t count"
+.Fc
+.Ft void
+.Fo bus_space_set_multi_stream_8
+.Fa "bus_space_tag_t space"
+.Fa "bus_space_handle_t handle" "bus_size_t offset" "u_int64_t value"
+.Fa "bus_size_t count"
+.Fc
.Sh DESCRIPTION
The
.Nm
@@ -1356,6 +1596,58 @@
argument error), that indicates a software bug which should cause a
panic.
In that case, they will never return.
+.Sh STREAM FUNCTIONS
+Most of the
+.Nm
+functions imply a host byte-order and a bus byte-order and take care of
+any translation for the caller.
+In some cases, however, hardware may map a FIFO or some other memory region
+for which the caller may want to use multi-word, yet untranslated access.
+Access to these types of memory regions should be with the
+.Fn bus_space_*_stream_N
+functions.
+.Pp
+.Bl -tag -compact
+.It Fn bus_space_read_stream_1
+.It Fn bus_space_read_stream_2
+.It Fn bus_space_read_stream_4
+.It Fn bus_space_read_stream_8
+.It Fn bus_space_read_multi_stream_1
+.It Fn bus_space_read_multi_stream_2
+.It Fn bus_space_read_multi_stream_4
+.It Fn bus_space_read_multi_stream_8
+.It Fn bus_space_read_region_stream_1
+.It Fn bus_space_read_region_stream_2
+.It Fn bus_space_read_region_stream_4
+.It Fn bus_space_read_region_stream_8
+.It Fn bus_space_write_stream_1
+.It Fn bus_space_write_stream_2
+.It Fn bus_space_write_stream_4
+.It Fn bus_space_write_stream_8
+.It Fn bus_space_write_multi_stream_1
+.It Fn bus_space_write_multi_stream_2
+.It Fn bus_space_write_multi_stream_4
+.It Fn bus_space_write_multi_stream_8
+.It Fn bus_space_write_region_stream_1
+.It Fn bus_space_write_region_stream_2
+.It Fn bus_space_write_region_stream_4
+.It Fn bus_space_write_region_stream_8
+.It Fn bus_space_copy_region_stream_1
+.It Fn bus_space_copy_region_stream_2
+.It Fn bus_space_copy_region_stream_4
+.It Fn bus_space_copy_region_stream_8
+.It Fn bus_space_set_multi_stream_1
+.It Fn bus_space_set_multi_stream_2
+.It Fn bus_space_set_multi_stream_4
+.It Fn bus_space_set_multi_stream_8
+.It Fn bus_space_set_region_stream_1
+.It Fn bus_space_set_region_stream_2
+.It Fn bus_space_set_region_stream_4
+.It Fn bus_space_set_region_stream_8
+.El
+.Pp
+These functions are defined just as their non-stream counterparts,
+except that they provide no byte-order translation.
.Sh COMPATIBILITY
The current
.Nx
Index: critical_enter.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/critical_enter.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/critical_enter.9 -L share/man/man9/critical_enter.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/critical_enter.9
+++ share/man/man9/critical_enter.9
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/critical_enter.9,v 1.7.14.1 2005/10/14 18:34:29 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/critical_enter.9,v 1.8 2005/10/05 19:48:21 jhb Exp $
.\"
.Dd October 5, 2005
.Dt CRITICAL_ENTER 9
Index: vm_page_sleep_busy.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_sleep_busy.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_sleep_busy.9 -L share/man/man9/vm_page_sleep_busy.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_sleep_busy.9
+++ share/man/man9/vm_page_sleep_busy.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_sleep_busy.9,v 1.2 2005/06/28 20:15:18 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_SLEEP_BUSY 9
Index: pmap_extract.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/pmap_extract.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/pmap_extract.9 -L share/man/man9/pmap_extract.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/pmap_extract.9
+++ share/man/man9/pmap_extract.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/pmap_extract.9,v 1.3 2004/07/06 07:02:31 ru Exp $
+.\" $FreeBSD: src/share/man/man9/pmap_extract.9,v 1.4 2007/01/28 16:23:55 rwatson Exp $
.\"
.Dd July 21, 2003
.Dt PMAP_EXTRACT 9
@@ -55,13 +55,6 @@
the given page protection.
.Sh IMPLEMENTATION NOTES
Currently, the page protection requested by the caller is not verified.
-.Pp
-In the
-.Fn pmap_extract_and_hold
-function, the
-.Va Giant
-lock is held for the duration of the call to ensure that only a single
-caller is present.
.Sh RETURN VALUES
The
.Fn pmap_extract
Index: VOP_OPENCLOSE.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VOP_OPENCLOSE.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VOP_OPENCLOSE.9 -L share/man/man9/VOP_OPENCLOSE.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VOP_OPENCLOSE.9
+++ share/man/man9/VOP_OPENCLOSE.9
@@ -26,9 +26,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VOP_OPENCLOSE.9,v 1.18 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/VOP_OPENCLOSE.9,v 1.19 2007/06/05 10:48:29 kib Exp $
.\"
-.Dd July 24, 1996
+.Dd June 5, 2007
.Os
.Dt VOP_OPEN 9
.Sh NAME
@@ -39,7 +39,7 @@
.In sys/param.h
.In sys/vnode.h
.Ft int
-.Fn VOP_OPEN "struct vnode *vp" "int mode" "struct ucred *cred" "struct thread *td" "int fdidx"
+.Fn VOP_OPEN "struct vnode *vp" "int mode" "struct ucred *cred" "struct thread *td" "struct file *fp"
.Ft int
.Fn VOP_CLOSE "struct vnode *vp" "int mode" "struct ucred *cred" "struct thread *td"
.Sh DESCRIPTION
@@ -57,14 +57,21 @@
The access mode required by the calling process.
.It Fa td
The thread which is accessing the file.
+.It Fa fp
+The file being opened.
.El
.Pp
-Additionally,
-.Fn VOP_OPEN
-can accept a file descriptor number in
-.Fa fdidx ;
-this is useful for file systems which require such information, e.g.,
+Pointer to the file
+.Fa fp
+is useful for file systems which require such information, e.g.,
.Xr fdescfs 5 .
+Use
+.Ql NULL
+as
+.Fa fp
+argument to
+.Fn VOP_OPEN
+for in-kernel opens.
.Pp
The access mode is a set of flags, including
.Dv FREAD ,
@@ -85,20 +92,13 @@
.Fa vn_close
expects an unlocked, referenced vnode and will dereference the vnode prior
to returning.
-.Sh IMPLEMENTATION NOTES
-The
-.Fa fdidx
-argument to
-.Fn VOP_OPEN
-is currently unused, use
-.Ql \-1
-for the meantime; however, this will change in future.
.Sh RETURN VALUES
Zero is returned on success, otherwise an error code is returned.
.Sh PSEUDOCODE
.Bd -literal
int
-vop_open(struct vnode *vp, int mode, struct ucred *cred, struct thread *td)
+vop_open(struct vnode *vp, int mode, struct ucred *cred, struct thread *td,
+ struct file *fp)
{
/*
* Most file systems don't do much here.
Index: mac.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/mac.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/mac.9 -L share/man/man9/mac.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/mac.9
+++ share/man/man9/mac.9
@@ -31,9 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/mac.9,v 1.15 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/mac.9,v 1.17 2006/07/11 16:26:40 joel Exp $
.\"
-.Dd February 16, 2002
+.Dd July 10, 2006
.Dt MAC 9
.Os
.Sh NAME
@@ -152,7 +152,7 @@
policies.
.Sh ENTRY POINTS
System service and module authors should reference the
-.%T "FreeBSD Developer's Handbook"
+.%T "FreeBSD Architecture Handbook"
for information on the MAC Framework APIs.
.Sh SEE ALSO
.Xr acl 3 ,
@@ -172,8 +172,8 @@
.Xr vaccess_acl_posix1e 9 ,
.Xr VFS 9
.Rs
-.%T "The FreeBSD Developers' Handbook"
-.%O "http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/"
+.%T "The FreeBSD Architecture Handbook"
+.%O "http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/arch-handbook/"
.Re
.Sh HISTORY
The
Index: vm_page_rename.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_rename.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_rename.9 -L share/man/man9/vm_page_rename.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_rename.9
+++ share/man/man9/vm_page_rename.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_rename.9,v 1.2 2001/08/08 10:04:08 ru Exp $
-.\" $MidnightBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_RENAME 9
Index: hash.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/hash.9,v
retrieving revision 1.1
retrieving revision 1.2
diff -L share/man/man9/hash.9 -L share/man/man9/hash.9 -u -r1.1 -r1.2
--- share/man/man9/hash.9
+++ share/man/man9/hash.9
@@ -24,39 +24,39 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: hash.9,v 1.5 2003/04/17 05:08:39 jmc Exp $
-.\" $FreeBSD: src/share/man/man9/hash.9,v 1.1.2.1 2006/04/04 19:50:02 andre Exp $
+.\" $FreeBSD: src/share/man/man9/hash.9,v 1.4 2007/04/09 22:55:14 thompsa Exp $
.\"
-.Dd December 8, 2001
+.Dd April 3, 2007
.Dt HASH 9
.Os
.Sh NAME
-.Nm hash
-.\" XXX - Should all these be .Nm as well?
-.\" .Nm hash32 ,
-.\" .Nm hash32_buf ,
-.\" .Nm hash32_str ,
-.\" .Nm hash32_strn ,
-.\" .Nm hash32_stre ,
-.\" .Nm hash32_strne
+.Nm hash ,
+.Nm hash32 ,
+.Nm hash32_buf ,
+.Nm hash32_str ,
+.Nm hash32_strn ,
+.Nm hash32_stre ,
+.Nm hash32_strne
.Nd general kernel hashing functions
.Sh SYNOPSIS
-.Fd #include <sys/hash.h>
+.In sys/hash.h
.Ft uint32_t
-.Fn hash32_buf "void *buf" "size_t len" "uint32_t hash"
+.Fn hash32_buf "const void *buf" "size_t len" "uint32_t hash"
.Ft uint32_t
-.Fn hash32_str "void *buf" "uint32_t hash"
+.Fn hash32_str "const void *buf" "uint32_t hash"
.Ft uint32_t
-.Fn hash32_strn "void *buf" "size_t len" "uint32_t hash"
+.Fn hash32_strn "const void *buf" "size_t len" "uint32_t hash"
.Ft uint32_t
-.Fn hash32_stre "void *buf" "int end" "char **ep" "uint32_t hash"
+.Fn hash32_stre "const void *buf" "int end" "const char **ep" "uint32_t hash"
.Ft uint32_t
-.Fn hash32_strne "void *buf" "size_t len" "int end" "char **ep" "uint32_t hash"
+.Fn hash32_strne "const void *buf" "size_t len" "int end" "const char **ep" "uint32_t hash"
.Sh DESCRIPTION
The
.Fn hash32
functions are used to give a consistent and general interface to
a decent hashing algorithm within the kernel.
-These functions can be used to hash ASCII
+These functions can be used to hash
+.Tn ASCII
.Dv NUL
terminated strings, as well as blocks of memory.
.Pp
@@ -119,6 +119,7 @@
void
sample_init(void)
{
+
hashtbl = hashinit(numwanted, type, flags, &mask);
}
Index: buf.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/buf.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/buf.9 -L share/man/man9/buf.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/buf.9
+++ share/man/man9/buf.9
@@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/buf.9,v 1.17 2005/02/15 09:27:00 ru Exp $
+.\" $FreeBSD: src/share/man/man9/buf.9,v 1.18 2006/02/13 21:34:18 joel Exp $
.\"
.Dd December 22, 1998
.Dt BUF 9
@@ -138,7 +138,6 @@
buffer cache from being freed.
This can complicate the life of the paging
system.
-.Pp
.\" .Sh SEE ALSO
.\" .Xr <fillmein> 9
.Sh HISTORY
Index: SYSCALL_MODULE.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/SYSCALL_MODULE.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/SYSCALL_MODULE.9 -L share/man/man9/SYSCALL_MODULE.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/SYSCALL_MODULE.9
+++ share/man/man9/SYSCALL_MODULE.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/SYSCALL_MODULE.9,v 1.6 2005/01/07 09:02:40 keramida Exp $
+.\" $FreeBSD: src/share/man/man9/SYSCALL_MODULE.9,v 1.7 2006/04/15 12:04:18 maxim Exp $
.\"
.Dd January 7, 2005
.Dt SYSCALL_MODULE 9
@@ -40,7 +40,7 @@
.In sys/proc.h
.In sys/module.h
.In sys/sysent.h
-.Fn SYSCALL_MODULE name "int *offset" "struct sysent new_sysent" "modeventhand_t evh" "void *arg"
+.Fn SYSCALL_MODULE name "int *offset" "struct sysent *new_sysent" "modeventhand_t evh" "void *arg"
.Sh DESCRIPTION
The
.Fn SYSCALL_MODULE
@@ -58,8 +58,8 @@
.Vt "struct sysent"
where the syscall is allocated.
.It Fa new_sysent
-The function implementing the syscall and the number of arguments this
-function needs (see
+is a pointer to a structure that specifies the function implementing
+the syscall and the number of arguments this function needs (see
.In sys/sysent.h ) .
.It Fa evh
A pointer to the kernel module event handler function with the argument
--- /dev/null
+++ share/man/man9/priv.9
@@ -0,0 +1,123 @@
+.\"-
+.\" Copyright (c) 2006 nCircle Network Security, Inc.
+.\" All rights reserved.
+.\"
+.\" This software was developed by Robert N. M. Watson for the TrustedBSD
+.\" Project under contract to nCircle Network Security, Inc.
+.\"
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR, NCIRCLE NETWORK SECURITY,
+.\" INC., 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/priv.9,v 1.6 2007/06/26 23:12:05 rwatson Exp $
+.\"
+.Dd August 30, 2006
+.Dt PRIV 9
+.Os
+.Sh NAME
+.Nm priv
+.Nd kernel privilege checking API
+.Sh SYNOPSIS
+.In sys/priv.h
+.Ft int
+.Fn priv_check "struct thread *td" "int priv"
+.Ft int
+.Fn priv_check_cred "struct ucred *cred" "int priv" "int flags"
+.Sh DESCRIPTION
+The
+.Nm
+interfaces check to see if specific system privileges are granted to the
+passed thread,
+.Fa td ,
+or credential,
+.Fa cred .
+This interface replaces the
+.Xr suser 9
+privilege checking interface.
+Privileges typically represent rights in one of two categories: the right to
+manage a particular component of the system, or an exemption to a specific
+policy or access control list.
+The caller identifies the desired privilege via the
+.Fa priv
+argument.
+The optional flags argument,
+.Fa flags ,
+is currently unused.
+.Ss Privilege Policies
+Privileges are typically granted based on one of two base system policies:
+the superuser policy, which grants privilege based on the effective (or
+sometimes real) UID having a value of 0, and the
+.Xr jail 2
+policy, which permits only certain privileges to be granted to processes in a
+jail.
+The set of available privileges may also be influenced by the TrustedBSD MAC
+Framework, described in
+.Xr mac 9 .
+.Sh IMPLEMENTATION NOTES
+When adding a new privilege check to a code path, first check the complete
+list of current privileges in
+.Pa sys/priv.h
+to see if one already exists for the class of privilege required.
+Only if there is not an exact match should a new privilege be added to the
+privilege list.
+As privilege numbers becomes encoded in the kernel module ABI, privilege
+constants must not be changed as any kernel modules depending on privileges
+will then need to be recompiled.
+When adding a new privilege, be certain to also determine whether it should
+be listed in
+.Fn prison_priv_check ,
+which includes a complete list of privileges granted to the root user in
+.Xr jail 2 .
+.Pp
+Certain catch-all privileges exist, such as
+.Dv PRIV_DRIVER ,
+intended to be used by device drivers, rather than adding a new
+driver-specific privilege.
+.Sh RETURN VALUES
+Typically, 0 will be returned for success, and
+.Er EPERM
+will be returned on failure.
+Most consumers of
+.Nm
+will wish to directly return the error code from a failed privilege check to
+user space; a small number will wish to translate it to another error code
+appropriate to a specific context.
+.Pp
+When designing new APIs, it is preferable to return explicit errors from a
+call if privilege is not granted rather than changing the semantics of the
+call but returning success.
+For example, the behavior exhibited by
+.Xr stat 2 ,
+in which the generation field is optionally zero'd out when there is
+insufficient privilege is highly undesirable, as it results in frequent
+privilege checks, and the caller is unable to tell if an access control
+failure occurred.
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr mac 9 ,
+.Xr suser 9 ,
+.Xr ucred 9
+.Sh AUTHORS
+The
+.Nm
+API and implementation were created by
+.An Robert Watson
+under contract to
+nCircle Network Security, Inc.
Index: VOP_FSYNC.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VOP_FSYNC.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VOP_FSYNC.9 -L share/man/man9/VOP_FSYNC.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VOP_FSYNC.9
+++ share/man/man9/VOP_FSYNC.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VOP_FSYNC.9,v 1.15 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/VOP_FSYNC.9,v 1.16 2007/05/12 13:10:55 pav Exp $
.\"
.Dd July 24, 1996
.Os
@@ -38,7 +38,7 @@
.In sys/param.h
.In sys/vnode.h
.Ft int
-.Fn VOP_FSYNC "struct vnode *vp" "struct ucred *cred" "int waitfor" "struct thread *td"
+.Fn VOP_FSYNC "struct vnode *vp" "int waitfor" "struct thread *td"
.Sh DESCRIPTION
This call flushes any dirty file system buffers for the file.
It is used to implement the
@@ -51,8 +51,6 @@
.Bl -tag -width waitfor
.It Fa vp
The vnode of the file.
-.It Fa cred
-The caller's credentials.
.It Fa waitfor
Whether the function should wait for I/O to complete.
Possible values are:
@@ -84,7 +82,7 @@
.Sh PSEUDOCODE
.Bd -literal
int
-vop_fsync(struct vnode *vp, struct ucred *cred, int waitfor, struct thread *td)
+vop_fsync(struct vnode *vp, int waitfor, struct thread *td)
{
struct buf *bp;
struct buf *nbp;
Index: driver.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/driver.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/driver.9 -L share/man/man9/driver.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/driver.9
+++ share/man/man9/driver.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/driver.9,v 1.11 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/driver.9,v 1.12 2005/08/08 12:16:53 brian Exp $
.\"
.Dd June 16, 1998
.Dt DRIVER 9
@@ -45,7 +45,7 @@
static int foo_frob(device_t, int, int);
static int foo_twiddle(device_t, char *);
-static struct device_method_t foo_methods[] = {
+static device_method_t foo_methods[] = {
/* Methods from the device interface */
DEVMETHOD(device_probe, foo_probe),
DEVMETHOD(device_attach, foo_attach),
Index: vm_page_free.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_free.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_free.9 -L share/man/man9/vm_page_free.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_free.9
+++ share/man/man9/vm_page_free.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_free.9,v 1.2 2001/08/08 10:04:08 ru Exp $
-.\" $MidnightBSD$
.\"
.Dd July 24, 2001
.Dt VM_PAGE_FREE 9
Index: VFS_SYNC.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VFS_SYNC.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VFS_SYNC.9 -L share/man/man9/VFS_SYNC.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VFS_SYNC.9
+++ share/man/man9/VFS_SYNC.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VFS_SYNC.9,v 1.15 2005/06/15 13:31:23 ru Exp $
+.\" $FreeBSD: src/share/man/man9/VFS_SYNC.9,v 1.16 2007/05/12 13:10:55 pav Exp $
.\"
.Dd January 7, 2005
.Os
@@ -39,7 +39,7 @@
.In sys/mount.h
.In sys/vnode.h
.Ft int
-.Fn VFS_SYNC "struct mount *mp" "int waitfor" "struct ucred *cred" "struct thread *td"
+.Fn VFS_SYNC "struct mount *mp" "int waitfor" "struct thread *td"
.Sh DESCRIPTION
The
.Fn VFS_SYNC
@@ -61,8 +61,6 @@
.It Dv MNT_LAZY
push data not written by file system syncer
.El
-.It Fa cred
-The caller's credentials.
.It Fa td
The calling thread.
.El
Index: sbuf.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sbuf.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/sbuf.9 -L share/man/man9/sbuf.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/sbuf.9
+++ share/man/man9/sbuf.9
@@ -23,12 +23,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sbuf.9,v 1.24 2004/07/09 11:44:49 des Exp $
+.\" $FreeBSD: src/share/man/man9/sbuf.9,v 1.26 2006/09/18 15:24:20 ru Exp $
.\"
.Dd July 9, 2004
.Dt SBUF 9
.Os
.Sh NAME
+.Nm sbuf ,
.Nm sbuf_new ,
.Nm sbuf_clear ,
.Nm sbuf_setpos ,
@@ -92,7 +93,7 @@
.Fn sbuf_delete "struct sbuf *s"
.Sh DESCRIPTION
The
-.Nm sbuf
+.Nm
family of functions allows one to safely allocate, construct and
release bounded null-terminated strings in kernel space.
Instead of arrays of characters, these functions operate on structures
@@ -308,35 +309,48 @@
or it is reinitialized to a sufficiently short string using
.Fn sbuf_cpy .
.Sh RETURN VALUES
+The
.Fn sbuf_new
-returns
+function returns
.Dv NULL
if it failed to allocate a storage buffer, and a pointer to the new
.Fa sbuf
otherwise.
.Pp
+The
.Fn sbuf_setpos
-returns \-1 if
+function returns \-1 if
.Fa pos
was invalid, and zero otherwise.
.Pp
+The
.Fn sbuf_cat ,
.Fn sbuf_cpy ,
.Fn sbuf_printf ,
.Fn sbuf_putc ,
and
.Fn sbuf_trim
+functions
all return \-1 if the buffer overflowed, and zero otherwise.
.Pp
+The
.Fn sbuf_overflowed
+function
returns a non-zero value if the buffer overflowed, and zero otherwise.
.Pp
+The
.Fn sbuf_data
and
.Fn sbuf_len
-return
+functions return
.Dv NULL
and \-1, respectively, if the buffer overflowed.
+.Pp
+The
+.Fn sbuf_copyin
+function
+returns \-1 if copying string from userland failed, and number of bytes
+copied otherwise.
.Sh SEE ALSO
.Xr printf 3 ,
.Xr strcat 3 ,
@@ -346,13 +360,13 @@
.Xr printf 9
.Sh HISTORY
The
-.Nm sbuf
+.Nm
family of functions first appeared in
.Fx 4.4 .
.Sh AUTHORS
.An -nosplit
The
-.Nm sbuf
+.Nm
family of functions was designed by
.An Poul-Henning Kamp Aq phk at FreeBSD.org
and implemented by
Index: sysctl_add_oid.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sysctl_add_oid.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/sysctl_add_oid.9 -L share/man/man9/sysctl_add_oid.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/sysctl_add_oid.9
+++ share/man/man9/sysctl_add_oid.9
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sysctl_add_oid.9,v 1.20 2004/07/03 18:29:24 ru Exp $
+.\" $FreeBSD: src/share/man/man9/sysctl_add_oid.9,v 1.21 2006/04/28 10:45:27 rwatson Exp $
.\"
.Dd July 15, 2000
.Dt SYSCTL_ADD_OID 9
@@ -496,6 +496,7 @@
.Em "Care should be taken to free all oids once they are no longer needed!"
.Sh SEE ALSO
.Xr sysctl 8 ,
+.Xr sysctl 9 ,
.Xr sysctl_ctx_free 9 ,
.Xr sysctl_ctx_init 9
.Sh HISTORY
Index: selrecord.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/selrecord.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/selrecord.9 -L share/man/man9/selrecord.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/selrecord.9
+++ share/man/man9/selrecord.9
@@ -24,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/selrecord.9,v 1.3 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/selrecord.9,v 1.4 2007/06/14 22:38:50 njl Exp $
.\"
-.Dd March 20, 2002
+.Dd June 13, 2007
.Dt SELRECORD 9
.Os
.Sh NAME
@@ -86,6 +86,13 @@
.Xr poll 2
when they wake up.
.Pp
+The contents of
+.Fa *sip
+must be zeroed, such as by softc initialization, before any call to
+.Fn selrecord
+or
+.Fn selwakeup ,
+otherwise a panic may occur.
.Fn selwakeup
acquires and releases
.Va sellock
Index: VFS.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VFS.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VFS.9 -L share/man/man9/VFS.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VFS.9
+++ share/man/man9/VFS.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VFS.9,v 1.11.2.1 2005/07/27 02:11:20 scottl Exp $
+.\" $FreeBSD: src/share/man/man9/VFS.9,v 1.12 2005/07/27 02:08:59 scottl Exp $
.\"
.Dd July 24, 1996
.Os
--- /dev/null
+++ share/man/man9/p_cansee.9
@@ -0,0 +1,93 @@
+.\"
+.\" Copyright (c) 2003 Joseph Koshy <jkoshy at freebsd.org>
+.\" Copyright (c) 2006 Ceri Davies <ceri at FreeBSD.org>
+.\"
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/p_cansee.9,v 1.1 2006/11/19 13:35:03 ceri Exp $
+.\"
+.Dd November 19, 2006
+.Os
+.Dt P_CANSEE 9
+.Sh NAME
+.Nm p_cansee
+.Nd determine visibility of a process
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/proc.h
+.Ft int
+.Fn p_cansee "struct thread *td" "struct proc *p"
+.Sh DESCRIPTION
+This function can be used to determine if a given process
+.Fa p
+is visible to the thread
+.Fa td ,
+where the notion of
+.Dq visibility
+may be read as
+.Dq "awareness of existence" .
+.Pp
+The function is implemented using
+.Xr cr_cansee 9 ,
+and the dependencies on
+.Xr sysctl 8
+variables documented in the
+.Xr cr_cansee 9
+manual page apply.
+.Sh RETURN VALUES
+The
+.Fn p_cansee
+function
+returns
+.Li 0
+if the process denoted by
+.Fa p
+is visible by thread
+.Fa td ,
+or a non-zero error return value otherwise.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ESRCH
+Process
+.Fa p
+is not visible to thread
+.Fa td
+as determined by
+.Xr cr_cansee 9 .
+.It Bq Er ESRCH
+Thread
+.Fa td
+has been jailed and process
+.Fa p
+does not belong to the same jail as
+.Fa td .
+.It Bq Er ESRCH
+The MAC subsystem denied visibility.
+.El
+.Sh SEE ALSO
+.Xr jail 2 ,
+.Xr sysctl 8 ,
+.Xr cr_cansee 9 ,
+.Xr mac 9 ,
+.Xr p_candebug 9 ,
+.Xr prison_check 9
--- /dev/null
+++ share/man/man9/sf_buf.9
@@ -0,0 +1,141 @@
+.\"
+.\" Copyright (c) 2007 Seccuris Inc.
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Robert N. M. Watson under contract to
+.\" Seccuris Inc.
+.\"
+.\" 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(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/sf_buf.9,v 1.2 2007/01/31 09:40:31 rwatson Exp $
+.\"
+.Dd January 28, 2007
+.Dt SF_BUF 9
+.Os
+.Sh NAME
+.Nm sf_buf
+.Nd manage temporary kernel address space mapping for memory pages
+.Sh SYNOPSIS
+.In sys/sf_buf.h
+.Ft struct sf_buf *
+.Fn sf_buf_alloc "struct vm_page *m" "int flags"
+.Ft void
+.Fn sf_buf_free "struct sf_buf *sf"
+.Ft vm_offset_t
+.Fn sf_buf_kva "struct sf_buf *sf"
+.Ft struct vm_page *
+.Fn sf_buf_page "struct sf_buf *sf"
+.Sh DESCRIPTION
+The
+.Nm
+interface, historically the
+.Xr sendfile 2
+buffer interface, allows kernel subsystems to manage temporary kernel address
+space mappings for physical memory pages.
+On systems with a direct memory map region (allowing all physical pages to be
+visible in the kernel address space at all times), the
+.Vt "struct sf_buf"
+will point to an address in the direct map region; on systems without a
+direct memory map region, the
+.Vt "struct sf_buf"
+will manage a temporary kernel address space mapping valid for the lifetime
+of the
+.Vt "struct sf_buf".
+.Pp
+Call
+.Fn sf_buf_alloc
+to allocate a
+.Vt "struct sf_buf"
+for a physical memory page.
+.Fn sf_buf_alloc
+is not responsible for arranging for the page to be present in physical
+memory; the caller should already have arranged for the page to be wired,
+i.e., by calling
+.Xr vm_page_wire 9 .
+Several flags may be passed to
+.Fn sf_buf_alloc :
+.Bl -tag -width SFB_CPUPRIVATE
+.It Dv SFB_CATCH
+Cause
+.Fn sf_buf_alloc
+to abort and return
+.Dv NULL
+if a signal is received waiting for a
+.Vt "struct sf_buf"
+to become available.
+.It Dv SFB_NOWAIT
+Cause
+.Fn sf_buf_alloc
+to return
+.Dv NULL
+rather than sleeping if a
+.Vt "struct sf_buf"
+is not immediately available.
+.It Dv SFB_CPUPRIVATE
+Cause
+.Fn sf_buf_alloc
+to only arrange that the temporary mapping be valid on the current CPU,
+avoiding unnecessary TLB shootdowns for mappings that will only be accessed
+on a single CPU at a time.
+The caller must ensure that accesses to the virtual address occur only on the
+CPU from which
+.Fn sf_buf_alloc
+was invoked, perhaps by using
+.Fn sched_pin .
+.El
+.Pp
+Call
+.Fn sf_buf_kva
+to return a kernel mapped address for the page.
+.Pp
+Call
+.Fn sf_buf_page
+to return a pointer to the page originally passed into
+.Fn sf_buf_alloc .
+.Pp
+Call
+.Fn sf_buf_free
+to release the
+.Vt "struct sf_buf"
+reference.
+The caller is responsible for releasing any wiring they have previously
+acquired on the physical page;
+.Fn sf_buf_free
+releases only the temporary kernel address space mapping, not the page
+itself.
+.Pp
+Uses of this interface include managing mappings of borrowed pages from user
+memory, such as in zero-copy socket I/O, or pages of memory from the buffer
+cache referenced by mbuf external storage for
+.Xr sendfile 2 .
+.Sh SEE ALSO
+.Xr sendfile 2 ,
+.Xr vm_page_wire 9
+.Sh AUTHORS
+The
+.Vt "struct sf_buf"
+API was designed and implemented by
+.An Alan L. Cox .
+This manual page was written by
+.An Robert N. M. Watson .
Index: kobj.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/kobj.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/kobj.9 -L share/man/man9/kobj.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/kobj.9
+++ share/man/man9/kobj.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/kobj.9,v 1.16 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/kobj.9,v 1.17 2006/10/28 10:57:35 maxim Exp $
.\"
.Dd April 4, 2000
.Dt KOBJ 9
@@ -83,7 +83,7 @@
specified by the class and initialise it by zeroing the memory and
installing a pointer to the class' method dispatch table.
Objects created in this way should be freed by calling
-.Fn kobj_free .
+.Fn kobj_delete .
.Pp
Clients which would like to manage the allocation of memory
themselves should call
Index: Makefile
===================================================================
RCS file: /home/cvs/src/share/man/man9/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/Makefile -L share/man/man9/Makefile -u -r1.2 -r1.3
--- share/man/man9/Makefile
+++ share/man/man9/Makefile
@@ -1,4 +1,5 @@
-# $FreeBSD: src/share/man/man9/Makefile,v 1.260.2.5 2006/02/23 02:13:29 mlaier Exp $
+# $MidnightBSD$
+# $FreeBSD: src/share/man/man9/Makefile,v 1.310.2.1.2.1 2008/02/15 15:19:26 brueffer Exp $
MAN= accept_filter.9 \
accf_data.9 \
@@ -38,8 +39,10 @@
byteorder.9 \
cd.9 \
condvar.9 \
+ config_intrhook.9 \
contigmalloc.9 \
copy.9 \
+ cr_cansee.9 \
critical_enter.9 \
cr_seeothergids.9 \
cr_seeotheruids.9 \
@@ -72,6 +75,7 @@
device_get_parent.9 \
device_get_softc.9 \
device_get_state.9 \
+ device_get_sysctl.9 \
device_get_unit.9 \
DEVICE_IDENTIFY.9 \
device_ids.9 \
@@ -85,7 +89,6 @@
DEVICE_SHUTDOWN.9 \
DEV_MODULE.9 \
devstat.9 \
- devsw.9 \
devtoname.9 \
disk.9 \
domain.9 \
@@ -127,9 +130,12 @@
kernacc.9 \
kernel_mount.9 \
kobj.9 \
+ kqueue.9 \
kthread.9 \
ktr.9 \
lock.9 \
+ locking.9 \
+ LOCK_PROFILING.9 \
mac.9 \
make_dev.9 \
malloc.9 \
@@ -149,11 +155,11 @@
MODULE_VERSION.9 \
mtx_pool.9 \
mutex.9 \
- MUTEX_PROFILING.9 \
namei.9 \
panic.9 \
pbuf.9 \
p_candebug.9 \
+ p_cansee.9 \
pci.9 \
pfil.9 \
pfind.9 \
@@ -185,10 +191,12 @@
pmap_zero_page.9 \
printf.9 \
prison_check.9 \
+ priv.9 \
pseudofs.9 \
psignal.9 \
random.9 \
random_harvest.9 \
+ redzone.9 \
resettodr.9 \
resource_int_value.9 \
rijndael.9 \
@@ -196,21 +204,26 @@
rtalloc.9 \
rtentry.9 \
runqueue.9 \
+ rwlock.9 \
sbuf.9 \
scheduler.9 \
securelevel_gt.9 \
selrecord.9 \
sema.9 \
+ sf_buf.9 \
signal.9 \
sleep.9 \
sleepqueue.9 \
+ socket.9 \
spl.9 \
+ stack.9 \
store.9 \
style.9 \
suser.9 \
swi.9 \
sx.9 \
SYSCALL_MODULE.9 \
+ sysctl.9 \
sysctl_add_oid.9 \
sysctl_ctx_init.9 \
taskqueue.9 \
@@ -221,6 +234,7 @@
ucred.9 \
uidinfo.9 \
uio.9 \
+ usbdi.9 \
utopia.9 \
vaccess.9 \
vaccess_acl_posix1e.9 \
@@ -232,6 +246,7 @@
vfsconf.9 \
VFS_FHTOVP.9 \
vfs_getnewfsid.9 \
+ vfs_getopt.9 \
vfs_getvfs.9 \
VFS_LOCK_GIANT.9 \
VFS_MOUNT.9 \
@@ -249,7 +264,6 @@
VFS_UNMOUNT.9 \
vfs_unmountall.9 \
VFS_VGET.9 \
- VFS_VPTOFH.9 \
vget.9 \
vgone.9 \
vhold.9 \
@@ -292,7 +306,6 @@
vm_page_protect.9 \
vm_page_rename.9 \
vm_page_sleep_busy.9 \
- vm_page_unmanage.9 \
vm_page_wakeup.9 \
vm_page_wire.9 \
vm_page_zero_fill.9 \
@@ -331,6 +344,7 @@
VOP_SETACL.9 \
VOP_SETEXTATTR.9 \
VOP_STRATEGY.9 \
+ VOP_VPTOFH.9 \
vput.9 \
vref.9 \
vrele.9 \
@@ -368,6 +382,7 @@
bus_dma.9 bus_dmamap_destroy.9 \
bus_dma.9 bus_dmamap_load.9 \
bus_dma.9 bus_dmamap_load_mbuf.9 \
+ bus_dma.9 bus_dmamap_load_mbuf_sg.9 \
bus_dma.9 bus_dmamap_load_uio.9 \
bus_dma.9 bus_dmamap_sync.9 \
bus_dma.9 bus_dmamap_unload.9 \
@@ -380,6 +395,83 @@
MLINKS+=BUS_SETUP_INTR.9 bus_setup_intr.9 \
BUS_SETUP_INTR.9 BUS_TEARDOWN_INTR.9 \
BUS_SETUP_INTR.9 bus_teardown_intr.9
+MLINKS+=bus_space.9 bus_space_barrier.9 \
+ bus_space.9 bus_space_copy_region_1.9 \
+ bus_space.9 bus_space_copy_region_2.9 \
+ bus_space.9 bus_space_copy_region_4.9 \
+ bus_space.9 bus_space_copy_region_8.9 \
+ bus_space.9 bus_space_copy_region_stream_1.9 \
+ bus_space.9 bus_space_copy_region_stream_2.9 \
+ bus_space.9 bus_space_copy_region_stream_4.9 \
+ bus_space.9 bus_space_copy_region_stream_8.9 \
+ bus_space.9 bus_space_free.9 \
+ bus_space.9 bus_space_map.9 \
+ bus_space.9 bus_space_read_1.9 \
+ bus_space.9 bus_space_read_2.9 \
+ bus_space.9 bus_space_read_4.9 \
+ bus_space.9 bus_space_read_8.9 \
+ bus_space.9 bus_space_read_multi_1.9 \
+ bus_space.9 bus_space_read_multi_2.9 \
+ bus_space.9 bus_space_read_multi_4.9 \
+ bus_space.9 bus_space_read_multi_8.9 \
+ bus_space.9 bus_space_read_multi_stream_1.9 \
+ bus_space.9 bus_space_read_multi_stream_2.9 \
+ bus_space.9 bus_space_read_multi_stream_4.9 \
+ bus_space.9 bus_space_read_multi_stream_8.9 \
+ bus_space.9 bus_space_read_region_1.9 \
+ bus_space.9 bus_space_read_region_2.9 \
+ bus_space.9 bus_space_read_region_4.9 \
+ bus_space.9 bus_space_read_region_8.9 \
+ bus_space.9 bus_space_read_region_stream_1.9 \
+ bus_space.9 bus_space_read_region_stream_2.9 \
+ bus_space.9 bus_space_read_region_stream_4.9 \
+ bus_space.9 bus_space_read_region_stream_8.9 \
+ bus_space.9 bus_space_read_stream_1.9 \
+ bus_space.9 bus_space_read_stream_2.9 \
+ bus_space.9 bus_space_read_stream_4.9 \
+ bus_space.9 bus_space_read_stream_8.9 \
+ bus_space.9 bus_space_set_multi_1.9 \
+ bus_space.9 bus_space_set_multi_2.9 \
+ bus_space.9 bus_space_set_multi_4.9 \
+ bus_space.9 bus_space_set_multi_8.9 \
+ bus_space.9 bus_space_set_multi_stream_1.9 \
+ bus_space.9 bus_space_set_multi_stream_2.9 \
+ bus_space.9 bus_space_set_multi_stream_4.9 \
+ bus_space.9 bus_space_set_multi_stream_8.9 \
+ bus_space.9 bus_space_set_region_1.9 \
+ bus_space.9 bus_space_set_region_2.9 \
+ bus_space.9 bus_space_set_region_4.9 \
+ bus_space.9 bus_space_set_region_8.9 \
+ bus_space.9 bus_space_set_region_stream_1.9 \
+ bus_space.9 bus_space_set_region_stream_2.9 \
+ bus_space.9 bus_space_set_region_stream_4.9 \
+ bus_space.9 bus_space_set_region_stream_8.9 \
+ bus_space.9 bus_space_subregion.9 \
+ bus_space.9 bus_space_unmap.9 \
+ bus_space.9 bus_space_write_1.9 \
+ bus_space.9 bus_space_write_2.9 \
+ bus_space.9 bus_space_write_4.9 \
+ bus_space.9 bus_space_write_8.9 \
+ bus_space.9 bus_space_write_multi_1.9 \
+ bus_space.9 bus_space_write_multi_2.9 \
+ bus_space.9 bus_space_write_multi_4.9 \
+ bus_space.9 bus_space_write_multi_8.9 \
+ bus_space.9 bus_space_write_multi_stream_1.9 \
+ bus_space.9 bus_space_write_multi_stream_2.9 \
+ bus_space.9 bus_space_write_multi_stream_4.9 \
+ bus_space.9 bus_space_write_multi_stream_8.9 \
+ bus_space.9 bus_space_write_region_1.9 \
+ bus_space.9 bus_space_write_region_2.9 \
+ bus_space.9 bus_space_write_region_4.9 \
+ bus_space.9 bus_space_write_region_8.9 \
+ bus_space.9 bus_space_write_region_stream_1.9 \
+ bus_space.9 bus_space_write_region_stream_2.9 \
+ bus_space.9 bus_space_write_region_stream_4.9 \
+ bus_space.9 bus_space_write_region_stream_8.9 \
+ bus_space.9 bus_space_write_stream_1.9 \
+ bus_space.9 bus_space_write_stream_2.9 \
+ bus_space.9 bus_space_write_stream_4.9 \
+ bus_space.9 bus_space_write_stream_8.9
MLINKS+=byteorder.9 be16dec.9 \
byteorder.9 be16enc.9 \
byteorder.9 be16toh.9 \
@@ -416,7 +508,10 @@
condvar.9 cv_timedwait_sig.9 \
condvar.9 cv_wait.9 \
condvar.9 cv_wait_sig.9 \
+ condvar.9 cv_wait_unlock.9 \
condvar.9 cv_wmesg.9
+MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \
+ config_intrhook.9 config_intrhook_establish.9
MLINKS+=contigmalloc.9 contigfree.9
MLINKS+=copy.9 copyin.9 \
copy.9 copyinstr.9 \
@@ -424,20 +519,20 @@
copy.9 copystr.9
MLINKS+=critical_enter.9 critical.9 \
critical_enter.9 critical_exit.9
-MLINKS+=crypto.9 crypto_get_driverid.9 \
- crypto.9 crypto_register.9 \
- crypto.9 crypto_kregister.9 \
- crypto.9 crypto_unregister.9 \
- crypto.9 crypto_unregister_all.9 \
+MLINKS+=crypto.9 crypto_dispatch.9 \
crypto.9 crypto_done.9 \
- crypto.9 crypto_kdone.9 \
- crypto.9 crypto_newsession.9 \
+ crypto.9 crypto_freereq.9 \
crypto.9 crypto_freesession.9 \
- crypto.9 crypto_dispatch.9 \
+ crypto.9 crypto_get_driverid.9 \
+ crypto.9 crypto_getreq.9 \
crypto.9 crypto_kdispatch.9 \
+ crypto.9 crypto_kdone.9 \
+ crypto.9 crypto_kregister.9 \
+ crypto.9 crypto_newsession.9 \
+ crypto.9 crypto_register.9 \
crypto.9 crypto_unblock.9 \
- crypto.9 crypto_getreq.9 \
- crypto.9 crypto_freereq.9
+ crypto.9 crypto_unregister.9 \
+ crypto.9 crypto_unregister_all.9
MLINKS+=devclass_add_driver.9 devclass_delete_driver.9 \
devclass_add_driver.9 devclass_find_driver.9
MLINKS+=device_add_child.9 device_add_child_ordered.9
@@ -449,6 +544,8 @@
device_get_state.9 device_is_alive.9 \
device_get_state.9 device_is_attached.9 \
device_get_state.9 device_unbusy.9
+MLINKS+=device_get_sysctl.9 device_get_sysctl_ctx.9 \
+ device_get_sysctl.9 device_get_sysctl_tree.9
MLINKS+=device_ids.9 major.9 \
device_ids.9 minor.9 \
device_ids.9 umajor.9 \
@@ -467,19 +564,19 @@
disk.9 disk_destroy.9
MLINKS+=domain.9 DOMAIN_SET.9 \
domain.9 net_add_domain.9 \
- domain.9 pfctlinput2.9 \
domain.9 pfctlinput.9 \
+ domain.9 pfctlinput2.9 \
domain.9 pffindproto.9 \
domain.9 pffindtype.9
MLINKS+=DRIVER_MODULE.9 MULTI_DRIVER_MODULE.9
MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \
EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \
EVENTHANDLER.9 eventhandler_deregister.9 \
+ EVENTHANDLER.9 eventhandler_find_list.9 \
EVENTHANDLER.9 EVENTHANDLER_INVOKE.9 \
+ EVENTHANDLER.9 eventhandler_prune_list.9 \
EVENTHANDLER.9 EVENTHANDLER_REGISTER.9 \
- EVENTHANDLER.9 eventhandler_register.9 \
- EVENTHANDLER.9 eventhandler_find_list.9 \
- EVENTHANDLER.9 eventhandler_prune_list.9
+ EVENTHANDLER.9 eventhandler_register.9
MLINKS+=fetch.9 fubyte.9 \
fetch.9 fuswintr.9 \
fetch.9 fusword.9 \
@@ -501,8 +598,15 @@
MLINKS+=g_provider.9 g_destroy_provider.9 \
g_provider.9 g_error_provider.9 \
g_provider.9 g_new_providerf.9
+MLINKS+=hash.9 hash32.9 \
+ hash.9 hash32_buf.9 \
+ hash.9 hash32_str.9 \
+ hash.9 hash32_stre.9 \
+ hash.9 hash32_strn.9 \
+ hash.9 hash32_strne.9
MLINKS+=hashinit.9 hashdestroy.9 \
- hashinit.9 phashinit.9
+ hashinit.9 phashinit.9 \
+ hashinit.9 hashinit_flags.9
MLINKS+=ieee80211.9 ieee80211_attach.9 \
ieee80211.9 ieee80211_chan2ieee.9 \
ieee80211.9 ieee80211_chan2mode.9 \
@@ -572,6 +676,20 @@
kobj.9 kobj_create.9 \
kobj.9 kobj_delete.9 \
kobj.9 kobj_init.9
+MLINKS+=kqueue.9 knlist_add.9 \
+ kqueue.9 knlist_clear.9 \
+ kqueue.9 knlist_delete.9 \
+ kqueue.9 knlist_destroy.9 \
+ kqueue.9 knlist_empty.9 \
+ kqueue.9 knlist_init.9 \
+ kqueue.9 knlist_remove.9 \
+ kqueue.9 knlist_remove_inevent.9 \
+ kqueue.9 knote_fdclose.9 \
+ kqueue.9 KNOTE_LOCKED.9 \
+ kqueue.9 KNOTE_UNLOCKED.9 \
+ kqueue.9 kqfd_register.9 \
+ kqueue.9 kqueue_add_filteropts.9 \
+ kqueue.9 kqueue_del_filteropts.9
MLINKS+=kthread.9 kproc_shutdown.9 \
kthread.9 kproc_start.9 \
kthread.9 kthread_create.9 \
@@ -591,6 +709,7 @@
lock.9 lockmgr.9 \
lock.9 lockmgr_printinfo.9 \
lock.9 lockstatus.9
+MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9
MLINKS+=make_dev.9 destroy_dev.9 \
make_dev.9 dev_depends.9 \
make_dev.9 make_dev_alias.9
@@ -720,6 +839,7 @@
mutex.9 mtx_lock_spin_flags.9 \
mutex.9 mtx_owned.9 \
mutex.9 mtx_recursed.9 \
+ mutex.9 mtx_sleep.9 \
mutex.9 MTX_SYSINIT.9 \
mutex.9 mtx_trylock.9 \
mutex.9 mtx_trylock_flags.9 \
@@ -737,6 +857,7 @@
pci.9 pci_enable_busmaster.9 \
pci.9 pci_enable_io.9 \
pci.9 pci_find_bsf.9 \
+ pci.9 pci_find_dbsf.9 \
pci.9 pci_find_device.9 \
pci.9 pci_get_powerstate.9 \
pci.9 pci_read_config.9 \
@@ -763,6 +884,8 @@
MLINKS+=printf.9 log.9 \
printf.9 tprintf.9 \
printf.9 uprintf.9
+MLINKS+=priv.9 priv_check.9 \
+ priv.9 priv_check_cred.9
MLINKS+=psignal.9 gsignal.9 \
psignal.9 pgsignal.9
MLINKS+=random.9 arc4rand.9 \
@@ -775,7 +898,6 @@
rman.9 rman_await_resource.9 \
rman.9 rman_deactivate_resource.9 \
rman.9 rman_fini.9 \
- rman.9 rman_fini.9 \
rman.9 rman_get_bushandle.9 \
rman.9 rman_get_bustag.9 \
rman.9 rman_get_device.9 \
@@ -797,12 +919,25 @@
rman.9 rman_set_virtual.9
MLINKS+=rtalloc.9 rtalloc1.9 \
rtalloc.9 rtalloc_ign.9 \
- rtalloc.9 rtfree.9 \
- rtalloc.9 RTFREE.9
+ rtalloc.9 RTFREE.9 \
+ rtalloc.9 rtfree.9
MLINKS+=runqueue.9 chooseproc.9 \
runqueue.9 procrunnable.9 \
runqueue.9 remrunqueue.9 \
runqueue.9 setrunqueue.9
+MLINKS+=rwlock.9 rw_assert.9 \
+ rwlock.9 rw_destroy.9 \
+ rwlock.9 rw_downgrade.9 \
+ rwlock.9 rw_init.9 \
+ rwlock.9 rw_initialized.9 \
+ rwlock.9 rw_rlock.9 \
+ rwlock.9 rw_runlock.9 \
+ rwlock.9 rw_sleep.9 \
+ rwlock.9 RW_SYSINIT.9 \
+ rwlock.9 rw_try_upgrade.9 \
+ rwlock.9 rw_wlock.9 \
+ rwlock.9 rw_wowned.9 \
+ rwlock.9 rw_wunlock.9
MLINKS+=sbuf.9 sbuf_bcat.9 \
sbuf.9 sbuf_bcopyin.9 \
sbuf.9 sbuf_bcpy.9 \
@@ -841,6 +976,10 @@
sema.9 sema_trywait.9 \
sema.9 sema_value.9 \
sema.9 sema_wait.9
+MLINKS+=sf_buf.9 sf_buf_alloc.9 \
+ sf_buf.9 sf_buf_free.9 \
+ sf_buf.9 sf_buf_kva.9 \
+ sf_buf.9 sf_buf_page.9
MLINKS+=signal.9 cursig.9 \
signal.9 execsigs.9 \
signal.9 issignal.9 \
@@ -868,6 +1007,8 @@
signal.9 SIG_STOPSIGMASK.9 \
signal.9 trapsignal.9
MLINKS+=sleep.9 msleep.9 \
+ sleep.9 msleep_spin.9 \
+ sleep.9 pause.9 \
sleep.9 tsleep.9 \
sleep.9 wakeup.9 \
sleep.9 wakeup_one.9
@@ -888,6 +1029,15 @@
sleepqueue.9 sleepq_timedwait_sig.9 \
sleepqueue.9 sleepq_wait.9 \
sleepqueue.9 sleepq_wait_sig.9
+MLINKS+=socket.9 sobind.9 \
+ socket.9 soclose.9 \
+ socket.9 soconnect.9 \
+ socket.9 socreate.9 \
+ socket.9 sogetopt.9 \
+ socket.9 soreceive.9 \
+ socket.9 sosetopt.9 \
+ socket.9 sosend.9 \
+ socket.9 soshutdown.9
MLINKS+=spl.9 spl0.9 \
spl.9 splbio.9 \
spl.9 splclock.9 \
@@ -900,6 +1050,14 @@
spl.9 spltty.9 \
spl.9 splvm.9 \
spl.9 splx.9
+MLINKS+=stack.9 stack_copy.9 \
+ stack.9 stack_create.9 \
+ stack.9 stack_destroy.9 \
+ stack.9 stack_printf.9 \
+ stack.9 stack_put.9 \
+ stack.9 stack_save.9 \
+ stack.9 stack_sbuf_print.9 \
+ stack.9 stack_zero.9
MLINKS+=store.9 subyte.9 \
store.9 suswintr.9 \
store.9 susword.9 \
@@ -911,14 +1069,31 @@
sx.9 sx_destroy.9 \
sx.9 sx_downgrade.9 \
sx.9 sx_init.9 \
+ sx.9 sx_init_flags.9 \
sx.9 sx_slock.9 \
sx.9 sx_sunlock.9 \
sx.9 SX_SYSINIT.9 \
sx.9 sx_try_slock.9 \
sx.9 sx_try_upgrade.9 \
sx.9 sx_try_xlock.9 \
+ sx.9 sx_sleep.9 \
+ sx.9 sx_unlock.9 \
+ sx.9 sx_xholder.9 \
sx.9 sx_xlock.9 \
+ sx.9 sx_xlocked.9 \
sx.9 sx_xunlock.9
+MLINKS+=sysctl.9 SYSCTL_DECL.9 \
+ sysctl.9 SYSCTL_INT.9 \
+ sysctl.9 SYSCTL_LONG.9 \
+ sysctl.9 SYSCTL_NODE.9 \
+ sysctl.9 SYSCTL_OPAQUE.9 \
+ sysctl.9 SYSCTL_PROC.9 \
+ sysctl.9 SYSCTL_STRING.9 \
+ sysctl.9 SYSCTL_STRUCT.9 \
+ sysctl.9 SYSCTL_UINT.9 \
+ sysctl.9 SYSCTL_ULONG.9 \
+ sysctl.9 SYSCTL_XINT.9 \
+ sysctl.9 SYSCTL_XLONG.9
MLINKS+=sysctl_add_oid.9 SYSCTL_ADD_INT.9 \
sysctl_add_oid.9 SYSCTL_ADD_LONG.9 \
sysctl_add_oid.9 SYSCTL_ADD_NODE.9 \
@@ -971,13 +1146,68 @@
uidinfo.9 uihashinit.9 \
uidinfo.9 uihold.9
MLINKS+=uio.9 uiomove.9
+MLINKS+=usbdi.9 usbd_abort_default_pipe.9 \
+ usbdi.9 usbd_abort_pipe.9 \
+ usbdi.9 usbd_alloc_buffer.9 \
+ usbdi.9 usbd_alloc_xfer.9 \
+ usbdi.9 usbd_clear_endpoint_stall.9 \
+ usbdi.9 usbd_clear_endpoint_stall_async.9 \
+ usbdi.9 usbd_clear_endpoint_toggle.9 \
+ usbdi.9 usbd_close_pipe.9 \
+ usbdi.9 usbd_device2interface_handle.9 \
+ usbdi.9 usbd_do_request.9 \
+ usbdi.9 usbd_do_request_async.9 \
+ usbdi.9 usbd_do_request_flags.9 \
+ usbdi.9 usbd_do_request_flags_pipe.9 \
+ usbdi.9 usbd_endpoint_count.9 \
+ usbdi.9 usbd_errstr.9 \
+ usbdi.9 usbd_find_edesc.9 \
+ usbdi.9 usbd_find_idesc.9 \
+ usbdi.9 usbd_free_buffer.9 \
+ usbdi.9 usbd_free_xfer.9 \
+ usbdi.9 usbd_get_buffer.9 \
+ usbdi.9 usbd_get_config.9 \
+ usbdi.9 usbd_get_config_desc.9 \
+ usbdi.9 usbd_get_config_desc_full.9 \
+ usbdi.9 usbd_get_config_descriptor.9 \
+ usbdi.9 usbd_get_device_descriptor.9 \
+ usbdi.9 usbd_get_endpoint_descriptor.9 \
+ usbdi.9 usbd_get_interface_altindex.9 \
+ usbdi.9 usbd_get_interface_descriptor.9 \
+ usbdi.9 usbd_get_no_alts.9 \
+ usbdi.9 usbd_get_quirks.9 \
+ usbdi.9 usbd_get_speed.9 \
+ usbdi.9 usbd_get_string.9 \
+ usbdi.9 usbd_get_string_desc.9 \
+ usbdi.9 usbd_get_xfer_status.9 \
+ usbdi.9 usbd_interface2device_handle.9 \
+ usbdi.9 usbd_interface2endpoint_descriptor.9 \
+ usbdi.9 usbd_interface_count.9 \
+ usbdi.9 usbd_open_pipe.9 \
+ usbdi.9 usbd_open_pipe_intr.9 \
+ usbdi.9 usbd_pipe2device_handle.9 \
+ usbdi.9 usbd_set_config_index.9 \
+ usbdi.9 usbd_set_config_no.9 \
+ usbdi.9 usbd_set_interface.9 \
+ usbdi.9 usbd_setup_default_xfer.9 \
+ usbdi.9 usbd_setup_isoc_xfer.9 \
+ usbdi.9 usbd_setup_xfer.9 \
+ usbdi.9 usbd_sync_transfer.9 \
+ usbdi.9 usbd_transfer.9 \
+ usbdi.9 usb_find_desc.9
MLINKS+=vcount.9 count_dev.9
MLINKS+=vfsconf.9 vfs_modevent.9 \
vfsconf.9 vfs_register.9 \
vfsconf.9 vfs_unregister.9
+MLINKS+=vfs_getopt.9 vfs_getopts.9 \
+ vfs_getopt.9 vfs_flagopt.9 \
+ vfs_getopt.9 vfs_scanopt.9 \
+ vfs_getopt.9 vfs_copyopt.9 \
+ vfs_getopt.9 vfs_filteropt.9
MLINKS+=VFS_LOCK_GIANT.9 VFS_UNLOCK_GIANT.9
MLINKS+=vgone.9 vgonel.9
-MLINKS+=vhold.9 vdrop.9
+MLINKS+=vhold.9 vdrop.9 \
+ vhold.9 vdropl.9
MLINKS+=vm_map_lock.9 vm_map_lock_downgrade.9 \
vm_map_lock.9 vm_map_lock_read.9 \
vm_map_lock.9 vm_map_lock_upgrade.9 \
Index: microtime.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/microtime.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/microtime.9 -L share/man/man9/microtime.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/microtime.9
+++ share/man/man9/microtime.9
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/microtime.9,v 1.10.2.1 2005/11/04 22:08:40 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/microtime.9,v 1.11 2005/10/13 16:01:28 jhb Exp $
.\"
.Dd September 16, 2004
.Dt MICROTIME 9
Index: vm_page_io.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_io.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_io.9 -L share/man/man9/vm_page_io.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_io.9
+++ share/man/man9/vm_page_io.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_io.9,v 1.5 2005/06/28 20:15:18 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_IO_START 9
Index: sx.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sx.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/sx.9 -L share/man/man9/sx.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/sx.9
+++ share/man/man9/sx.9
@@ -24,25 +24,31 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sx.9,v 1.31 2005/01/12 21:48:25 ru Exp $
+.\" $FreeBSD: src/share/man/man9/sx.9,v 1.41.2.1 2007/11/27 14:08:14 attilio Exp $
.\"
-.Dd January 5, 2005
+.Dd November 25, 2007
.Dt SX 9
.Os
.Sh NAME
.Nm sx ,
.Nm sx_init ,
+.Nm sx_init_flags ,
.Nm sx_destroy ,
.Nm sx_slock ,
.Nm sx_xlock ,
+.Nm sx_slock_sig ,
+.Nm sx_xlock_sig ,
.Nm sx_try_slock ,
.Nm sx_try_xlock ,
.Nm sx_sunlock ,
.Nm sx_xunlock ,
+.Nm sx_unlock ,
.Nm sx_try_upgrade ,
.Nm sx_downgrade ,
+.Nm sx_sleep ,
+.Nm sx_xholder ,
+.Nm sx_xlocked ,
.Nm sx_assert ,
-.Nm sx_unlock ,
.Nm SX_SYSINIT
.Nd kernel shared/exclusive lock
.Sh SYNOPSIS
@@ -52,12 +58,18 @@
.Ft void
.Fn sx_init "struct sx *sx" "const char *description"
.Ft void
+.Fn sx_init_flags "struct sx *sx" "const char *description" "int opts"
+.Ft void
.Fn sx_destroy "struct sx *sx"
.Ft void
.Fn sx_slock "struct sx *sx"
.Ft void
.Fn sx_xlock "struct sx *sx"
.Ft int
+.Fn sx_slock_sig "struct sx *sx"
+.Ft int
+.Fn sx_xlock_sig "struct sx *sx"
+.Ft int
.Fn sx_try_slock "struct sx *sx"
.Ft int
.Fn sx_try_xlock "struct sx *sx"
@@ -65,28 +77,36 @@
.Fn sx_sunlock "struct sx *sx"
.Ft void
.Fn sx_xunlock "struct sx *sx"
+.Ft void
+.Fn sx_unlock "struct sx *sx"
.Ft int
.Fn sx_try_upgrade "struct sx *sx"
.Ft void
.Fn sx_downgrade "struct sx *sx"
+.Ft int
+.Fn sx_sleep "void *chan" "struct sx *sx" "int priority" "const char *wmesg" "int timo"
+.Ft "struct thread *"
+.Fn sx_xholder "struct sx *sx"
+.Ft int
+.Fn sx_xlocked "struct sx *sx"
+.Pp
+.Cd "options INVARIANTS"
+.Cd "options INVARIANT_SUPPORT"
.Ft void
.Fn sx_assert "struct sx *sx" "int what"
-.\"
-.Ss Nm Ss utility macros
-.Fn sx_unlock "struct sx *sx"
+.In sys/kernel.h
.Fn SX_SYSINIT "name" "struct sx *sx" "const char *description"
-.\"
-.Ss Kernel options
-.Cd "options INVARIANTS"
-.Cd "options INVARIANT_SUPPORT"
.Sh DESCRIPTION
Shared/exclusive locks are used to protect data that are read far more often
than they are written.
-Mutexes are inherently more efficient than shared/exclusive locks, so
+Shared/exclusive locks do not implement priority propagation like mutexes and
+reader/writer locks to prevent priority inversions, so
shared/exclusive locks should be used prudently.
.Pp
-Shared/exclusive locks are created with
-.Fn sx_init ,
+Shared/exclusive locks are created with either
+.Fn sx_init
+or
+.Fn sx_init_flags
where
.Fa sx
is a pointer to space for a
@@ -95,10 +115,46 @@
.Fa description
is a pointer to a null-terminated character string that describes the
shared/exclusive lock.
+The
+.Fa opts
+argument to
+.Fn sx_init_flags
+specifies a set of optional flags to alter the behavior of
+.Fa sx .
+It contains one or more of the following flags:
+.Bl -tag -width SX_ADAPTIVESPIN
+.It Dv SX_ADAPTIVESPIN
+If the kernel is compiled with
+.Cd "options ADAPTIVE_SX" ,
+then lock operations for
+.Fa sx
+will spin instead of sleeping while an exclusive lock holder is executing on
+another CPU.
+.It Dv SX_DUPOK
+Witness should not log messages about duplicate locks being acquired.
+.It Dv SX_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv SX_NOPROFILE
+Do not profile this lock.
+.It Dv SX_RECURSE
+Allow threads to recursively acquire exclusive locks for
+.Fa sx .
+.It Dv SX_QUIET
+Do not log any operations for this lock via
+.Xr ktr 4 .
+.El
+.Pp
Shared/exclusive locks are destroyed with
.Fn sx_destroy .
+The lock
+.Fa sx
+must not be locked by any thread when it is destroyed.
+.Pp
Threads acquire and release a shared lock by calling
-.Fn sx_slock
+.Fn sx_slock ,
+.Fn sx_slock_sig
or
.Fn sx_try_slock
and
@@ -106,7 +162,8 @@
or
.Fn sx_unlock .
Threads acquire and release an exclusive lock by calling
-.Fn sx_xlock
+.Fn sx_xlock ,
+.Fn sx_xlock_sig
or
.Fn sx_try_xlock
and
@@ -132,6 +189,20 @@
immediately; otherwise the exclusive lock will be acquired and a non-zero value
will be returned.
.Pp
+.Fn sx_slock_sig
+and
+.Fn sx_xlock_sig
+do the same as their normal versions but performing an interruptible sleep.
+They return a non-zero value if the sleep has been interrupted by a signal
+or an interrupt, otherwise 0.
+.Pp
+A thread can atomically release a shared/exclusive lock while waiting for an
+event by calling
+.Fn sx_sleep .
+For more details on the parameters to this function,
+see
+.Xr sleep 9 .
+.Pp
When compiled with
.Cd "options INVARIANTS"
and
@@ -143,29 +214,58 @@
for the assertions specified in
.Fa what ,
and panics if they are not met.
-The following assertions are supported:
-.Bl -tag -width ".Dv SX_UNLOCKED"
-.It Dv SX_LOCKED
+One of the following assertions must be specified:
+.Bl -tag -width ".Dv SA_UNLOCKED"
+.It Dv SA_LOCKED
Assert that the current thread has either a shared or an exclusive lock on the
.Vt sx
lock pointed to by the first argument.
-.It Dv SX_SLOCKED
+.It Dv SA_SLOCKED
Assert that the current thread has a shared lock on the
.Vt sx
lock pointed to by
the first argument.
-.It Dv SX_XLOCKED
+.It Dv SA_XLOCKED
Assert that the current thread has an exclusive lock on the
.Vt sx
lock pointed to
by the first argument.
-.It Dv SX_UNLOCKED
+.It Dv SA_UNLOCKED
Assert that the current thread has no lock on the
.Vt sx
lock pointed to
by the first argument.
.El
.Pp
+In addition, one of the following optional assertions may be included with
+either an
+.Dv SA_LOCKED ,
+.Dv SA_SLOCKED ,
+or
+.Dv SA_XLOCKED
+assertion:
+.Bl -tag -width ".Dv SA_NOTRECURSED"
+.It Dv SA_RECURSED
+Assert that the current thread has a recursed lock on
+.Fa sx .
+.It Dv SA_NOTRECURSED
+Assert that the current thread does not have a recursed lock on
+.Fa sx .
+.El
+.Pp
+.Fn sx_xholder
+will return a pointer to the thread which currently holds an exclusive lock on
+.Fa sx .
+If no thread holds an exclusive lock on
+.Fa sx ,
+then
+.Dv NULL
+is returned instead.
+.Pp
+.Fn sx_xlocked
+will return non-zero if the current thread holds the exclusive lock;
+otherwise, it will return zero.
+.Pp
For ease of programming,
.Fn sx_unlock
is provided as a macro frontend to the respective functions,
@@ -206,10 +306,11 @@
lock after acquiring a mutex, then the second thread would effectively
end up sleeping while holding a mutex, which is not allowed.
.Sh SEE ALSO
-.Xr condvar 9 ,
-.Xr mtx_pool 9 ,
+.Xr locking 9 ,
+.Xr lock 9 ,
.Xr mutex 9 ,
.Xr panic 9 ,
+.Xr rwlock 9 ,
.Xr sema 9
.Sh BUGS
Currently there is no way to assert that a lock is not held.
@@ -220,8 +321,8 @@
In the
.No non- Ns Dv WITNESS
case, the
-.Dv SX_LOCKED
+.Dv SA_LOCKED
and
-.Dv SX_SLOCKED
+.Dv SA_SLOCKED
assertions merely check that some thread holds a shared lock.
They do not ensure that the current thread holds a shared lock.
Index: vn_fullpath.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vn_fullpath.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vn_fullpath.9 -L share/man/man9/vn_fullpath.9 -u -r1.2 -r1.3
--- share/man/man9/vn_fullpath.9
+++ share/man/man9/vn_fullpath.9
@@ -26,7 +26,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vn_fullpath.9,v 1.4 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd January 11, 2004
.Dt VN_FULLPATH 9
Index: vm_page_protect.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_protect.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_protect.9 -L share/man/man9/vm_page_protect.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_protect.9
+++ share/man/man9/vm_page_protect.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_protect.9,v 1.3 2005/06/28 20:15:18 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 14, 2001
.Dt VM_PAGE_PROTECT 9
Index: utopia.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/utopia.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/utopia.9 -L share/man/man9/utopia.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/utopia.9
+++ share/man/man9/utopia.9
@@ -25,7 +25,7 @@
.\"
.\" Author: Hartmut Brandt <harti at FreeBSD.org>
.\"
-.\" $FreeBSD: src/share/man/man9/utopia.9,v 1.7 2004/07/07 07:56:58 ru Exp $
+.\" $FreeBSD: src/share/man/man9/utopia.9,v 1.8 2006/12/14 14:33:13 mpp Exp $
.\"
.Dd May 8, 2003
.Dt UTOPIA 9
@@ -245,7 +245,7 @@
.It Va chip
This points to a function vector for chip specific functions.
Two fields
-in this vector are publically available:
+in this vector are publicly available:
.Bl -tag -width indent
.It Va type
This is the type of the detected PHY chip.
Index: bpf.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/bpf.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/bpf.9 -L share/man/man9/bpf.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/bpf.9
+++ share/man/man9/bpf.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/bpf.9,v 1.6 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/bpf.9,v 1.7 2006/12/13 06:27:20 ru Exp $
.\"
-.Dd May 19, 2004
+.Dd December 13, 2006
.Dt BPF 9
.Os
.\"
@@ -51,7 +51,7 @@
.Fn bpf_mtap2 "struct bpf_if *bp" "void *data" "u_int dlen" "struct mbuf *m"
.Ft u_int
.Fo bpf_filter
-.Fa "const struct bpf_insn *pc " "u_char *pkt" "u_int *wirelen" "u_int *buflen"
+.Fa "const struct bpf_insn *pc " "u_char *pkt" "u_int wirelen" "u_int buflen"
.Fc
.Ft int
.Fn bpf_validate "const struct bpf_insn *fcode" "int flen"
@@ -217,6 +217,12 @@
is the length of the original packet and
.Fa buflen
is the amount of data present.
+The
+.Fa buflen
+value of 0 is special; it indicates that the
+.Fa pkt
+is actually a pointer to an mbuf chain
+.Pq Vt "struct mbuf *" .
.Pp
The
.Fn bpf_validate
Index: vm_page_lookup.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_lookup.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_lookup.9 -L share/man/man9/vm_page_lookup.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_lookup.9
+++ share/man/man9/vm_page_lookup.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_lookup.9,v 1.2 2005/06/28 20:15:18 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_LOOKUP 9
Index: pmap_zero_page.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/pmap_zero_page.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/pmap_zero_page.9 -L share/man/man9/pmap_zero_page.9 -u -r1.2 -r1.3
--- share/man/man9/pmap_zero_page.9
+++ share/man/man9/pmap_zero_page.9
@@ -24,7 +24,6 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/pmap_zero_page.9,v 1.3 2004/07/06 07:02:31 ru Exp $
-.\" $MidnightBSD$
.\"
.Dd July 21, 2003
.Dt PMAP_ZERO 9
Index: vm_set_page_size.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_set_page_size.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_set_page_size.9 -L share/man/man9/vm_set_page_size.9 -u -r1.2 -r1.3
--- share/man/man9/vm_set_page_size.9
+++ share/man/man9/vm_set_page_size.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_set_page_size.9,v 1.4 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 17, 2001
.Dt VM_SET_PAGE_SIZE 9
Index: g_bio.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/g_bio.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/g_bio.9 -L share/man/man9/g_bio.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/g_bio.9
+++ share/man/man9/g_bio.9
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2004 Pawel Jakub Dawidek <pjd at FreeBSD.org>
+.\" Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd at FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,9 +22,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/g_bio.9,v 1.9 2004/08/04 21:35:05 pjd Exp $
+.\" $FreeBSD: src/share/man/man9/g_bio.9,v 1.13 2007/05/06 12:48:39 wkoszek Exp $
.\"
-.Dd January 16, 2004
+.Dd November 1, 2006
.Dt G_BIO 9
.Os
.Sh NAME
@@ -39,7 +39,11 @@
.Ft "struct bio *"
.Fn g_new_bio void
.Ft "struct bio *"
+.Fn g_alloc_bio void
+.Ft "struct bio *"
.Fn g_clone_bio "struct bio *bp"
+.Ft "struct bio *"
+.Fn g_duplicate_bio "struct bio *bp"
.Ft void
.Fn g_destroy_bio "struct bio *bp"
.Ft void
@@ -71,6 +75,8 @@
Attributes are named by ascii strings and are stored in the
.Va bio_attribute
field.
+.It Dv BIO_FLUSH
+Tells underlying providers to flush their write caches.
.El
.It Va bio_flags
Available flags:
@@ -138,6 +144,13 @@
.Vt bio
structure.
.Pp
+.Fn g_alloc_bio
+- same as
+.Fn g_new_bio ,
+but always succeeds (allocates bio with the
+.Dv M_WAITOK
+malloc flag).
+.Pp
The
.Fn g_clone_bio
function allocates a new
@@ -174,6 +187,13 @@
Schedule the clone on its own consumer.
.El
.Pp
+.Fn g_duplicate_bio
+- same as
+.Fn g_clone_bio ,
+but always succeeds (allocates bio with the
+.Dv M_WAITOK
+malloc flag).
+.Pp
The
.Fn g_destroy_bio
function deallocates and destroys the given
@@ -213,7 +233,7 @@
struct bio *cbp;
printf("Request received: ");
- g_print_bio();
+ g_print_bio(bp);
printf("\\n");
sc = bp->bio_to->geom->softc;
Index: sleepqueue.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sleepqueue.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/sleepqueue.9 -L share/man/man9/sleepqueue.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/sleepqueue.9
+++ share/man/man9/sleepqueue.9
@@ -21,9 +21,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sleepqueue.9,v 1.12 2005/04/19 16:30:25 jkoshy Exp $
+.\" $FreeBSD: src/share/man/man9/sleepqueue.9,v 1.16 2007/09/28 11:13:40 gabor Exp $
.\"
-.Dd March 10, 2004
+.Dd August 13, 2007
.Dt SLEEPQUEUE 9
.Os
.Sh NAME
@@ -54,11 +54,11 @@
.Ft void
.Fn sleepq_abort "struct thread *td"
.Ft void
-.Fn sleepq_add "void *wchan" "struct mtx *lock" "const char *wmesg" "int flags"
+.Fn sleepq_add "void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue"
.Ft struct sleepqueue *
.Fn sleepq_alloc "void"
.Ft void
-.Fn sleepq_broadcast "void *wchan" "int flags" "int pri"
+.Fn sleepq_broadcast "void *wchan" "int flags" "int pri" "int queue"
.Ft int
.Fn sleepq_calc_signal_retval "int sig"
.Ft int
@@ -74,7 +74,7 @@
.Ft void
.Fn sleepq_remove "struct thread *td" "void *wchan"
.Ft void
-.Fn sleepq_signal "void *wchan" "int flags" "int pri"
+.Fn sleepq_signal "void *wchan" "int flags" "int pri" "int queue"
.Ft void
.Fn sleepq_set_timeout "void *wchan" "int timo"
.Ft int
@@ -91,6 +91,8 @@
Each queue is associated with a specific wait channel when it is active,
and only one queue may be associated with a wait channel at any given point
in time.
+The implementation of each wait channel splits its sleepqueue into 2 sub-queues
+in order to enable some optimizations on threads' wakeups.
An active queue holds a list of threads that are blocked on the associated
wait channel.
Threads that are not blocked on a wait channel have an associated inactive
@@ -157,12 +159,12 @@
must be locked by a prior call to
.Fn sleepq_lock
when this function is called.
-If a mutex is specified via the
+If a lock is specified via the
.Fa lock
argument, and if the kernel was compiled with
.Cd "options INVARIANTS" ,
then the sleep queue code will perform extra checks to ensure that
-the mutex is used by all threads sleeping on
+the lock is used by all threads sleeping on
.Fa wchan .
The
.Fa wmesg
@@ -172,18 +174,25 @@
.Fa flags
parameter is a bitmask consisting of the type of sleep queue being slept on
and zero or more optional flags.
+The
+.Fa queue
+parameter specifies the sub-queue, in which the contending thread will be
+inserted.
.Pp
-There are currently two types of sleep queues:
+There are currently three types of sleep queues:
.Pp
.Bl -tag -width ".Dv SLEEPQ_CONDVAR" -compact
.It Dv SLEEPQ_CONDVAR
A sleep queue used to implement condition variables.
-.It Dv SLEEPQ_MSLEEP
+.It Dv SLEEPQ_SLEEP
A sleep queue used to implement
-.Xr msleep 9 ,
+.Xr sleep 9 ,
.Xr wakeup 9
and
.Xr wakeup_one 9 .
+.It Dv SLEEPQ_PAUSE
+A sleep queue used to implement
+.Xr pause 9 .
.El
.Pp
There is currently only one optional flag:
@@ -307,6 +316,9 @@
must be locked by a prior call to
.Fn sleepq_lock
before calling any of these functions.
+The
+.Fa queue
+argument specifies the sub-queue, from which threads need to be woken up.
.Pp
A thread in an interruptible sleep can be interrupted by another thread via
the
@@ -336,7 +348,7 @@
channel.
.Pp
The sleep queue interface is currently used to implement the
-.Xr msleep 9
+.Xr sleep 9
and
.Xr condvar 9
interfaces.
@@ -344,6 +356,6 @@
than manipulating sleep queues directly.
.Sh SEE ALSO
.Xr condvar 9 ,
-.Xr msleep 9 ,
.Xr runqueue 9 ,
-.Xr scheduler 9
+.Xr scheduler 9 ,
+.Xr sleep 9
Index: vm_map.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_map.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/vm_map.9 -L share/man/man9/vm_map.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/vm_map.9
+++ share/man/man9/vm_map.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vm_map.9,v 1.9 2005/01/15 12:28:00 ru Exp $
+.\" $FreeBSD: src/share/man/man9/vm_map.9,v 1.10 2007/01/27 18:58:33 rwatson Exp $
.\"
.Dd September 26, 2004
.Dt VM_MAP 9
@@ -144,7 +144,7 @@
.It Dv MAP_DISABLE_COREDUMP
Do not include the mapping in a core dump.
.It Dv MAP_PREFAULT_MADVISE
-Specify that the request from a user process calling
+Specify that the request is from a user process calling
.Xr madvise 2 .
.El
.Pp
--- /dev/null
+++ share/man/man9/redzone.9
@@ -0,0 +1,123 @@
+.\" Copyright (c) 2006 Pawel Jakub Dawidek <pjd at FreeBSD.org>
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/redzone.9,v 1.1 2006/01/31 11:09:20 pjd Exp $
+.\"
+.Dd January 31, 2006
+.Dt REDZONE 9
+.Os
+.Sh NAME
+.Nm RedZone
+.Nd "buffer corruptions detector"
+.Sh SYNOPSIS
+.Cd "options DEBUG_REDZONE"
+.Sh DESCRIPTION
+.Nm
+detects buffer underflow and buffer overflow bugs at runtime.
+Currently
+.Nm
+only detects buffer corruptions for memory allocated with
+.Xr malloc 9 .
+When such corruption is detected two backtraces are printed on the console.
+The first one shows from where memory was allocated, the second one shows from
+where memory was freed.
+By default the system will not panic when buffer corruption is detected.
+This can be changed by setting the
+.Va vm.redzone.panic
+.Xr sysctl 8
+variable to 1.
+The amount of extra memory allocated for
+.Nm Ns 's
+needs is stored in the
+.Va vm.redzone.extra_mem
+.Xr sysctl 8
+variable.
+.Sh EXAMPLE
+The example below shows the logs from the detection of a buffer underflow and a
+buffer overflow.
+.Bd -literal -offset indent
+REDZONE: Buffer underflow detected. 2 bytes corrupted before 0xc8688580 (16 bytes allocated).
+Allocation backtrace:
+#0 0xc0583e4e at redzone_setup+0x3c
+#1 0xc04a23fa at malloc+0x19e
+#2 0xcdeb69ca at redzone_modevent+0x60
+#3 0xc04a3f3c at module_register_init+0x82
+#4 0xc049d96a at linker_file_sysinit+0x8e
+#5 0xc049dc7c at linker_load_file+0xed
+#6 0xc04a041f at linker_load_module+0xc4
+#7 0xc049e883 at kldload+0x116
+#8 0xc05d9b3d at syscall+0x325
+#9 0xc05c944f at Xint0x80_syscall+0x1f
+Free backtrace:
+#0 0xc0583f92 at redzone_check+0xd4
+#1 0xc04a2422 at free+0x1c
+#2 0xcdeb69a6 at redzone_modevent+0x3c
+#3 0xc04a438d at module_unload+0x61
+#4 0xc049e0b3 at linker_file_unload+0x89
+#5 0xc049e979 at kern_kldunload+0x96
+#6 0xc049ea00 at kldunloadf+0x2c
+#7 0xc05d9b3d at syscall+0x325
+#8 0xc05c944f at Xint0x80_syscall+0x1f
+
+REDZONE: Buffer overflow detected. 4 bytes corrupted after 0xc8688590 (16 bytes allocated).
+Allocation backtrace:
+#0 0xc0583e4e at redzone_setup+0x3c
+#1 0xc04a23fa at malloc+0x19e
+#2 0xcdeb69ca at redzone_modevent+0x60
+#3 0xc04a3f3c at module_register_init+0x82
+#4 0xc049d96a at linker_file_sysinit+0x8e
+#5 0xc049dc7c at linker_load_file+0xed
+#6 0xc04a041f at linker_load_module+0xc4
+#7 0xc049e883 at kldload+0x116
+#8 0xc05d9b3d at syscall+0x325
+#9 0xc05c944f at Xint0x80_syscall+0x1f
+Free backtrace:
+#0 0xc0584020 at redzone_check+0x162
+#1 0xc04a2422 at free+0x1c
+#2 0xcdeb69a6 at redzone_modevent+0x3c
+#3 0xc04a438d at module_unload+0x61
+#4 0xc049e0b3 at linker_file_unload+0x89
+#5 0xc049e979 at kern_kldunload+0x96
+#6 0xc049ea00 at kldunloadf+0x2c
+#7 0xc05d9b3d at syscall+0x325
+#8 0xc05c944f at Xint0x80_syscall+0x1f
+.Ed
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr malloc 9 ,
+.Xr memguard 9
+.Sh HISTORY
+.Nm
+first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An Pawel Jakub Dawidek Aq pjd at FreeBSD.org
+.Sh BUGS
+Currently,
+.Nm
+does not cooperate with
+.Xr memguard 9 .
+Allocations from a memory type controlled by
+.Xr memguard 9
+are simply skipped, so buffer corruptions will not be detected there.
--- /dev/null
+++ share/man/man9/cr_cansee.9
@@ -0,0 +1,92 @@
+.\"
+.\" Copyright (c) 2006 Ceri Davies <ceri at FreeBSD.org>
+.\"
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/cr_cansee.9,v 1.1 2006/11/19 13:35:03 ceri Exp $
+.\"
+.Dd November 19, 2006
+.Os
+.Dt CR_CANSEE 9
+.Sh NAME
+.Nm cr_cansee
+.Nd "determine visibility of objects given their user credentials"
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/systm.h
+.In sys/ucred.h
+.Ft int
+.Fn cr_cansee "struct ucred *u1" "struct ucred *u2"
+.Sh DESCRIPTION
+This function determines the visibility of objects in the
+kernel based on the real user IDs and group IDs in the credentials
+.Fa u1
+and
+.Fa u2
+associated with them.
+.Pp
+The visibility of objects is influenced by the
+.Xr sysctl 8
+variables
+.Va security.bsd.see_other_gids
+and
+.Va security.bsd.see_other_uids ,
+as per the description in
+.Xr cr_seeothergids 9
+and
+.Xr cr_seeotheruids 9
+respectively.
+.Sh RETURN VALUES
+This function returns zero if the object with credential
+.Fa u1
+can
+.Dq see
+the object with credential
+.Fa u2 ,
+or
+.Er ESRCH
+otherwise.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er ESRCH
+The object with credential
+.Fa u1
+cannot
+.Dq see
+the object with credential
+.Fa u2 .
+.It Bq Er ESRCH
+The object with credential
+.Fa u1
+has been jailed and the object with credential
+.Fa u2
+does not belong to the same jail as
+.Fa u1 .
+.It Bq Er ESRCH
+The MAC subsystem denied visibility.
+.El
+.Sh SEE ALSO
+.Xr cr_seeothergids 9 ,
+.Xr cr_seeotheruids 9 ,
+.Xr mac 9 ,
+.Xr p_cansee 9
Index: DECLARE_GEOM_CLASS.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/DECLARE_GEOM_CLASS.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/DECLARE_GEOM_CLASS.9 -L share/man/man9/DECLARE_GEOM_CLASS.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/DECLARE_GEOM_CLASS.9
+++ share/man/man9/DECLARE_GEOM_CLASS.9
@@ -22,9 +22,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/DECLARE_GEOM_CLASS.9,v 1.4 2005/01/13 09:33:06 ru Exp $
+.\" $FreeBSD: src/share/man/man9/DECLARE_GEOM_CLASS.9,v 1.5 2007/09/20 10:52:08 gabor Exp $
.\"
-.Dd January 6, 2005
+.Dd August 13, 2007
.Dt DECLARE_GEOM_CLASS 9
.Os
.Sh NAME
@@ -110,7 +110,7 @@
.Sh EXAMPLES
Example class declaration.
.Bd -literal -offset indent
-static struct geom *
+static struct g_geom *
g_example_taste(struct g_class *mp, struct g_provider *pp,
int flags __unused)
{
Index: VOP_REMOVE.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VOP_REMOVE.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VOP_REMOVE.9 -L share/man/man9/VOP_REMOVE.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VOP_REMOVE.9
+++ share/man/man9/VOP_REMOVE.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VOP_REMOVE.9,v 1.14 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/VOP_REMOVE.9,v 1.15 2006/11/04 23:58:15 pjd Exp $
.\"
.Dd July 24, 1996
.Os
@@ -80,16 +80,6 @@
*/
...;
- /*
- * Careful about trying to remove ".". XXX this should be handled
- * higher up.
- */
- if (dvp == vp)
- vrele(vp);
- else
- vput(vp);
- vput(dvp);
-
return error;
}
.Ed
Index: vm_map_stack.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_map_stack.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/vm_map_stack.9 -L share/man/man9/vm_map_stack.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/vm_map_stack.9
+++ share/man/man9/vm_map_stack.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vm_map_stack.9,v 1.4 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/vm_map_stack.9,v 1.5 2006/12/14 14:33:13 mpp Exp $
.\"
.Dd July 19, 2003
.Dt VM_MAP_STACK 9
@@ -100,7 +100,7 @@
or if there is already a mapping at the address which would result,
or if
.Fa max_ssize
-could not be accomodated within the current mapping,
+could not be accommodated within the current mapping,
.Dv KERN_NO_SPACE
is returned.
.Pp
Index: condvar.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/condvar.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/condvar.9 -L share/man/man9/condvar.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/condvar.9
+++ share/man/man9/condvar.9
@@ -24,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/condvar.9,v 1.11 2004/11/08 18:15:11 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/condvar.9,v 1.21 2007/06/05 20:53:18 imp Exp $
.\"
-.Dd December 11, 2000
+.Dd June 5, 2007
.Dt CONDVAR 9
.Os
.Sh NAME
@@ -35,6 +35,7 @@
.Nm cv_destroy ,
.Nm cv_wait ,
.Nm cv_wait_sig ,
+.Nm cv_wait_unlock ,
.Nm cv_timedwait ,
.Nm cv_timedwait_sig ,
.Nm cv_signal ,
@@ -51,13 +52,15 @@
.Ft void
.Fn cv_destroy "struct cv *cvp"
.Ft void
-.Fn cv_wait "struct cv *cvp" "struct mtx *mp"
+.Fn cv_wait "struct cv *cvp" "lock"
.Ft int
-.Fn cv_wait_sig "struct cv *cvp" "struct mtx *mp"
+.Fn cv_wait_sig "struct cv *cvp" "lock"
+.Ft void
+.Fn cv_wait_unlock "struct cv *cvp" "lock"
.Ft int
-.Fn cv_timedwait "struct cv *cvp" "struct mtx *mp" "int timo"
+.Fn cv_timedwait "struct cv *cvp" "lock" "int timo"
.Ft int
-.Fn cv_timedwait_sig "struct cv *cvp" "struct mtx *mp" "int timo"
+.Fn cv_timedwait_sig "struct cv *cvp" "lock" "int timo"
.Ft void
.Fn cv_signal "struct cv *cvp"
.Ft void
@@ -84,6 +87,7 @@
Threads wait on condition variables by calling
.Fn cv_wait ,
.Fn cv_wait_sig ,
+.Fn cv_wait_unlock ,
.Fn cv_timedwait ,
or
.Fn cv_timedwait_sig .
@@ -105,26 +109,45 @@
as set by the initial call to
.Fn cv_init .
.Pp
+The
+.Fa lock
+argument is a pointer to either a
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+or
+.Xr sx 9
+lock.
+A
+.Xr mutex 9
+argument must be initialized with
+.Dv MTX_DEF
+and not
+.Dv MTX_SPIN .
A thread must hold
-.Fa mp
+.Fa lock
before calling
.Fn cv_wait ,
.Fn cv_wait_sig ,
+.Fn cv_wait_unlock ,
.Fn cv_timedwait ,
or
.Fn cv_timedwait_sig .
When a thread waits on a condition,
-.Fa mp
-is atomically released before the thread is blocked, then atomically reacquired
+.Fa lock
+is atomically released before the thread is blocked, then reacquired
before the function call returns.
+The
+.Fn cv_wait_unlock
+function does not reacquire the lock before returning.
All waiters must pass the same
-.Fa mp
+.Fa lock
in conjunction with
.Fa cvp .
.Pp
When
.Fn cv_wait ,
.Fn cv_wait_sig ,
+.Fn cv_wait_unlock ,
.Fn cv_timedwait ,
and
.Fn cv_timedwait_sig
@@ -169,9 +192,9 @@
will fail if:
.Bl -tag -width Er
.It Bq Er EINTR
-An unmasked signal was caught.
+A signal was caught and the system call should be interrupted.
.It Bq Er ERESTART
-A masked signal was caught.
+A signal was caught and the system call should be restarted.
.El
.Pp
.Fn cv_timedwait
@@ -183,8 +206,10 @@
Timeout expired.
.El
.Sh SEE ALSO
-.Xr msleep 9 ,
+.Xr locking 9 ,
.Xr mtx_pool 9 ,
.Xr mutex 9 ,
+.Xr rwlock 9 ,
.Xr sema 9 ,
+.Xr sleep 9 ,
.Xr sx 9
Index: p_candebug.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/p_candebug.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/p_candebug.9 -L share/man/man9/p_candebug.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/p_candebug.9
+++ share/man/man9/p_candebug.9
@@ -25,15 +25,16 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/p_candebug.9,v 1.3 2004/07/06 07:26:23 ru Exp $
+.\" $FreeBSD: src/share/man/man9/p_candebug.9,v 1.5 2006/11/19 13:36:04 ceri Exp $
.\"
-.Dd November 11, 2003
+.Dd November 19, 2006
.Os
.Dt P_CANDEBUG 9
.Sh NAME
.Nm p_candebug
.Nd determine debuggability of a process
.Sh SYNOPSIS
+.In sys/param.h
.In sys/proc.h
.Ft int
.Fn p_candebug "struct thread *td" "struct proc *p"
@@ -128,10 +129,10 @@
The MAC subsystem denied debuggability.
.El
.Sh SEE ALSO
-.Xr intro 2 ,
.Xr jail 2 ,
.Xr sysctl 8 ,
.Xr cr_seeothergids 9 ,
.Xr cr_seeotheruids 9 ,
.Xr mac 9 ,
+.Xr p_cansee 9 ,
.Xr prison_check 9
Index: vslock.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vslock.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vslock.9 -L share/man/man9/vslock.9 -u -r1.2 -r1.3
--- share/man/man9/vslock.9
+++ share/man/man9/vslock.9
@@ -35,7 +35,6 @@
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vslock.9,v 1.15 2004/08/16 03:12:10 green Exp $
-.\" $MidnightBSD$
.\"
.Dd August 10, 2004
.Dt VSLOCK 9
Index: style.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/style.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/style.9 -L share/man/man9/style.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/style.9
+++ share/man/man9/style.9
@@ -24,7 +24,7 @@
.\" SUCH DAMAGE.
.\"
.\" From: @(#)style 1.14 (Berkeley) 4/28/95
-.\" $FreeBSD: src/share/man/man9/style.9,v 1.121 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/style.9,v 1.123 2007/01/28 20:51:04 joel Exp $
.\"
.Dd February 10, 2005
.Dt STYLE 9
@@ -46,7 +46,7 @@
* Style guide for FreeBSD. Based on the CSRG's KNF (Kernel Normal Form).
*
* @(#)style 1.14 (Berkeley) 4/28/95
- * $FreeBSD: src/share/man/man9/style.9,v 1.121 2005/06/28 20:15:18 hmp Exp $
+ * $FreeBSD: src/share/man/man9/style.9,v 1.123 2007/01/28 20:51:04 joel Exp $
*/
/*
@@ -65,7 +65,8 @@
line of the comment having a dash after the star like so:
.Bd -literal
/*-
- * Copyright (c) 1984-2025 John Q. Public. All Rights Reserved.
+ * Copyright (c) 1984-2025 John Q. Public
+ * All rights reserved.
*
* Long, boring license goes here, but redacted for brevity
*/
@@ -110,7 +111,7 @@
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/share/man/man9/style.9,v 1.121 2005/06/28 20:15:18 hmp Exp $");
+__FBSDID("$FreeBSD: src/share/man/man9/style.9,v 1.123 2007/01/28 20:51:04 joel Exp $");
.Ed
.Pp
Leave another blank line before the header files.
@@ -473,7 +474,7 @@
while ((ch = getopt(argc, argv, "abNn:")) != -1)
switch (ch) { /* Indent the switch. */
case 'a': /* Don't indent the case. */
- aflag = 1;
+ aflag = 1; /* Indent case body one tab. */
/* FALLTHROUGH */
case 'b':
bflag = 1;
Index: vm_page_insert.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_insert.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_insert.9 -L share/man/man9/vm_page_insert.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_insert.9
+++ share/man/man9/vm_page_insert.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_insert.9,v 1.3 2001/08/08 10:04:08 ru Exp $
-.\" $MidnightBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_INSERT 9
Index: VFS_LOCK_GIANT.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VFS_LOCK_GIANT.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VFS_LOCK_GIANT.9 -L share/man/man9/VFS_LOCK_GIANT.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VFS_LOCK_GIANT.9
+++ share/man/man9/VFS_LOCK_GIANT.9
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VFS_LOCK_GIANT.9,v 1.1.2.1 2005/09/25 18:51:45 rwatson Exp $
+.\" $FreeBSD: src/share/man/man9/VFS_LOCK_GIANT.9,v 1.5 2006/01/03 14:00:22 rwatson Exp $
.\"
.Dd September 21, 2005
.Dt VFS_LOCK_GIANT 9
@@ -33,9 +33,10 @@
.Sh NAME
.Nm VFS_LOCK_GIANT ,
.Nm VFS_UNLOCK_GIANT
-.Nd "Conditionally lock and unlock Giant around entry into VFS"
+.Nd "conditionally lock and unlock Giant around entry into VFS"
.Sh SYNOPSIS
.In sys/param.h
+.In sys/mount.h
.In sys/vnode.h
.Ft int
.Fn VFS_LOCK_GIANT "struct mount *mp"
@@ -44,16 +45,18 @@
.Sh DESCRIPTION
.Fn VFS_LOCK_GIANT
will conditionally acquire the
-.Dv Giant
+.Va Giant
lock if the file system referenced by
.Fa mp
-is marked as MPSAFE or not, returning a flag indicating whether Giant was
+is marked as MPSAFE or not, returning a flag indicating whether
+.Va Giant
+was
set, which may later be passed to
.Fn VFS_UNLOCK_GIANT .
The value of
.Fa mp
will typically be derived from the mount pointer in a
-.Xr vnode
+.Vt vnode
on which a VFS operation will be performed.
.Pp
.Fn VFS_UNLOCK_GIANT
@@ -63,7 +66,7 @@
.Fa vfslocked
argument is non-zero.
It is expected that the argument will be derived from the return values of
-.Vn VFS_LOCK_GIANT
+.Fn VFS_LOCK_GIANT
or
.Xr NDHASGIANT 9 .
.Sh RETURN VALUES
@@ -76,6 +79,7 @@
.Xr NDHASGIANT 9 ,
.Xr vnode 9
.Sh AUTHORS
+.An -nosplit
MPSAFE VFS support for
.Fx
was implemented by
@@ -84,7 +88,6 @@
This manual page was written by
.An Robert Watson .
.Sh BUGS
-.Pp
Non-MPSAFE file systems exist, requiring callers conditional locking and
unlocking of
.Va Giant .
--- /dev/null
+++ share/man/man9/kqueue.9
@@ -0,0 +1,375 @@
+.\" Copyright 2006 John-Mark Gurney
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/kqueue.9,v 1.6 2006/12/29 22:30:10 jmg Exp $
+.\"
+.Dd December 28, 2006
+.Dt KQUEUE 9
+.Os
+.Sh NAME
+.Nm kqueue_add_filteropts , kqueue_del_filteropts ,
+.Nm kqfd_register ,
+.Nm knote_fdclose ,
+.Nm knlist_add , knlist_remove , knlist_remove_inevent , knlist_empty ,
+.Nm knlist_init , knlist_destroy , knlist_clear , knlist_delete ,
+.Nm KNOTE_LOCKED , KNOTE_UNLOCKED
+.Nd "event delivery subsystem"
+.Sh SYNOPSIS
+.In sys/event.h
+.Ft int
+.Fn kqueue_add_filteropts "int filt" "struct filterops *filtops"
+.Ft int
+.Fn kqueue_del_filteropts "int filt"
+.Ft int
+.Fn kqfd_register "int fd" "struct kevent *kev" "struct thread *td" "int waitok"
+.Ft void
+.Fn knote_fdclose "struct thread *td" "int fd"
+.Ft void
+.Fn knlist_add "struct knlist *knl" "struct knote *kn" "int islocked"
+.Ft void
+.Fn knlist_remove "struct knlist *knl" "struct knote *kn" "int islocked"
+.Ft void
+.Fn knlist_remove_inevent "struct knlist *knl" "struct knote *kn"
+.Ft int
+.Fn knlist_empty "struct knlist *knl"
+.Ft void
+.Fo knlist_init
+.Fa "struct knlist *knl"
+.Fa "void *lock"
+.Fa "void \*[lp]*kl_lock\*[rp]\*[lp]void *\*[rp]"
+.Fa "void \*[lp]*kl_unlock\*[rp]\*[lp]void *\*[rp]"
+.Fa "int \*[lp]*kl_locked\*[rp]\*[lp]void *\*[rp]"
+.Fc
+.Ft void
+.Fn knlist_destroy "struct knlist *knl"
+.Ft void
+.Fn knlist_clear "struct knlist *knl" "int islocked"
+.Ft void
+.Fn knlist_delete "struct knlist *knl" "struct thread *td" "int islocked"
+.Ft void
+.Fn KNOTE_LOCKED "struct knlist *knl" "long hint"
+.Ft void
+.Fn KNOTE_UNLOCKED "struct knlist *knl" "long hint"
+.Sh DESCRIPTION
+The functions
+.Fn kqueue_add_filteropts
+and
+.Fn kqueue_del_filteropts
+allow for the addition and removal of a filter type.
+The filter is statically defined by the
+.Dv EVFILT_*
+macros.
+The function
+.Fn kqueue_add_filteropts
+will make
+.Fa filt
+available.
+The
+.Vt "struct filterops"
+has the following members:
+.Bl -tag -width ".Va f_attach"
+.It Va f_isfd
+If
+.Va f_isfd
+is set,
+.Va ident
+in
+.Vt "struct kevent"
+is taken to be a file descriptor.
+In this case, the
+.Vt knote
+passed into
+.Va f_attach
+will have the
+.Va kn_fp
+member initialized to the
+.Vt "struct file *"
+that represents the file descriptor.
+.It Va f_attach
+The
+.Va f_attach
+function will be called when attaching a
+.Vt knote
+to the object.
+The method should call
+.Fn knlist_add
+to add the
+.Vt knote
+to the list that was initialized with
+.Fn knlist_init .
+The call to
+.Fn knlist_add
+is only necessary if the object can have multiple
+.Vt knotes
+associated with it.
+If there is no
+.Vt knlist
+to call
+.Fn knlist_add
+with, the function
+.Va f_attach
+must clear the
+.Dv KN_DETACHED
+bit of
+.Va kn_status
+in the
+.Vt knote .
+The function shall return 0 on success, or appropriate error for the failure.
+During
+.Va f_attach ,
+it is valid to change the
+.Va kn_fops
+pointer to a different pointer.
+This will change the
+.Va f_event
+and
+.Va f_detach
+functions called when processing the
+.Vt knote .
+.It Va f_detach
+The
+.Va f_detach
+function will be called to detach the
+.Vt knote
+if the
+.Vt knote
+has not already been detached by a call to
+.Fn knlist_remove .
+.It Va f_event
+The
+.Va f_event
+function will be called to update the status of the
+.Vt knote .
+If the function returns 0, it will be assumed that the object is not
+ready (or no longer ready) to be woken up.
+The
+.Fa hint
+argument will be 0 when scanning
+.Vt knotes
+to see which are triggered.
+Otherwise, the
+.Fa hint
+argument will be the value passed to either
+.Dv KNOTE_LOCKED
+or
+.Dv KNOTE_UNLOCKED .
+The
+.Va kn_data
+value should be updated as necessary to reflect the current value, such as
+number of bytes available for reading, or buffer space available for writing.
+If the note needs to be removed,
+.Fn knlist_remove_inevent
+must be called.
+The function
+.Fn knlist_remove_inevent
+will remove the note from the list, the
+.Va f_detach
+function will not be called and the
+.Vt knote
+will not be returned as an event.
+.Pp
+Locks
+.Em must not
+be acquired in
+.Va f_event .
+If a lock is required in
+.Va f_event ,
+it must be obtained in the
+.Fa kl_lock
+function of the
+.Vt knlist
+that the
+.Va knote
+was added to.
+.El
+.Pp
+The function
+.Fn kqfd_register
+will register the
+.Vt kevent
+on the kqueue file descriptor
+.Fa fd .
+If it is safe to sleep,
+.Fa waitok
+should be set.
+.Pp
+The function
+.Fn knote_fdclose
+is used to delete all
+.Vt knotes
+associated with
+.Fa fd .
+Once returned, there will no longer be any
+.Vt knotes
+associated with the
+.Fa fd .
+The
+.Vt knotes
+removed will never be returned from a
+.Xr kevent 2
+call, so if userland uses the
+.Vt knote
+to track resources, they will be leaked.
+The
+.Fn FILEDESC_LOCK
+lock must be held over the call to
+.Fn knote_fdclose
+so that file descriptors cannot be added or removed.
+.Pp
+The
+.Fn knlist_*
+family of functions are for managing
+.Vt knotes
+associated with an object.
+A
+.Vt knlist
+is not required, but is commonly used.
+If used, the
+.Vt knlist
+must be initialized with the
+.Fn knlist_init
+function.
+If
+.Fa lock
+is
+.Dv NULL ,
+an internal lock will be used and the remaining arguments will be ignored.
+The
+.Fa kl_lock , kl_unlock
+and
+.Fa kl_locked
+functions will be used to manipulate a
+.Fa lock .
+If the argument is
+.Dv NULL ,
+default routines operating on
+.Vt "struct mtx *"
+will be used.
+The
+.Vt knlist
+structure may be embedded into the object structure.
+The
+.Fa lock
+will be held over calls to
+.Va f_event .
+If
+.Dv NULL
+is passed for the mutex, a private mutex will be used.
+The function
+.Fn knlist_empty
+requires that a
+.Fa lock
+be held.
+The function
+.Fn knlist_clear
+is used to remove all
+.Vt knotes
+associated with the list.
+The
+.Fa islocked
+argument declares if
+.Fa lock
+has been acquired.
+All
+.Vt knotes
+will be marked as detached, and
+.Dv EV_ONESHOT
+will be set so that the
+.Vt knote
+will be deleted after the next scan.
+The
+.Fn knlist_destroy
+function is used to destroy a
+.Vt knlist .
+There must be no
+.Vt knotes
+associated with the
+.Vt knlist
+.Fn ( knlist_empty
+returns true)
+and no more
+.Vt knotes
+may be attached to the object.
+A
+.Vt knlist
+may be emptied by calling
+.Fn knlist_clear .
+.Pp
+The macros
+.Fn KNOTE_LOCKED
+and
+.Fn KNOTE_UNLOCKED
+are used to notify
+.Vt knotes
+about events associated with the object.
+It will iterate over all
+.Vt knotes
+on the list calling the
+.Va f_event
+function associated with the
+.Vt knote .
+The macro
+.Fn KNOTE_LOCKED
+must be used if the lock associated with the
+.Fa knl
+passed in is held.
+The function
+.Fn KNOTE_UNLOCKED
+will acquire the lock before iterating over the list of
+.Vt knotes .
+.Sh RETURN VALUES
+The function
+.Fn kqueue_add_filteropts
+will return zero on success,
+.Er EINVAL
+in the case of an invalid
+.Fa filt ,
+or
+.Er EEXIST
+if the filter has already been installed.
+.Pp
+The function
+.Fn kqueue_del_filteropts
+will return zero on success,
+.Er EINVAL
+in the case of an invalid
+.Fa filt ,
+or
+.Er EBUSY
+if the filter is still in use.
+.Pp
+The function
+.Fn kqfd_register
+will return zero on success,
+.Er EBADF
+if the file descriptor is not a kqueue, or any of the possible values returned
+by
+.Xr kevent 2 .
+.Sh SEE ALSO
+.Xr kevent 2 ,
+.Xr kqueue 2
+.Sh AUTHORS
+This
+manual page was written by
+.An John-Mark Gurney Aq jmg at FreeBSD.org .
Index: zero_copy.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/zero_copy.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/zero_copy.9 -L share/man/man9/zero_copy.9 -u -r1.2 -r1.3
--- share/man/man9/zero_copy.9
+++ share/man/man9/zero_copy.9
@@ -23,8 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/zero_copy.9,v 1.7 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/share/man/man9/zero_copy.9,v 1.8 2006/05/15 20:58:05 wilko Exp $
.\"
.Dd December 5, 2004
.Dt ZERO_COPY 9
@@ -91,8 +90,7 @@
For receiving data, in order to take advantage of the zero copy receive
code, the user must have a NIC that is configured for an MTU greater than
the architecture page size.
-(E.g., for alpha this would be 8KB, for i386,
-it would be 4KB.)
+(E.g., for i386 it would be 4KB.)
Additionally, in order for zero copy receive to work,
packet payloads must be at least a page in size and page aligned.
.Pp
Index: VOP_RENAME.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VOP_RENAME.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VOP_RENAME.9 -L share/man/man9/VOP_RENAME.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VOP_RENAME.9
+++ share/man/man9/VOP_RENAME.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VOP_RENAME.9,v 1.21 2005/01/28 10:43:05 ru Exp $
+.\" $FreeBSD: src/share/man/man9/VOP_RENAME.9,v 1.22 2006/11/04 23:59:51 pjd Exp $
.\"
.Dd July 24, 1996
.Os
@@ -104,34 +104,13 @@
}
/*
- * Check if just deleting a link name.
+ * POSIX: "If the old argument and the new argument
+ * both refer to links to the same existing file,
+ * the rename() function shall return successfully
+ * and perform no other action."
+ * The upper layers already handle this case.
*/
- if (fvp == tvp) {
- if (fvp->v_type == VDIR) {
- error = EINVAL;
- goto abortit;
- }
-
- /*
- * Release destination.
- */
- vput(tdvp);
- vput(tvp);
-
- /*
- * Delete source. Pretty bizarre stuff.
- */
- vrele(fdvp);
- vrele(fvp);
- fcnp->cn_flags &= ~MODMASK;
- fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- fcnp->cn_nameiop = DELETE;
- VREF(fdvp);
- error = relookup(fdvp, &fvp, fcnp);
- if (error == 0)
- vrele(fdvp);
- return VOP_REMOVE(fdvp, fvp, fcnp);
- }
+ KASSERT(fvp != tvp, ("vop_rename: source and destination are the same"));
if (fvp is immutable) {
error = EPERM;
Index: uio.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/uio.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/uio.9 -L share/man/man9/uio.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/uio.9
+++ share/man/man9/uio.9
@@ -23,9 +23,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/uio.9,v 1.19 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/uio.9,v 1.21 2006/11/29 20:24:56 alfred Exp $
.\"
-.Dd February 2, 1997
+.Dd December 8, 2006
.Os
.Dt UIO 9
.Sh NAME
@@ -38,13 +38,13 @@
.Pp
.Bd -literal
struct uio {
- struct iovec *uio_iov;
- int uio_iovcnt;
- off_t uio_offset;
- int uio_resid;
- enum uio_seg uio_segflg;
- enum uio_rw uio_rw;
- struct thread *uio_td;
+ struct iovec *uio_iov; /* scatter/gather list */
+ int uio_iovcnt; /* length of scatter/gather list */
+ off_t uio_offset; /* offset in target object */
+ int uio_resid; /* remaining bytes to copy */
+ enum uio_seg uio_segflg; /* address space */
+ enum uio_rw uio_rw; /* operation */
+ struct thread *uio_td; /* owner */
};
.Ed
.Ft int
@@ -87,7 +87,7 @@
.It Va uio_offset
The offset into the device.
.It Va uio_resid
-The number of bytes to process.
+The remaining number of bytes to process, updated after transfer.
.It Va uio_segflg
One of the following flags:
.Bl -tag -width ".Dv UIO_USERSPACE"
@@ -112,14 +112,20 @@
space.
.El
.Sh RETURN VALUES
+On success
.Fn uiomove
-can return
-.Er EFAULT
-from the invoked
+will return 0, on error it will return an appropriate errno.
+.Sh ERRORS
+.Fn uiomove
+will fail and return the following error code if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The invoked
.Xr copyin 9
or
.Xr copyout 9
-in case the transfer was to/from a process's address space.
+returned
+.Er EFAULT
.Sh EXAMPLES
The idea is that the driver maintains a private buffer for its data,
and processes the request in chunks of maximal the size of this
Index: vn_isdisk.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vn_isdisk.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vn_isdisk.9 -L share/man/man9/vn_isdisk.9 -u -r1.2 -r1.3
--- share/man/man9/vn_isdisk.9
+++ share/man/man9/vn_isdisk.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vn_isdisk.9,v 1.6 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 9, 2001
.Dt VN_ISDISK 9
--- /dev/null
+++ share/man/man9/LOCK_PROFILING.9
@@ -0,0 +1,203 @@
+.\"-
+.\" Copyright (c) 2004 Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2005 Robert N. M. Watson
+.\" Copyright (c) 2006 Kip Macy
+.\" 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. 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 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/LOCK_PROFILING.9,v 1.2 2006/12/01 17:46:25 ru Exp $
+.\"
+.Dd November 11, 2006
+.Dt LOCK_PROFILING 9
+.Os
+.Sh NAME
+.Nm LOCK_PROFILING
+.Nd kernel lock profiling support
+.Sh SYNOPSIS
+.Cd "options LOCK_PROFILING"
+.Sh DESCRIPTION
+The
+.Dv LOCK_PROFILING
+kernel option adds support for measuring and reporting lock use and
+contention statistics.
+These statistics are collated by
+.Dq acquisition point .
+Acquisition points are
+distinct places in the kernel source code (identified by source file
+name and line number) where a lock is acquired.
+.Pp
+For each acquisition point, the following statistics are accumulated:
+.Bl -bullet
+.It
+The longest time the lock was ever continuously held after being
+acquired at this point.
+.It
+The total time the lock was held after being acquired at this point.
+.It
+The total time that threads have spent waiting to acquire the lock.
+.It
+The total number of non-recursive acquisitions.
+.It
+The total number of times the lock was already held by another thread
+when this point was reached, requiring a spin or a sleep.
+.It
+The total number of times another thread tried to acquire the lock
+while it was held after having been acquired at this point.
+.El
+.Pp
+In addition, the average hold time and average wait time are derived
+from the total hold time
+and total wait time respectively and the number of acquisitions.
+.Pp
+The
+.Dv LOCK_PROFILING
+kernel option also adds the following
+.Xr sysctl 8
+variables to control and monitor the profiling code:
+.Bl -tag -width indent
+.It Va debug.lock.prof.enable
+Enable or disable the lock profiling code.
+This defaults to 0 (off).
+.It Va debug.lock.prof.reset
+Reset the current lock profiling buffers.
+.It Va debug.lock.prof.acquisitions
+The total number of lock acquisitions recorded.
+.It Va debug.lock.prof.records
+The total number of acquisition points recorded.
+Note that only active acquisition points (i.e., points that have been
+reached at least once) are counted.
+.It Va debug.lock.prof.maxrecords
+The maximum number of acquisition points the profiling code is capable
+of monitoring.
+Since it would not be possible to call
+.Xr malloc 9
+from within the lock profiling code, this is a static limit.
+The number of records can be changed with the
+.Dv LPROF_BUFFERS
+kernel option.
+.It Va debug.lock.prof.rejected
+The number of acquisition points that were ignored after the table
+filled up.
+.It Va debug.lock.prof.hashsize
+The size of the hash table used to map acquisition points to
+statistics records.
+The hash size can be changed with the
+.Dv LPROF_HASH_SIZE
+kernel option.
+.It Va debug.lock.prof.collisions
+The number of hash collisions in the acquisition point hash table.
+.It Va debug.lock.prof.stats
+The actual profiling statistics in plain text.
+The columns are as follows, from left to right:
+.Bl -tag -width ".Va cnt_hold"
+.It Va max
+The longest continuous hold time in microseconds.
+.It Va total
+The total (accumulated) hold time in microseconds.
+.It Va wait_total
+The total (accumulated) wait time in microseconds.
+.It Va count
+The total number of acquisitions.
+.It Va avg
+The average hold time in microseconds, derived from the total hold time
+and the number of acquisitions.
+.It Va wait_avg
+The average wait time in microseconds, derived from the total wait time
+and the number of acquisitions.
+.It Va cnt_hold
+The number of times the lock was held and another thread attempted to
+acquire the lock.
+.It Va cnt_lock
+The number of times the lock was already held when this point was
+reached.
+.It Va name
+The name of the acquisition point, derived from the source file name
+and line number, followed by the name of the lock in parentheses.
+.El
+.El
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr mutex 9
+.Sh HISTORY
+Mutex profiling support appeared in
+.Fx 5.0 .
+Generalized lock profiling support appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm MUTEX_PROFILING
+code was written by
+.An Eivind Eklund Aq eivind at FreeBSD.org ,
+.An Dag-Erling Sm\(/orgrav Aq des at FreeBSD.org
+and
+.An Robert Watson Aq rwatson at FreeBSD.org .
+The
+.Nm
+code was written by
+.An Kip Macy Aq kmacy at FreeBSD.org .
+This manual page was written by
+.An Dag-Erling Sm\(/orgrav Aq des at FreeBSD.org .
+.Sh NOTES
+The
+.Dv LOCK_PROFILING
+option increases the size of
+.Vt "struct lock_object" ,
+so a kernel built with that option will not work with modules built
+without it.
+.Pp
+The
+.Dv LOCK_PROFILING
+option also prevents inlining of the mutex code, which can result in a
+fairly severe performance penalty.
+This is, however, not always the case.
+.Dv LOCK_PROFILING
+can introduce a substantial performance overhead that is easily
+monitorable using other profiling tools, so combining profiling tools
+with
+.Dv LOCK_PROFILING
+is not recommended.
+.Pp
+Measurements are made and stored in nanoseconds using
+.Xr nanotime 9 ,
+(on architectures without a synchronized TSC) but are presented in microseconds.
+This should still be sufficient for the locks one would be most
+interested in profiling (those that are held long and/or acquired
+often).
+.Pp
+.Dv LOCK_PROFILING
+should generally not be used in combination with other debugging options, as
+the results may be strongly affected by interactions between the features.
+In particular,
+.Dv LOCK_PROFILING
+will report higher than normal
+.Xr uma 9
+lock contention when run with
+.Dv INVARIANTS
+due to extra locking that occurs when
+.Dv INVARIANTS
+is present; likewise, using it in combination with
+.Dv WITNESS
+will lead to much higher lock hold times and contention in profiling output.
--- /dev/null
+++ share/man/man9/device_get_sysctl.9
@@ -0,0 +1,58 @@
+.\" -*- nroff -*-
+.\"
+.\" Copyright (c) 2006 M. Warner Losh
+.\"
+.\" All rights reserved.
+.\"
+.\" This program is free software.
+.\"
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/device_get_sysctl.9,v 1.2 2006/09/30 17:09:59 ru Exp $
+.\"
+.Dd May 23, 2006
+.Dt DEVICE_GET_SYSCTL 9
+.Os
+.Sh NAME
+.Nm device_get_sysctl_ctx ,
+.Nm device_get_sysctl_tree
+.Nd manipulate the sysctl oid tree for driver specific sysctl nodes
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/bus.h
+.Ft "struct sysctl_ctx_list *"
+.Fn device_get_sysctl_ctx "device_t dev"
+.Ft "struct sysctl_oid *"
+.Fn device_get_sysctl_tree "device_t dev"
+.Sh DESCRIPTION
+The newbus system automatically adds a sysctl node for each device
+in the system.
+This node can be accessed with the
+.Fn device_get_sysctl_tree
+function.
+The context for the node can be obtained with the
+.Fn device_get_sysctl_ctl
+function.
+.Sh SEE ALSO
+.Xr device 9
+.Sh AUTHORS
+This manual page was written by
+.An Warner Losh .
Index: ifnet.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/ifnet.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/ifnet.9 -L share/man/man9/ifnet.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/ifnet.9
+++ share/man/man9/ifnet.9
@@ -26,9 +26,9 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/ifnet.9,v 1.50.2.1 2005/08/18 15:01:24 keramida Exp $
+.\" $FreeBSD: src/share/man/man9/ifnet.9,v 1.53 2007/03/14 13:19:50 bms Exp $
.\"
-.Dd June 10, 2005
+.Dd March 14, 2007
.Os
.Dt IFNET 9
.Sh NAME
@@ -103,19 +103,9 @@
.Ft void
.Fn \*(lp*if_start\*(rp "struct ifnet *ifp"
.Ft int
-.Fn \*(lp*if_done\*(rp "struct ifnet *ifp"
-.Ft int
.Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "int cmd" "caddr_t data"
.Ft void
.Fn \*(lp*if_watchdog\*(rp "struct ifnet *ifp"
-.Ft int
-.Fn \*(lp*if_poll_recv\*(rp "struct ifnet *ifp" "int *quotap"
-.Ft int
-.Fn \*(lp*if_poll_xmit\*(rp "struct ifnet *ifp" "int *quotap"
-.Ft void
-.Fn \*(lp*if_poll_inttrn\*(rp "struct ifnet *ifp"
-.Ft void
-.Fn \*(lp*if_poll_slowinput\*(rp "struct ifnet *ifp" "struct mbuf *m"
.Ft void
.Fn \*(lp*if_init\*(rp "void *if_softc"
.Ft int
@@ -1024,7 +1014,7 @@
.Va ifnet_addrs . )
The
.Fa ifp
-must have been allocted by
+must have been allocated by
.Fn if_alloc .
.It Fn if_detach
Shut down and unlink the specified
Index: g_consumer.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/g_consumer.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/g_consumer.9 -L share/man/man9/g_consumer.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/g_consumer.9
+++ share/man/man9/g_consumer.9
@@ -22,7 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/g_consumer.9,v 1.7 2004/07/06 08:21:12 ru Exp $
+.\" $FreeBSD: src/share/man/man9/g_consumer.9,v 1.8 2006/03/17 13:13:18 des Exp $
.\"
.Dd January 16, 2004
.Dt G_CONSUMER 9
@@ -60,11 +60,9 @@
.It
The geom
.Fa gp
-has to have
-.Va start
-and
-.Va access
-methods defined.
+has to have an
+.Va orphan
+method defined.
.It
The topology lock has to be held.
.El
Index: VOP_LISTEXTATTR.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VOP_LISTEXTATTR.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VOP_LISTEXTATTR.9 -L share/man/man9/VOP_LISTEXTATTR.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VOP_LISTEXTATTR.9
+++ share/man/man9/VOP_LISTEXTATTR.9
@@ -28,7 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VOP_LISTEXTATTR.9,v 1.6.2.1 2005/08/31 00:27:35 rodrigc Exp $
+.\" $FreeBSD: src/share/man/man9/VOP_LISTEXTATTR.9,v 1.7 2005/08/19 12:17:47 rodrigc Exp $
.\"
.Dd August 19, 2005
.Os
Index: EVENTHANDLER.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/EVENTHANDLER.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/EVENTHANDLER.9 -L share/man/man9/EVENTHANDLER.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/EVENTHANDLER.9
+++ share/man/man9/EVENTHANDLER.9
@@ -21,7 +21,7 @@
.\" 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.
-.\" $FreeBSD: src/share/man/man9/EVENTHANDLER.9,v 1.3 2005/01/07 19:41:00 keramida Exp $
+.\" $FreeBSD: src/share/man/man9/EVENTHANDLER.9,v 1.4 2005/10/11 16:05:35 keramida Exp $
.\"
.Dd January 7, 2005
.Dt EVENTHANDLER 9
@@ -139,7 +139,7 @@
A pointer to a callback function.
Argument
.Fa arg
-is a passed to the callback function
+is passed to the callback function
.Fa func
as its first argument when it is invoked.
.It Fa priority
Index: vflush.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vflush.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/vflush.9 -L share/man/man9/vflush.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/vflush.9
+++ share/man/man9/vflush.9
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vflush.9,v 1.5 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/vflush.9,v 1.6 2006/06/08 04:39:02 maxim Exp $
.\"
.Dd November 21, 2001
.Dt VFLUSH 9
@@ -61,7 +61,7 @@
If set, busy vnodes will be forcibly closed.
.It Dv SKIPSYSTEM
If set, vnodes with the
-.Dv VSYSTEM
+.Dv VV_SYSTEM
flag set will be skipped.
.It Dv WRITECLOSE
If set, only regular files currently opened for writing will be removed.
Index: bus_dma.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/bus_dma.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/bus_dma.9 -L share/man/man9/bus_dma.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/bus_dma.9
+++ share/man/man9/bus_dma.9
@@ -57,10 +57,10 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/bus_dma.9,v 1.25.2.1 2005/12/08 01:41:54 scottl Exp $
+.\" $FreeBSD: src/share/man/man9/bus_dma.9,v 1.40 2007/03/06 17:32:49 jhb Exp $
.\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $
.\"
-.Dd December 5, 2005
+.Dd March 6, 2007
.Dt BUS_DMA 9
.Os
.Sh NAME
@@ -133,7 +133,7 @@
DMA mappings, handling cache issues, bus specific features
and limitations.
.Sh STRUCTURES AND TYPES
-.Bl -tag -width compact
+.Bl -tag -width indent
.It Vt bus_dma_tag_t
A machine-dependent (MD) opaque type that describes the
characteristics of DMA transactions.
@@ -143,17 +143,17 @@
to contribute to the constraints of those transactions.
.It Vt bus_dma_filter_t
Client specified address filter having the format:
-.Bl -tag -width compact
+.Bl -tag -width indent
.It Ft int
.Fn "client_filter" "void *filtarg" "bus_addr_t testaddr"
.El
-.sp
+.Pp
Address filters can be specified during tag creation to allow
for devices whose DMA address restrictions cannot be specified
by a single window.
The
.Fa filtarg
-is client specified during tag creation to be passed to all
+argument is specified by the client during tag creation to be passed to all
invocations of the callback.
The
.Fa testaddr
@@ -163,16 +163,17 @@
to
.Ql trunc_page(testaddr) + PAGE_SIZE - 1 ,
inclusive.
-The filter function should return zero for any mapping in this range
-that can be accommodated by the device and non-zero otherwise.
+The filter function should return zero if any mapping in this range
+can be accommodated by the device and non-zero otherwise.
.It Vt bus_dma_segment_t
A machine-dependent type that describes individual
DMA segments.
+It contains the following fields:
.Bd -literal
bus_addr_t ds_addr;
bus_size_t ds_len;
.Ed
-.sp
+.Pp
The
.Fa ds_addr
field contains the device visible address of the DMA segment, and
@@ -187,9 +188,12 @@
One map is used for each memory allocation that will be loaded.
Maps can be reused once they have been unloaded.
Multiple maps can be associated with one DMA tag.
-While the value of the map may evaluate to NULL on some platforms under
-certain conditions, it should never be assumed that it will be NULL in all
-cases.
+While the value of the map may evaluate to
+.Dv NULL
+on some platforms under certain conditions,
+it should never be assumed that it will be
+.Dv NULL
+in all cases.
.It Vt bus_dmamap_callback_t
Client specified callback for receiving mapping information resulting from
the load of a
@@ -197,12 +201,12 @@
via
.Fn bus_dmamap_load .
Callbacks are of the format:
-.Bl -tag -width compact
+.Bl -tag -width indent
.It Ft void
.Fn "client_callback" "void *callback_arg" "bus_dma_segment_t *segs" \
"int nseg" "int error"
.El
-.sp
+.Pp
The
.Fa callback_arg
is the callback argument passed to dmamap load functions.
@@ -210,13 +214,13 @@
.Fa segs
and
.Fa nseg
-parameters describe an array of
+arguments describe an array of
.Vt bus_dma_segment_t
structures that represent the mapping.
This array is only valid within the scope of the callback function.
The success or failure of the mapping is indicated by the
.Fa error
-parameter.
+argument.
More information on the use of callbacks can be found in the
description of the individual dmamap load functions.
.It Vt bus_dmamap_callback2_t
@@ -227,14 +231,14 @@
.Fn bus_dmamap_load_uio
or
.Fn bus_dmamap_load_mbuf .
-.sp
+.Pp
Callback2s are of the format:
-.Bl -tag -width compact
+.Bl -tag -width indent
.It Ft void
.Fn "client_callback2" "void *callback_arg" "bus_dma_segment_t *segs" \
"int nseg" "bus_size_t mapsize" "int error"
.El
-.sp
+.Pp
Callback2's behavior is the same as
.Vt bus_dmamap_callback_t
with the addition that the length of the data mapped is provided via
@@ -257,22 +261,22 @@
All operations specified below are performed from the host memory point of view,
where a read implies data coming from the device to the host memory, and a write
implies data going from the host memory to the device.
-Alternately, the operations can be thought of in terms of driver operations,
+Alternatively, the operations can be thought of in terms of driver operations,
where reading a network packet or storage sector corresponds to a read operation
in
.Nm .
-.Bl -tag -width BUS_DMASYNC_POSTWRITE
+.Bl -tag -width ".Dv BUS_DMASYNC_POSTWRITE"
.It Dv BUS_DMASYNC_PREREAD
Perform any synchronization required prior to an update of host memory by the
-DMA read operation.
+device.
.It Dv BUS_DMASYNC_PREWRITE
Perform any synchronization required after an update of host memory by the CPU
-and prior to DMA write operations.
+and prior to device access to host memory.
.It Dv BUS_DMASYNC_POSTREAD
-Perform any synchronization required after DMA read operations and prior to
-CPU access to host memory.
+Perform any synchronization required after an update of host memory by the
+device and prior to CPU access to host memory.
.It Dv BUS_DMASYNC_POSTWRITE
-Perform any synchronization required after DMA write operations.
+Perform any synchronization required after device access to host memory.
.El
.It Vt bus_dma_lock_t
Client specified lock/mutex manipulation method.
@@ -287,48 +291,57 @@
will not be called since the function loading the map should
be holding the appropriate locks.
This method is of the format:
-.Bl -tag -width compact
+.Bl -tag -width indent
.It Ft void
.Fn "lockfunc" "void *lockfunc_arg" "bus_dma_lock_op_t op"
.El
-.sp
+.Pp
+The
+.Fa lockfuncarg
+argument is specified by the client during tag creation to be passed to all
+invocations of the callback.
+The
+.Fa op
+argument specifies the lock operation to perform.
+.Pp
Two
.Vt lockfunc
implementations are provided for convenience.
.Fn busdma_lock_mutex
-performs standard mutex operations on the sleep mutex provided via the
+performs standard mutex operations on the sleep mutex provided via
.Fa lockfuncarg .
-passed into
-.Fn bus_dma_tag_create .
.Fn dflt_lock
will generate a system panic if it is called.
It is substituted into the tag when
.Fa lockfunc
-is passed as NULL to
-.Fn bus_dma_tag_create .
+is passed as
+.Dv NULL
+to
+.Fn bus_dma_tag_create
+and is useful for tags that should not be used with deferred load operations.
.It Vt bus_dma_lock_op_t
Operations to be performed by the client-specified
.Fn lockfunc .
-.Bl -tag -width BUS_DMA_UNLOCK
+.Bl -tag -width ".Dv BUS_DMA_UNLOCK"
.It Dv BUS_DMA_LOCK
Acquires and/or locks the client locking primitive.
.It Dv BUS_DMA_UNLOCK
Releases and/or unlocks the client locking primitive.
.El
.El
-.sp
.Sh FUNCTIONS
-.Bl -tag -width compact
+.Bl -tag -width indent
.It Fn bus_dma_tag_create "parent" "alignment" "boundary" "lowaddr" \
"highaddr" "*filtfunc" "*filtfuncarg" "maxsize" "nsegments" "maxsegsz" \
"flags" "lockfunc" "lockfuncarg" "*dmat"
Allocates a device specific DMA tag, and initializes it according to
the arguments provided:
-.Bl -tag -width *filtfuncarg -compact
+.Bl -tag -width ".Fa filtfuncarg"
.It Fa parent
Indicates restrictions between the parent bridge, CPU memory, and the
device.
-May be NULL, if no DMA restrictions are to be inherited.
+Each device must use a master parent tag by calling
+.Fn bus_get_dma_tag .
.It Fa alignment
Alignment constraint, in bytes, of any mappings created using this tag.
The alignment must be a power of 2.
@@ -337,7 +350,7 @@
for byte alignment.
Hardware requiring DMA transfers to start on a multiple of 4K
would specify
-.Em 4096.
+.Em 4096 .
.It Fa boundary
Boundary constraint, in bytes, of the target DMA memory region.
The boundary indicates the set of addresses, all multiples of the
@@ -347,8 +360,7 @@
maximum segment size.
.Ql 0
indicates that there are no boundary restrictions.
-.It Fa lowaddr
-.It Fa highaddr
+.It Fa lowaddr , highaddr
Bounds of the window of bus address space that
.Em cannot
be directly accessed by the device.
@@ -372,11 +384,13 @@
is used to bounce requests that would otherwise conflict with
the exclusion window.
.It Fa filtfunc
-Optional filter function (may be NULL) to be called for any attempt to
+Optional filter function (may be
+.Dv NULL )
+to be called for any attempt to
map memory into the window described by
.Fa lowaddr
and
-.Fa highaddr.
+.Fa highaddr .
A filter function is only required when the single window described
by
.Fa lowaddr
@@ -387,7 +401,8 @@
that overlaps the exclusion window.
.It Fa filtfuncarg
Argument passed to all calls to the filter function for this tag.
-May be NULL.
+May be
+.Dv NULL .
.It Fa maxsize
Maximum size, in bytes, of the sum of all segment lengths in a given
DMA mapping associated with this tag.
@@ -403,7 +418,7 @@
.Fa dmat .
.It Fa flags
Are as follows:
-.Bl -tag -width "BUS_DMA_ALLOCNOW" -compact
+.Bl -tag -width ".Dv BUS_DMA_ALLOCNOW"
.It Dv BUS_DMA_ALLOCNOW
Pre-allocate enough resources to handle at least one map load operation on
this tag.
@@ -418,9 +433,13 @@
It should be treated only as a minor optimization.
.El
.It Fa lockfunc
-Optional lock manipulation function (may be NULL) to be called when busdma
+Optional lock manipulation function (may be
+.Dv NULL )
+to be called when busdma
needs to manipulate a lock on behalf of the client.
-If NULL is specified,
+If
+.Dv NULL
+is specified,
.Fn dflt_lock
is used.
.It Fa lockfuncarg
@@ -451,7 +470,7 @@
.It Fn bus_dmamap_create "dmat" "flags" "*mapp"
Allocates and initializes a DMA map.
Arguments are as follows:
-.Bl -tag -width nsegments -compact
+.Bl -tag -width ".Fa nsegments"
.It Fa dmat
DMA tag.
.It Fa flags
@@ -471,7 +490,7 @@
.It Fn bus_dmamap_destroy "dmat" "map"
Frees all resources associated with a given DMA map.
Arguments are as follows:
-.Bl -tag -width dmat -compact
+.Bl -tag -width ".Fa dmat"
.It Fa dmat
DMA tag used to allocate
.Fa map .
@@ -493,10 +512,10 @@
.Fa map .
This call will always return immediately and will not block for any reason.
Arguments are as follows:
-.Bl -tag -width buflen -compact
+.Bl -tag -width ".Fa buflen"
.It Fa dmat
DMA tag used to allocate
-.Fa map.
+.Fa map .
.It Fa map
A DMA map without a currently active mapping.
.It Fa buf
@@ -515,15 +534,15 @@
See below for specific flags and error codes that control this behavior.
.It Fa flags
Are as follows:
-.Bl -tag -width BUS_DMA_NOWAIT -compact
-.It Er BUS_DMA_NOWAIT
+.Bl -tag -width ".Dv BUS_DMA_NOWAIT"
+.It Dv BUS_DMA_NOWAIT
The load should not be deferred in case of insufficient mapping resources,
and instead should return immediately with an appropriate error.
.El
.El
.Pp
Return values to the caller are as follows:
-.Bl -tag -width EINPROGRESS -compact
+.Bl -tag -width ".Er EINPROGRESS"
.It 0
The callback has been called and completed.
The status of the mapping has been delivered to the callback.
@@ -536,7 +555,7 @@
.It Er ENOMEM
The load request has failed due to insufficient resources, and the caller
specifically used the
-.Fa BUS_DMA_NOWAIT
+.Dv BUS_DMA_NOWAIT
flag.
.It Er EINVAL
The load request was invalid.
@@ -558,7 +577,7 @@
When the callback is called, it is presented with an error value
indicating the disposition of the mapping.
Error may be one of the following:
-.Bl -tag -width EINPROGRESS -compact
+.Bl -tag -width ".Er EINPROGRESS"
.It 0
The mapping was successful and the
.Fa dm_segs
@@ -581,7 +600,7 @@
argument is also passed to the callback routine, which
contains the mbuf chain's packet header length.
The
-.Fa BUS_DMA_NOWAIT
+.Dv BUS_DMA_NOWAIT
flag is implied, thus no callback deferral will happen.
.Pp
Mbuf chains are assumed to be in kernel virtual address space.
@@ -617,7 +636,7 @@
i.e.
.Fa uio->uio_resid .
The
-.Fa BUS_DMA_NOWAIT
+.Dv BUS_DMA_NOWAIT
flag is implied, thus no callback deferral will happen.
Returns the same errors as
.Fn bus_dmamap_load .
@@ -638,7 +657,7 @@
.It Fn bus_dmamap_unload "dmat" "map"
Unloads a DMA map.
Arguments are as follows:
-.Bl -tag -width dmam -compact
+.Bl -tag -width ".Fa dmam"
.It Fa dmat
DMA tag used to allocate
.Fa map .
@@ -655,7 +674,7 @@
Performs synchronization of a device visible mapping with the CPU visible
memory referenced by that mapping.
Arguments are as follows:
-.Bl -tag -width dmat -compact
+.Bl -tag -width ".Fa dmat"
.It Fa dmat
DMA tag used to allocate
.Fa map .
@@ -669,38 +688,44 @@
.Fa op .
.El
.Pp
+The
.Fn bus_dmamap_sync
-is the method used to ensure that CPU and device DMA access to shared
+function
+is the method used to ensure that CPU's and device's direct
+memory access (DMA) to shared
memory is coherent.
-For example, the CPU might be used to setup the contents of a buffer
-that is to be DMA'ed into a device.
+For example, the CPU might be used to set up the contents of a buffer
+that is to be made available to a device.
To ensure that the data are visible via the device's mapping of that
-memory, the buffer must be loaded and a dma sync operation of
-.Dv BUS_DMASYNC_PREREAD
-must be performed.
-Additional sync operations must be performed after every CPU write
-to this memory if additional DMA reads are to be performed.
-Conversely, for the DMA write case, the buffer must be loaded,
-and a dma sync operation of
+memory, the buffer must be loaded and a DMA sync operation of
+.Dv BUS_DMASYNC_PREWRITE
+must be performed after the CPU has updated the buffer and before the device
+access is initiated.
+If the CPU modifies this buffer again later, another
.Dv BUS_DMASYNC_PREWRITE
-must be performed.
-The CPU will only be able to see the results of this DMA write
-once the DMA has completed and a
-.Dv BUS_DMASYNC_POSTWRITE
-operation has been performed.
+sync operation must be performed before an additional device
+access.
+Conversely, suppose a device updates memory that is to be read by a CPU.
+In this case, the buffer must be loaded, and a DMA sync operation of
+.Dv BUS_DMASYNC_PREREAD
+must be performed before the device access is initiated.
+The CPU will only be able to see the results of this memory update
+once the DMA operation has completed and a
+.Dv BUS_DMASYNC_POSTREAD
+sync operation has been performed.
.Pp
-If DMA read and write operations are not preceded and followed by the
+If read and write operations are not preceded and followed by the
appropriate synchronization operations, behavior is undefined.
.It Fn bus_dmamem_alloc "dmat" "**vaddr" "flags" "*mapp"
Allocates memory that is mapped into KVA at the address returned
in
.Fa vaddr
-that is permanently loaded into the newly created
+and that is permanently loaded into the newly created
.Vt bus_dmamap_t
returned via
.Fa mapp .
Arguments are as follows:
-.Bl -tag -width alignment -compact
+.Bl -tag -width ".Fa alignment"
.It Fa dmat
DMA tag describing the constraints of the DMA mapping.
.It Fa vaddr
@@ -708,7 +733,7 @@
the allocated region.
.It Fa flags
Flags are defined as follows:
-.Bl -tag -width BUS_DMA_NOWAIT -compact
+.Bl -tag -width ".Dv BUS_DMA_NOWAIT"
.It Dv BUS_DMA_WAITOK
The routine can safely wait (sleep) for resources.
.It Dv BUS_DMA_NOWAIT
@@ -724,6 +749,9 @@
Use of this flag does not remove the requirement of using
bus_dmamap_sync, but it may reduce the cost of performing
these operations.
+The
+.Dv BUS_DMA_COHERENT
+flag is currently implemented on sparc64 and arm.
.It Dv BUS_DMA_ZERO
Causes the allocated memory to be set to all zeros.
.El
@@ -735,7 +763,9 @@
.Pp
The size of memory to be allocated is
.Fa maxsize
-as specified in
+as specified in the call to
+.Fn bus_dma_tag_create
+for
.Fa dmat .
.Pp
The current implementation of
@@ -753,7 +783,7 @@
referenced by the returned map, the synchronization requirements
as described in the
.Fn bus_dmamap_sync
-section still apply and should be used to achieve portability on architecutures
+section still apply and should be used to achieve portability on architectures
without coherent buses.
.Pp
Returns
@@ -766,7 +796,7 @@
Any mappings
will be invalidated.
Arguments are as follows:
-.Bl -tag -width vaddr -compact
+.Bl -tag -width ".Fa vaddr"
.It Fa dmat
DMA tag.
.It Fa vaddr
@@ -783,14 +813,84 @@
.Er ENOMEM
is returned.
All
-routines that are not of type,
-.Vt void ,
+routines that are not of type
+.Vt void
will return 0 on success or an error
-code, as discussed above.
+code on failure as discussed above.
.Pp
All
.Vt void
routines will succeed if provided with valid arguments.
+.Sh LOCKING
+Two locking protocols are used by
+.Nm .
+The first is a private global lock that is used to synchronize access to the
+bounce buffer pool on the architectures that make use of them.
+This lock is strictly a leaf lock that is only used internally to
+.Nm
+and is not exposed to clients of the API.
+.Pp
+The second protocol involves protecting various resources stored in the tag.
+Since almost all
+.Nm
+operations are done through requests from the driver that created the tag,
+the most efficient way to protect the tag resources is through the lock that
+the driver uses.
+In cases where
+.Nm
+acts on its own without being called by the driver, the lock primitive
+specified in the tag is acquired and released automatically.
+An example of this is when the
+.Fn bus_dmamap_load
+callback function is called from a deferred context instead of the driver
+context.
+This means that certain
+.Nm
+functions must always be called with the same lock held that is specified in the
+tag.
+These functions include:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Fn bus_dmamap_load
+.It
+.Fn bus_dmamap_load_uio
+.It
+.Fn bus_dmamap_load_mbuf
+.It
+.Fn bus_dmamap_load_mbuf_sg
+.It
+.Fn bus_dmamap_unload
+.It
+.Fn bus_dmamap_sync
+.El
+.Pp
+There is one exception to this rule.
+It is common practice to call some of these functions during driver start-up
+without any locks held.
+So long as there is a guarantee of no possible concurrent use of the tag by
+different threads during this operation, it is safe to not hold a lock for
+these functions.
+.Pp
+Certain
+.Nm
+operations should not be called with the driver lock held, either because
+they are already protected by an internal lock, or because they might sleep
+due to memory or resource allocation.
+The following functions must not be
+called with any non-sleepable locks held:
+.Pp
+.Bl -item -offset indent -compact
+.It
+.Fn bus_dma_tag_create
+.It
+.Fn bus_dmamap_create
+.It
+.Fn bus_dmamem_alloc
+.El
+.Pp
+All other functions do not have a locking protocol and can thus be
+called with or without any system or driver locks held.
.Sh SEE ALSO
.Xr devclass 9 ,
.Xr device 9 ,
Index: mutex.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/mutex.9,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L share/man/man9/mutex.9 -L share/man/man9/mutex.9 -u -r1.1.1.2 -r1.2
--- share/man/man9/mutex.9
+++ share/man/man9/mutex.9
@@ -26,14 +26,15 @@
.\" SUCH DAMAGE.
.\"
.\" from BSDI $Id: mutex.4,v 1.1.2.3 1998/04/27 22:53:13 ewv Exp $
-.\" $FreeBSD: src/share/man/man9/mutex.9,v 1.47.2.1 2005/09/21 21:09:36 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/mutex.9,v 1.55 2007/03/30 18:07:26 julian Exp $
.\"
-.Dd February 16, 2005
+.Dd December 21, 2006
.Dt MUTEX 9
.Os
.Sh NAME
.Nm mutex ,
.Nm mtx_init ,
+.Nm mtx_destroy ,
.Nm mtx_lock ,
.Nm mtx_lock_spin ,
.Nm mtx_lock_flags ,
@@ -44,7 +45,7 @@
.Nm mtx_unlock_spin ,
.Nm mtx_unlock_flags ,
.Nm mtx_unlock_spin_flags ,
-.Nm mtx_destroy ,
+.Nm mtx_sleep ,
.Nm mtx_initialized ,
.Nm mtx_owned ,
.Nm mtx_recursed ,
@@ -58,6 +59,8 @@
.Ft void
.Fn mtx_init "struct mtx *mutex" "const char *name" "const char *type" "int opts"
.Ft void
+.Fn mtx_destroy "struct mtx *mutex"
+.Ft void
.Fn mtx_lock "struct mtx *mutex"
.Ft void
.Fn mtx_lock_spin "struct mtx *mutex"
@@ -77,8 +80,8 @@
.Fn mtx_unlock_flags "struct mtx *mutex" "int flags"
.Ft void
.Fn mtx_unlock_spin_flags "struct mtx *mutex" "int flags"
-.Ft void
-.Fn mtx_destroy "struct mtx *mutex"
+.Ft int
+.Fn mtx_sleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
.Ft int
.Fn mtx_initialized "struct mtx *mutex"
.Ft int
@@ -91,7 +94,7 @@
.Ft void
.Fn mtx_assert "struct mtx *mutex" "int what"
.In sys/kernel.h
-.Fn MTX_SYSINIT "name" "struct mutex *mtx" "const char *description" "int opts"
+.Fn MTX_SYSINIT "name" "struct mtx *mtx" "const char *description" "int opts"
.Sh DESCRIPTION
Mutexes are the most basic and primary method of thread synchronization.
The major design considerations for mutexes are:
@@ -305,6 +308,15 @@
when it is destroyed.
.Pp
The
+.Fn mtx_sleep
+function is used to atomically release
+.Fa mtx
+while waiting for an event.
+For more details on the parameters to this function,
+see
+.Xr sleep 9 .
+.Pp
+The
.Fn mtx_initialized
function returns non-zero if
.Fa mutex
@@ -434,6 +446,8 @@
to ignore this lock.
.It Dv MTX_DUPOK
Witness should not log messages about duplicate locks being acquired.
+.It Dv MTX_NOPROFILE
+Do not profile this lock.
.El
.Ss Lock and Unlock Flags
The flags passed to the
@@ -495,11 +509,13 @@
No locks are needed when calling these functions.
.Sh SEE ALSO
.Xr condvar 9 ,
-.Xr msleep 9 ,
+.Xr LOCK_PROFILING 9 ,
+.Xr locking 9 ,
.Xr mtx_pool 9 ,
-.Xr MUTEX_PROFILING 9 ,
.Xr panic 9 ,
+.Xr rwlock 9 ,
.Xr sema 9 ,
+.Xr sleep 9 ,
.Xr sx 9
.Sh HISTORY
These
Index: pmap_remove.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/pmap_remove.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/pmap_remove.9 -L share/man/man9/pmap_remove.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/pmap_remove.9
+++ share/man/man9/pmap_remove.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/pmap_remove.9,v 1.2 2004/07/06 07:02:31 ru Exp $
+.\" $FreeBSD: src/share/man/man9/pmap_remove.9,v 1.3 2006/04/03 21:17:36 peter Exp $
.\"
.Dd July 21, 2003
.Dt PMAP_REMOVE 9
@@ -42,7 +42,7 @@
.Ft void
.Fn pmap_remove_all "vm_page_t m"
.Ft void
-.Fn pmap_remove_pages "pmap_t pmap" "vm_offset_t sva" "vm_offset_t eva"
+.Fn pmap_remove_pages "pmap_t pmap"
.Sh DESCRIPTION
The
.Fn pmap_remove
@@ -72,12 +72,8 @@
.Pp
The
.Fn pmap_remove_pages
-function removes all pages from the physical map
-.Fa pmap ,
-within the range of physical addresses bounded by
-.Fa sva
-and
-.Fa eva .
+function removes all user pages from the physical map
+.Fa pmap .
This function is called when a process exits to run down its address space
more quickly than would be the case for calling
.Fn pmap_remove .
Index: suser.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/suser.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/suser.9 -L share/man/man9/suser.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/suser.9
+++ share/man/man9/suser.9
@@ -12,11 +12,7 @@
.\" 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 for the FreeBSD Project
-.\" by Julian R Elischer
-.\" 4. The name of the author may not be used to endorse or promote products
+.\" 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
@@ -31,18 +27,17 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/suser.9,v 1.28 2005/01/12 21:48:25 ru Exp $
+.\" $FreeBSD: src/share/man/man9/suser.9,v 1.34 2007/08/30 15:03:21 danger Exp $
.\"
-.Dd April 2, 2002
+.Dd August 30, 2007
.Dt SUSER 9
.Os
.Sh NAME
.Nm suser ,
.Nm suser_cred
-.Nd check if credentials have superuser privilege
+.Nd check if credentials have superuser privileges
.Sh SYNOPSIS
-.In sys/param.h
-.In sys/systm.h
+.In sys/priv.h
.Ft int
.Fn suser "struct thread *td"
.Ft int
@@ -54,6 +49,12 @@
.Fn suser_cred
functions check if the credentials given include superuser powers.
.Pp
+These interfaces have now been obsoleted by
+.Xr priv 9 ,
+and are provided only for compatibility with third party kernel modules that
+have not yet been updated to the new interface.
+They should not be used in any new kernel code.
+.Pp
The
.Fn suser
function is the most common, and should be used unless special
@@ -66,37 +67,17 @@
powers should be extended to imprisoned roots, or when the credential
to be checked is the real user rather than the effective user.
.Pp
-By default, a process does not command superuser powers if it has
-been imprisoned by the
-.Xr jail 2
-system call.
-There are cases however where this is appropriate, and this can
-be done by passing
-.Dv SUSER_ALLOWJAIL
-in the
-.Fa flag
-argument to the
-.Fn suser_cred
-function.
-It is important to review carefully in each case that
-this does not weaken the prison.
-Generally, only where the action is protected by
-.Xr chroot 2
-implicit in the
-.Xr jail 2
-call should such powers be granted.
-.Pp
-By default, the credential checked is the effective user.
-There are cases
-where it is instead necessary to check the real user (for example, when
-determining if resource limits should be applied), and this can be done
-by passing the
-.Dv SUSER_RUID
-flag in the
-.Fa flag
-argument to the
-.Fn suser_cred
-function.
+Whether or not a privilege is permitted in a
+.Xr jail 8
+depends on logic in
+.Fn prison_priv_check .
+.Pp
+In general, privileges are assigned based on the effective user ID; in some
+cases, the real user ID may be used.
+.Pp
+The
+.Fa flags
+field is currently unused.
.Pp
The
.Fn suser
@@ -123,7 +104,8 @@
in which a TRUE response indicates superuser powers.
.Sh SEE ALSO
.Xr chroot 2 ,
-.Xr jail 2
+.Xr jail 2 ,
+.Xr priv 9
.Sh BUGS
The
.Fn suser
Index: vref.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vref.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vref.9 -L share/man/man9/vref.9 -u -r1.2 -r1.3
--- share/man/man9/vref.9
+++ share/man/man9/vref.9
@@ -27,7 +27,6 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vref.9,v 1.13 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 24, 1996
.Os
Index: sleep.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/sleep.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/sleep.9 -L share/man/man9/sleep.9 -u -r1.2 -r1.3
--- share/man/man9/sleep.9
+++ share/man/man9/sleep.9
@@ -23,14 +23,15 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/sleep.9,v 1.45 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/sleep.9,v 1.61 2007/03/30 18:07:26 julian Exp $
.\"
-.Dd December 17, 1998
+.Dd February 27, 2007
.Os
.Dt SLEEP 9
.Sh NAME
-.Nm sleep ,
.Nm msleep ,
+.Nm msleep_spin ,
+.Nm pause ,
.Nm tsleep ,
.Nm wakeup
.Nd wait for events
@@ -39,80 +40,65 @@
.In sys/systm.h
.In sys/proc.h
.Ft int
-.Fn tsleep "void *ident" "int priority" "const char *wmesg" "int timo"
+.Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
.Ft int
-.Fn msleep "void *ident" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
+.Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo"
.Ft void
-.Fn wakeup "void *ident"
+.Fn pause "const char *wmesg" "int timo"
+.Ft int
+.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo"
+.Ft void
+.Fn wakeup "void *chan"
.Ft void
-.Fn wakeup_one "void *ident"
+.Fn wakeup_one "void *chan"
.Sh DESCRIPTION
The functions
-.Fn tsleep
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn pause ,
+.Fn wakeup ,
and
-.Fn wakeup
-handle event-based process blocking.
-If a process must wait for an
-external event, it is put on sleep by
-.Fn tsleep .
+.Fn wakeup_one
+handle event-based thread blocking.
+If a thread must wait for an
+external event, it is put to sleep by
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+or
+.Fn pause .
+Threads may also wait using one of the locking primitive sleep routines
+.Xr mtx_sleep 9 ,
+.Xr rw_sleep 9 ,
+or
+.Xr sx_sleep 9 .
+.Pp
The parameter
-.Fa ident
+.Fa chan
is an arbitrary address that uniquely identifies the event on which
-the process is being asleep.
-All processes sleeping on a single
-.Fa ident
+the thread is being put to sleep.
+All threads sleeping on a single
+.Fa chan
are woken up later by
.Fn wakeup ,
often called from inside an interrupt routine, to indicate that the
-resource the process was blocking on is available now.
+resource the thread was blocking on is available now.
.Pp
The parameter
-.Fa wmesg
-is a string describing the sleep condition for tools like
-.Xr ps 1 .
-Due to the limited space of those programs to display arbitrary strings,
-this message should not be longer than 6 characters.
-.Pp
-The
-.Fn wakeup_one
-function is used to make the first process in the queue that is
-sleeping on the parameter
-.Fa ident
-runnable.
-This can prevent the system from becoming saturated
-when a large number of processes are sleeping on the same address,
-but only one of them can actually do any useful work when made
-runnable.
-.Pp
-The
-.Fn tsleep
-function is the general sleep call.
-Suspends the current process until a wakeup is
-performed on the specified identifier.
-The process will then be made
+.Fa priority
+specifies a new priority for the thread as well as some optional flags.
+If the new priority is not 0,
+then the thread will be made
runnable with the specified
-.Fa priority .
-Sleeps at most
-.Fa timo
-\&/ hz seconds (0 means no timeout).
-If the
-.Va Giant
-lock is not held, and
-.Fa mtx
-is
-.Dv NULL ,
-then
-.Fa timo
-must be non-zero.
+.Fa priority
+when it resumes.
If
.Fa priority
includes the
.Dv PCATCH
-flag, signals are checked before and after sleeping, else signals are
+flag, signals are checked before and after sleeping, otherwise signals are
not checked.
-Returns 0 if awakened,
-.Er EWOULDBLOCK
-if the timeout expires.
If
.Dv PCATCH
is set and a signal needs to be delivered,
@@ -124,48 +110,206 @@
(return
.Er EINTR ) .
.Pp
-The
-.Fn msleep
-function is a variation on tsleep.
The parameter
-.Fa mtx
-is a mutex which will be released before sleeping and reacquired before
-.Fn msleep
-returns.
+.Fa wmesg
+is a string describing the sleep condition for tools like
+.Xr ps 1 .
+Due to the limited space of those programs to display arbitrary strings,
+this message should not be longer than 6 characters.
+.Pp
+The parameter
+.Fa timo
+specifies a timeout for the sleep.
+If
+.Fa timo
+is not 0,
+then the thread will sleep for at most
+.Fa timo No / Va hz
+seconds.
+If the timeout expires,
+then the sleep function will return
+.Er EWOULDBLOCK .
+.Pp
+Several of the sleep functions including
+.Fn msleep ,
+.Fn msleep_spin ,
+and the locking primitive sleep routines specify an additional lock
+parameter.
+The lock will be released before sleeping and reacquired
+before the sleep routine returns.
If
.Fa priority
includes the
.Dv PDROP
-flag, the
-.Fa mtx
-parameter will not be reacquired before returning.
-The mutex is
-used to ensure that a condition can be checked atomically, and
-that the current process can be suspended without missing a
+flag, then
+the lock will not be reacquired before returning.
+The lock is used to ensure that a condition can be checked atomically,
+and that the current thread can be suspended without missing a
change to the condition, or an associated wakeup.
+In addition, all of the sleep routines will fully drop the
+.Va Giant
+mutex
+(even if recursed)
+while the thread is suspended and will reacquire the
+.Va Giant
+mutex before the function returns.
+.Pp
+To avoid lost wakeups,
+either a lock should be used to protect against races,
+or a timeout should be specified to place an upper bound on the delay due
+to a lost wakeup.
+As a result,
+the
+.Fn tsleep
+function should only be invoked with a timeout of 0 when the
+.Va Giant
+mutex is held.
+.Pp
+The
+.Fn msleep
+function requires that
+.Fa mtx
+reference a default, i.e. non-spin, mutex.
+Its use is deprecated in favor of
+.Xr mtx_sleep 9
+which provides identical behavior.
+.Pp
+The
+.Fn msleep_spin
+function requires that
+.Fa mtx
+reference a spin mutex.
+The
+.Fn msleep_spin
+function does not accept a
+.Fa priority
+parameter and thus does not support changing the current thread's priority,
+the
+.Dv PDROP
+flag,
+or catching signals via the
+.Dv PCATCH
+flag.
+.Pp
+The
+.Fn pause
+function is a wrapper around
+.Fn tsleep
+that suspends execution of the current thread for the indicated timeout.
+The thread can not be awakened early by signals or calls to
+.Fn wakeup
+or
+.Fn wakeup_one .
+.Pp
+The
+.Fn wakeup_one
+function makes the first thread in the queue that is sleeping on the
+parameter
+.Fa chan
+runnable.
+This reduces the load when a large number of threads are sleeping on
+the same address, but only one of them can actually do any useful work
+when made runnable.
+.Pp
+Due to the way it works, the
+.Fn wakeup_one
+function requires that only related threads sleep on a specific
+.Fa chan
+address.
+It is the programmer's responsibility to choose a unique
+.Fa chan
+value.
+The older
+.Fn wakeup
+function did not require this, though it was never good practice
+for threads to share a
+.Fa chan
+value.
+When converting from
+.Fn wakeup
+to
+.Fn wakeup_one ,
+pay particular attention to ensure that no other threads wait on the
+same
+.Fa chan .
.Sh RETURN VALUES
-See above.
+If the thread is awakened by a call to
+.Fn wakeup
+or
+.Fn wakeup_one ,
+the
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn tsleep ,
+and locking primitive sleep functions return 0.
+Otherwise, a non-zero error code is returned.
+.Sh ERRORS
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn tsleep ,
+and the locking primitive sleep functions will fail if:
+.Bl -tag -width Er
+.It Bq Er EINTR
+The
+.Dv PCATCH
+flag was specified, a signal was caught, and the system call should be
+interrupted.
+.It Bq Er ERESTART
+The
+.Dv PCATCH
+flag was specified, a signal was caught, and the system call should be
+restarted.
+.It Bq Er EWOULDBLOCK
+A non-zero timeout was specified and the timeout expired.
+.El
.Sh SEE ALSO
.Xr ps 1 ,
+.Xr locking 9 ,
.Xr malloc 9 ,
-.Xr mi_switch 9
+.Xr mi_switch 9 ,
+.Xr mtx_sleep 9 ,
+.Xr rw_sleep 9 ,
+.Xr sx_sleep 9
.Sh HISTORY
-The sleep/wakeup process synchronization mechanism is very old.
-It
-appeared in a very early version of
+The functions
+.Fn sleep
+and
+.Fn wakeup
+were present in
+.At v1 .
+They were probably also present in the preceding
+PDP-7 version of
.Ux .
+They were the basic process synchronization model.
.Pp
The
.Fn tsleep
function appeared in
-.Bx 4.4 .
-.Pp
+.Bx 4.4
+and added the parameters
+.Fa wmesg
+and
+.Fa timo .
The
.Fn sleep
-function used to be the traditional form.
-It did not let you specify a timeout or a
-.Fa wmesg ,
-hence it was discontinued.
+function was removed in
+.Fx 2.2 .
+The
+.Fn wakeup_one
+function appeared in
+.Fx 2.2 .
+The
+.Fn msleep
+function appeared in
+.Fx 5.0 ,
+and the
+.Fn msleep_spin
+function appeared in
+.Fx 6.2 .
+The
+.Fn pause
+function appeared in
+.Fx 7.0 .
.Sh AUTHORS
.An -nosplit
This manual page was written by
Index: atomic.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/atomic.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/atomic.9 -L share/man/man9/atomic.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/atomic.9
+++ share/man/man9/atomic.9
@@ -21,9 +21,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/atomic.9,v 1.11.10.1 2005/10/06 18:12:04 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/atomic.9,v 1.13 2005/11/18 10:52:24 ru Exp $
.\"
-.Dd October 27, 2000
+.Dd September 27, 2005
.Os
.Dt ATOMIC 9
.Sh NAME
Index: rtentry.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/rtentry.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/rtentry.9 -L share/man/man9/rtentry.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/rtentry.9
+++ share/man/man9/rtentry.9
@@ -26,7 +26,7 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/rtentry.9,v 1.24 2005/01/21 08:36:40 ru Exp $
+.\" $FreeBSD: src/share/man/man9/rtentry.9,v 1.25 2007/08/05 07:38:09 maxim Exp $
.\"
.Dd October 7, 2004
.Os
@@ -263,7 +263,7 @@
.Dv RMX_RTTUNIT
per second.
.It Vt "u_long rmx_rttvar" ;
-The average deviation of the round-type time to this destination, in
+The average deviation of the round-trip time to this destination, in
units of
.Dv RMX_RTTUNIT
per second.
Index: device_get_softc.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/device_get_softc.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/device_get_softc.9 -L share/man/man9/device_get_softc.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/device_get_softc.9
+++ share/man/man9/device_get_softc.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/device_get_softc.9,v 1.10.10.2 2005/11/04 22:10:13 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/device_get_softc.9,v 1.13 2005/11/18 10:52:24 ru Exp $
.\"
.Dd August 2, 2005
.Dt DEVICE_GET_SOFTC 9
@@ -60,8 +60,8 @@
.Sh RETURN VALUES
The pointer to the driver-specific instance variable is returned.
.Sh SEE ALSO
-.Xr DEVICE_PROBE 9 ,
.Xr device 9 ,
+.Xr DEVICE_PROBE 9 ,
.Xr device_set_softc 9 ,
.Xr driver 9
.Sh AUTHORS
Index: mi_switch.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/mi_switch.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/mi_switch.9 -L share/man/man9/mi_switch.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/mi_switch.9
+++ share/man/man9/mi_switch.9
@@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/mi_switch.9,v 1.19 2005/01/29 20:05:07 ru Exp $
+.\" $FreeBSD: src/share/man/man9/mi_switch.9,v 1.20 2007/03/09 22:41:01 jhb Exp $
.\"
.Dd November 24, 1996
.Dt MI_SWITCH 9
@@ -65,13 +65,13 @@
can be enumerated as follows:
.Bl -enum -offset indent
.It
-From within
-.Xr sleep 9 ,
-.Xr tsleep 9
-and
-.Xr msleep 9
+From within a function such as
+.Xr cv_wait 9 ,
+.Xr mtx_lock ,
+or
+.Xr tsleep 9
when the current thread
-voluntarily relinquishes the CPU to wait for some resource to become
+voluntarily relinquishes the CPU to wait for some resource or lock to become
available.
.It
After handling a trap
@@ -157,6 +157,7 @@
.Va sched_lock
mutex held.
.Sh SEE ALSO
+.Xr cv_wait 9 ,
.Xr issignal 9 ,
.Xr mutex 9 ,
.Xr runqueue 9 ,
Index: vm_page_wakeup.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_wakeup.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_wakeup.9 -L share/man/man9/vm_page_wakeup.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_wakeup.9
+++ share/man/man9/vm_page_wakeup.9
@@ -24,8 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vm_page_wakeup.9,v 1.2 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/share/man/man9/vm_page_wakeup.9,v 1.3 2006/02/13 21:34:19 joel Exp $
.\"
.Dd July 14, 2001
.Dt VM_PAGE_BUSY 9
@@ -68,7 +67,6 @@
flag on the page, and calls
.Fn vm_page_flash
in case somebody has been waiting for it.
-.Pp
.Sh SEE ALSO
.Xr vm_page_sleep_busy 9 ,
.Xr wakeup 9
Index: memguard.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/memguard.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/memguard.9 -L share/man/man9/memguard.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/memguard.9
+++ share/man/man9/memguard.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/memguard.9,v 1.1 2005/02/22 17:18:27 brueffer Exp $
+.\" $FreeBSD: src/share/man/man9/memguard.9,v 1.5 2006/09/18 15:24:20 ru Exp $
.\"
-.Dd February 22, 2005
+.Dd January 31, 2006
.Dt MEMGUARD 9
.Os
.Sh NAME
@@ -47,42 +47,38 @@
and
.Fn free
for a particular malloc type.
-.Nm
-takes over
-.Dv M_SUBPROC
-allocations by default.
-.Sh FILES
-.Bl -tag -width ".Pa src/sys/kern/kern_malloc.c" -compact
-.It Pa src/sys/kern/kern_malloc.c
-File to replace the malloc type in
-.El
.Sh EXAMPLES
-The following steps are necessary to use
-.Nm :
-.Bl -enum
-.It
-Put the
-.Dv DEBUG_MEMGUARD
-option into your kernel config.
-.It
-Open
-.Pa src/sys/kern/kern_malloc.c
-in your favourite editor.
-Look for lines containing
-.Dq Li "XXX CHANGEME!"
-and replace
-.Dv M_SUBPROC
-with the appropriate malloc type.
-This might require additional but small/simple
-code modifications
-(e.g., if the malloc type is declared out of scope).
-.It
-Build and install your kernel.
-Tune the
-.Va vm.memguard_divisor
-boot-time tunable, which is used to scale how much of
+To use
+.Nm
+for memory type compiled into the kernel, one has to add the
+following line to the
+.Pa /boot/loader.conf :
+.Bd -literal -offset indent
+vm.memguard.desc=<memory_type>
+.Ed
+.Pp
+Where
+.Ar memory_type
+is a short description of memory type to monitor.
+The short description of memory type is the second argument to
+.Xr MALLOC_DEFINE 9 ,
+so one has to find it in the kernel source.
+.Pp
+To use
+.Nm
+for memory type defined in a kernel module, one has to set
+.Va vm.memguard.desc
+.Xr sysctl 8
+variable before loading the module:
+.Bd -literal -offset indent
+sysctl vm.memguard.desc=<memory_type>
+.Ed
+.Pp
+The
+.Va vm.memguard.divisor
+boot-time tunable is used to scale how much of
.Va kmem_map
-you want to allot for
+one wants to allocate for
.Nm .
The default is 10, so
.Va kmem_size Ns /10
@@ -93,12 +89,12 @@
.Va vm.kmem_size
.Xr sysctl 8
variable.
-.El
.Sh SEE ALSO
.Xr sysctl 8 ,
.Xr vmstat 8 ,
.Xr contigmalloc 9 ,
-.Xr malloc 9
+.Xr malloc 9 ,
+.Xr redzone 9
.Sh HISTORY
.Nm
first appeared in
--- /dev/null
+++ share/man/man9/locking.9
@@ -0,0 +1,357 @@
+.\" Copyright (c) 2007 Julian Elischer (julian - freebsd org )
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/locking.9,v 1.11 2007/08/09 21:09:56 julian Exp $
+.\"
+.Dd March 14, 2007
+.Dt LOCKING 9
+.Os
+.Sh NAME
+.Nm locking
+.Nd kernel synchronization primitives
+.Sh SYNOPSIS
+All sorts of stuff to go here.
+.Pp
+.Sh DESCRIPTION
+The
+.Em FreeBSD
+kernel is written to run across multiple CPUs and as such requires
+several different synchronization primitives to allow the developers
+to safely access and manipulate the many data types required.
+.Pp
+These include:
+.Bl -enum
+.It
+Spin Mutexes
+.It
+Sleep Mutexes
+.It
+pool Mutexes
+.It
+Shared-Exclusive locks
+.It
+Reader-Writer locks
+.It
+Turnstiles
+.It
+Semaphores
+.It
+Condition variables
+.It
+Sleep/wakeup
+.It
+Giant
+.It
+Lockmanager locks
+.El
+.Pp
+The primitives interact and have a number of rules regarding how
+they can and can not be combined.
+There are too many for the average
+human mind and they keep changing.
+(if you disagree, please write replacement text) :-)
+.Pp
+Some of these primitives may be used at the low (interrupt) level and
+some may not.
+.Pp
+There are strict ordering requirements and for some of the types this
+is checked using the
+.Xr witness 4
+code.
+.Pp
+.Ss SPIN Mutexes
+Mutexes are the basic primitive.
+You either hold it or you don't.
+If you don't own it then you just spin, waiting for the holder (on
+another CPU) to release it.
+Hopefully they are doing something fast.
+You
+.Em must not
+do anything that deschedules the thread while you
+are holding a SPIN mutex.
+.Ss Mutexes
+Basically (regular) mutexes will deschedule the thread if the
+mutex can not be acquired.
+A non-spin mutex can be considered to be equivalent
+to getting a write lock on an
+.Em rw_lock
+(see below), and in fact non-spin mutexes and rw_locks may soon become the same thing.
+As in spin mutexes, you either get it or you don't.
+You may only call the
+.Xr sleep 9
+call via
+.Fn msleep
+or the new
+.Fn mtx_sleep
+variant.
+These will atomically drop the mutex and reacquire it
+as part of waking up.
+This is often however a
+.Em BAD
+idea because it generally relies on you having
+such a good knowledge of all the call graph above you
+and what assumptions it is making that there are a lot
+of ways to make hard-to-find mistakes.
+For example you MUST re-test all the assumptions you made before,
+all the way up the call graph to where you got the lock.
+You can not just assume that mtx_sleep can be inserted anywhere.
+If any caller above you has any mutex or
+rwlock, your sleep, will cause a panic.
+If the sleep only happens rarely it may be years before the
+bad code path is found.
+.Ss Pool Mutexes
+A variant of regular mutexes where the allocation of the mutex is handled
+more by the system.
+.Ss Rw_locks
+Reader/writer locks allow shared access to protected data by multiple threads,
+or exclusive access by a single thread.
+The threads with shared access are known as
+.Em readers
+since they should only read the protected data.
+A thread with exclusive access is known as a
+.Em writer
+since it may modify protected data.
+.Pp
+Although reader/writer locks look very similar to
+.Xr sx 9
+(see below) locks, their usage pattern is different.
+Reader/writer locks can be treated as mutexes (see above and
+.Xr mutex 9 )
+with shared/exclusive semantics.
+More specifically, regular mutexes can be
+considered to be equivalent to a write-lock on an
+.Em rw_lock.
+In the future this may in fact
+become literally the fact.
+An
+.Em rw_lock
+can be locked while holding a regular mutex, but
+can
+.Em not
+be held while sleeping.
+The
+.Em rw_lock
+locks have priority propagation like mutexes, but priority
+can be propagated only to an exclusive holder.
+This limitation comes from the fact that shared owners
+are anonymous.
+Another important property is that shared holders of
+.Em rw_lock
+can recurse, but exclusive locks are not allowed to recurse.
+This ability should not be used lightly and
+.Em may go away.
+Users of recursion in any locks should be prepared to
+defend their decision against vigorous criticism.
+.Ss Sx_locks
+Shared/exclusive locks are used to protect data that are read far more often
+than they are written.
+Mutexes are inherently more efficient than shared/exclusive locks, so
+shared/exclusive locks should be used prudently.
+The main reason for using an
+.Em sx_lock
+is that a thread may hold a shared or exclusive lock on an
+.Em sx_lock
+lock while sleeping.
+As a consequence of this however, an
+.Em sx_lock
+lock may not be acquired while holding a mutex.
+The reason for this is that, if one thread slept while holding an
+.Em sx_lock
+lock while another thread blocked on the same
+.Em sx_lock
+lock after acquiring a mutex, then the second thread would effectively
+end up sleeping while holding a mutex, which is not allowed.
+The
+.Em sx_lock
+should be considered to be closely related to
+.Xr sleep 9 .
+In fact it could in some cases be
+considered a conditional sleep.
+.Ss Turnstiles
+Turnstiles are used to hold a queue of threads blocked on
+non-sleepable locks.
+Sleepable locks use condition variables to implement their queues.
+Turnstiles differ from a sleep queue in that turnstile queue's
+are assigned to a lock held by an owning thread.
+Thus, when one thread is enqueued onto a turnstile, it can lend its
+priority to the owning thread.
+If this sounds confusing, we need to describe it better.
+.Ss Semaphores
+.Ss Condition variables
+Condition variables are used in conjunction with mutexes to wait for
+conditions to occur.
+A thread must hold the mutex before calling the
+.Fn cv_wait* ,
+functions.
+When a thread waits on a condition, the mutex
+is atomically released before the thread is blocked, then reacquired
+before the function call returns.
+.Ss Giant
+Giant is a special instance of a sleep lock.
+It has several special characteristics.
+.Bl -enum
+.It
+It is recursive.
+.It
+Drivers can request that Giant be locked around them, but this is
+going away.
+.It
+You can sleep while it has recursed, but other recursive locks cannot.
+.It
+Giant must be locked first before other locks.
+.It
+There are places in the kernel that drop Giant and pick it back up
+again.
+Sleep locks will do this before sleeping.
+Parts of the Network or VM code may do this as well, depending on the
+setting of a sysctl.
+This means that you cannot count on Giant keeping other code from
+running if your code sleeps, even if you want it to.
+.El
+.Ss Sleep/wakeup
+The functions
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+.Fn pause ,
+.Fn wakeup ,
+and
+.Fn wakeup_one
+handle event-based thread blocking.
+If a thread must wait for an external event, it is put to sleep by
+.Fn tsleep ,
+.Fn msleep ,
+.Fn msleep_spin ,
+or
+.Fn pause .
+Threads may also wait using one of the locking primitive sleep routines
+.Xr mtx_sleep 9 ,
+.Xr rw_sleep 9 ,
+or
+.Xr sx_sleep 9 .
+.Pp
+The parameter
+.Fa chan
+is an arbitrary address that uniquely identifies the event on which
+the thread is being put to sleep.
+All threads sleeping on a single
+.Fa chan
+are woken up later by
+.Fn wakeup ,
+often called from inside an interrupt routine, to indicate that the
+resource the thread was blocking on is available now.
+.Pp
+Several of the sleep functions including
+.Fn msleep ,
+.Fn msleep_spin ,
+and the locking primitive sleep routines specify an additional lock
+parameter.
+The lock will be released before sleeping and reacquired
+before the sleep routine returns.
+If
+.Fa priority
+includes the
+.Dv PDROP
+flag, then the lock will not be reacquired before returning.
+The lock is used to ensure that a condition can be checked atomically,
+and that the current thread can be suspended without missing a
+change to the condition, or an associated wakeup.
+In addition, all of the sleep routines will fully drop the
+.Va Giant
+mutex
+(even if recursed)
+while the thread is suspended and will reacquire the
+.Va Giant
+mutex before the function returns.
+.Pp
+.Ss lockmanager locks
+Largely deprecated.
+See the
+.Xr lock 9
+page for more information.
+I don't know what the downsides are but I'm sure someone will fill in this part.
+.Sh Usage tables.
+.Ss Interaction table.
+The following table shows what you can and can not do if you hold
+one of the synchronization primitives discussed here:
+(someone who knows what they are talking about should write this table)
+.Bl -column ".Ic xxxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXX" -offset indent
+.It Xo
+.Em "You have: You want:" Ta Spin_mtx Ta Slp_mtx Ta sx_lock Ta rw_lock Ta sleep
+.Xc
+.It Ic SPIN mutex Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no-3
+.It Ic Sleep mutex Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&no-3
+.It Ic sx_lock Ta \&ok Ta \&no Ta \&ok-2 Ta \&no Ta \&ok-4
+.It Ic rw_lock Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&no-3
+.El
+.Pp
+.Em *1
+Recursion is defined per lock.
+Lock order is important.
+.Pp
+.Em *2
+readers can recurse though writers can not.
+Lock order is important.
+.Pp
+.Em *3
+There are calls atomically release this primitive when going to sleep
+and reacquire it on wakeup (e.g.
+.Fn mtx_sleep ,
+.Fn rw_sleep
+and
+.Fn msleep_spin
+).
+.Pp
+.Em *4
+Though one can sleep holding an sx lock, one can also use
+.Fn sx_sleep
+which atomically release this primitive when going to sleep and
+reacquire it on wakeup.
+.Ss Context mode table.
+The next table shows what can be used in different contexts.
+At this time this is a rather easy to remember table.
+.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXX" -offset indent
+.It Xo
+.Em "Context:" Ta Spin_mtx Ta Slp_mtx Ta sx_lock Ta rw_lock Ta sleep
+.Xc
+.It interrupt: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no
+.It idle: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no
+.El
+.Sh SEE ALSO
+.Xr condvar 9 ,
+.Xr lock 9 ,
+.Xr mtx_pool 9 ,
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr sema 9 ,
+.Xr sleep 9 ,
+.Xr sx 9 ,
+.Xr LOCK_PROFILING 9 ,
+.Xr WITNESS 9
+.Sh HISTORY
+These
+functions appeared in
+.Bsx 4.1
+through
+.Fx 7.0
Index: zone.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/zone.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/zone.9 -L share/man/man9/zone.9 -u -r1.2 -r1.3
--- share/man/man9/zone.9
+++ share/man/man9/zone.9
@@ -23,10 +23,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/zone.9,v 1.26 2004/01/25 11:39:41 des Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/share/man/man9/zone.9,v 1.28 2006/10/21 16:08:21 ru Exp $
.\"
-.Dd July 21, 2003
+.Dd October 2, 2006
.Dt ZONE 9
.Os
.Sh NAME
@@ -66,27 +65,9 @@
are not, and provides functions for allocating items from the zone and
for releasing them back (which makes them available for later use).
.Pp
-The zone allocator stores state information inside the items proper
-while they are not allocated,
-so structures that will be managed by the zone allocator
-and wish to use the type stable property of zones by leaving some fields
-pre-filled between allocations, must reserve
-two pointers at the very beginning for internal use by the zone
-allocator, as follows:
-.Bd -literal -offset indent
-struct my_item {
- struct my_item *z_rsvd1;
- struct my_item *z_rsvd2;
- /* rest of structure */
-};
-.Ed
-.Pp
-Alternatively they should assume those entries corrupted
-after each allocation.
After the first allocation of an item,
it will have been cleared to zeroes, however subsequent allocations
-will retain the contents as of the last free, with the exception of the
-fields mentioned above.
+will retain the contents as of the last free.
.Pp
The
.Fn uma_zcreate
Index: disk.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/disk.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/disk.9 -L share/man/man9/disk.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/disk.9
+++ share/man/man9/disk.9
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/disk.9,v 1.7 2004/06/21 14:11:45 mpp Exp $
+.\" $FreeBSD: src/share/man/man9/disk.9,v 1.10 2007/05/05 17:12:15 pjd Exp $
.\"
.Dd February 18, 2004
.Dt DISK 9
@@ -35,7 +35,7 @@
.Nd kernel disk storage API
.Sh SYNOPSIS
.In geom/geom_disk.h
-.Ft struct *disk
+.Ft struct disk *
.Fn disk_alloc void
.Ft void
.Fn disk_create "struct disk *disk" "int version"
@@ -94,8 +94,10 @@
(maintained by device driver),
.Dv DISKFLAG_OPEN
(maintained by storage framework),
-and
.Dv DISKFLAG_CANDELETE
+(maintained by device driver),
+and
+.Dv DISKFLAG_CANFLUSHCACHE
(maintained by device driver).
.It Vt "const char *" Va d_name
Holds the name of the storage device class, e.g.,
@@ -170,6 +172,8 @@
Please see
.Pa src/sys/geom/notes
for details.
+.It Vt char Va d_ident[DISK_IDENT_SIZE]
+This field can and should be used to store disk's serial number.
.El
.Ss Driver Private Data
This field may be used by the device driver to store a pointer to
Index: VFS_ROOT.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/VFS_ROOT.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/VFS_ROOT.9 -L share/man/man9/VFS_ROOT.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/VFS_ROOT.9
+++ share/man/man9/VFS_ROOT.9
@@ -26,9 +26,9 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/VFS_ROOT.9,v 1.10 2004/07/12 09:06:51 alfred Exp $
+.\" $FreeBSD: src/share/man/man9/VFS_ROOT.9,v 1.12 2006/09/18 15:24:20 ru Exp $
.\"
-.Dd July 24, 1996
+.Dd August 26, 2006
.Os
.Dt VFS_ROOT 9
.Sh NAME
@@ -39,14 +39,23 @@
.In sys/mount.h
.In sys/vnode.h
.Ft int
-.Fn VFS_ROOT "struct mount *mp" "struct vnode **vpp" "struct thread *td"
+.Fn VFS_ROOT "struct mount *mp" "int flags" "struct vnode **vpp" "struct thread *td"
.Sh DESCRIPTION
Return a locked vnode for the root directory of the file system.
.Pp
Its arguments are:
-.Bl -tag -width vpp
+.Bl -tag -width flags
.It Fa mp
The file system.
+.It Fa flags
+The lock type.
+Could be
+.Dv LK_EXCLUSIVE
+or
+.Dv LK_SHARED .
+File system is free to ignore the
+.Fa flags
+argument and instead acquire an exclusive lock.
.It Fa vpp
Return parameter for the root vnode.
.It Fa td
Index: pci.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/pci.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/pci.9 -L share/man/man9/pci.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/pci.9
+++ share/man/man9/pci.9
@@ -23,9 +23,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/pci.9,v 1.9 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/pci.9,v 1.10 2007/09/30 11:05:13 marius Exp $
.\"
-.Dd January 22, 2005
+.Dd September 30, 2007
.Dt PCI 9
.Os
.Sh NAME
@@ -39,6 +39,7 @@
.Nm pci_set_powerstate ,
.Nm pci_get_powerstate ,
.Nm pci_find_bsf ,
+.Nm pci_find_dbsf ,
.Nm pci_find_device
.Nd PCI bus interface
.Sh SYNOPSIS
@@ -65,6 +66,8 @@
.Ft device_t
.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func"
.Ft device_t
+.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func"
+.Ft device_t
.Fn pci_find_device "uint16_t vendor" "uint16_t device"
.Sh DESCRIPTION
The
@@ -198,6 +201,30 @@
number actually refers to the number of the device on the bus,
which does not necessarily indicate its geographic location
in terms of a physical slot.
+Note that in case the system has multiple PCI domains,
+the
+.Fn pci_find_bsf
+function only searches the first one.
+Actually, it is equivalent to:
+.Bd -literal -offset indent
+pci_find_dbsf(0, bus, slot, func);
+.Ed
+.Pp
+The
+.Fn pci_find_dbsf
+function looks up the
+.Vt device_t
+of a PCI device, given its
+.Fa domain ,
+.Fa bus ,
+.Fa slot ,
+and
+.Fa func .
+The
+.Fa slot
+number actually refers to the number of the device on the bus,
+which does not necessarily indicate its geographic location
+in terms of a physical slot.
.Pp
The
.Fn pci_find_device
--- /dev/null
+++ share/man/man9/rwlock.9
@@ -0,0 +1,286 @@
+.\" Copyright (c) 2006 Gleb Smirnoff <glebius at FreeBSD.org>
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/rwlock.9,v 1.10.2.1 2007/11/27 14:08:14 attilio Exp $
+.\"
+.Dd November 25, 2007
+.Dt RWLOCK 9
+.Os
+.Sh NAME
+.Nm rwlock ,
+.Nm rw_init ,
+.Nm rw_init_flags,
+.Nm rw_destroy ,
+.Nm rw_rlock ,
+.Nm rw_wlock ,
+.Nm rw_runlock ,
+.Nm rw_wunlock ,
+.Nm rw_try_upgrade ,
+.Nm rw_downgrade ,
+.Nm rw_sleep ,
+.Nm rw_initialized ,
+.Nm rw_wowned ,
+.Nm rw_assert ,
+.Nm RW_SYSINIT
+.Nd kernel reader/writer lock
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/lock.h
+.In sys/rwlock.h
+.Ft void
+.Fn rw_init "struct rwlock *rw" "const char *name"
+.Ft void
+.Fn rw_init_flags "struct rwlock *rw" "const char *name" "int opts"
+.Ft void
+.Fn rw_destroy "struct rwlock *rw"
+.Ft void
+.Fn rw_rlock "struct rwlock *rw"
+.Ft void
+.Fn rw_wlock "struct rwlock *rw"
+.Ft void
+.Fn rw_runlock "struct rwlock *rw"
+.Ft void
+.Fn rw_wunlock "struct rwlock *rw"
+.Ft int
+.Fn rw_try_upgrade "struct rwlock *rw"
+.Ft void
+.Fn rw_downgrade "struct rwlock *rw"
+.Ft int
+.Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
+.Ft int
+.Fn rw_initialized "struct rwlock *rw"
+.Ft int
+.Fn rw_wowned "struct rwlock *rw"
+.Pp
+.Cd "options INVARIANTS"
+.Cd "options INVARIANT_SUPPORT"
+.Ft void
+.Fn rw_assert "struct rwlock *rw" "int what"
+.In sys/kernel.h
+.Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc"
+.Sh DESCRIPTION
+Reader/writer locks allow shared access to protected data by multiple threads,
+or exclusive access by a single thread.
+The threads with shared access are known as
+.Em readers
+since they only read the protected data.
+A thread with exclusive access is known as a
+.Em writer
+since it can modify protected data.
+.Pp
+Although reader/writer locks look very similar to
+.Xr sx 9
+locks, their usage pattern is different.
+Reader/writer locks can be treated as mutexes (see
+.Xr mutex 9 )
+with shared/exclusive semantics.
+Unlike
+.Xr sx 9 ,
+an
+.Nm
+can be locked while holding a non-spin mutex, and an
+.Nm
+cannot be held while sleeping.
+The
+.Nm
+locks have priority propagation like mutexes, but priority
+can be propagated only to an exclusive holder.
+This limitation comes from the fact that shared owners
+are anonymous.
+Another important property is that shared holders of
+.Nm
+can recurse,
+and exclusive locks can be made recursive selectively.
+.Ss Macros and Functions
+.Bl -tag -width indent
+.It Fn rw_init "struct rwlock *rw" "const char *name"
+Initialize structure located at
+.Fa rw
+as reader/writer lock, described by name
+.Fa name .
+The description is used solely for debugging purposes.
+This function must be called before any other operations
+on the lock.
+.It Fn rw_init_flags "struct rwlock *rw" "const char *name" "int opts"
+Initialize the rw lock just like the
+.Fn rw_init
+function, but specifying a set of optional flags to alter the
+behaviour of
+.Fa rw ,
+through the
+.Fa opts
+argument.
+It contains one or more of the following flags:
+.Bl -tag -width ".Dv RW_NOPROFILE"
+.It Dv RW_DUPOK
+Witness should not log messages about duplicate locks being acquired.
+.It Dv RW_NOPROFILE
+Do not profile this lock.
+.It Dv RW_NOWITNESS
+Instruct
+.Xr witness 4
+to ignore this lock.
+.It Dv RW_QUIET
+Do not log any operations for this lock via
+.Xr ktr 4 .
+.It Dv RW_RECURSE
+Allow threads to recursively acquire exclusive locks for
+.Fa rw .
+.It Fn rw_rlock "struct rwlock *rw"
+Lock
+.Fa rw
+as a reader.
+If any thread holds this lock exclusively, the current thread blocks,
+and its priority is propagated to the exclusive holder.
+The
+.Fn rw_rlock
+function can be called when the thread has already acquired reader
+access on
+.Fa rw .
+This is called
+.Dq "recursing on a lock" .
+.It Fn rw_wlock "struct rwlock *rw"
+Lock
+.Fa rw
+as a writer.
+If there are any shared owners of the lock, the current thread blocks.
+The
+.Fn rw_wlock
+function can be called recursively only if
+.Fa rw
+has been initialized with the
+.Dv RW_RECURSE
+option enabled.
+.It Fn rw_runlock "struct rwlock *rw"
+This function releases a shared lock previously acquired by
+.Fn rw_rlock .
+.It Fn rw_wunlock "struct rwlock *rw"
+This function releases an exclusive lock previously acquired by
+.Fn rw_wlock .
+.It Fn rw_try_upgrade "struct rwlock *rw"
+Attempt to upgrade a single shared lock to an exclusive lock.
+The current thread must hold a shared lock of
+.Fa rw .
+This will only succeed if the current thread holds the only shared lock on
+.Fa rw ,
+and it only holds a single shared lock.
+If the attempt succeeds
+.Fn rw_try_upgrade
+will return a non-zero value,
+and the current thread will hold an exclusive lock.
+If the attempt fails
+.Fn rw_try_upgrade
+will return zero,
+and the current thread will still hold a shared lock.
+.It Fn rw_downgrade "struct rwlock *rw"
+Convert an exclusive lock into a single shared lock.
+The current thread must hold an exclusive lock of
+.Fa rw .
+.It Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
+Atomically release
+.Fa rw
+while waiting for an event.
+For more details on the parameters to this function,
+see
+.Xr sleep 9 .
+.It Fn rw_initialized "struct rwlock *rw"
+This function returns non-zero if
+.Fa rw
+has been initialized, and zero otherwise.
+.It Fn rw_destroy "struct rwlock *rw"
+This functions destroys a lock previously initialized with
+.Fn rw_init .
+The
+.Fa rw
+lock must be unlocked.
+.It Fn rw_wowned "struct rwlock *rw"
+This function returns a non-zero value if the current thread owns an
+exclusive lock on
+.Fa rw .
+.It Fn rw_assert "struct rwlock *rw" "int what"
+This function allows assertions specified in
+.Fa what
+to be made about
+.Fa rw .
+If the assertions are not true and the kernel is compiled
+with
+.Cd "options INVARIANTS"
+and
+.Cd "options INVARIANT_SUPPORT" ,
+the kernel will panic.
+Currently the following assertions are supported:
+.Bl -tag -width ".Dv RA_UNLOCKED"
+.It Dv RA_LOCKED
+Assert that current thread holds either a shared or exclusive lock
+of
+.Fa rw .
+.It Dv RA_RLOCKED
+Assert that current thread holds a shared lock of
+.Fa rw .
+.It Dv RA_WLOCKED
+Assert that current thread holds an exclusive lock of
+.Fa rw .
+.It Dv RA_UNLOCKED
+Assert that current thread holds neither a shared nor exclusive lock of
+.Fa rw .
+.El
+.El
+.Sh SEE ALSO
+.Xr locking 9 ,
+.Xr mutex 9 ,
+.Xr panic 9 ,
+.Xr sema 9 ,
+.Xr sx 9
+.Sh HISTORY
+These
+functions appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+facility was written by
+.An "John Baldwin" .
+This manual page was written by
+.An "Gleb Smirnoff" .
+.Sh BUGS
+If
+.Dv WITNESS
+is not included in the kernel,
+then it is impossible to assert that the current thread does or does not
+hold a read lock.
+In the
+.Pf non- Dv WITNESS
+case, the
+.Dv RA_LOCKED
+and
+.Dv RA_RLOCKED
+assertions merely check that some thread holds a read lock.
+.Pp
+Reader/writer is a bit of an awkward name.
+An
+.Nm
+can also be called a
+.Dq Robert Watson
+lock if desired.
Index: vm_page_wire.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_wire.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_wire.9 -L share/man/man9/vm_page_wire.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_wire.9
+++ share/man/man9/vm_page_wire.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_wire.9,v 1.3 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_WIRE 9
--- /dev/null
+++ share/man/man9/usbdi.9
@@ -0,0 +1,1253 @@
+.\"
+.\" Copyright (c) 2005 Ian Dowse <iedowse at FreeBSD.org>
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/usbdi.9,v 1.2 2006/12/14 14:33:13 mpp Exp $
+.Dd December 30, 2005
+.Os
+.Dt USBDI 9
+.Sh NAME
+.Nm usb_detach_wait ,
+.Nm usb_detach_wakeup ,
+.Nm usb_find_desc ,
+.Nm usbd_abort_default_pipe ,
+.Nm usbd_abort_pipe ,
+.Nm usbd_alloc_buffer ,
+.Nm usbd_alloc_xfer ,
+.Nm usbd_bulk_transfer ,
+.Nm usbd_clear_endpoint_stall ,
+.Nm usbd_clear_endpoint_stall_async ,
+.Nm usbd_clear_endpoint_toggle ,
+.Nm usbd_close_pipe ,
+.Nm usbd_device2interface_handle ,
+.Nm usbd_devinfo ,
+.Nm usbd_do_request ,
+.Nm usbd_do_request_async ,
+.Nm usbd_do_request_flags ,
+.Nm usbd_do_request_flags_pipe ,
+.Nm usbd_dopoll ,
+.Nm usbd_endpoint_count ,
+.Nm usbd_errstr ,
+.Nm usbd_fill_deviceinfo ,
+.Nm usbd_find_edesc ,
+.Nm usbd_find_idesc ,
+.Nm usbd_free_buffer ,
+.Nm usbd_free_xfer ,
+.Nm usbd_get_buffer ,
+.Nm usbd_get_config ,
+.Nm usbd_get_config_desc ,
+.Nm usbd_get_config_desc_full ,
+.Nm usbd_get_config_descriptor ,
+.Nm usbd_get_device_descriptor ,
+.Nm usbd_get_endpoint_descriptor ,
+.Nm usbd_get_interface_altindex ,
+.Nm usbd_get_interface_descriptor ,
+.Nm usbd_get_no_alts ,
+.Nm usbd_get_quirks ,
+.Nm usbd_get_speed ,
+.Nm usbd_get_string ,
+.Nm usbd_get_string_desc ,
+.Nm usbd_get_xfer_status ,
+.Nm usbd_interface2device_handle ,
+.Nm usbd_interface2endpoint_descriptor ,
+.Nm usbd_interface_count ,
+.Nm usbd_intr_transfer ,
+.Nm usbd_open_pipe ,
+.Nm usbd_open_pipe_intr ,
+.Nm usbd_pipe2device_handle ,
+.Nm usbd_ratecheck ,
+.Nm usbd_set_config_index ,
+.Nm usbd_set_config_no ,
+.Nm usbd_set_interface ,
+.Nm usbd_set_polling ,
+.Nm usbd_setup_default_xfer ,
+.Nm usbd_setup_isoc_xfer ,
+.Nm usbd_setup_xfer ,
+.Nm usbd_sync_transfer ,
+.Nm usbd_transfer
+.Nd Universal Serial Bus driver programming interface
+.Sh SYNOPSIS
+.In dev/usb/usb.h
+.In dev/usb/usbdi.h
+.In dev/usb/usbdi_util.h
+.Pp
+.Ft void
+.Fn usb_detach_wait "device_ptr_t dv"
+.Ft void
+.Fn usb_detach_wakeup "device_ptr_t dv"
+.Ft "const usb_descriptor_t *"
+.Fn usb_find_desc "usbd_device_handle dev" "int type" "int subtype"
+.Ft usbd_status
+.Fn usbd_abort_default_pipe "usbd_device_handle dev"
+.Ft usbd_status
+.Fn usbd_abort_pipe "usbd_pipe_handle pipe"
+.Ft "void *"
+.Fn usbd_alloc_buffer "usbd_xfer_handle xfer" "u_int32_t size"
+.Ft usbd_xfer_handle
+.Fn usbd_alloc_xfer "usbd_device_handle dev"
+.Ft usbd_status
+.Fo usbd_bulk_transfer
+.Fa "usbd_xfer_handle xfer"
+.Fa "usbd_pipe_handle pipe"
+.Fa "u_int16_t flags"
+.Fa "u_int32_t timeout"
+.Fa "void *buf"
+.Fa "u_int32_t *size"
+.Fa "char *lbl"
+.Fc
+.Ft usbd_status
+.Fn usbd_clear_endpoint_stall "usbd_pipe_handle pipe"
+.Ft usbd_status
+.Fn usbd_clear_endpoint_stall_async "usbd_pipe_handle"
+.Ft void
+.Fn usbd_clear_endpoint_toggle "usbd_pipe_handle pipe"
+.Ft usbd_status
+.Fn usbd_close_pipe "usbd_pipe_handle pipe"
+.Ft usbd_status
+.Fo usbd_device2interface_handle
+.Fa "usbd_device_handle dev"
+.Fa "u_int8_t ifaceno"
+.Fa "usbd_interface_handle *iface"
+.Fc
+.Ft void
+.Fn usbd_devinfo "usbd_device_handle dev" "int showclass" "char *cp"
+.Ft usbd_status
+.Fo usbd_do_request
+.Fa "usbd_device_handle dev"
+.Fa "usb_device_request_t *req"
+.Fa "void *data"
+.Fc
+.Ft usbd_status
+.Fo usbd_do_request_async
+.Fa "usbd_device_handle dev"
+.Fa "usb_device_request_t *req"
+.Fa "void *data"
+.Fc
+.Ft usbd_status
+.Fo usbd_do_request_flags
+.Fa "usbd_device_handle dev"
+.Fa "usb_device_request_t *req"
+.Fa "void *data"
+.Fa "u_int16_t flags"
+.Fa "int *actlen"
+.Fa "u_int32_t timo"
+.Fc
+.Ft usbd_status
+.Fo usbd_do_request_flags_pipe
+.Fa "usbd_device_handle dev"
+.Fa "usbd_pipe_handle pipe"
+.Fa "usb_device_request_t *req"
+.Fa "void *data"
+.Fa "u_int16_t flags"
+.Fa "int *actlen"
+.Fa "u_int32_t timeout"
+.Fc
+.Ft void
+.Fn usbd_dopoll "usbd_interface_handle iface"
+.Ft usbd_status
+.Fn usbd_endpoint_count "usbd_interface_handle iface" "u_int8_t *count"
+.Ft "const char *"
+.Fn usbd_errstr "usbd_status err"
+.Ft void
+.Fo usbd_fill_deviceinfo
+.Fa "usbd_device_handle dev"
+.Fa "struct usb_device_info *di"
+.Fa "int usedev"
+.Fc
+.Ft "usb_endpoint_descriptor_t *"
+.Fo usbd_find_edesc
+.Fa "usb_config_descriptor_t *cd"
+.Fa "int ifaceidx"
+.Fa "int altidx"
+.Fa "int endptidx"
+.Fc
+.Ft "usb_interface_descriptor_t *"
+.Fn usbd_find_idesc "usb_config_descriptor_t *cd" "int ifaceidx" "int altidx"
+.Ft void
+.Fn usbd_free_buffer "usbd_xfer_handle xfer"
+.Ft usbd_status
+.Fn usbd_free_xfer "usbd_xfer_handle xfer"
+.Ft "void *"
+.Fn usbd_get_buffer "usbd_xfer_handle xfer"
+.Ft usbd_status
+.Fn usbd_get_config "usbd_device_handle dev" "u_int8_t *conf"
+.Ft usbd_status
+.Fo usbd_get_config_desc
+.Fa "usbd_device_handle dev"
+.Fa "int confidx"
+.Fa "usb_config_descriptor_t *d"
+.Fc
+.Ft usbd_status
+.Fo usbd_get_config_desc_full
+.Fa "usbd_device_handle dev"
+.Fa "int conf"
+.Fa "void *d"
+.Fa "int size"
+.Fc
+.Ft "usb_config_descriptor_t *"
+.Fn usbd_get_config_descriptor "usbd_device_handle dev"
+.Ft "usb_device_descriptor_t *"
+.Fn usbd_get_device_descriptor "usbd_device_handle dev"
+.Ft "usb_endpoint_descriptor_t *"
+.Fo usbd_get_endpoint_descriptor
+.Fa "usbd_interface_handle iface"
+.Fa "u_int8_t address"
+.Fc
+.Ft int
+.Fn usbd_get_interface_altindex "usbd_interface_handle iface"
+.Ft "usb_interface_descriptor_t *"
+.Fn usbd_get_interface_descriptor "usbd_interface_handle iface"
+.Ft int
+.Fn usbd_get_no_alts "usb_config_descriptor_t *cdesc" "int ifaceno"
+.Ft "const struct usbd_quirks *"
+.Fn usbd_get_quirks "usbd_device_handle dev"
+.Ft int
+.Fn usbd_get_speed "usbd_device_handle dev"
+.Ft usbd_status
+.Fn usbd_get_string "usbd_device_handle dev" "int si" "char *buf"
+.Ft usbd_status
+.Fo usbd_get_string_desc
+.Fa "usbd_device_handle dev"
+.Fa "int sindex"
+.Fa "int langid"
+.Fa "usb_string_descriptor_t *sdesc"
+.Fa "int *sizep"
+.Fc
+.Ft void
+.Fo usbd_get_xfer_status
+.Fa "usbd_xfer_handle xfer"
+.Fa "usbd_private_handle *priv"
+.Fa "void **buffer"
+.Fa "u_int32_t *count"
+.Fa "usbd_status *status"
+.Fc
+.Ft void
+.Fo usbd_interface2device_handle
+.Fa "usbd_interface_handle iface"
+.Fa "usbd_device_handle *dev"
+.Fc
+.Ft "usb_endpoint_descriptor_t *"
+.Fo usbd_interface2endpoint_descriptor
+.Fa "usbd_interface_handle iface"
+.Fa "u_int8_t index"
+.Fc
+.Ft usbd_status
+.Fn usbd_interface_count "usbd_device_handle dev" "u_int8_t *count"
+.Ft usbd_status
+.Fo usbd_intr_transfer
+.Fa "usbd_xfer_handle xfer"
+.Fa "usbd_pipe_handle pipe"
+.Fa "u_int16_t flags"
+.Fa "u_int32_t timeout"
+.Fa "void *buf"
+.Fa "u_int32_t *size"
+.Fa "char *lbl"
+.Fc
+.Ft usbd_status
+.Fo usbd_open_pipe
+.Fa "usbd_interface_handle iface"
+.Fa "u_int8_t address"
+.Fa "u_int8_t flags"
+.Fa "usbd_pipe_handle *pipe"
+.Fc
+.Ft usbd_status
+.Fo usbd_open_pipe_intr
+.Fa "usbd_interface_handle iface"
+.Fa "u_int8_t address"
+.Fa "u_int8_t flags"
+.Fa "usbd_pipe_handle *pipe"
+.Fa "usbd_private_handle priv"
+.Fa "void *buffer"
+.Fa "u_int32_t len"
+.Fa "usbd_callback cb"
+.Fa "int ival"
+.Fc
+.Ft usbd_device_handle
+.Fn usbd_pipe2device_handle "usbd_pipe_handle pipe"
+.Ft int
+.Fn usbd_ratecheck "struct timeval *last"
+.Ft usbd_status
+.Fn usbd_set_config_index "usbd_device_handle dev" "int index" "int msg"
+.Ft usbd_status
+.Fn usbd_set_config_no "usbd_device_handle dev" "int no" "int msg"
+.Ft usbd_status
+.Fn usbd_set_interface "usbd_interface_handle iface" "int altidx"
+.Ft void
+.Fn usbd_set_polling "usbd_device_handle dev" "int on"
+.Ft void
+.Fo usbd_setup_default_xfer
+.Fa "usbd_xfer_handle xfer"
+.Fa "usbd_device_handle dev"
+.Fa "usbd_private_handle priv"
+.Fa "u_int32_t timeout"
+.Fa "usb_device_request_t *req"
+.Fa "void *buffer"
+.Fa "u_int32_t length"
+.Fa "u_int16_t flags"
+.Fa "usbd_callback callback"
+.Fc
+.Ft void
+.Fo usbd_setup_isoc_xfer
+.Fa "usbd_xfer_handle xfer"
+.Fa "usbd_pipe_handle pipe"
+.Fa "usbd_private_handle priv"
+.Fa "u_int16_t *frlengths"
+.Fa "u_int32_t nframes"
+.Fa "u_int16_t flags"
+.Fa "usbd_callback callback"
+.Fc
+.Ft void
+.Fo usbd_setup_xfer
+.Fa "usbd_xfer_handle xfer"
+.Fa "usbd_pipe_handle pipe"
+.Fa "usbd_private_handle priv"
+.Fa "void *buffer"
+.Fa "u_int32_t length"
+.Fa "u_int16_t flags"
+.Fa "u_int32_t timeout"
+.Fa "usbd_callback callback"
+.Fc
+.Ft usbd_status
+.Fn usbd_sync_transfer "usbd_xfer_handle xfer"
+.Ft usbd_status
+.Fn usbd_transfer "usbd_xfer_handle xfer"
+.Sh DESCRIPTION
+The Universal Serial Bus (USB) driver programming interface provides
+USB peripheral drivers with a host controller independent API for
+controlling and communicating with USB peripherals.
+.Pp
+Typically, drivers will first use some combination of the functions
+.Fn usbd_set_config_no ,
+.Fn usbd_get_config_descriptor ,
+.Fn usbd_set_interface ,
+.Fn usbd_get_interface_descriptor ,
+.Fn usbd_device2interface_handle ,
+.Fn usbd_endpoint_count
+and
+.Fn usbd_interface2endpoint_descriptor
+to query the device's properties and prepare it for use.
+Drivers can then perform requests on the USB control pipe using
+.Fn usbd_do_request ,
+they can open pipes using the functions
+.Fn usbd_open_pipe
+and
+.Fn usbd_open_pipe_intr ,
+and perform transfers over these pipes using
+.Fn usbd_alloc_xfer ,
+.Fn usbd_setup_xfer
+and
+.Fn usbd_transfer .
+Finally, the functions
+.Fn usbd_abort_pipe ,
+.Fn usbd_close_pipe
+and
+.Fn usbd_free_xfer
+are used to cancel outstanding transfers, close open pipes and deallocate
+transfer structures.
+.Pp
+The
+.Fn usbd_get_device_descriptor
+function returns a pointer to the USB device descriptor for
+.Fa dev .
+See
+.Sx "USB Descriptors"
+below for information about the USB device descriptor.
+.Pp
+The
+.Fn usbd_get_config_desc
+function retrieves the specified configuration descriptor from the device.
+The
+.Fa confidx
+parameter specifies the configuration descriptor index, which must be less
+than the
+.Fa bNumConfigurations
+value in the device descriptor.
+The function
+.Fn usbd_get_config_desc_full
+retrieves a full configuration descriptor, which has all related interface
+and endpoint descriptors appended to a normal configuration descriptor.
+The parameter
+.Fa d
+should point to memory that is at least
+.Fa size
+bytes in length, and this should be at least as long as the
+.Fa wTotalLength
+value from the configuration descriptor.
+See
+.Sx "USB Descriptors"
+below for information about the USB configuration descriptor.
+.Pp
+The
+.Fn usbd_get_config
+function retrieves the current configuration number from the device, i.e.\&
+the
+.Fa bConfigurationValue
+value from the configuration that is active.
+If the device is unconfigured then
+.Dv USB_UNCONFIG_NO
+is returned.
+The current configuration can be changed by calling either
+.Fn usbd_set_config_index
+or
+.Fn usbd_set_config_no .
+The difference between these functions is that
+.Fn usbd_set_config_index
+accepts a configuration index number that is less than the
+.Fa bNumConfigurations
+value from the device descriptor, whereas
+.Fn usbd_set_config_no
+requires the
+.Fa bConfigurationValue
+value of the desired configuration to be provided instead.
+To unconfigure the device, supply a configuration index of
+.Dv USB_UNCONFIG_INDEX
+to
+.Fn usbd_set_config_index ,
+or else specify a configuration number of
+.Dv USB_UNCONFIG_NO
+to
+.Fn usbd_set_config_no .
+.Pp
+The
+.Fn usbd_get_config_descriptor
+function returns a pointer to an in-memory copy of the full configuration
+descriptor of the configuration that is currently active.
+The returned pointer remains valid until the device configuration
+is changed using
+.Fn usbd_set_config_index
+or
+.Fn usbd_set_config_no .
+If the device is unconfigured then
+.Dv NULL
+is returned instead.
+.Pp
+The function
+.Fn usbd_interface_count
+returns the number of interfaces available in the current device
+configuration.
+The
+.Fn usbd_get_no_alts
+function determines the number of alternate interfaces in a full
+configuration descriptor by counting the interface descriptors with
+.Fa bInterfaceNumber
+equal to
+.Fa ifaceno
+(the count includes alternate index zero).
+The
+.Fn usbd_find_idesc
+function locates an interface descriptor within a full configuration
+descriptor.
+The
+.Fa ifaceidx
+parameter specifies the interface index number, which should be less than
+the number of interfaces in the configuration descriptor (i.e.\& the value
+returned by
+.Fn usbd_interface_count
+or the
+.Fa bNumInterface
+field from the configuration descriptor).
+An alternate interface can be specified using a non-zero
+.Fa altidx ,
+which should be less than the value returned by
+.Fn usbd_get_no_alts .
+The return value is a pointer to the requested interface descriptor
+within the full configuration descriptor, or
+.Dv NULL
+if the specified interface descriptor does not exist.
+Note that the
+.Fa altidx
+parameter specifies the alternate setting by index number starting
+at zero; it is not the alternate setting number defined in the
+interface descriptor.
+.Pp
+The function
+.Fn usbd_find_edesc
+locates an endpoint descriptor within a full configuration descriptor.
+The
+.Fa ifaceidx
+and
+.Fa altidx
+parameters are the same as described for
+.Fn usbd_find_idesc ,
+and the
+.Fa endptidx
+parameter is an endpoint index number that should be less than the
+.Fa bNumEndpoints
+field in the interface descriptor.
+The return value is a pointer to the requested endpoint descriptor
+within the full configuration descriptor, or
+.Dv NULL
+if the specified endpoint descriptor does not exist.
+Note that the
+.Fa altidx
+and
+.Fa endptidx
+parameters are index numbers starting at zero; they are not the
+alternate setting and endpoint address defined in the descriptors.
+.Pp
+The
+.Fn usbd_get_speed
+function returns the device speed.
+This can be
+.Dv USB_SPEED_LOW ,
+.Dv USB_SPEED_FULL
+or
+.Dv USB_SPEED_HIGH .
+.Pp
+USB devices optionally support string descriptors, which can be
+retrieved using the
+.Fn usbd_get_string
+or
+.Fn usbd_get_string_desc
+functions.
+Device, configuration and interface descriptors reference strings by
+an index number that can be supplied to these functions.
+The
+.Fn usbd_get_string
+function should be used unless a non-default language is required.
+It requires that
+.Fa buf
+points to a buffer of at least
+.Dv USB_MAX_STRING_LEN
+bytes in size.
+The
+.Fa si
+parameter specified which string to retrieve.
+.Pp
+The
+.Fn usb_find_desc
+function searches through the in-memory full configuration descriptor
+for the active configuration and finds the first descriptor that has a
+.Fa bDescriptorType
+equal to
+.Fa type ,
+and if
+.Fa subtype
+is not equal to
+.Dv USBD_SUBTYPE_ANY ,
+the descriptor must also have a
+.Fa bDescriptorSubtype
+equal to
+.Fa subtype .
+If found, then a pointer to the descriptor is returned.
+Otherwise,
+.Fn usb_find_desc
+returns
+.Dv NULL .
+The returned pointer is valid until the device configuration is changed using
+.Fn usbd_set_config_index
+or
+.Fn usbd_set_config_no .
+.Pp
+The USB driver interface uses opaque interface handles to refer to
+configuration interfaces.
+These handles remain valid until the device configuration is changed using
+.Fn usbd_set_config_index
+or
+.Fn usbd_set_config_no .
+The
+.Fn usbd_device2interface_handle
+function retrieves an interface handle.
+The
+.Fa ifaceno
+parameter is an interface index number starting at zero.
+If the device is configured and the specified interface exists, then
+.Dv USBD_NORMAL_COMPLETION
+is returned and the interface handle is stored in
+.Fa *iface .
+Otherwise an error code is returned and
+.Fa *iface
+is not changed.
+The
+.Fn usbd_interface2device_handle
+function retrieves the device handle from an interface handle.
+This is just for convenience to save passing around the device
+handle as well as the interface handle.
+The
+.Fn usbd_set_interface
+function changes the alternate setting number for an interface to
+the alternate setting identified by the zero-based index number
+.Fa altidx .
+This operation invalidates any existing endpoints on this
+interface and their descriptors.
+The
+.Fn usbd_get_interface_altindex
+function returns the current alternative setting index as was
+specified when calling
+.Fn usbd_set_interface .
+The
+.Fn usbd_endpoint_count
+function retrieves the number of endpoints associated with the
+specified interface.
+The
+.Fn usbd_interface2endpoint_descriptor
+function returns a pointer to an in-memory endpoint descriptor for
+the endpoint that has an index number of
+.Fa index .
+This pointer remains valid until the configuration or alternate setting
+number are changed.
+The function
+.Fn usbd_get_endpoint_descriptor
+is like
+.Fn usbd_interface2endpoint_descriptor
+but it accepts a
+.Fa bEndpointAddress
+address value instead of an index.
+.Pp
+The
+.Fn usbd_fill_deviceinfo
+function fills out a
+.Vt usb_device_info
+structure with information about the device.
+The vendor and product names come from the device itself, falling back to
+a table lookup or just providing the IDs in hexadecimal.
+If
+.Fa usedev
+is zero then
+.Fn usbd_fill_deviceinfo
+will not attempt to retrieve the vendor and product names from the
+device.
+The usb_device_info structure is defined in
+.In dev/usb/usb.h
+as follows:
+.Bd -literal
+struct usb_device_info {
+ u_int8_t udi_bus;
+ u_int8_t udi_addr; /* device address */
+ usb_event_cookie_t udi_cookie;
+ char udi_product[USB_MAX_STRING_LEN];
+ char udi_vendor[USB_MAX_STRING_LEN];
+ char udi_release[8];
+ u_int16_t udi_productNo;
+ u_int16_t udi_vendorNo;
+ u_int16_t udi_releaseNo;
+ u_int8_t udi_class;
+ u_int8_t udi_subclass;
+ u_int8_t udi_protocol;
+ u_int8_t udi_config;
+ u_int8_t udi_speed;
+#define USB_SPEED_LOW 1
+#define USB_SPEED_FULL 2
+#define USB_SPEED_HIGH 3
+ int udi_power; /* power consumption in mA */
+ int udi_nports;
+ char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
+ /* hub only: addresses of devices on ports */
+ u_int8_t udi_ports[16];
+#define USB_PORT_ENABLED 0xff
+#define USB_PORT_SUSPENDED 0xfe
+#define USB_PORT_POWERED 0xfd
+}
+.Ed
+.Pp
+The
+.Fn usbd_devinfo
+function generates a string description of the USB device.
+The
+.Fa cp
+argument should point to a 1024-byte buffer (XXX the maximum length
+is approximately 320 chars, but there is no sanity checking and everything uses
+1024-character buffers).
+Device class information is included if the
+.Fa showclass
+parameter is non-zero.
+.Pp
+The
+.Fn usbd_get_quirks
+function returns information from a table of devices that require
+special workarounds in order to function correctly.
+The returned structure is defined in
+.In dev/usb/usb_quirks.h
+as follows:
+.Bd -literal
+struct usbd_quirks {
+ u_int32_t uq_flags; /* Device problems */
+};
+.Ed
+.Pp
+See
+.In dev/usb/usb_quirks.h
+for a list of all currently defined quirks.
+.Pp
+USB control requests are performed via
+.Vt usb_device_request_t
+structures, defined in
+.In dev/usb/usb.h
+as follows:
+.Bd -literal
+typedef struct {
+ uByte bmRequestType;
+ uByte bRequest;
+ uWord wValue;
+ uWord wIndex;
+ uWord wLength;
+} UPACKED usb_device_request_t;
+.Ed
+.Pp
+The
+.Fn usbd_do_request
+function performs a single request synchronously.
+The
+.Fa req
+parameter should point to a properly initialized
+.Vt usb_device_request_t ,
+and when the
+.Fa wLength
+field is non-zero,
+.Fa data
+should point at a buffer that is at least
+.Fa wLength
+bytes in length.
+The request timeout is set to 5 seconds, so the operation will fail
+with
+.Er USBD_TIMEOUT
+if the device does not respond within that time.
+The
+.Fn usbd_do_request_async
+function is like
+.Fn usbd_do_request ,
+but it does not wait for the request to complete before returning.
+This routine does not block so it can be used from contexts where
+sleeping is not allowed.
+Note that there is no notification mechanism to report when the
+operation completed nor is there a way to determine whether the
+request succeeded, so this function is of limited use.
+See
+.Fn usbd_setup_default_xfer
+and
+.Fn usbd_transfer
+for a way to invoke an asynchronous callback upon completion of
+a control request.
+The
+.Fn usbd_do_request_flags
+function is like
+.Fn usbd_do_request ,
+but additional flags can be specified, the timeout is configurable,
+and the actual number of bytes transferred is made available to the
+caller.
+The
+.Fn usbd_do_request_flags_pipe
+function uses a specified pipe instead of the default pipe.
+.Pp
+The function
+.Fn usbd_open_pipe
+creates a pipe connected to a specified endpoint on a specified interface.
+The parameter
+.Fa address
+should be the
+.Fa bEndpointAddress
+value from one of this interface's endpoint descriptors.
+If
+.Fa flags
+contains
+.Dv USBD_EXCLUSIVE_USE
+then the operation will only succeed if there are no open pipes
+already connected to the specified endpoint.
+The
+.Fn usbd_open_pipe_intr
+function creates an interrupt pipe connected to the specified endpoint.
+The parameter
+.Fa address
+should be the
+.Fa bEndpointAddress
+value from one of this interface's endpoint descriptors.
+The
+.Fa flags
+parameter is passed to
+.Fn usbd_setup_xfer .
+The
+.Fa buffer
+and
+.Fa len
+parameters define a buffer that is to be used for the interrupt transfers.
+The callback to be invoked each time a transfer completes is specified by
+.Fa cb ,
+and
+.Fa priv
+is an argument to be passed to the callback function.
+The
+.Fa ival
+parameter specifies the maximum acceptable interval between transfers;
+in practice the transfers may occur more frequently.
+The function
+.Fn usbd_pipe2device_handle
+returns the device associated with the specified
+.Fa pipe .
+.Pp
+The
+.Fn usbd_abort_pipe
+function aborts all active or waiting transfers on the specified pipe.
+Each transfer is aborted with a
+.Dv USBD_CANCELLED
+status; callback routines must detect this error code to ensure that
+they do not attempt to initiate a new transfer in response to one being
+aborted.
+This routine blocks while it is waiting for the hardware to complete
+processing of aborted transfers, so it is only safe to call it in
+contexts where sleeping is allowed.
+The function
+.Fn usbd_abort_default_pipe
+aborts all active or waiting transfers on the default pipe.
+Like
+.Fn usbd_abort_pipe ,
+it blocks waiting for the hardware processing to complete.
+.Pp
+When a pipe has no active or waiting transfers, the pipe may be closed
+using the
+.Fn usbd_close_pipe
+function.
+Once a pipe is closed, its pipe handle becomes invalid and may no longer
+be used.
+.Pp
+USB transfer handles are allocated using the function
+.Fn usbd_alloc_xfer
+and may be freed using
+.Fn usbd_free_xfer .
+.Pp
+The function
+.Fn usbd_setup_xfer
+initializes a transfer handle with the details of a transfer to or from
+a USB device.
+The
+.Fa xfer
+parameter specifies the transfer handle to initialize,
+.Fa pipe
+specifies the pipe on which the transfer is to take place, and
+.Fa priv
+is an argument that will be passed to callback function.
+The arguments
+.Fa buffer
+and
+.Fa length
+define the data buffer for the transfer.
+If
+.Fa length
+is zero then the
+.Fa buffer
+may be
+.Dv NULL .
+The
+.Fa flags
+parameter may contain the following flags:
+.Bl -tag -width ".Dv USBD_FORCE_SHORT_XFER"
+.It Dv USBD_NO_COPY
+This is used in association with
+.Fn usbd_alloc_buffer
+and
+.Fn usbd_free_buffer
+to use a dedicated DMA-capable buffer for the transfer.
+.It Dv USBD_SYNCHRONOUS
+Wait for the transfer to compete in
+.Fn usbd_transfer .
+.It Dv USBD_SHORT_XFER_OK
+Permit transfers shorter than the requested data length.
+.It Dv USBD_FORCE_SHORT_XFER
+Force a short transfer at the end of a write operation to let the
+device know that the transfer has ended.
+.El
+.Pp
+The
+.Fa timeout
+parameter specifies a timeout for the transfer in milliseconds.
+A value of
+.Dv USBD_NO_TIMEOUT
+indicates that no timeout should be configured.
+The parameter
+.Fa callback
+specifies the function to call when the transfer completes.
+Note that
+.Fn usbd_setup_xfer
+does not actually initiate the transfer.
+The
+.Fn usbd_setup_default_xfer
+initializes a control transfer for the default pipe.
+The
+.Fa req
+parameter should point at a completed
+.Vt usb_device_request_t
+structure.
+The function
+.Fa usbd_setup_isoc_xfer
+initializes a transfer for an isochronous pipe.
+.Pp
+The function
+.Fn usbd_transfer
+initiates a transfer.
+Normally it returns
+.Dv USBD_IN_PROGRESS
+to indicate that the transfer has been queued.
+If the USB stack is operating in polling mode, or if the transfer
+is synchronous, then
+.Dv USBD_NORMAL_COMPLETION
+may be returned.
+Other return values indicate that the transfer could not be
+initiated due to an error.
+The
+.Fn usbd_sync_transfer
+function executes a transfer synchronously.
+It will sleep waiting for the transfer to complete and then return
+the transfer status.
+Note that if the transfer has a callback routine, this will be
+invoked before
+.Fn usbd_sync_transfer
+returns.
+.Pp
+The
+.Fn usbd_intr_transfer
+and
+.Fn usbd_bulk_transfer
+functions set up a transfer and wait synchronously for it to complete
+but they allows signals to interrupt the wait.
+They returns
+.Dv USBD_INTERRUPTED
+if the transfer was interrupted by a signal.
+XXX these two functions are identical apart from their names.
+.Pp
+The function
+.Fn usbd_get_xfer_status
+retrieves various information from a completed transfer.
+If the
+.Fa priv
+parameter is not NULL then the callback private argument is
+stored in
+.Fa *priv .
+If
+.Fa buffer
+is not NULL then the transfer buffer pointer is stored in
+.Fa *buffer .
+The actual number of bytes transferred is stored in
+.Fa *count
+if
+.Fa count is not NULL.
+Finally, the transfer status is stored in
+.Fa *status
+if
+.Fa status
+is not NULL.
+.Pp
+The
+.Fn usbd_clear_endpoint_stall
+function clears an endpoint stall condition synchronously, i.e.\&
+it sleeps waiting for the stall clear request to complete.
+The function
+.Fn usbd_clear_endpoint_stall_async
+performs the same function asynchronously, but it provides no
+way to determine when the request completed, or whether it was
+successful.
+The
+.Fn usbd_clear_endpoint_toggle
+function instructs the host controller driver to reset the toggle bit
+on a pipe.
+This is used when manually clearing an endpoint stall using a
+control pipe request, in order to ensure that the host controller
+driver and the USB device restart with the same toggle value.
+.Pp
+Normally the USB subsystem maps and copies data to and from
+DMA-capable memory each time a transfer is performed.
+The function
+.Fn usbd_alloc_buffer
+allocates a permanent DMA-capable buffer associated with the
+transfer to avoid this overhead.
+The return value is the virtual address of the buffer.
+Any time that
+.Fn usbd_setup_xfer
+is called on the transfer with the
+.Dv USBD_NO_COPY
+flag enabled, the allocated buffer will be used directly and
+the
+.Fa buffer
+argument passed to
+.Fn usbd_setup_xfer
+will be ignored.
+The
+.Fn usbd_get_buffer
+function returns a pointer to the virtual address of a buffer previously
+allocated by
+.Fn usbd_alloc_buffer .
+Finally,
+.Fn usbd_free_buffer
+deallocates the buffer.
+.Pp
+The
+.Fn usbd_errstr
+function converts a status code into a string for display.
+.Pp
+The function
+.Fn usbd_set_polling
+enables or disables polling mode.
+In polling mode, all operations will busy-wait for the device to
+respond, so its use is effectively limited to boot time and kernel
+debuggers.
+It is important to match up calls that enable and disable polling
+mode, because the implementation just increments a polling reference
+count when
+.Fa on
+is non-zero and decrements it when
+.Fa on
+is zero.
+The
+.Fn usbd_dopoll
+causes the host controller driver to poll for any activity.
+This should only be used when polling mode is enabled.
+.Pp
+The
+.Fn usbd_ratecheck
+function is used to limit the rate at which error messages are
+printed to approximately once per second.
+The
+.Fa last
+argument should point at a persistent
+.Vt "struct timeval" .
+A value of 1 will be returned if a message should be printed, but if
+.Fn usbd_ratecheck
+has already been called with the same
+.Vt "struct timeval"
+parameter in the last second then 0 is returned and the error message
+should be suppressed.
+.Pp
+The functions
+.Fn usb_detach_wait
+and
+.Fn usb_detach_wakeup
+are used to wait for references to drain before completing the
+detachment of a device.
+The
+.Fn usb_detach_wait
+function will wait up to 60 seconds to receive a signal from
+.Fn usb_detach_wait .
+.Ss "USB Descriptors"
+The USB specification defines a number of standard descriptors by
+which USB devices report their attributes.
+These descriptors are fixed-format structures that all USB devices
+make available through USB control pipe requests.
+.Pp
+Every USB device has exactly one USB device descriptor.
+The USB subsystem retrieves this automatically when a device is
+attached, and a copy of the descriptor is kept in memory.
+The
+.Fn usbd_get_device_descriptor
+function returns a pointer to the descriptor.
+The device descriptor structure is defined in
+.In dev/usb/usb.h
+as follows:
+.Bd -literal
+typedef struct {
+ uByte bLength;
+ uByte bDescriptorType;
+ uWord bcdUSB;
+#define UD_USB_2_0 0x0200
+#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0)
+ uByte bDeviceClass;
+ uByte bDeviceSubClass;
+ uByte bDeviceProtocol;
+ uByte bMaxPacketSize;
+ /* The fields below are not part of the initial descriptor. */
+ uWord idVendor;
+ uWord idProduct;
+ uWord bcdDevice;
+ uByte iManufacturer;
+ uByte iProduct;
+ uByte iSerialNumber;
+ uByte bNumConfigurations;
+} UPACKED usb_device_descriptor_t;
+#define USB_DEVICE_DESCRIPTOR_SIZE 18
+.Ed
+.Pp
+USB devices have at least one configuration descriptor.
+The
+.Fa bNumConfigurations
+field of the device descriptor specifies the number of configuration
+descriptors that a device supports.
+The
+.Fn usbd_get_config_desc
+function retrieves a particular configuration descriptor from the device
+and the
+.Fn usbd_get_config_desc_full
+function retrieves a full
+.Fa wTotalLength
+length configuration descriptor, which includes all related interface
+and endpoint descriptors.
+Only one configuration may be active at a time.
+The
+.Fn usbd_set_config_index
+function activates a specified configuration.
+The configuration descriptor structure is defined in
+.In dev/usb/usb.h
+as follows:
+.Bd -literal
+typedef struct {
+ uByte bLength;
+ uByte bDescriptorType;
+ uWord wTotalLength;
+ uByte bNumInterface;
+ uByte bConfigurationValue;
+ uByte iConfiguration;
+ uByte bmAttributes;
+#define UC_BUS_POWERED 0x80
+#define UC_SELF_POWERED 0x40
+#define UC_REMOTE_WAKEUP 0x20
+ uByte bMaxPower; /* max current in 2 mA units */
+#define UC_POWER_FACTOR 2
+} UPACKED usb_config_descriptor_t;
+#define USB_CONFIG_DESCRIPTOR_SIZE 9
+.Ed
+.Pp
+Each device configuration provides one or more interfaces.
+The
+.Fa bNumInterface
+field of the configuration descriptor specifies the number of
+interfaces associated with a device configuration.
+Interfaces are described by an interface descriptor, which is defined in
+.In dev/usb/usb.h
+as follows:
+.Bd -literal
+typedef struct {
+ uByte bLength;
+ uByte bDescriptorType;
+ uByte bInterfaceNumber;
+ uByte bAlternateSetting;
+ uByte bNumEndpoints;
+ uByte bInterfaceClass;
+ uByte bInterfaceSubClass;
+ uByte bInterfaceProtocol;
+ uByte iInterface;
+} UPACKED usb_interface_descriptor_t;
+#define USB_INTERFACE_DESCRIPTOR_SIZE 9
+.Ed
+.Pp
+Configurations may also have alternate interfaces with the same
+.Fa bInterfaceNumber
+but different
+.Fa bAlternateSetting
+values.
+These alternate interface settings may be selected by passing a
+non-zero
+.Fa altidx
+parameter to
+.Fn usbd_set_interface .
+.Pp
+Interfaces have zero or more endpoints, and each endpoint has an
+endpoint descriptor.
+Note that endpoint zero, which is always present, does not have an
+endpoint descriptor, and it is never included in the
+.Fa bNumEndpoints
+count of endpoints.
+The endpoint descriptor is defined in
+.In dev/usb/usb.h
+as follows:
+.Bd -literal
+typedef struct {
+ uByte bLength;
+ uByte bDescriptorType;
+ uByte bEndpointAddress;
+#define UE_GET_DIR(a) ((a) & 0x80)
+#define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7))
+#define UE_DIR_IN 0x80
+#define UE_DIR_OUT 0x00
+#define UE_ADDR 0x0f
+#define UE_GET_ADDR(a) ((a) & UE_ADDR)
+ uByte bmAttributes;
+#define UE_XFERTYPE 0x03
+#define UE_CONTROL 0x00
+#define UE_ISOCHRONOUS 0x01
+#define UE_BULK 0x02
+#define UE_INTERRUPT 0x03
+#define UE_GET_XFERTYPE(a) ((a) & UE_XFERTYPE)
+#define UE_ISO_TYPE 0x0c
+#define UE_ISO_ASYNC 0x04
+#define UE_ISO_ADAPT 0x08
+#define UE_ISO_SYNC 0x0c
+#define UE_GET_ISO_TYPE(a) ((a) & UE_ISO_TYPE)
+ uWord wMaxPacketSize;
+ uByte bInterval;
+} UPACKED usb_endpoint_descriptor_t;
+#define USB_ENDPOINT_DESCRIPTOR_SIZE 7
+.Ed
+.Sh RETURN VALUES
+Many functions return a
+.Vt usbd_status
+type to indicate the outcome of the operation.
+If the operation completed successfully then
+.Dv USBD_NORMAL_COMPLETION
+is returned.
+Operations that have been started but not yet completed will return
+.Dv USBD_IN_PROGRESS .
+Other errors usually indicate a problem.
+Error codes can be converted to strings using
+.Fn usbd_errstr .
+.Sh ERRORS
+.Bl -tag -width ".Er USBD_PENDING_REQUESTS"
+.It Bq Er USBD_PENDING_REQUESTS
+A pipe could not be closed because there are active requests.
+.It Bq Er USBD_NOT_STARTED
+The transfer has not yet been started.
+.It Bq Er USBD_INVAL
+An invalid value was supplied.
+.It Bq Er USBD_NOMEM
+An attempt to allocate memory failed.
+.It Bq Er USBD_CANCELLED
+The transfer was aborted.
+.It Bq Er USBD_BAD_ADDRESS
+The specified endpoint address was not found.
+.It Bq Er USBD_IN_USE
+The endpoint is already in use, or the configuration cannot be changed
+because some of its endpoints are in use.
+.It Bq Er USBD_NO_ADDR
+No free USB devices addresses were found to assign to the device.
+.It Bq Er USBD_SET_ADDR_FAILED
+The device address could not be set.
+.It Bq Er USBD_NO_POWER
+Insufficient power was available for the device.
+.It Bq Er USBD_TOO_DEEP
+Too many levels of chained hubs were found.
+.It Bq Er USBD_IOERROR
+There was an error communicating with the device.
+.It Bq Er USBD_NOT_CONFIGURED
+An operation that requires an active configuration was attempted while
+the device was in an unconfigured state.
+.It Bq Er USBD_TIMEOUT
+A transfer timed out.
+.It Bq Er USBD_SHORT_XFER
+A transfer that disallowed short data lengths completed with less than
+the requested length transferred.
+.It Bq Er USBD_STALLED
+A transfer failed because the pipe is stalled.
+.It Bq Er USBD_INTERRUPTED
+An interruptible operation caught a signal.
+.El
+.Sh SEE ALSO
+.Xr usb 4
+.Sh HISTORY
+The USB driver interface first appeared in
+.Fx 3.0 .
+.Sh AUTHORS
+The USB driver was written by
+.An Lennart Augustsson
+for the
+.Nx
+project.
+.Pp
+.An -nosplit
+This manual page was written by
+.An Ian Dowse Aq iedowse at FreeBSD.org .
Index: timeout.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/timeout.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/timeout.9 -L share/man/man9/timeout.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/timeout.9
+++ share/man/man9/timeout.9
@@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/timeout.9,v 1.28.2.2 2005/12/05 20:07:33 jhb Exp $
+.\" $FreeBSD: src/share/man/man9/timeout.9,v 1.31 2005/12/01 19:16:35 jhb Exp $
.\"
.Dd September 8, 2005
.Dt TIMEOUT 9
--- /dev/null
+++ share/man/man9/config_intrhook.9
@@ -0,0 +1,105 @@
+.\"
+.\" Copyright (C) 2006 M. Warner Losh <imp at FreeBSD.org>. 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(s), this list of conditions and the following disclaimer as
+.\" the first lines of this file unmodified other than the possible
+.\" addition of one or more copyright notices.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice(s), this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/config_intrhook.9,v 1.4 2006/12/14 14:33:13 mpp Exp $
+.\"
+.Dd September 24, 2006
+.Dt CONFIG_INTRHOOK 9
+.Os
+.Sh NAME
+.Nm config_intrhook
+.Nd schedule a function to be run after interrupts have been enabled,
+but before root is mounted
+.Sh SYNOPSIS
+.In sys/kernel.h
+.Ft int
+.Fn config_intrhook_establish "struct intr_config_hook *hook"
+.Ft void
+.Fn config_intrhook_disestablish "struct intr_config_hook *hook"
+.Sh DESCRIPTION
+The
+.Fn config_intrhook_establish
+function schedules a function to be run after interrupts have been
+enabled, but before root is mounted.
+If the system has already passed this point in its initialization,
+the function is called immediately.
+.Pp
+The
+.Fn config_intrhook_disestablish
+function removes the entry from the hook queue.
+.Pp
+Before root is mounted, all the previously established hooks are
+run.
+The boot process is then stalled until all handlers remove their hook
+from the hook queue with
+.Fn config_intrhook_disestablish .
+The boot process then proceeds to attempt to mount the root file
+system.
+Any driver that can potentially provide devices they wish to be
+mounted as root must use either this hook, or probe all these devices
+in the initial probe.
+Since interrupts are disabled during the probe process, many drivers
+need a method to probe for devices with interrupts enabled.
+.Pp
+The requests are made with the
+.Vt intr_config_hook
+structure.
+This structure is defined as follows:
+.Bd -literal
+struct intr_config_hook {
+ TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */
+ void (*ich_func)(void *arg); /* function to call */
+ void *ich_arg; /* Argument to call */
+};
+.Ed
+.Pp
+Storage for the
+.Vt intr_config_hook
+structure must be provided by the driver.
+It must be stable from just before the hook is established until
+after the hook is disestablished.
+.Pp
+Specifically, hooks are run at
+.Fn SI_SUB_INT_CONFIG_HOOKS ,
+which is immediately after the scheduler is started,
+and just before the root file system device is discovered.
+.Sh RETURN VALUES
+A zero return value means the hook was successfully added to the queue
+(with either deferred or immediate execution).
+A non-zero return value means the hook could not be added to the queue
+because it was already on the queue.
+.Sh SEE ALSO
+.Xr DEVICE_ATTACH 9
+.Sh HISTORY
+These functions were introduced in
+.Fx 3.0
+with the CAM subsystem, but are available for any driver to use.
+.Sh AUTHORS
+.An -nosplit
+The functions were written by
+.An Justin Gibbs Aq gibbs at FreeBSD.org .
+This manual page was written by
+.An M. Warner Losh Aq imp at FreeBSD.org .
Index: vrele.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vrele.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vrele.9 -L share/man/man9/vrele.9 -u -r1.2 -r1.3
--- share/man/man9/vrele.9
+++ share/man/man9/vrele.9
@@ -27,7 +27,6 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vrele.9,v 1.12 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 24, 1996
.Os
Index: BUS_SETUP_INTR.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/BUS_SETUP_INTR.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/BUS_SETUP_INTR.9 -L share/man/man9/BUS_SETUP_INTR.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/BUS_SETUP_INTR.9
+++ share/man/man9/BUS_SETUP_INTR.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/BUS_SETUP_INTR.9,v 1.18 2005/01/06 17:11:56 keramida Exp $
+.\" $FreeBSD: src/share/man/man9/BUS_SETUP_INTR.9,v 1.20 2007/03/01 14:33:29 ru Exp $
.\"
-.Dd January 6, 2005
+.Dd March 1, 2007
.Dt BUS_SETUP_INTR 9
.Os
.Sh NAME
@@ -37,11 +37,21 @@
.In sys/param.h
.In sys/bus.h
.Ft int
-.Fn BUS_SETUP_INTR "device_t dev" "device_t child" "struct resource *irq" "int flags" "driver_intr_t *intr" "void *arg" "void **cookiep"
+.Fo BUS_SETUP_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "int flags"
+.Fa "driver_filter_t *filter" "driver_intr_t *ithread" "void *arg"
+.Fa "void **cookiep"
+.Fc
.Ft int
-.Fn bus_setup_intr "device_t dev" "struct resource *r" "int flags" "driver_intr_t handler" "void *arg" "void **cookiep"
+.Fo bus_setup_intr
+.Fa "device_t dev" "struct resource *r" "int flags"
+.Fa "driver_filter_t filter" "driver_intr_t ithread" "void *arg"
+.Fa "void **cookiep"
+.Fc
.Ft int
-.Fn BUS_TEARDOWN_INTR "device_t dev" "device_t child" "struct resource *irq" "void *cookiep"
+.Fo BUS_TEARDOWN_INTR
+.Fa "device_t dev" "device_t child" "struct resource *irq" "void *cookiep"
+.Fc
.Ft int
.Fn bus_teardown_intr "device_t dev" "struct resource *r" "void *cookiep"
.Sh DESCRIPTION
@@ -61,11 +71,6 @@
.Fa flags
also tell the interrupt handlers about certain
device driver characteristics.
-.Dv INTR_FAST
-means the handler is for a timing-critical function.
-Extra care is take to speed up these handlers.
-Use of this implies
-.Dv INTR_EXCL .
.Dv INTR_EXCL
marks the handler as being
an exclusive handler for this interrupt.
@@ -79,8 +84,16 @@
marks the interrupt as being a good source of entropy -
this may be used by the entropy device
.Pa /dev/random .
-The handler
-.Fa intr
+.Pp
+To define a time-critical handler (previously known as
+.Dv INTR_FAST )
+that will not execute any potentially blocking operation, use the
+.Fa filter
+argument.
+Otherwise, use the
+.Fa ithread
+argument.
+The defined handler
will be called with the value
.Fa arg
as its only argument.
Index: thread_exit.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/thread_exit.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/thread_exit.9 -L share/man/man9/thread_exit.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/thread_exit.9
+++ share/man/man9/thread_exit.9
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/thread_exit.9,v 1.2 2002/12/09 14:29:34 ru Exp $
+.\" $FreeBSD: src/share/man/man9/thread_exit.9,v 1.3 2007/03/09 22:41:01 jhb Exp $
.\"
.Dd July 5, 2002
.Dt THREAD_EXIT 9
@@ -58,6 +58,6 @@
mutex held.
.Sh SEE ALSO
.Xr mi_switch 9 ,
-.Xr msleep 9 ,
.Xr mutex 9 ,
-.Xr runqueue 9
+.Xr runqueue 9 ,
+.Xr sleep 9
Index: ithread.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/ithread.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/ithread.9 -L share/man/man9/ithread.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/ithread.9
+++ share/man/man9/ithread.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/ithread.9,v 1.11 2004/07/05 17:12:52 ru Exp $
+.\" $FreeBSD: src/share/man/man9/ithread.9,v 1.12 2006/08/25 19:04:42 pav Exp $
.\"
-.Dd February 10, 2001
+.Dd August 25, 2006
.Dt ITHREAD 9
.Os
.Sh NAME
@@ -202,6 +202,12 @@
and
.Dv INTR_ENTROPY
flags are not valid for software interrupt handlers.
+.Pp
+It is not permitted to sleep in an interrupt thread; hence, any memory
+or zone allocations in an interrupt thread should be specified with the
+.Dv M_NOWAIT
+flag set.
+Any allocation errors must be handled thereafter.
.Sh RETURN VALUES
The
.Fn ithread_add_handler ,
@@ -340,7 +346,9 @@
.El
.Sh SEE ALSO
.Xr kthread 9 ,
-.Xr swi 9
+.Xr malloc 9 ,
+.Xr swi 9 ,
+.Xr uma 9
.Sh HISTORY
Interrupt threads and their corresponding API first appeared in
.Fx 5.0 .
--- /dev/null
+++ share/man/man9/sysctl.9
@@ -0,0 +1,304 @@
+.\"
+.\" Copyright (c) 2006 Robert N. M. Watson
+.\" 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+.\"
+.\" $FreeBSD: src/share/man/man9/sysctl.9,v 1.8 2006/12/14 14:33:13 mpp Exp $
+.\"
+.Dd November 23, 2006
+.Dt SYSCTL 9
+.Os
+.Sh NAME
+.Nm SYSCTL_DECL ,
+.Nm SYSCTL_INT ,
+.Nm SYSCTL_LONG ,
+.Nm SYSCTL_NODE ,
+.Nm SYSCTL_OPAQUE ,
+.Nm SYSCTL_PROC ,
+.Nm SYSCTL_STRING ,
+.Nm SYSCTL_STRUCT ,
+.Nm SYSCTL_UINT ,
+.Nm SYSCTL_ULONG ,
+.Nm SYSCTL_XINT ,
+.Nm SYSCTL_XLONG
+.Nd Static sysctl declaration functions
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/sysctl.h
+.Fn SYSCTL_DECL name
+.Fn SYSCTL_INT parent nbr name access ptr val descr
+.Fn SYSCTL_LONG parent nbr name access ptr val descr
+.Fn SYSCTL_NODE parent nbr name access handler descr
+.Fn SYSCTL_OPAQUE parent nbr name access ptr len fmt descr
+.Fn SYSCTL_PROC parent nbr name access ptr arg handler fmt descr
+.Fn SYSCTL_STRING parent nbr name access arg len descr
+.Fn SYSCTL_STRUCT parent nbr name access ptr type descr
+.Fn SYSCTL_UINT parent nbr name access ptr val descr
+.Fn SYSCTL_ULONG parent nbr name access ptr val descr
+.Fn SYSCTL_XINT parent nbr name access ptr val descr
+.Fn SYSCTL_XLONG parent nbr name access ptr val descr
+.Sh DESCRIPTION
+The
+.Nm SYSCTL
+kernel interfaces allow code to statically declare
+.Xr sysctl 8
+MIB entries, which will be initialized when the kernel module containing the
+declaration is initialized.
+When the module is unloaded, the sysctl will be automatically destroyed.
+.Pp
+Sysctl nodes are created in a hierarchical tree, with all static nodes being
+represented by named C data structures; in order to create a new node under
+an existing node in the tree, the structure representing the desired parent
+node must be declared in the current context using
+.Fn SYSCTL_DECL .
+.Pp
+New nodes are declared using one of
+.Fn SYSCTL_INT ,
+.Fn SYSCTL_LONG ,
+.Fn SYSCTL_NODE ,
+.Fn SYSCTL_OPAQUE ,
+.Fn SYSCTL_PROC ,
+.Fn SYSCTL_STRING ,
+.Fn SYSCTL_STRUCT ,
+.Fn SYSCTL_UINT ,
+.Fn SYSCTL_ULONG ,
+.Fn SYSCTL_XINT ,
+and
+.Fn SYSCTL_XLONG .
+Each macro accepts a parent name, as declared using
+.Fn SYSCTL_DECL ,
+an OID number, typically
+.Dv OID_AUTO ,
+a node name, a set of control and access flags, and a description.
+Depending on the macro, a pointer to a variable supporting the MIB entry, a
+size, a value, and a function pointer implementing the MIB entry may also be
+present.
+.Pp
+For most of the above macros, declaring a type as part of the access flags is
+not necessary \[em] however, when declaring a sysctl implemented by a function,
+including a type in the access mask is required:
+.Bl -tag -width ".Dv CTLTYPE_STRING"
+.It Dv CTLTYPE_NODE
+This is a node intended to be a parent for other nodes.
+.It Dv CTLTYPE_INT
+This is a signed integer.
+.It Dv CTLTYPE_STRING
+This is a nul-terminated string stored in a character array.
+.It Dv CTLTYPE_QUAD
+This is a 64-bit signed integer.
+.It Dv CTLTYPE_OPAQUE
+This is an opaque data structure.
+.It Dv CTLTYPE_STRUCT
+Alias for
+.Dv CTLTYPE_OPAQUE.
+.It Dv CTLTYPE_UINT
+This is an unsigned integer.
+.It Dv CTLTYPE_LONG
+This is a signed long.
+.It Dv CTLTYPE_ULONG
+This is an unsigned long.
+.El
+.Pp
+All sysctl types except for new node declarations require one or more flags
+to be set indicating the read and write disposition of the sysctl:
+.Bl -tag -width ".Dv CTLFLAG_ANYBODY"
+.It Dv CTLFLAG_RD
+This is a read-only sysctl.
+.It Dv CTLFLAG_WR
+This is a writable sysctl.
+.It Dv CTLFLAG_RW
+This sysctl is readable and writable.
+.It Dv CTLFLAG_ANYBODY
+Any user or process can write to this sysctl.
+.It Dv CTLFLAG_SECURE
+This sysctl can be written to only if the effective securelevel of the
+process is \[<=] 0.
+.It Dv CTLFLAG_PRISON
+This sysctl can be written to by processes in
+.Xr jail 2 .
+.It Dv CTLFLAG_SKIP
+When iterating the sysctl name space, do not list this sysctl.
+.It Dv CTLFLAG_TUN
+Also declare a system tunable with the same name to initialize this variable.
+.It Dv CTLFLAG_RDTUN
+Also declare a system tunable with the same name to initialize this variable;
+however, the run-time variable is read-only.
+.El
+.Pp
+When creating new sysctls, careful attention should be paid to the security
+implications of the monitoring or management interface being created.
+Most sysctls present in the kernel are read-only or writable only by the
+superuser.
+Sysctls exporting extensive information on system data structures and
+operation, especially those implemented using procedures, will wish to
+implement access control to limit the undesired exposure of information about
+other processes, network connections, etc.
+.Pp
+The following top level sysctl name spaces are commonly used:
+.Bl -tag -width ".Va regression"
+.It Va compat
+Compatibility layer information.
+.It Va debug
+Debugging information.
+Various name spaces exist under
+.Va debug .
+.It Va hw
+Hardware and device driver information.
+.It Va kern
+Kernel behavior tuning; generally deprecated in favor of more specific
+name spaces.
+.It Va machdep
+Machine-dependent configuration parameters.
+.It Va net
+Network subsystem.
+Various protocols have name spaces under
+.Va net .
+.It Va regression
+Regression test configuration and information.
+.It Va security
+Security and security-policy configuration and information.
+.It Va sysctl
+Reserved name space for the implementation of sysctl.
+.It Va user
+Configuration settings relating to user application behavior.
+Generally, configuring applications using kernel sysctls is discouraged.
+.It Va vfs
+Virtual file system configuration and information.
+.It Va vm
+Virtual memory subsystem configuration and information.
+.El
+.Sh EXAMPLES
+Sample use of
+.Fn SYSCTL_DECL
+to declare the
+.Va security
+sysctl tree for use by new nodes:
+.Bd -literal -offset indent
+SYSCTL_DECL(_security);
+.Ed
+.Pp
+Examples of integer, opaque, string, and procedure sysctls follow:
+.Bd -literal -offset indent
+/*
+ * Example of a constant integer value. Notice that the control
+ * flags are CTLFLAG_RD, the variable pointer is NULL, and the
+ * value is declared.
+ * If sysctl(8) should print this value in hex, use 'SYSCTL_XINT'.
+ */
+SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, NULL,
+ sizeof(struct bio), "sizeof(struct bio)");
+
+/*
+ * Example of a variable integer value. Notice that the control
+ * flags are CTLFLAG_RW, the variable pointer is set, and the
+ * value is 0.
+ */
+static int doingcache = 1; /* 1 => enable the cache */
+SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0,
+ "Enable name cache");
+
+/*
+ * Example of a variable string value. Notice that the control
+ * flags are CTLFLAG_RW, that the variable pointer and string
+ * size are set. Unlike newer sysctls, this older sysctl uses a
+ * static oid number.
+ */
+char kernelname[MAXPATHLEN] = "/kernel"; /* XXX bloat */
+SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW,
+ kernelname, sizeof(kernelname), "Name of kernel file booted");
+
+/*
+ * Example of an opaque data type exported by sysctl. Notice that
+ * the variable pointer and size are provided, as well as a format
+ * string for sysctl(8).
+ */
+static l_fp pps_freq; /* scaled frequence offset (ns/s) */
+SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD,
+ &pps_freq, sizeof(pps_freq), "I", "");
+
+/*
+ * Example of a procedure based sysctl exporting string
+ * information. Notice that the data type is declared, the NULL
+ * variable pointer and 0 size, the function pointer, and the
+ * format string for sysctl(8).
+ */
+SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, CTLTYPE_STRING |
+ CTLFLAG_RW, NULL, 0, sysctl_kern_timecounter_hardware, "A",
+ "");
+.Ed
+.Sh SYSCTL NAMING
+When adding, modifying, or removing sysctl names, it is important to be
+aware that these interfaces may be used by users, libraries, applications,
+or documentation (such as published books), and are implicitly published application interfaces.
+As with other application interfaces, caution must be taken not to break
+existing applications, and to think about future use of new name spaces so as
+to avoid the need to rename or remove interfaces that might be depended on in
+the future.
+.Pp
+The semantics chosen for a new sysctl should be as clear as possible,
+and the name of the sysctl must closely reflect its semantics.
+Therefore the sysctl name deserves a fair amount of consideration.
+It should be short but yet representative of the sysctl meaning.
+If the name consists of several words, they should be separated by
+underscore characters, as in
+.Va compute_summary_at_mount .
+Underscore characters may be omitted only if the name consists of not more
+than two words, each being not longer than four characters, as in
+.Va bootfile .
+For boolean sysctls, negative logic should be totally avoided.
+That is, do not use names like
+.Va no_foobar
+or
+.Va foobar_disable .
+They are confusing and lead to configuration errors.
+Use positive logic instead:
+.Va foobar ,
+.Va foobar_enable .
+.Pp
+A temporary sysctl node that should not be relied upon must be designated
+as such by a leading underscore character in its name. For example:
+.Va _dirty_hack .
+.Sh SEE ALSO
+.Xr sysctl 8 ,
+.Xr sysctl_add_oid 9 ,
+.Xr sysctl_ctx_free 9 ,
+.Xr sysctl_ctx_init 9 ,
+.Xr sysctl_remove_oid 9
+.Sh HISTORY
+The
+.Xr sysctl 8
+utility first appeared in
+.Bx 4.4 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm sysctl
+implementation originally found in
+.Bx
+has been extensively rewritten by
+.An Poul-Henning Kamp
+in order to add support for name lookups, name space iteration, and dynamic
+addition of MIB nodes.
+.Pp
+This man page was written by
+.An Robert N. M. Watson .
Index: taskqueue.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/taskqueue.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/taskqueue.9 -L share/man/man9/taskqueue.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/taskqueue.9
+++ share/man/man9/taskqueue.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/taskqueue.9,v 1.20 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/taskqueue.9,v 1.21 2007/07/09 06:24:10 jmg Exp $
.\"
.Dd May 19, 2005
.Dt TASKQUEUE 9
@@ -160,6 +160,12 @@
and the value of
.Va ta_pending
as its second argument.
+After the function
+.Va ta_func
+returns,
+.Xr wakeup 9
+is called on the task pointer passed to
+.Fn taskqueue_enqueue .
.Pp
The
.Fn taskqueue_drain
Index: watchdog.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/watchdog.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/watchdog.9 -L share/man/man9/watchdog.9 -u -r1.2 -r1.3
--- share/man/man9/watchdog.9
+++ share/man/man9/watchdog.9
@@ -22,8 +22,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/watchdog.9,v 1.3 2004/07/06 07:39:50 ru Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: src/share/man/man9/watchdog.9,v 1.6 2007/03/28 21:21:22 brueffer Exp $
.\"
.Dd February 28, 2004
.Dt WATCHDOG 9
@@ -36,6 +35,7 @@
.Ft void
.Fn watchdog_fn "void *private" "u_int cmd" "int *error"
.Fn EVENTHANDLER_REGISTER watchdog_list watchdog_fn private 0
+.Fn EVENTHANDLER_DEREGISTER watchdog_list eventhandler_tag
.Sh DESCRIPTION
To implement a watchdog in software or hardware, only a single
function needs to be written and registered on the global
@@ -51,17 +51,21 @@
is zero, the watchdog must be disabled and the
.Fa error
argument left untouched.
+If the watchdog cannot be disabled, the
+.Fa error
+argument must be set to
+.Dv EOPNOTSUPP .
.Pp
Else the watchdog should be reset and configured to a timeout of
.Pq 1 << Pq Fa cmd No & Dv WD_INTERVAL
nanoseconds or larger and the
.Fa error
-argument be set to zero.
+argument be set to zero to signal arming of a watchdog.
.Pp
If the watchdog cannot be configured to the proposed timeout, it
must be disabled and the
.Fa error
-argument left untouched.
+argument left as is (to avoid hiding the arming of another watchdog).
.Pp
There is no specification of what the watchdog should do when it
times out, but a hardware reset or similar
Index: mtx_pool.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/mtx_pool.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/mtx_pool.9 -L share/man/man9/mtx_pool.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/mtx_pool.9
+++ share/man/man9/mtx_pool.9
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/mtx_pool.9,v 1.5 2003/09/14 13:41:59 ru Exp $
+.\" $FreeBSD: src/share/man/man9/mtx_pool.9,v 1.8 2007/03/30 18:07:26 julian Exp $
.\"
.Dd March 25, 2002
.Dt MTX_POOL 9
@@ -64,7 +64,7 @@
.Sh DESCRIPTION
Mutex pools are designed to be used as short term leaf mutexes;
i.e., the last mutex one might acquire before calling
-.Xr msleep 9 .
+.Xr mtx_sleep 9 .
They operate using a shared pool of mutexes.
A mutex may be chosen from the pool based on a supplied pointer,
which may or may not point to anything valid,
@@ -110,7 +110,7 @@
No initialization or destruction overhead.
.It
Can be used with
-.Xr msleep 9 .
+.Xr mtx_sleep 9 .
.El
.Pp
And the following disadvantages:
@@ -176,9 +176,8 @@
on each mutex in the specified pool,
deallocates the memory associated with the pool,
and assigns NULL to the pool pointer.
-.Pp
.Sh SEE ALSO
-.Xr msleep 9 ,
+.Xr locking 9
.Xr mutex 9
.Sh HISTORY
These routines first appeared in
Index: ktr.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/ktr.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/ktr.9 -L share/man/man9/ktr.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/ktr.9
+++ share/man/man9/ktr.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/ktr.9,v 1.9 2005/06/15 13:31:23 ru Exp $
+.\" $FreeBSD: src/share/man/man9/ktr.9,v 1.13 2006/10/16 07:59:05 danger Exp $
.\"
-.Dd February 15, 2001
+.Dd December 27, 2005
.Dt KTR 9
.Os
.Sh NAME
@@ -51,6 +51,8 @@
.Fn CTR4 "u_int mask" "char *format" "arg1" "arg2" "arg3" "arg4"
.Ft void
.Fn CTR5 "u_int mask" "char *format" "arg1" "arg2" "arg3" "arg4" "arg5"
+.Ft void
+.Fn CTR6 "u_int mask" "char *format" "arg1" "arg2" "arg3" "arg4" "arg5" "arg6"
.Sh DESCRIPTION
KTR provides a circular buffer of events that can be logged in a
.Xr printf 9
@@ -143,3 +145,13 @@
so that if one CPU halts or starts spinning, then the log messages it
emitted just prior to halting or spinning will not be drowned out by events
from the other CPUs.
+.Pp
+The arguments given in
+.Fn CTRx
+macros are stored as
+.Vt u_long ,
+so do not pass arguments larger than size of an
+.Vt u_long
+type.
+For example passing 64bit arguments on 32bit architectures will give incorrect
+results.
Index: bus_alloc_resource.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/bus_alloc_resource.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/bus_alloc_resource.9 -L share/man/man9/bus_alloc_resource.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/bus_alloc_resource.9
+++ share/man/man9/bus_alloc_resource.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/bus_alloc_resource.9,v 1.21 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/bus_alloc_resource.9,v 1.23 2007/05/27 20:49:08 imp Exp $
.\"
.Dd May 18, 2000
.Dt BUS_ALLOC_RESOURCE 9
@@ -90,10 +90,10 @@
points to a bus specific handle that identifies the resource being allocated.
For ISA this is an index into an array of resources that have been setup
for this device by either the PnP mechanism, or via the hints mechanism.
-For PCCARD, similar things are used as of writing,
-but that may change in the future with newcard.
-For PCI it just happens to be the offset into pci config space which has
-a word that describes the resource.
+For PCCARD, this is an index into the array of resources described by the PC Card's
+CIS entry.
+For PCI, the offset into pci config space which has the BAR to use to access
+the resource.
The bus methods are free to change the RIDs that they are given as a parameter.
You must not depend on the value you gave it earlier.
.It
@@ -159,7 +159,7 @@
.Va irqid
should be saved in the softc of the device after these calls.
.Bd -literal
- struct resource *portres, irqres;
+ struct resource *portres, *irqres;
int portid, irqid;
portid = 0;
Index: vput.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vput.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vput.9 -L share/man/man9/vput.9 -u -r1.2 -r1.3
--- share/man/man9/vput.9
+++ share/man/man9/vput.9
@@ -27,7 +27,6 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vput.9,v 1.11 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd July 24, 1996
.Os
Index: acl.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/acl.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/acl.9 -L share/man/man9/acl.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/acl.9
+++ share/man/man9/acl.9
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/acl.9,v 1.14 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/acl.9,v 1.15 2006/02/13 21:34:18 joel Exp $
.\"
.Dd December 23, 1999
.Os
@@ -135,7 +135,6 @@
to the associated file.
.El
.El
-.Pp
.Sh IMPLEMENTATION NOTES
.Bd -literal
typedef mode_t *acl_permset_t;
Index: device_set_driver.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/device_set_driver.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/device_set_driver.9 -L share/man/man9/device_set_driver.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/device_set_driver.9
+++ share/man/man9/device_set_driver.9
@@ -26,7 +26,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/device_set_driver.9,v 1.3 2003/10/23 06:19:45 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/device_set_driver.9,v 1.4 2007/02/09 21:12:21 brueffer Exp $
.\"
.Dd April 21, 2003
.Dt DEVICE_SET_DRIVER 9
@@ -45,9 +45,7 @@
It is typically used in
.Xr DEVICE_IDENTIFY 9
functions to add devices to a bus that does not support doing so
-automatically, such as the
-.Xr isa 4
-bus.
+automatically, such as the ISA bus.
.Sh SEE ALSO
.Xr device 9
.Sh AUTHORS
Index: crypto.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/crypto.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/crypto.9 -L share/man/man9/crypto.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/crypto.9
+++ share/man/man9/crypto.9
@@ -15,9 +15,9 @@
.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
.\" PURPOSE.
.\"
-.\" $FreeBSD: src/share/man/man9/crypto.9,v 1.5 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/crypto.9,v 1.14 2007/09/19 16:28:46 brueffer Exp $
.\"
-.Dd October 14, 2002
+.Dd September 19, 2007
.Dt CRYPTO 9
.Os
.Sh NAME
@@ -62,7 +62,7 @@
struct cryptoini {
int cri_alg;
int cri_klen;
- int cri_rnd;
+ int cri_mlen;
caddr_t cri_key;
u_int8_t cri_iv[EALG_MAX_BLOCK_LEN];
struct cryptoini *cri_next;
@@ -74,6 +74,10 @@
int crd_inject;
int crd_flags;
struct cryptoini CRD_INI;
+#define crd_iv CRD_INI.cri_iv
+#define crd_key CRD_INI.cri_key
+#define crd_alg CRD_INI.cri_alg
+#define crd_klen CRD_INI.cri_klen
struct cryptodesc *crd_next;
};
@@ -171,30 +175,33 @@
Currently supported algorithms are:
.Pp
.Bl -tag -width ".Dv CRYPTO_RIPEMD160_HMAC" -compact
-.It Dv CRYPTO_DES_CBC
-.It Dv CRYPTO_3DES_CBC
+.It Dv CRYPTO_AES_CBC
+.It Dv CRYPTO_ARC4
.It Dv CRYPTO_BLF_CBC
+.It Dv CRYPTO_CAMELLIA_CBC
.It Dv CRYPTO_CAST_CBC
+.It Dv CRYPTO_DES_CBC
+.It Dv CRYPTO_3DES_CBC
.It Dv CRYPTO_SKIPJACK_CBC
+.It Dv CRYPTO_MD5
.It Dv CRYPTO_MD5_HMAC
-.It Dv CRYPTO_SHA1_HMAC
-.It Dv CRYPTO_RIPEMD160_HMAC
.It Dv CRYPTO_MD5_KPDK
-.It Dv CRYPTO_SHA1_KPDK
-.It Dv CRYPTO_AES_CBC
-.It Dv CRYPTO_ARC4
-.It Dv CRYPTO_MD5
+.It Dv CRYPTO_RIPEMD160_HMAC
.It Dv CRYPTO_SHA1
-.It Dv CRYPTO_SHA2_HMAC
+.It Dv CRYPTO_SHA1_HMAC
+.It Dv CRYPTO_SHA1_KPDK
+.It Dv CRYPTO_SHA2_256_HMAC
+.It Dv CRYPTO_SHA2_384_HMAC
+.It Dv CRYPTO_SHA2_512_HMAC
.It Dv CRYPTO_NULL_HMAC
.It Dv CRYPTO_NULL_CBC
.El
.It Va cri_klen
Specifies the length of the key in bits, for variable-size key
algorithms.
-.It Va cri_rnd
-Specifies the number of rounds to be used with the algorithm, for
-variable-round algorithms.
+.It Va cri_mlen
+Specifies how many bytes from the calculated hash should be copied back.
+0 means entire hash.
.It Va cri_key
Contains the key to be used with the algorithm.
.It Va cri_iv
@@ -278,11 +285,27 @@
.It Va crp_flags
Is a bitmask of flags associated with this request.
Currently defined flags are:
-.Bl -tag -width ".Dv CRYPTO_F_IMBUF"
+.Bl -tag -width ".Dv CRYPTO_F_CBIFSYNC"
.It Dv CRYPTO_F_IMBUF
The buffer pointed to by
.Va crp_buf
is an mbuf chain.
+.It Dv CRYPTO_F_IOV
+The buffer pointed to by
+.Va crp_buf
+is an
+.Vt uio
+structure.
+.It Dv CRYPTO_F_REL
+Must return data in the same place.
+.It Dv CRYPTO_F_BATCH
+Batch operation if possible.
+.It Dv CRYPTO_F_CBIMM
+Do callback immediately instead of doing it from a dedicated kernel thread.
+.It Dv CRYPTO_F_DONE
+Operation completed.
+.It Dv CRYPTO_F_CBIFSYNC
+Do callback immediately if operation is synchronous.
.El
.It Va crp_buf
Points to the input buffer.
@@ -302,6 +325,23 @@
on the input buffer.
The various fields are:
.Bl -tag -width ".Va crd_inject"
+.It Va crd_iv
+The field where IV should be provided when the
+.Dv CRD_F_IV_EXPLICIT
+flag is given.
+.It Va crd_key
+When the
+.Dv CRD_F_KEY_EXPLICIT
+flag is given, the
+.Va crd_key
+points to a buffer with encryption or authentication key.
+.It Va crd_alg
+An algorithm to use.
+Must be the same as the one given at newsession time.
+.It Va crd_klen
+The
+.Va crd_key
+key length.
.It Va crd_skip
The offset in the input buffer where processing should start.
.It Va crd_len
@@ -318,7 +358,7 @@
inserted.
.It Va crd_flags
The following flags are defined:
-.Bl -tag -width ".Dv CRD_F_IV_EXPLICIT"
+.Bl -tag -width 3n
.It Dv CRD_F_ENCRYPT
For encryption algorithms, this bit is set when encryption is required
(when not set, decryption is performed).
@@ -343,8 +383,8 @@
.It Dv CRD_F_IV_EXPLICIT
For encryption algorithms, this bit is set when the IV is explicitly
provided by the consumer in the
-.Va cri_iv
-fields.
+.Va crd_iv
+field.
Otherwise, for encryption operations the IV is provided for by
the driver used to perform the operation, whereas for decryption
operations it is pointed to by the
@@ -355,6 +395,14 @@
by the consumer, and does not precede the data (some
.Xr ipsec 4
configurations, and the encrypted swap are two such examples).
+.It Dv CRD_F_KEY_EXPLICIT
+For encryption and authentication (MAC) algorithms, this bit is set when the key
+is explicitly provided by the consumer in the
+.Va crd_key
+field for the given operation.
+Otherwise, the key is taken at newsession time from the
+.Va cri_key
+field.
.It Dv CRD_F_COMP
For compression algorithms, this bit is set when compression is required (when
not set, decompression is performed).
Index: vm_page_grab.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vm_page_grab.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vm_page_grab.9 -L share/man/man9/vm_page_grab.9 -u -r1.2 -r1.3
--- share/man/man9/vm_page_grab.9
+++ share/man/man9/vm_page_grab.9
@@ -25,7 +25,6 @@
.\" DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vm_page_grab.9,v 1.3 2005/06/28 20:15:18 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd August 7, 2001
.Dt VM_PAGE_GRAB 9
Index: hashinit.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/hashinit.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/hashinit.9 -L share/man/man9/hashinit.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/hashinit.9
+++ share/man/man9/hashinit.9
@@ -23,13 +23,13 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/hashinit.9,v 1.2 2005/01/21 08:36:40 ru Exp $
+.\" $FreeBSD: src/share/man/man9/hashinit.9,v 1.4 2007/01/27 23:06:00 ru Exp $
.\"
.Dd October 10, 2004
.Dt HASHINIT 9
.Os
.Sh NAME
-.Nm hashinit , hashdestroy , phashinit
+.Nm hashinit , hashinit_flags, hashdestroy , phashinit
.Nd manage kernel hash tables
.Sh SYNOPSIS
.In sys/malloc.h
@@ -38,12 +38,17 @@
.Ft "void *"
.Fn hashinit "int nelements" "struct malloc_type *type" "u_long *hashmask"
.Ft void
+.Fo hashinit_flags
+.Fa "int nelements" "struct malloc_type *type" "u_long *hashmask" "int flags"
+.Fc
+.Ft void
.Fn hashdestroy "void *hashtbl" "struct malloc_type *type" "u_long hashmask"
.Ft "void *"
.Fn phashinit "int nelements" "struct malloc_type *type" "u_long *nentries"
.Sh DESCRIPTION
The
-.Fn hashinit
+.Fn hashinit ,
+.Fn hashinit_flags
and
.Fn phashinit
functions allocate space for hash tables of size given by the argument
@@ -59,6 +64,13 @@
function allocates hash tables that are sized to the largest prime
number less than or equal to argument
.Fa nelements .
+The
+.Fn hashinit_flags
+function operates like
+.Fn hashinit
+but also accepts an additional argument
+.Fa flags
+which control various options during allocation.
Allocated hash tables are contiguous arrays of
.Xr LIST_HEAD 3
entries, allocated using
@@ -80,6 +92,20 @@
should be the bit mask returned by the call to
.Fn hashinit
that allocated the hash table.
+The argument
+.Fa flags
+must be used with one of the following values.
+.Pp
+.Bl -tag -width ".Dv HASH_NOWAIT" -offset indent -compact
+.It Dv HASH_NOWAIT
+Any malloc performed by the
+.Fn hashinit_flags
+function will not be allowed to wait, and therefore may fail.
+.It Dv HASH_WAITOK
+Any malloc performed by the
+.Fn hashinit_flags
+function is allowed to wait for memory.
+.El
.Sh IMPLEMENTATION NOTES
The largest prime hash value chosen by
.Fn phashinit
Index: mbuf.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/mbuf.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/mbuf.9 -L share/man/man9/mbuf.9 -u -r1.2 -r1.3
--- share/man/man9/mbuf.9
+++ share/man/man9/mbuf.9
@@ -22,9 +22,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/mbuf.9,v 1.58.2.2 2006/03/23 23:24:33 sam Exp $
+.\" $FreeBSD: src/share/man/man9/mbuf.9,v 1.65 2007/02/26 15:17:19 bms Exp $
.\"
-.Dd March 15, 2006
+.Dd February 26, 2007
.Dt MBUF 9
.Os
.\"
@@ -51,14 +51,10 @@
.Fa "int type"
.Fc
.Fn MEXTFREE "struct mbuf *mbuf"
-.Fn MEXT_ADD_REF "struct mbuf *mbuf"
-.Fn MEXT_REM_REF "struct mbuf *mbuf"
.Fn MFREE "struct mbuf *mbuf" "struct mbuf *successor"
.\"
.Ss Mbuf utility macros
.Fn mtod "struct mbuf *mbuf" "type"
-.Ft int
-.Fn MEXT_IS_REF "struct mbuf *mbuf"
.Fn M_ALIGN "struct mbuf *mbuf" "u_int len"
.Fn MH_ALIGN "struct mbuf *mbuf" "u_int len"
.Ft int
@@ -101,6 +97,8 @@
.Ft struct mbuf *
.Fn m_pullup "struct mbuf *mbuf" "int len"
.Ft struct mbuf *
+.Fn m_pulldown "struct mbuf *mbuf" "int offset" "int len" "int *offsetp"
+.Ft struct mbuf *
.Fn m_copym "struct mbuf *mbuf" "int offset" "int len" "int how"
.Ft struct mbuf *
.Fn m_copypacket "struct mbuf *mbuf" "int how"
@@ -233,9 +231,8 @@
.Bd -literal
/* mbuf types */
#define MT_DATA 1 /* dynamic (data) allocation */
-#define MT_HEADER 2 /* packet header */
+#define MT_HEADER MT_DATA /* packet header */
#define MT_SONAME 8 /* socket name */
-#define MT_FTABLE 11 /* fragment reassembly header */
#define MT_CONTROL 14 /* extra-data protocol message */
#define MT_OOBDATA 15 /* expedited data */
.Ed
@@ -302,18 +299,6 @@
.Pp
The allocation and management of the reference counter is handled by the
subsystem.
-The developer can check whether the reference count for the
-external storage of a given
-.Vt mbuf
-is greater than 1 with the
-.Dv MEXT_IS_REF
-macro.
-Similarly, the developer can directly add and remove references,
-if absolutely necessary, with the use of the
-.Dv MEXT_ADD_REF
-and
-.Dv MEXT_REM_REF
-macros.
.Pp
The system also supplies a default type of external storage buffer called an
.Vt mbuf cluster .
@@ -660,6 +645,10 @@
.Fa mbuf ,
so they are accessible with
.Fn mtod mbuf type .
+It is important to remember that this may involve
+reallocating some mbufs and moving data so all pointers
+referencing data within the old mbuf chain
+must be recalculated or made invalid.
Return the new
.Vt mbuf chain
on success,
@@ -676,6 +665,42 @@
must be less than
.Dv MHLEN .
.\"
+.It Fn m_pulldown mbuf offset len offsetp
+Arrange that
+.Fa len
+bytes between
+.Fa offset
+and
+.Fa offset + len
+in the
+.Vt mbuf chain
+are contiguous and lay in the data area of
+.Fa mbuf ,
+so they are accessible with
+.Fn mtod mbuf type .
+.Fa len must be smaller than, or equal to, the size of an
+.Vt mbuf cluster .
+Return a pointer to an intermediate
+.Vt mbuf
+in the chain containing the requested region;
+the offset in the data region of the
+.Vt mbuf chain
+to the data contained in the returned mbuf is stored in
+.Fa *offsetp .
+If
+.Fa offp
+is NULL, the region may be accessed using
+.Fn mtod mbuf type .
+If
+.Fa offp
+is non-NULL, the region may be accessed using
+.Fn mtod mbuf uint8_t + *offsetp .
+The region of the mbuf chain between its beginning and
+.Fa off
+is not modified, therefore it is safe to hold pointers to data within
+this region before calling
+.Fn m_pulldown .
+.\"
.It Fn m_copym mbuf offset len how
Make a copy of an
.Vt mbuf chain
@@ -1135,7 +1160,35 @@
Besides being used for network packets, they were used
to store various dynamic structures, such as routing table
entries, interface addresses, protocol control blocks, etc.
+In more recent
+.Fx
+use of
+.Vt mbufs
+is almost entirely limited to packet storage, with
+.Xr uma 9
+zones being used directly to store other network-related memory.
+.Pp
+Historically, the
+.Vt mbuf
+allocator has been a special-purpose memory allocator able to run in
+interrupt contexts and allocating from a special kernel address space map.
+As of
+.Fx 5.3 ,
+the
+.Vt mbuf
+allocator is a wrapper around
+.Xr uma 9 ,
+allowing caching of
+.Vt mbufs ,
+clusters, and
+.Vt mbuf
++ cluster pairs in per-CPU caches, as well as bringing other benefits of
+slab allocation.
.Sh AUTHORS
The original
.Nm
manual page was written by Yar Tikhiy.
+The
+.Xr uma 9
+.Vt mbuf
+allocator was written by Bosko Milekic.
Index: vgone.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vgone.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/vgone.9 -L share/man/man9/vgone.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/vgone.9
+++ share/man/man9/vgone.9
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/vgone.9,v 1.4 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/vgone.9,v 1.5 2006/06/07 16:51:54 jkoshy Exp $
.\"
.Dd November 21, 2001
.Dt VGONE 9
@@ -50,7 +50,7 @@
If the vnode has a
.Va v_usecount
of zero, and its
-.Dv VDOOMED
+.Dv VI_DOOMED
flag is not set, it is moved to the head of the free list
as in most cases the vnode
is about to be reused, or its file system being unmounted.
@@ -66,8 +66,6 @@
while
.Fn vgonel
expects the interlock to already be locked.
-.Sh SEE ALSO
-.Xr vclean 9
.Sh AUTHORS
This manual page was written by
.An Chad David Aq davidc at acns.ab.ca .
Index: lock.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/lock.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/lock.9 -L share/man/man9/lock.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/lock.9
+++ share/man/man9/lock.9
@@ -24,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/lock.9,v 1.12 2005/06/28 20:15:18 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/lock.9,v 1.17 2007/06/21 16:39:25 brueffer Exp $
.\"
-.Dd July 9, 2001
+.Dd June 20, 2006
.Dt LOCK 9
.Os
.Sh NAME
@@ -63,14 +63,14 @@
A pointer to the lock to initialize.
.It Fa prio
The priority passed to
-.Xr msleep 9 .
+.Xr sleep 9 .
.It Fa wmesg
The lock message.
This is used for both debugging output and
-.Xr msleep 9 .
+.Xr sleep 9 .
.It Fa timo
The timeout value passed to
-.Xr msleep 9 .
+.Xr sleep 9 .
.It Fa flags
The flags the lock is to be initialized with.
.Bl -tag -width ".Dv LG_CANRECURSE"
@@ -80,10 +80,8 @@
Fail after a sleep.
.It Dv LK_CANRECURSE
Allow recursive exclusive locks.
-.It Dv LK_REENABLE
-Re-enable the lock after a drain.
-.It Dv LK_NOPAUSE
-Disable the spinlock while acquiring the lock.
+.It Dv LK_NOSHARE
+Allow exclusive locks only.
.It Dv LK_TIMELOCK
Use
.Fa timo
@@ -140,6 +138,8 @@
.It Dv LK_UPGRADE
Upgrade a shared lock to an exclusive lock.
If this call fails, the shared lock is lost.
+During the upgrade, the shared lock could
+be temporarily dropped.
Attempts to upgrade an exclusive lock will cause a
.Xr panic 9 .
.It Dv LK_RELEASE
@@ -272,7 +272,12 @@
.Xr panic 9
will be the result of trying.
.Sh SEE ALSO
-.Xr msleep 9 ,
+.Xr condvar 9 ,
+.Xr locking 9 ,
+.Xr mutex 9 ,
+.Xr rwlock 9 ,
+.Xr sleep 9 ,
+.Xr sx 9 ,
.Xr mtx_assert 9 ,
.Xr panic 9 ,
.Xr VOP_PRINT 9
Index: firmware.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/firmware.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/firmware.9 -L share/man/man9/firmware.9 -u -r1.2 -r1.3
--- share/man/man9/firmware.9
+++ share/man/man9/firmware.9
@@ -21,7 +21,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/firmware.9,v 1.2.2.2 2006/03/23 07:41:32 hrs Exp $
+.\" $FreeBSD: src/share/man/man9/firmware.9,v 1.6 2007/02/15 17:52:17 luigi Exp $
.\"
.Dd January 6, 2006
.Os
@@ -43,73 +43,224 @@
const void *data; /* location of image */
size_t datasize; /* size of image in bytes */
unsigned int version; /* version of the image */
- int refcnt; /* held references */
- struct firmware *parent; /* not null if a subimage */
- linker_file_t file; /* loadable module */
};
.Ed
-.Ft struct firmware *
+.Ft "const struct firmware *"
.Fo firmware_register
.Fa "const char *imagename"
.Fa "const void *data"
.Fa "size_t datasize"
.Fa "unsigned int version"
-.Fa "struct firmware *parent"
+.Fa "const struct firmware *parent"
.Fc
.Ft int
.Fn firmware_unregister "const char *imagename"
-.Ft struct firmware *
+.Ft "const struct firmware *"
.Fn firmware_get "const char *imagename"
.Ft void
-.Fn firmware_put "struct firmware *fp" "int flags"
+.Fn firmware_put "const struct firmware *fp" "int flags"
.Sh DESCRIPTION
-The firmware abstraction provides a convenient interface for loading firmware
-images into the kernel.
-Specially crafted kernel modules are used to hold the firmware images.
+The
+.Nm firmware
+abstraction provides a convenient interface for loading
+.Nm firmware images
+into the kernel, and for accessing such images from kernel components.
+.Pp
+A
+.Nm firmware image
+(or
+.Nm image
+for brevity)
+is an opaque block of data residing in kernel memory.
+It is associated to a unique
+.Nm imagename
+which constitutes a search key, and to an integer
+.Nm version
+number, which is also an opaque piece of information for the
+firmware subsystem.
+.Pp
+An image is registered with the
+.Nm firmware
+subsystem by calling the function
+.Fn firmware_register ,
+and unregistered by calling
+.Fn firmware_unregister .
+These functions are usually (but not exclusively) called by
+specially crafted kernel modules that contain the firmware image.
+The modules can be statically compiled in the kernel, or loaded by
+.Nm /boot/loader ,
+manually at runtime, or on demand by the firmware subsystem.
+.Pp
+.Nm Clients
+of the firmware subsystem can request access to a given image
+by calling the function
+.Fn firmware_get
+with the
+.Nm imagename
+they want as an argument. If a matching image is not already registered,
+the firmware subsystem will try to load it using the
+mechanisms specified below (typically, a kernel module
+with
+.Nm the same name
+as the image).
+.Sh API DESCRIPTION
+The kernel
+.Nm firmware API
+is made of the following functions:
.Pp
-The function
-.Fn firmware_register
-is used on load of such modules to register contained firmware images.
-The arguments to
.Fn firmware_register
-include a name that identifies the image for later requests to the firmware
-system, a pointer to the actual image, the size of the image and an optional
-parent image.
-The parent image is used to keep track of references to a given module so that
-it can be unloaded on last reference.
+registers with the kernel an image of size
+.Nm datasize
+located at address
+.Nm data ,
+under the name
+.Nm imagename .
+.Pp
+The function returns NULL on error (e.g. because an
+image with the same name already exists, or the image
+table is full), or a
+.Ft const struct firmware *
+pointer to the image requested.
.Pp
-The function
.Fn firmware_unregister
-removes the firmware image identified by the name from the system if there
-are no pending references or returns an error otherwise.
+tries to unregister the firmware image
+.Nm imagename
+from the system. The function is successful and returns 0
+if there are no pending references to the image, otherwise
+it does not unregister the image and returns EBUSY.
.Pp
-The function
.Fn firmware_get
returns the requested firmware image.
-If the image is not yet registered with the system
+If the image is not yet registered with the system,
+the function tries to load it.
+This involves the linker subsystem and disk access, so
.Fn firmware_get
-tries to load a module with the corresponding name.
-This involves the linker subsystem and disk access which is why
-.Fn firmware_get
-must not be called with any locks (except for Giant).
-On success
+must not be called with any locks (except for
+.Va Giant ) .
+The caller must also have a process context so filesystem state such as
+the root vnode is defined (e.g. you cannot load from a taskqueue thread).
+.Pp
+On success,
.Fn firmware_get
returns a pointer to the image description and increases the reference count
-for this image.
+for this image. On failure, the function returns NULL.
.Pp
-The function
.Fn firmware_put
-is used to drop the reference to a firmware image.
-The flags argument may be set to
+drops a reference to a firmware image.
+The
+.Fa flags
+argument may be set to
.Dv FIRMWARE_UNLOAD
-to indicate that the caller wishes to unload the corresponding module if the
-image becomes unreferenced.
+to indicate that
+firmware_put is free to reclaim resources associated with
+the firmware image if this is the last reference.
+.Sh FIRMWARE LOADING MECHANISMS
+As mentioned before, any component of the system can register
+firmware images at any time by simply calling
+.Fn firmware_register .
+.Pp
+This is typically done when a module containing
+a firmware image is given control,
+whether compiled in, or preloaded by
+.Nm /boot/loader ,
+or manually loaded with
+.Xr kldload 8 .
+However, a system can implement additional mechanisms to bring
+these images in memory before calling
+.Fn firmware_register .
+.Pp
+When
+.Fn firmware_get
+does not find the requested image, it tries to load it using
+one of the available loading mechanisms.
+At the moment, there is only one, namely
+.Nm Loadable kernel modules :
+.Pp
+A firmware image named
+.Nm foo
+is looked up by trying to load the module named
+.Nm foo.ko ,
+using the facilities described in
+.Xr kld 4 .
+In particular, images are looked up in the directories specified
+by the sysctl variable
+.Nm kern.module_path
+which on most systems defaults to
+.Nm /boot/kernel;/boot/modules .
+.Pp
+Note that in case a module contains multiple images,
+the caller should first request a
+.Fn firmware_get
+for the first image contained in the module, followed by requests
+for the other images.
+.Sh BUILDING FIRMWARE LOADABLE MODULES
+A firmware module is built by embedding the
+.Nm firmware image
+into a suitable loadable kernel module that calls
+.Fn firmware_register
+on loading, and
+.Fn firmware_unregister
+on unloading.
+.Pp
+Various system scripts and makefiles let you build a module
+by simply writing a Makefile with the following entries:
+.Bd -literal
+
+ KMOD= imagename
+ FIRMWS= image_file:imagename[:version]
+ .include <bsd.kmod.mk>
+
+.Ed
+where KMOD is the basename of the module; FIRMWS is a list of
+colon-separated tuples indicating the image_file's to be embedded
+in the module, the imagename and version of each firmware image.
+.Pp
+If you need to embed firmware images into a system, you should write
+appropriate entries in the <files.arch> file, e.g. this example is
+from
+.Nm sys/arm/xscale/ixp425/files.ixp425:
+.Bd -literal
+ixp425_npe_fw.c optional npe_fw \\
+ compile-with "${AWK} -f $S/tools/fw_stub.awk \\
+ IxNpeMicrocode.dat:npe_fw -mnpe -c${.TARGET}" \\
+ no-implicit-rule before-depend local \\
+ clean "ixp425_npe_fw.c"
+#
+# NB: ld encodes the path in the binary symbols generated for the
+# firmware image so link the file to the object directory to
+# get known values for reference in the _fw.c file.
+#
+IxNpeMicrocode.fwo optional npe_fw \\
+ dependency "IxNpeMicrocode.dat" \\
+ compile-with "${LD} -b binary -d -warn-common \\
+ -r -d -o ${.TARGET} IxNpeMicrocode.dat" \\
+ no-implicit-rule \\
+ clean "IxNpeMicrocode.fwo"
+IxNpeMicrocode.dat optional npe_fw \\
+ dependency ".PHONY" \\
+ compile-with "if [ -e $S/arm/xscale/ixp425/IxNpeMicrocode.dat ]; \\
+ then \\
+ ln -sf $S/arm/xscale/ixp425/IxNpeMicrocode.dat .; \\
+ else echo 'WARNING, no IxNpeMicrocode.dat file; you must obtain this from the Intel web site'; false; \\
+ fi" \\
+ no-obj no-implicit-rule \\
+ clean "IxNpeMicrocode.dat"
+.Ed
+.Pp
+Note that generating the firmware modules in this way requires
+the availability of the following tools:
+.Xr awk ,
+.Xr Make ,
+the compiler and the linker.
.Sh SEE ALSO
-.Xr module 9
+.Xr module 9 ,
+.Xr kld 4
.Pp
-.Pa /usr/share/examples/kld
+.Pa /usr/share/examples/kld/firmware
.Sh HISTORY
-The firmware system was introduced in
+The
+.Nm firmware
+system was introduced in
.Fx 6.1 .
.Sh AUTHORS
This manual page was written by
Index: namei.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/namei.9,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L share/man/man9/namei.9 -L share/man/man9/namei.9 -u -r1.1.1.1 -r1.2
--- share/man/man9/namei.9
+++ share/man/man9/namei.9
@@ -31,9 +31,9 @@
.\" If you integrate this manpage in another OS, I'd appreciate a note
.\" - eivind at FreeBSD.org
.\"
-.\" $FreeBSD: src/share/man/man9/namei.9,v 1.26.2.1 2005/09/25 18:51:45 rwatson Exp $
+.\" $FreeBSD: src/share/man/man9/namei.9,v 1.29 2005/12/13 17:07:52 ru Exp $
.\"
-.Dd May 27, 2003
+.Dd September 21, 2005
.Os
.Dt NAMEI 9
.Sh NAME
@@ -82,7 +82,7 @@
in which case the caller must later release
.Va Giant
based on the results of
-.Fn NDHASGIANT.
+.Fn NDHASGIANT .
.Pp
The
.Fn NDINIT
Index: vnode.9
===================================================================
RCS file: /home/cvs/src/share/man/man9/vnode.9,v
retrieving revision 1.2
retrieving revision 1.3
diff -L share/man/man9/vnode.9 -L share/man/man9/vnode.9 -u -r1.2 -r1.3
--- share/man/man9/vnode.9
+++ share/man/man9/vnode.9
@@ -25,7 +25,6 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD: src/share/man/man9/vnode.9,v 1.29 2005/06/28 20:15:19 hmp Exp $
-.\" $MidnightBSD$
.\"
.Dd May 20, 2003
.Os
More information about the Midnightbsd-cvs
mailing list