source: trunk/src/emx/bsd/db/man/mpool.3@ 535

Last change on this file since 535 was 272, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.9 KB
Line 
1.\" Copyright (c) 1990, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\" notice, this list of conditions and the following disclaimer in the
11.\" documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\" must display the following acknowledgement:
14.\" This product includes software developed by the University of
15.\" California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\" may be used to endorse or promote products derived from this software
18.\" without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)mpool.3 8.1 (Berkeley) 6/4/93
33.\"
34.TH MPOOL 3 "June 4, 1993"
35.UC 7
36.SH NAME
37mpool \- shared memory buffer pool
38.SH SYNOPSIS
39.nf
40.ft B
41#include <db.h>
42#include <mpool.h>
43
44MPOOL *
45mpool_open (DBT *key, int fd, pgno_t pagesize, pgno_t maxcache);
46
47void
48mpool_filter (MPOOL *mp, void (*pgin)(void *, pgno_t, void *),
49.ti +5
50void (*pgout)(void *, pgno_t, void *), void *pgcookie);
51
52void *
53mpool_new (MPOOL *mp, pgno_t *pgnoaddr);
54
55void *
56mpool_get (MPOOL *mp, pgno_t pgno, u_int flags);
57
58int
59mpool_put (MPOOL *mp, void *pgaddr, u_int flags);
60
61int
62mpool_sync (MPOOL *mp);
63
64int
65mpool_close (MPOOL *mp);
66.ft R
67.fi
68.SH DESCRIPTION
69.IR Mpool
70is the library interface intended to provide page oriented buffer management
71of files.
72The buffers may be shared between processes.
73.PP
74The function
75.I mpool_open
76initializes a memory pool.
77The
78.I key
79argument is the byte string used to negotiate between multiple
80processes wishing to share buffers.
81If the file buffers are mapped in shared memory, all processes using
82the same key will share the buffers.
83If
84.I key
85is NULL, the buffers are mapped into private memory.
86The
87.I fd
88argument is a file descriptor for the underlying file, which must be seekable.
89If
90.I key
91is non-NULL and matches a file already being mapped, the
92.I fd
93argument is ignored.
94.PP
95The
96.I pagesize
97argument is the size, in bytes, of the pages into which the file is broken up.
98The
99.I maxcache
100argument is the maximum number of pages from the underlying file to cache
101at any one time.
102This value is not relative to the number of processes which share a file's
103buffers, but will be the largest value specified by any of the processes
104sharing the file.
105.PP
106The
107.I mpool_filter
108function is intended to make transparent input and output processing of the
109pages possible.
110If the
111.I pgin
112function is specified, it is called each time a buffer is read into the memory
113pool from the backing file.
114If the
115.I pgout
116function is specified, it is called each time a buffer is written into the
117backing file.
118Both functions are are called with the
119.I pgcookie
120pointer, the page number and a pointer to the page to being read or written.
121.PP
122The function
123.I mpool_new
124takes an MPOOL pointer and an address as arguments.
125If a new page can be allocated, a pointer to the page is returned and
126the page number is stored into the
127.I pgnoaddr
128address.