Unify kmem_alloc/zalloc/free under kmem(9). Links preserved.

This commit is contained in:
rmind 2009-08-03 19:43:58 +00:00
parent aa89e1b426
commit deef563516
5 changed files with 55 additions and 149 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1289 2009/08/03 19:08:48 rmind Exp $
# $NetBSD: mi,v 1.1290 2009/08/03 19:43:58 rmind Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -8700,6 +8700,7 @@
./usr/share/man/cat9/kfilter_register.0 comp-sys-catman .cat
./usr/share/man/cat9/kfilter_unregister.0 comp-sys-catman .cat
./usr/share/man/cat9/killproc.0 comp-sys-catman .cat
./usr/share/man/cat9/kmem.0 comp-sys-catman .cat
./usr/share/man/cat9/kmem_alloc.0 comp-sys-catman .cat
./usr/share/man/cat9/kmem_free.0 comp-sys-catman .cat
./usr/share/man/cat9/kmem_zalloc.0 comp-sys-catman .cat
@ -14093,6 +14094,7 @@
./usr/share/man/html9/kfilter_register.html comp-sys-htmlman html
./usr/share/man/html9/kfilter_unregister.html comp-sys-htmlman html
./usr/share/man/html9/killproc.html comp-sys-htmlman html
./usr/share/man/html9/kmem.html comp-sys-htmlman html
./usr/share/man/html9/kmem_alloc.html comp-sys-htmlman html
./usr/share/man/html9/kmem_free.html comp-sys-htmlman html
./usr/share/man/html9/kmem_zalloc.html comp-sys-htmlman html
@ -19645,6 +19647,7 @@
./usr/share/man/man9/kfilter_register.9 comp-sys-man .man
./usr/share/man/man9/kfilter_unregister.9 comp-sys-man .man
./usr/share/man/man9/killproc.9 comp-sys-man .man
./usr/share/man/man9/kmem.9 comp-sys-man .man
./usr/share/man/man9/kmem_alloc.9 comp-sys-man .man
./usr/share/man/man9/kmem_free.9 comp-sys-man .man
./usr/share/man/man9/kmem_zalloc.9 comp-sys-man .man

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.284 2009/08/03 19:08:48 rmind Exp $
# $NetBSD: Makefile,v 1.285 2009/08/03 19:43:58 rmind Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@ -26,8 +26,7 @@ MAN= accept_filter.9 accf_data.9 accf_http.9 \
ieee80211_radiotap.9 iic.9 imax.9 \
in_getifa.9 \
in4_cksum.9 inittodr.9 intro.9 ioasic.9 ioctl.9 ipkdb.9 isa.9 \
isapnp.9 itimerfix.9 kauth.9 kcopy.9 \
kmem_alloc.9 kmem_free.9 kmem_zalloc.9 \
isapnp.9 itimerfix.9 kauth.9 kcopy.9 kmem.9 \
kpause.9 \
kfilter_register.9 knote.9 \
kprintf.9 kthread.9 linedisc.9 lock.9 log.9 ltsleep.9 \
@ -335,6 +334,7 @@ MLINKS+=isapnp.9 isapnp_devmatch.9 \
isapnp.9 isapnp_unconfig.9
MLINKS+=knote.9 KNOTE.9 \
kfilter_register.9 kfilter_unregister.9
MLINKS+=kmem.9 kmem_alloc.9 kmem.9 kmem_free.9 kmem.9 kmem_zalloc.9
MAN+= kpreempt.9
MLINKS+=kpreempt.9 kpreempt_disable.9 \
kpreempt.9 kpreempt_disabled.9 \

View File

@ -1,4 +1,4 @@
.\" $NetBSD: kmem_alloc.9,v 1.11 2009/08/03 19:30:32 rmind Exp $
.\" $NetBSD: kmem.9,v 1.1 2009/08/03 19:43:59 rmind Exp $
.\"
.\" Copyright (c)2006 YAMAMOTO Takashi,
.\" All rights reserved.
@ -25,13 +25,13 @@
.\" SUCH DAMAGE.
.\"
.\" ------------------------------------------------------------
.Dd March 29, 2009
.Dt KMEM_ALLOC 9
.Dd August 3, 2009
.Dt KMEM 9
.Os
.\" ------------------------------------------------------------
.Sh NAME
.Nm kmem_alloc
.Nd allocate kernel wired memory
.Nm kmem
.Nd kernel wired memory allocator
.\" ------------------------------------------------------------
.Sh SYNOPSIS
.In sys/kmem.h
@ -39,6 +39,12 @@
.Ft void *
.Fn kmem_alloc \
"size_t size" "km_flag_t kmflags"
.Ft void *
.Fn kmem_zalloc \
"size_t size" "km_flag_t kmflags"
.Ft void
.Fn kmem_free \
"void *p" "size_t size"
.\" ------------------------------------------------------------
.Pp
.Cd "options DEBUG"
@ -79,6 +85,43 @@ allocation to be made in another place.
The contents of allocated memory are uninitialized.
.Pp
Unlike Solaris, kmem_alloc(0, flags) is illegal.
.Pp
.\" ------------------------------------------------------------
.Fn kmem_zalloc
is the equivalent of
.Fn kmem_alloc ,
except that it initializes the memory to zero.
.Pp
.\" ------------------------------------------------------------
.Fn kmem_free
frees kernel wired memory allocated by
.Fn kmem_alloc
or
.Fn kmem_zalloc
so that it can be used for other purposes.
It takes the following arguments.
.Bl -tag -width kmflags
.It Fa p
The pointer to the memory being freed.
It must be the one returned by
.Fn kmem_alloc
or
.Fn kmem_zalloc .
.It Fa size
The size of the memory being freed, in bytes.
It must be the same as the
.Fa size
argument used for
.Fn kmem_alloc
or
.Fn kmem_zalloc
when the memory was allocated.
.El
.Pp
Freeing
.Dv NULL
is illegal.
.\" ------------------------------------------------------------
.Sh NOTES
Making
.Dv KM_SLEEP
@ -183,8 +226,6 @@ Otherwise, it returns
.\" ------------------------------------------------------------
.Sh SEE ALSO
.Xr intro 9 ,
.Xr kmem_free 9 ,
.Xr kmem_zalloc 9 ,
.Xr malloc 9 ,
.Xr memoryallocators 9
.\" ------------------------------------------------------------

View File

@ -1,81 +0,0 @@
.\" $NetBSD: kmem_free.9,v 1.5 2008/01/03 15:59:57 yamt Exp $
.\"
.\" Copyright (c)2006 YAMAMOTO Takashi,
.\" 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.
.\"
.\" ------------------------------------------------------------
.Dd January 4, 2008
.Dt KMEM_FREE 9
.Os
.\" ------------------------------------------------------------
.Sh NAME
.Nm kmem_free
.Nd free kernel wired memory
.\" ------------------------------------------------------------
.Sh SYNOPSIS
.In sys/kmem.h
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.Ft void
.Fn kmem_free \
"void *p" "size_t size"
.\" ------------------------------------------------------------
.Sh DESCRIPTION
.Fn kmem_free
frees kernel wired memory allocated by
.Fn kmem_alloc
or
.Fn kmem_zalloc
so that it can be used for other purposes.
It takes the following arguments.
.Bl -tag -width kmflags
.It Fa p
The pointer to the memory being freed.
It must be the one returned by
.Fn kmem_alloc
or
.Fn kmem_zalloc .
.It Fa size
The size of the memory being freed, in bytes.
It must be the same as the
.Fa size
argument used for
.Fn kmem_alloc
or
.Fn kmem_zalloc
when the memory was allocated.
.El
.Pp
Freeing
.Dv NULL
is illegal.
.\" ------------------------------------------------------------
.Sh SEE ALSO
.Xr intro 9 ,
.Xr kmem_alloc 9 ,
.Xr kmem_zalloc 9 ,
.Xr memoryallocators 9
.\" ------------------------------------------------------------
.Sh CAVEATS
.Fn kmem_free
can not be used from interrupt context.

View File

@ -1,57 +0,0 @@
.\" $NetBSD: kmem_zalloc.9,v 1.5 2007/02/17 08:50:05 wiz Exp $
.\"
.\" Copyright (c)2006 YAMAMOTO Takashi,
.\" 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.
.\"
.\" ------------------------------------------------------------
.Dd June 25, 2006
.Dt KMEM_ZALLOC 9
.Os
.\" ------------------------------------------------------------
.Sh NAME
.Nm kmem_zalloc
.Nd allocate zero-initialized kernel wired memory
.\" ------------------------------------------------------------
.Sh SYNOPSIS
.In sys/kmem.h
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.Ft void *
.Fn kmem_zalloc \
"size_t size" "km_flag_t kmflags"
.\" ------------------------------------------------------------
.Sh DESCRIPTION
.Fn kmem_zalloc
is the equivalent of
.Fn kmem_alloc ,
except that it initializes the memory to zero.
.\" ------------------------------------------------------------
.Sh SEE ALSO
.Xr intro 9 ,
.Xr kmem_alloc 9 ,
.Xr kmem_free 9 ,
.Xr memoryallocators 9
.\" ------------------------------------------------------------
.Sh CAVEATS
.Fn kmem_zalloc
can not be used from interrupt context.