Bring up to date. pool_create() doesn't exist any longer. Include
missing description of pool_destroy(). Fix some minor nits. It isn't clear from the source whether pool_reclaim() and pool_drain() should belong to the exported API. At least it seems they aren't used. No descriptions for these functions exist in this manpage.
This commit is contained in:
parent
030941bc0d
commit
7b2064c2a5
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: pool.9,v 1.18 2001/06/21 11:59:01 wiz Exp $
|
.\" $NetBSD: pool.9,v 1.19 2001/07/19 21:35:53 gmcgarry Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
.\" Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
|
@ -34,12 +34,11 @@
|
||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd July 23, 1998
|
.Dd July 20, 2001
|
||||||
.Dt POOL 9
|
.Dt POOL 9
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm pool_init ,
|
.Nm pool_init ,
|
||||||
.Nm pool_create ,
|
|
||||||
.Nm pool_destroy ,
|
.Nm pool_destroy ,
|
||||||
.Nm pool_get ,
|
.Nm pool_get ,
|
||||||
.Nm pool_put ,
|
.Nm pool_put ,
|
||||||
|
@ -50,19 +49,6 @@
|
||||||
.Nd resource-pool manager
|
.Nd resource-pool manager
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Fd #include <sys/pool.h>
|
.Fd #include <sys/pool.h>
|
||||||
.Ft struct pool *
|
|
||||||
.\" too many arguments for a single .Fn
|
|
||||||
.Fo pool_create
|
|
||||||
.Fa "size_t size"
|
|
||||||
.Fa "u_int align"
|
|
||||||
.Fa "u_int align_offset"
|
|
||||||
.Fa "int nitems"
|
|
||||||
.Fa "char *wchan"
|
|
||||||
.Fa "u_int pagesz"
|
|
||||||
.Fa "void *(*palloc)(unsigned long sz, int flags, int tag)"
|
|
||||||
.Fa "void (*prelease)(void *v, unsigned long sz, int tag)"
|
|
||||||
.Fa "int mtag"
|
|
||||||
.Fc
|
|
||||||
.Ft void
|
.Ft void
|
||||||
.Fo pool_init
|
.Fo pool_init
|
||||||
.Fa "struct pool *"
|
.Fa "struct pool *"
|
||||||
|
@ -76,6 +62,8 @@
|
||||||
.Fa "void (*prelease)(void *v, unsigned long sz, int tag)"
|
.Fa "void (*prelease)(void *v, unsigned long sz, int tag)"
|
||||||
.Fa "int mtag"
|
.Fa "int mtag"
|
||||||
.Fc
|
.Fc
|
||||||
|
.Ft void
|
||||||
|
.Fn pool_destroy "struct pool *pp"
|
||||||
.Ft void *
|
.Ft void *
|
||||||
.Fn pool_get "struct pool *pp" "int flags"
|
.Fn pool_get "struct pool *pp" "int flags"
|
||||||
.Ft void
|
.Ft void
|
||||||
|
@ -99,18 +87,20 @@ resources currently available from the system-wide memory allocator
|
||||||
The pool manager can optionally obtain temporary memory by calling the
|
The pool manager can optionally obtain temporary memory by calling the
|
||||||
.Fn palloc
|
.Fn palloc
|
||||||
function passed to
|
function passed to
|
||||||
.Fn pool_create ,
|
.Fn pool_init ,
|
||||||
for extra pool items in case the number of allocations exceeds
|
for extra pool items in case the number of allocations exceeds
|
||||||
the nominal number of pool items managed by a pool resource.
|
the nominal number of pool items managed by a pool resource.
|
||||||
This temporary memory will be automatically returned to the system
|
This temporary memory will be automatically returned to the system
|
||||||
at a later time.
|
at a later time.
|
||||||
.Ss CREATING A POOL
|
.Ss INITIALIZING A POOL
|
||||||
The function
|
The function
|
||||||
.Fn pool_create
|
.Fn pool_init
|
||||||
initializes a resource pool and returns a handle to it.
|
initializes a resource pool.
|
||||||
The arguments are:
|
The arguments are:
|
||||||
.Pp
|
.Pp
|
||||||
.Bl -tag -offset indent -width "prelease"
|
.Bl -tag -offset indent -width "prelease"
|
||||||
|
.It Fa pp
|
||||||
|
The handle identifying the pool resource instance.
|
||||||
.It Fa size
|
.It Fa size
|
||||||
Specifies the size of the memory items managed by the pool.
|
Specifies the size of the memory items managed by the pool.
|
||||||
.It Fa align
|
.It Fa align
|
||||||
|
@ -163,7 +153,8 @@ and
|
||||||
.Xr uvm_km_free 9
|
.Xr uvm_km_free 9
|
||||||
to allocate and release memory using the
|
to allocate and release memory using the
|
||||||
.Em kernel_map
|
.Em kernel_map
|
||||||
.Po see
|
.Po
|
||||||
|
see
|
||||||
.Xr uvm 9
|
.Xr uvm 9
|
||||||
.Pc .
|
.Pc .
|
||||||
.It Fa mtag
|
.It Fa mtag
|
||||||
|
@ -174,24 +165,20 @@ and
|
||||||
when allocating or releasing memory pages.
|
when allocating or releasing memory pages.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If not enough memory is available to create the pool resource,
|
|
||||||
.Fn pool_create
|
|
||||||
returns
|
|
||||||
.Dv NULL .
|
|
||||||
.\"The macro
|
.\"The macro
|
||||||
.\".Fn POOL_STORAGE_SIZE "size" "nitems"
|
.\".Fn POOL_STORAGE_SIZE "size" "nitems"
|
||||||
.\"can be used to determine the amount of storage needed to setup a pool,
|
.\"can be used to determine the amount of storage needed to setup a pool,
|
||||||
.\"given the size and number of the pool items.
|
.\"given the size and number of the pool items.
|
||||||
.Pp
|
.Ss DESTROYING A POOL
|
||||||
.Fn pool_init
|
The function
|
||||||
can be used to initialize a pre-allocated pool structure. It takes a pointer
|
.Fn pool_destroy
|
||||||
to an existing
|
destroys a resource pool. It takes a single argument
|
||||||
.Fa struct pool
|
.Fa pp
|
||||||
as its first argument. The other arguments are as described for
|
identifying the pool resource instance.
|
||||||
.Fn pool_create .
|
|
||||||
.Ss ALLOCATING ITEMS FROM A POOL
|
.Ss ALLOCATING ITEMS FROM A POOL
|
||||||
.Fn pool_get
|
.Fn pool_get
|
||||||
allocates an item from the pool and returns a pointer to it.
|
allocates an item from the pool and returns a pointer to it.
|
||||||
|
The arguments are:
|
||||||
.Bl -tag -offset indent -width "flags"
|
.Bl -tag -offset indent -width "flags"
|
||||||
.It Fa pp
|
.It Fa pp
|
||||||
The handle identifying the pool resource instance.
|
The handle identifying the pool resource instance.
|
||||||
|
@ -245,6 +232,9 @@ size set by
|
||||||
and there are no outstanding requests for pool items,
|
and there are no outstanding requests for pool items,
|
||||||
the excess items will be returned to the system by calling
|
the excess items will be returned to the system by calling
|
||||||
.Fn prelease .
|
.Fn prelease .
|
||||||
|
The arguments to
|
||||||
|
.Fn pool_put
|
||||||
|
are:
|
||||||
.Bl -tag -offset indent -width "item"
|
.Bl -tag -offset indent -width "item"
|
||||||
.It Fa pp
|
.It Fa pp
|
||||||
The handle identifying the pool resource instance.
|
The handle identifying the pool resource instance.
|
||||||
|
@ -264,7 +254,9 @@ by the caller through the
|
||||||
.Fa storage
|
.Fa storage
|
||||||
parameter.
|
parameter.
|
||||||
.Pp
|
.Pp
|
||||||
|
The arguments to
|
||||||
.Fn pool_prime
|
.Fn pool_prime
|
||||||
|
are:
|
||||||
.Bl -tag -offset indent -width "nitems"
|
.Bl -tag -offset indent -width "nitems"
|
||||||
.It Fa pp
|
.It Fa pp
|
||||||
The handle identifying the pool resource instance.
|
The handle identifying the pool resource instance.
|
||||||
|
|
Loading…
Reference in New Issue