OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / mpool.3
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 .\" 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>
39 .\"
40 .\"WORD:        descriptor      ¥Ç¥¹¥¯¥ê¥×¥¿
41 .TH MPOOL 3 1993-06-04 "" "Linux Programmer's Manual"
42 .UC 7
43 .SH Ì¾Á°
44 .\"O  mpool \- shared memory buffer pool
45 mpool \- ¶¦Í­¥á¥â¥ê¥Ð¥Ã¥Õ¥¡¥×¡¼¥ë
46 .SH ½ñ¼°
47 .nf
48 .B #include <db.h>
49 .B #include <mpool.h>
50 .sp
51 .BI "MPOOL *mpool_open(DBT *" key ", int " fd ", pgno_t " pagesize \
52 ", pgno_t " maxcache );
53 .sp
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 );
57 .sp
58 .BI "void *mpool_new(MPOOL *" mp ", pgno_t *" pgnoaddr );
59 .sp
60 .BI "void *mpool_get(MPOOL *" mp ", pgno_t " pgno ", unsigned int " flags );
61 .sp
62 .BI "int mpool_put(MPOOL *" mp ", void *" pgaddr ", unsigned int " flags );
63 .sp
64 .BI "int mpool_sync(MPOOL *" mp );
65 .sp
66 .BI "int mpool_close(MPOOL *" mp );
67 .fi
68 .SH ÀâÌÀ
69 .\"O .I Mpool
70 .\"O is the library interface intended to provide page oriented buffer management
71 .\"O of files.
72 .\"O The buffers may be shared between processes.
73 .I mpool
74 ¤Ï¡¢¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥Ú¡¼¥¸»Ø¸þ¤Î¥Ð¥Ã¥Õ¥¡´ÉÍý¤ò¼ÂÁõ¤·¤¿
75 ¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Ç¤¢¤ë¡£
76 .PP
77 .\"O The function
78 .\"O .BR mpool_open ()
79 .\"O initializes a memory pool.
80 ´Ø¿ô
81 .BR mpool_open ()
82 ¤Ï¥á¥â¥ê¥×¡¼¥ë¤ò½é´ü²½¤¹¤ë¡£
83 .\"O The
84 .\"O .I key
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.
89 .I key
90 °ú¿ô¤Ï¥Ð¥¤¥Èʸ»úÎó¤Ç¤¢¤ê¡¢¥Ð¥Ã¥Õ¥¡¤ò¶¦Í­¤·¤¿¤¤Ê£¿ô¥×¥í¥»¥¹´Ö
91 ¤Ç¤Î¥Í¥´¥·¥¨¡¼¥·¥ç¥ó¤Ë»È¤ï¤ì¤ë¡£
92 ¥Õ¥¡¥¤¥ë¥Ð¥Ã¥Õ¥¡¤¬¶¦Í­¥á¥â¥ê¤Ë¥Þ¥Ã¥×¤µ¤ì¤ë¤È¡¢
93 Ʊ¤¸¥­¡¼¤ò»È¤¦¥×¥í¥»¥¹¤ÏÁ´¤Æ¥Ð¥Ã¥Õ¥¡¤ò¶¦Í­¤¹¤ë¡£
94 .\"O If
95 .\"O .I key
96 .\"O is NULL, the buffers are mapped into private memory.
97 .I key
98 ¤¬ NULL ¤À¤È¡¢¥Ð¥Ã¥Õ¥¡¤Ï¥×¥é¥¤¥Ù¡¼¥È¤Ê¥á¥â¥ê¤Ë³ä¤êÉÕ¤±¤é¤ì¤ë¡£
99 .\"O The
100 .\"O .I fd
101 .\"O argument is a file descriptor for the underlying file, which must be seekable.
102 .I fd
103 °ú¿ô¤Ï¤â¤È¤Ë¤Ê¤ë¥Õ¥¡¥¤¥ë¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ç¤¢¤ë¡£
104 ¤³¤Î¥Õ¥¡¥¤¥ë¥Ç¥¹¥¯¥ê¥×¥¿¤Ï¥·¡¼¥¯²Äǽ¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
105 .\"O If
106 .\"O .I key
107 .\"O is non-NULL and matches a file already being mapped, the
108 .\"O .I fd
109 .\"O argument is ignored.
110 .I key
111 ¤¬ NULL ¤Ç¤Ê¤¯¡¢¤«¤Ä´û¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ë¥Þ¥Ã¥Á¤·¤¿¾ì¹ç¡¢
112 .I fd
113 °ú¿ô¤Ï̵»ë¤µ¤ì¤ë¡£
114 .PP
115 .\"O The
116 .\"O .I pagesize
117 .\"O argument is the size, in bytes, of the pages into which the file is broken up.
118 .I pagesize
119 °ú¿ô¤Ï¥Ð¥¤¥Èñ°Ì¤Ç¤Î¥Ú¡¼¥¸¥µ¥¤¥º¤Ç¤¢¤ê¡¢¥Õ¥¡¥¤¥ë¤Ï¤³¤Î¥µ¥¤¥º¤Ëʬ³ä¤µ¤ì¤ë¡£
120 .\"O The
121 .\"O .I maxcache
122 .\"O argument is the maximum number of pages from the underlying file to cache
123 .\"O at any one time.
124 .I maxcache
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 ¥Õ¥¡¥¤¥ë¤ò¶¦Í­¤¹¤ë¥×¥í¥»¥¹¤¬»ØÄꤷ¤¿¤¦¤Á¤ÎºÇÂçÃͤ¬¼ÂºÝ¤ËÍѤ¤¤é¤ì¤ë¡£
133 .PP
134 .\"O The
135 .\"O .BR mpool_filter ()
136 .\"O function is intended to make transparent input and output processing of the
137 .\"O pages possible.
138 ´Ø¿ô
139 .BR mpool_filter ()
140 ¤ÏÆ©²áŪ¤Ê¥Ú¡¼¥¸Æþ½ÐÎϽèÍý¤ò²Äǽ¤Ë¤¹¤ë¡£
141 .\"O If the
142 .\"O .I pgin
143 .\"O function is specified, it is called each time a buffer is read into the memory
144 .\"O pool from the backing file.
145 ´Ø¿ô
146 .I pgin
147 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤È¡¢
148 ¥Õ¥¡¥¤¥ë¤«¤é¥á¥â¥ê¥×¡¼¥ë¤ËÆɤ߹þ¤Þ¤ì¤ëÅ٤ˤ³¤Î´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
149 .\"O If the
150 .\"O .I pgout
151 .\"O function is specified, it is called each time a buffer is written into the
152 .\"O backing file.
153 ´Ø¿ô
154 .I pgout
155 ¤¬»ØÄꤵ¤ì¤Æ¤¤¤È¡¢
156 ¥Ð¥Ã¥Õ¥¡¤«¤é¥Õ¥¡¥¤¥ë¤Ë½ñ¤­½Ð¤µ¤ì¤ëÅ٤ˤ³¤Î´Ø¿ô¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
157 .\"O Both functions are called with the
158 .\"O .I pgcookie
159 .\"O pointer, the page number and a pointer to the page to being read or written.
160 ¤É¤Á¤é¤Î´Ø¿ô¤â¡¢
161 .I pgcookie
162 ¥Ý¥¤¥ó¥¿¡¢¥Ú¡¼¥¸¿ô¡¢Æɤ߽ñ¤­¤µ¤ì¤ë¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿¤ò°ú¿ô¤Ë¤È¤ë¡£
163 .PP
164 .\"O The function
165 .\"O .BR mpool_new ()
166 .\"O takes an
167 .\"O .I MPOOL
168 .\"O pointer and an address as arguments.
169 ´Ø¿ô
170 .BR mpool_new ()
171 ¤Ï
172 .I MPOOL
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
176 .\"O .I pgnoaddr
177 .\"O address.
178 ¿·¤·¤¤¥Ú¡¼¥¸¤¬³ä¤êÅö¤Æ²Äǽ¤Ê¾ì¹ç¡¢¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¡¢
179 ¥Ú¡¼¥¸¿ô¤¬
180 .I pgnoaddr
181 ¥¢¥É¥ì¥¹¤ËǼ¤á¤é¤ì¤ë¡£
182 .\"O Otherwise, NULL is returned and
183 .\"O .I errno
184 .\"O is set.
185 ³ä¤êÅö¤Æ¤¬ÉÔ²Äǽ¤Ê¾ì¹ç¤Ï NULL ¤¬ÊÖ¤µ¤ì¡¢ 
186 .I errno
187 ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
188 .PP
189 .\"O The function
190 .\"O .BR mpool_get ()
191 .\"O takes a
192 .\"O .I MPOOL
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
196 .\"O .I errno
197 .\"O is set.
198 .\"O The
199 .\"O .I flags
200 .\"O argument is not currently used.
201 ´Ø¿ô
202 .BR mpool_get ()
203 ¤Ï
204 .I MPOOL
205 ¥Ý¥¤¥ó¥¿¤È¥Ú¡¼¥¸¿ô¤ò°ú¿ô¤Ë¤È¤ë¡£¥Ú¡¼¥¸¤¬Â¸ºß¤·¤Æ¤¤¤ë¤È¡¢
206 ¥Ú¡¼¥¸¤Ø¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¤ë¡£
207 ¸ºß¤·¤Æ¤¤¤Ê¤¤¤È NULL ¤¬ÊÖ¤µ¤ì¡¢ 
208 .I errno
209 ¤¬¥»¥Ã¥È¤µ¤ì¤ë¡£
210 .I flags
211 °ú¤­¿ô¤Ï¸½ºß»ÈÍѤµ¤ì¤Æ¤¤¤Ê¤¤¡£
212 .PP
213 .\"O The function
214 .\"O .BR mpool_put ()
215 .\"O unpins the page referenced by
216 .\"O .IR pgaddr .
217 ´Ø¿ô
218 .BR mpool_put ()
219 ¤Ï
220 .I pgaddr
221 ¤¬»²¾È¤¹¤ë¥Ú¡¼¥¸¤ò²òÊü¤¹¤ë¡£
222 .\"O .I pgaddr
223 .\"O must be an address previously returned by
224 .\"O .BR mpool_get ()
225 .\"O or
226 .\"O .BR mpool_new ().
227 .I pgaddr
228 ¤Ï°ÊÁ°¤Ë
229 .BR mpool_get ()
230 ¤«
231 .BR mpool_new ()
232 ¤¬ÊÖ¤·¤¿¥¢¥É¥ì¥¹¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
233 .\"O The flag value is specified by
234 .\"O .IR or 'ing
235 .\"O any of the following values:
236 flag ¤ÎÃͤϰʲ¼¤ÎÃͤΤ¤¤º¤ì¤«¤«¡¢¤³¤ì¤é¤ÎÏÀÍýϤǤ¢¤ë¡£
237 .TP
238 .B MPOOL_DIRTY
239 .\"O The page has been modified and needs to be written to the backing file.
240 ¥Ú¡¼¥¸¤ÏÊѹ¹¤µ¤ì¤Æ¤ª¤ê¡¢¥Õ¥¡¥¤¥ë¤Ë½ñ¤­½Ð¤¹É¬Íפ¬¤¢¤ë¡£
241 .PP
242 .\"O .BR mpool_put ()
243 .\"O returns 0 on success and \-1 if an error occurs.
244 .BR mpool_put ()
245 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬¤¢¤ë¤È \-1 ¤òÊÖ¤¹¡£
246 .PP
247 .\"O The function
248 .\"O .BR mpool_sync ()
249 .\"O writes all modified pages associated with the
250 .\"O .I MPOOL
251 .\"O pointer to the
252 .\"O backing file.
253 ´Ø¿ô
254 .BR mpool_sync ()
255 ¤Ï
256 .I MPOOL
257 ¥Ý¥¤¥ó¥¿¤Î¼¨¤¹¥Ú¡¼¥¸¤Î¤¦¤Á¡¢
258 Êѹ¹¤µ¤ì¤¿¤â¤Î¤òÁ´¤Æ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­½Ð¤¹¡£
259 .\"O .BR mpool_sync ()
260 .\"O returns 0 on success and \-1 if an error occurs.
261 .BR mpool_sync ()
262 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬¤¢¤ë¤È \-1 ¤òÊÖ¤¹¡£
263 .PP
264 .\"O The
265 .\"O .BR mpool_close ()
266 .\"O function free's up any allocated memory associated with the memory pool
267 .\"O cookie.
268 ´Ø¿ô
269 .BR mpool_close ()
270 ¤Ï¥á¥â¥ê¥×¡¼¥ë¥¯¥Ã¥­¡¼¤Î¼¨¤¹³ä¤êÅö¤ÆºÑ¤ß¤Î¥á¥â¥ê¤ò²òÊü¤¹¤ë¡£
271 .\"O Modified pages are
272 .\"O .B not
273 .\"O written to the backing file.
274 Êѹ¹¤µ¤ì¤¿¥Ú¡¼¥¸¤Ï¥Õ¥¡¥¤¥ë¤Ë\fB½ñ¤­½Ð¤µ¤ì¤Ê¤¤\fP¡£
275 .\"O .BR mpool_close ()
276 .\"O returns 0 on success and \-1 if an error occurs.
277 .I mpool_close ()
278 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤ò¡¢¥¨¥é¡¼¤¬¤¢¤ë¤È \-1 ¤òÊÖ¤¹¡£
279 .SH ¥¨¥é¡¼
280 .\"O The
281 .\"O .BR mpool_open ()
282 .\"O function may fail and set
283 .\"O .I errno
284 .\"O for any of the errors specified for the library routine
285 .\"O .BR malloc (3).
286 ´Ø¿ô
287 .BR mpool_open ()
288 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
289 .BR malloc (3)
290 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
291 .I errno
292 ¤ò¥»¥Ã¥È¤¹¤ë¡£
293 .PP
294 .\"O The
295 .\"O .BR mpool_get ()
296 .\"O function may fail and set
297 .\"O .I errno
298 .\"O for the following:
299 ´Ø¿ô
300 .BR mpool_get ()
301 ¤Ï¼ºÇÔ¤¹¤ë¤È¼¡¤Î¤è¤¦¤Ê
302 .I errno
303 ¤ò¥»¥Ã¥È¤¹¤ë¡£
304 .TP 15
305 .B EINVAL
306 .\"O The requested record doesn't exist.
307 Í×µá¤Î¤¢¤Ã¤¿¥ì¥³¡¼¥É¤Ï¸ºß¤·¤Ê¤¤¡£
308 .PP
309 .\"O The
310 .\"O .BR mpool_new ()
311 .\"O and
312 .\"O .BR mpool_get ()
313 .\"O functions may fail and set
314 .\"O .I errno
315 .\"O for any of the errors specified for the library routines
316 .\"O .BR read (2),
317 .\"O .BR write (2),
318 .\"O and
319 .\"O .BR malloc (3).
320 ´Ø¿ô
321 .BR mpool_new ()
322 ¤È
323 .BR mpool_get ()
324 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
325 .BR read (2),
326 .BR write (2),
327 .BR malloc (3)
328 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
329 .I errno
330 ¤ò¥»¥Ã¥È¤¹¤ë¡£
331 .PP
332 .\"O The
333 .\"O .BR mpool_sync ()
334 .\"O function may fail and set
335 .\"O .I errno
336 .\"O for any of the errors specified for the library routine
337 .\"O .BR write (2).
338 ´Ø¿ô
339 .BR mpool_sync ()
340 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
341 .BR write (2)
342 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
343 .I errno
344 ¤ò¥»¥Ã¥È¤¹¤ë¡£
345 .PP
346 .\"O The
347 .\"O .BR mpool_close ()
348 .\"O function may fail and set
349 .\"O .I errno
350 .\"O for any of the errors specified for the library routine
351 .\"O .BR free (3).
352 ´Ø¿ô
353 .BR mpool_close ()
354 ¤Ï¼ºÇÔ¤¹¤ë¤È¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
355 .BR free (3)
356 ¤Ç»ØÄꤵ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Ë±þ¤¸¤¿
357 .I errno
358 ¤ò¥»¥Ã¥È¤¹¤ë¡£
359 .\"O .SH "CONFORMING TO"
360 .SH ½àµò
361 .\"O Not in POSIX.1-2001.
362 .\"O Present on the BSDs.
363 POSIX.1-2001 ¤Ë¤Ï¤Ê¤¤¡£
364 BSD ·Ï¤Ë¸ºß¤¹¤ë¡£
365 .SH ´ØÏ¢¹àÌÜ
366 .BR btree (3),
367 .BR dbopen (3),
368 .BR hash (3),
369 .BR recno (3)