1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
32 .\" @(#)mpool.3 8.1 (Berkeley) 6/4/93
34 .\" Japanese Version Copyright (c) 1999 Shouichi Saito
35 .\" all rights reserved.
36 .\" Translated Mon Jul 26 21:51:36 JST 1999
37 .\" by Shouichi Saito <ss236rx@ymg.urban.ne.jp>
38 .\" Proofed Tue Aug 19 1999 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
40 .\"WORD: descriptor ¥Ç¥¹¥¯¥ê¥×¥¿
41 .TH MPOOL 3 1993-06-04 "" "Linux Programmer's Manual"
44 .\"O mpool \- shared memory buffer pool
45 mpool \- ¶¦Í¥á¥â¥ê¥Ð¥Ã¥Õ¥¡¥×¡¼¥ë
51 .BI "MPOOL *mpool_open(DBT *" key ", int " fd ", pgno_t " pagesize \
52 ", pgno_t " maxcache );
54 .BI "void mpool_filter(MPOOL *" mp ", void (*pgin)(void *, pgno_t, void *),"
55 .BI " void (*" pgout ")(void *, pgno_t, void *),"
56 .BI " void *" pgcookie );
58 .BI "void *mpool_new(MPOOL *" mp ", pgno_t *" pgnoaddr );
60 .BI "void *mpool_get(MPOOL *" mp ", pgno_t " pgno ", unsigned int " flags );
62 .BI "int mpool_put(MPOOL *" mp ", void *" pgaddr ", unsigned int " flags );
64 .BI "int mpool_sync(MPOOL *" mp );
66 .BI "int mpool_close(MPOOL *" mp );
70 .\"O is the library interface intended to provide page oriented buffer management
72 .\"O The buffers may be shared between processes.
74 ¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥Ú¡¼¥¸»Ø¸þ¤Î¥Ð¥Ã¥Õ¥¡´ÉÍý¤ò¼ÂÁõ¤·¤¿
75 ¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£
78 .\"O .BR mpool_open ()
79 .\"O initializes a memory pool.
82 ¤Ï¥á¥â¥ê¥×¡¼¥ë¤ò½é´ü²½¤¹¤ë¡£
85 .\"O argument is the byte string used to negotiate between multiple
86 .\"O processes wishing to share buffers.
87 .\"O If the file buffers are mapped in shared memory, all processes using
88 .\"O the same key will share the buffers.
90 °ú¿ô¤Ï¥Ð¥¤¥Èʸ»úÎó¤Ç¤¢¤ê¡¢¥Ð¥Ã¥Õ¥¡¤ò¶¦Í¤·¤¿¤¤Ê£¿ô¥×¥í¥»¥¹´Ö
91 ¤Ç¤Î¥Í¥´¥·¥¨¡¼¥·¥ç¥ó¤Ë»È¤ï¤ì¤ë¡£
92 ¥Õ¥¡¥¤¥ë¥Ð¥Ã¥Õ¥¡¤¬¶¦Í¥á¥â¥ê¤Ë¥Þ¥Ã¥×¤µ¤ì¤ë¤È¡¢
93 Ʊ¤¸¥¡¼¤ò»È¤¦¥×¥í¥»¥¹¤ÏÁ´¤Æ¥Ð¥Ã¥Õ¥¡¤ò¶¦Í¤¹¤ë¡£
96 .\"O is NULL, the buffers are mapped into private memory.
98 ¤¬ NULL ¤À¤È¡¢¥Ð¥Ã¥Õ¥¡¤Ï¥×¥é¥¤¥Ù¡¼¥È¤Ê¥á¥â¥ê¤Ë³ä¤êÉÕ¤±¤é¤ì¤ë¡£
101 .\"O argument is a file descriptor for the underlying file, which must be seekable.
103 °ú¿ô¤Ï¤â¤È¤Ë¤Ê¤ë¥Õ¥¡¥¤¥ë¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ç¤¢¤ë¡£
104 ¤³¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ï¥·¡¼¥¯²Äǽ¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
107 .\"O is non-NULL and matches a file already being mapped, the
109 .\"O argument is ignored.
111 ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤«¤Ä´û¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ë¥Þ¥Ã¥Á¤·¤¿¾ì¹ç¡¢
117 .\"O argument is the size, in bytes, of the pages into which the file is broken up.
119 °ú¿ô¤Ï¥Ð¥¤¥Èñ°Ì¤Ç¤Î¥Ú¡¼¥¸¥µ¥¤¥º¤Ç¤¢¤ê¡¢¥Õ¥¡¥¤¥ë¤Ï¤³¤Î¥µ¥¤¥º¤Ëʬ³ä¤µ¤ì¤ë¡£
122 .\"O argument is the maximum number of pages from the underlying file to cache
123 .\"O at any one time.
125 °ú¿ô¤Ï´ð¥Õ¥¡¥¤¥ë¤ò¥¥ã¥Ã¥·¥å¤¹¤ë¤È¤¤ËÍѤ¤¤ëºÇÂç¥Ú¡¼¥¸¿ô¤Ç¤¢¤ë¡£
126 .\"NAKANO "at any one time" ¤Ï¡Ö¤É¤ó¤Ê½Ö´Ö¤Ë¤ª¤¤¤Æ¤â (ºÇÂç)¡×¤Ç¤¹¤¬¡¢
127 .\"NAKANO ¾Êά²Äǽ¤Ç¤·¤ç¤¦¡£
128 .\"O This value is not relative to the number of processes which share a file's
129 .\"O buffers, but will be the largest value specified by any of the processes
130 .\"O sharing the file.
131 ¤³¤ÎÃͤϥե¡¥¤¥ë¥Ð¥Ã¥Õ¥¡¤ò¶¦Í¤·¤Æ¤¤¤ë¥×¥í¥»¥¹¤Î¿ô¤Ë¤Ï´Ø·¸¤Ê¤¤¤¬¡¢
132 ¥Õ¥¡¥¤¥ë¤ò¶¦Í¤¹¤ë¥×¥í¥»¥¹¤¬»ØÄꤷ¤¿¤¦¤Á¤ÎºÇÂçÃͤ¬¼ÂºÝ¤ËÍѤ¤¤é¤ì¤ë¡£
135 .\"O .BR mpool_filter ()
136 .\"O function is intended to make transparent input and output processing of the
140 ¤ÏÆ©²áŪ¤Ê¥Ú¡¼¥¸Æþ½ÐÎϽèÍý¤ò²Äǽ¤Ë¤¹¤ë¡£
143 .\"O function is specified, it is called each time a buffer is read into the memory
144 .\"O pool from the backing file.
148 ¥Õ¥¡¥¤¥ë¤«¤é¥á¥â¥ê¥×¡¼¥ë¤ËÆɤ߹þ¤Þ¤ì¤ëÅ٤ˤ³¤Î´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
151 .\"O function is specified, it is called each time a buffer is written into the
156 ¥Ð¥Ã¥Õ¥¡¤«¤é¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤µ¤ì¤ëÅ٤ˤ³¤Î´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
157 .\"O Both functions are called with the
159 .\"O pointer, the page number and a pointer to the page to being read or written.
162 ¥Ý¥¤¥ó¥¿¡¢¥Ú¡¼¥¸¿ô¡¢Æɤ߽ñ¤¤µ¤ì¤ë¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿¤ò°ú¿ô¤Ë¤È¤ë¡£
165 .\"O .BR mpool_new ()
168 .\"O pointer and an address as arguments.
173 ¥Ý¥¤¥ó¥¿¤È¥¢¥É¥ì¥¹¤ò°ú¿ô¤Ë¤È¤ë¡£
174 .\"O If a new page can be allocated, a pointer to the page is returned and
175 .\"O the page number is stored into the
178 ¿·¤·¤¤¥Ú¡¼¥¸¤¬³ä¤êÅö¤Æ²Äǽ¤Ê¾ì¹ç¡¢¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¡¢
181 ¥¢¥É¥ì¥¹¤ËǼ¤á¤é¤ì¤ë¡£
182 .\"O Otherwise, NULL is returned and
185 ³ä¤êÅö¤Æ¤¬ÉÔ²Äǽ¤Ê¾ì¹ç¤Ï NULL ¤¬ÊÖ¤µ¤ì¡¢
190 .\"O .BR mpool_get ()
193 .\"O pointer and a page number as arguments.
194 .\"O If the page exists, a pointer to the page is returned.
195 .\"O Otherwise, NULL is returned and
200 .\"O argument is not currently used.
205 ¥Ý¥¤¥ó¥¿¤È¥Ú¡¼¥¸¿ô¤ò°ú¿ô¤Ë¤È¤ë¡£¥Ú¡¼¥¸¤¬Â¸ºß¤·¤Æ¤¤¤ë¤È¡¢
206 ¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
207 ¸ºß¤·¤Æ¤¤¤Ê¤¤¤È NULL ¤¬ÊÖ¤µ¤ì¡¢
211 °ú¤¿ô¤Ï¸½ºß»ÈÍѤµ¤ì¤Æ¤¤¤Ê¤¤¡£
214 .\"O .BR mpool_put ()
215 .\"O unpins the page referenced by
221 ¤¬»²¾È¤¹¤ë¥Ú¡¼¥¸¤ò²òÊü¤¹¤ë¡£
223 .\"O must be an address previously returned by
224 .\"O .BR mpool_get ()
226 .\"O .BR mpool_new ().
232 ¤¬ÊÖ¤·¤¿¥¢¥É¥ì¥¹¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
233 .\"O The flag value is specified by ORing
234 .\"O any of the following values:
235 flag ¤ÎÃͤϰʲ¼¤ÎÃͤÎÏÀÍýϤǻØÄꤹ¤ë¡£
238 .\"O The page has been modified and needs to be written to the backing file.
239 ¥Ú¡¼¥¸¤ÏÊѹ¹¤µ¤ì¤Æ¤ª¤ê¡¢¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹É¬Íפ¬¤¢¤ë¡£
241 .\"O .BR mpool_put ()
242 .\"O returns 0 on success and \-1 if an error occurs.
244 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬¤¢¤ë¤È \-1 ¤òÊÖ¤¹¡£
247 .\"O .BR mpool_sync ()
248 .\"O writes all modified pages associated with the
256 ¥Ý¥¤¥ó¥¿¤Î¼¨¤¹¥Ú¡¼¥¸¤Î¤¦¤Á¡¢
257 Êѹ¹¤µ¤ì¤¿¤â¤Î¤òÁ´¤Æ¥Õ¥¡¥¤¥ë¤Ë½ñ¤½Ð¤¹¡£
258 .\"O .BR mpool_sync ()
259 .\"O returns 0 on success and \-1 if an error occurs.
261 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬¤¢¤ë¤È \-1 ¤òÊÖ¤¹¡£
264 .\"O .BR mpool_close ()
265 .\"O function free's up any allocated memory associated with the memory pool
269 ¤Ï¥á¥â¥ê¥×¡¼¥ë¥¯¥Ã¥¡¼¤Î¼¨¤¹³ä¤êÅö¤ÆºÑ¤ß¤Î¥á¥â¥ê¤ò²òÊü¤¹¤ë¡£
270 .\"O Modified pages are
272 .\"O written to the backing file.
273 Êѹ¹¤µ¤ì¤¿¥Ú¡¼¥¸¤Ï¥Õ¥¡¥¤¥ë¤Ë\fB½ñ¤½Ð¤µ¤ì¤Ê¤¤\fP¡£
274 .\"O .BR mpool_close ()
275 .\"O returns 0 on success and \-1 if an error occurs.
277 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬¤¢¤ë¤È \-1 ¤òÊÖ¤¹¡£
280 .\"O .BR mpool_open ()
281 .\"O function may fail and set
283 .\"O for any of the errors specified for the library routine
287 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
289 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
294 .\"O .BR mpool_get ()
295 .\"O function may fail and set
297 .\"O for the following:
300 ¤Ï¼ºÇÔ¤¹¤ë¤È¼¡¤Î¤è¤¦¤Ê
305 .\"O The requested record doesn't exist.
306 Í×µá¤Î¤¢¤Ã¤¿¥ì¥³¡¼¥É¤Ï¸ºß¤·¤Ê¤¤¡£
309 .\"O .BR mpool_new ()
311 .\"O .BR mpool_get ()
312 .\"O functions may fail and set
314 .\"O for any of the errors specified for the library routines
323 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
327 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
332 .\"O .BR mpool_sync ()
333 .\"O function may fail and set
335 .\"O for any of the errors specified for the library routine
339 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
341 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
346 .\"O .BR mpool_close ()
347 .\"O function may fail and set
349 .\"O for any of the errors specified for the library routine
353 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
355 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
358 .\"O .SH "CONFORMING TO"
360 .\"O Not in POSIX.1-2001.
361 .\"O Present on the BSDs.
362 POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£