1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)mpool.3 8.1 (Berkeley) 6/4/93
36 .TH MPOOL 3 2017-09-15 "" "Linux Programmer's Manual"
39 mpool \- shared memory buffer pool
45 .BI "MPOOL *mpool_open(DBT *" key ", int " fd ", pgno_t " pagesize \
46 ", pgno_t " maxcache );
48 .BI "void mpool_filter(MPOOL *" mp ", void (*pgin)(void *, pgno_t, void *),"
49 .BI " void (*" pgout ")(void *, pgno_t, void *),"
50 .BI " void *" pgcookie );
52 .BI "void *mpool_new(MPOOL *" mp ", pgno_t *" pgnoaddr );
54 .BI "void *mpool_get(MPOOL *" mp ", pgno_t " pgno ", unsigned int " flags );
56 .BI "int mpool_put(MPOOL *" mp ", void *" pgaddr ", unsigned int " flags );
58 .BI "int mpool_sync(MPOOL *" mp );
60 .BI "int mpool_close(MPOOL *" mp );
64 This page documents interfaces provided in glibc up until version 2.1.
65 Since version 2.2, glibc no longer provides these interfaces.
66 Probably, you are looking for the APIs provided by the
71 is the library interface intended to provide page oriented buffer management
73 The buffers may be shared between processes.
77 initializes a memory pool.
80 argument is the byte string used to negotiate between multiple
81 processes wishing to share buffers.
82 If the file buffers are mapped in shared memory, all processes using
83 the same key will share the buffers.
86 is NULL, the buffers are mapped into private memory.
89 argument is a file descriptor for the underlying file, which must be seekable.
92 is non-NULL and matches a file already being mapped, the
98 argument is the size, in bytes, of the pages into which the file is broken up.
101 argument is the maximum number of pages from the underlying file to cache
103 This value is not relative to the number of processes which share a file's
104 buffers, but will be the largest value specified by any of the processes
109 function is intended to make transparent input and output processing of the
113 function is specified, it is called each time a buffer is read into the memory
114 pool from the backing file.
117 function is specified, it is called each time a buffer is written into the
119 Both functions are called with the
121 pointer, the page number and a pointer to the page to being read or written.
127 pointer and an address as arguments.
128 If a new page can be allocated, a pointer to the page is returned and
129 the page number is stored into the
132 Otherwise, NULL is returned and
140 pointer and a page number as arguments.
141 If the page exists, a pointer to the page is returned.
142 Otherwise, NULL is returned and
147 argument is not currently used.
151 unpins the page referenced by
154 must be an address previously returned by
158 The flag value is specified by ORing
159 any of the following values:
162 The page has been modified and needs to be written to the backing file.
165 returns 0 on success and \-1 if an error occurs.
169 writes all modified pages associated with the
174 returns 0 on success and \-1 if an error occurs.
178 function free's up any allocated memory associated with the memory pool
182 written to the backing file.
184 returns 0 on success and \-1 if an error occurs.
188 function may fail and set
190 for any of the errors specified for the library routine
195 function may fail and set
200 The requested record doesn't exist.
206 functions may fail and set
208 for any of the errors specified for the library routines
216 function may fail and set
218 for any of the errors specified for the library routine
223 function may fail and set
225 for any of the errors specified for the library routine