6a00dc5ed2
Submitted by: Yuko Sasaki <yuko@veltec.co.jp>
233 lines
6 KiB
Groff
233 lines
6 KiB
Groff
.\" Copyright (c) 1990, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)mpool.3 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/db/man/mpool.3,v 1.5.2.4 2001/12/14 18:33:49 ru Exp %
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd June 4, 1993
|
|
.Dt MPOOL 3
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm mpool
|
|
.Nd ¶¦Í¥á¥â¥ê¥Ð¥Ã¥Õ¥¡¥×¡¼¥ë
|
|
.Sh ½ñ¼°
|
|
.In db.h
|
|
.In mpool.h
|
|
.Ft MPOOL *
|
|
.Fn mpool_open "void *key" "int fd" "pgno_t pagesize" "pgno_t maxcache"
|
|
.Ft void
|
|
.Fo mpool_filter
|
|
.Fa "MPOOL *mp"
|
|
.Fa "void (*pgin)(void *, pgno_t, void *)"
|
|
.Fa "void (*pgout)(void *, pgno_t, void *)"
|
|
.Fa "void *pgcookie"
|
|
.Fc
|
|
.Ft void *
|
|
.Fn mpool_new "MPOOL *mp" "pgno_t *pgnoaddr"
|
|
.Ft void *
|
|
.Fn mpool_get "MPOOL *mp" "pgno_t pgno" "u_int flags"
|
|
.Ft int
|
|
.Fn mpool_put "MPOOL *mp" "void *pgaddr" "u_int flags"
|
|
.Ft int
|
|
.Fn mpool_sync "MPOOL *mp"
|
|
.Ft int
|
|
.Fn mpool_close "MPOOL *mp"
|
|
.Sh ²òÀâ
|
|
.Nm mpool
|
|
¤Ï¡¢¥Ú¡¼¥¸¤ò´ð½à¤Ë¤·¤¿¡¢¥Õ¥¡¥¤¥ë¤Î¥Ð¥Ã¥Õ¥¡´ÉÍý¤ò¹Ô¤Ê¤¦
|
|
¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¹¡£¥Ð¥Ã¥Õ¥¡¤Ï¥×¥í¥»¥¹´Ö¤Ç¶¦Í¤Ç¤¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_open
|
|
¤Ï¥á¥â¥ê¥×¡¼¥ë¤ò½é´ü²½¤·¤Þ¤¹¡£°ú¿ô
|
|
.Fa key
|
|
¤Ï¡¢¥Ð¥Ã¥Õ¥¡
|
|
¤ò¶¦Í¤¹¤ëÊ£¿ô¤Î¥×¥í¥»¥¹´Ö¤Ç¥Í¥´¥·¥¨¡¼¥È¤¹¤ë¤¿¤á¤Ë»È¤ï¤ì¤ë
|
|
¥Ð¥¤¥È¥¹¥È¥ê¥ó¥°¤Ç¤¹¡£
|
|
¥Õ¥¡¥¤¥ë¥Ð¥Ã¥Õ¥¡¤¬¶¦Í¥á¥â¥ê¤Ë¥Þ¥Ã¥×¤µ¤ì¤¿¾ì¹ç¤Ï¡¢Æ±¤¸¥¡¼¤ò
|
|
»ÈÍѤ·¤Æ¤¤¤ë¤¹¤Ù¤Æ¤Î¥×¥í¥»¥¹¤¬¥Ð¥Ã¥Õ¥¡¤ò¶¦Í¤·¤Þ¤¹¡£
|
|
.Fa key
|
|
¤¬
|
|
.Dv NULL
|
|
¤Ç¤¢¤ë¾ì¹ç¡¢¥Ð¥Ã¥Õ¥¡¤Ï¥×¥é¥¤¥Ù¡¼¥È¥á¥â¥ê¤Ë¥Þ¥Ã¥×¤µ¤ì¤Þ¤¹¡£
|
|
°ú¿ô
|
|
.Fa fd
|
|
¤Ï¡¢´ðÁäȤʤë
|
|
¥Õ¥¡¥¤¥ë¤Î¥Õ¥¡¥¤¥ëµ½Ò»Ò¤Ç¡¢¸¡º÷²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Fa key
|
|
¤¬
|
|
.Dv NULL
|
|
¤Ç¤Ï¤Ê¤¯¡¢¤¹¤Ç¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤È°ìÃפ¹¤ë¾ì¹ç¡¢°ú¿ô
|
|
.Fa fd
|
|
¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
°ú¿ô
|
|
.Fa pagesize
|
|
¤Ï¡¢¥Õ¥¡¥¤¥ë¤òʬ³ä¤¹¤ë¥Ú¡¼¥¸¤Î¥µ¥¤¥º (¥Ð¥¤¥Èñ°Ì) ¤Ç¤¹¡£°ú¿ô
|
|
.Fa maxcache
|
|
¤Ï¡¢°ìÅ٤˥¥ã¥Ã¥·¥å¤¹¤ë¡¢´ðÁäȤʤë¥Õ¥¡¥¤¥ë¤ÎºÇÂç¥Ú¡¼¥¸¿ô¤Ç¤¹¡£
|
|
¤³¤ÎÃͤϡ¢¥Õ¥¡¥¤¥ë¤Î¥Ð¥Ã¥Õ¥¡¤ò¶¦Í¤¹¤ë¥×¥í¥»¥¹¿ô¤È¤Ï
|
|
´Ø·¸¤¢¤ê¤Þ¤»¤ó¤¬¡¢¥Õ¥¡¥¤¥ë¤ò¶¦Í¤¹¤ë¥×¥í¥»¥¹¤¬»ØÄꤷ¤¿ºÇÂçÃͤˤʤê¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_filter
|
|
¤Ï¡¢¥Ú¡¼¥¸¤ÎÆ©²áŪÆþ½ÐÎϽèÍý¤ò¹Ô¤Ê¤¤¤Þ¤¹¡£
|
|
.Fa pgin
|
|
´Ø¿ô¤¬»ØÄꤵ¤ì¤ë¤È¡¢Êݸ¥Õ¥¡¥¤¥ë¤«¤é¥á¥â¥ê¥×¡¼¥ë¤Ë¥Ð¥Ã¥Õ¥¡¤ò
|
|
Æɤ߹þ¤à¤¿¤Ó¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£
|
|
.Fa pgout
|
|
´Ø¿ô¤¬»ØÄꤵ¤ì¤ë¤È¡¢Êݸ¥Õ¥¡¥¤¥ë¤Ë¥Ð¥Ã¥Õ¥¡¤¬½ñ¤¹þ¤Þ¤ì¤ë¤¿¤Ó¤Ë
|
|
¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£¤É¤Á¤é¤Î´Ø¿ô¤â¡¢
|
|
.Fa pgcookie
|
|
¥Ý¥¤¥ó¥¿¡¢¥Ú¡¼¥¸Èֹ桢Æɤ߽ñ¤¤ò¹Ô¤Ê¤¦¥Ú¡¼¥¸¤Î¥Ý¥¤¥ó¥¿¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_new
|
|
¤Ï¡¢
|
|
.Ft MPOOL
|
|
¥Ý¥¤¥ó¥¿¤È¥¢¥É¥ì¥¹¤ò°ú¿ô¤È¤·¤Æ¼è¤ê¤Þ¤¹¡£
|
|
¿·¤·¤¤¥Ú¡¼¥¸¤ò³ä¤ê¿¶¤ë¤³¤È¤¬¤Ç¤¤ë¾ì¹ç¤Ï¡¢¥Ú¡¼¥¸¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¡¢
|
|
¥Ú¡¼¥¸Èֹ椬
|
|
.Fa pgnoaddr
|
|
¥¢¥É¥ì¥¹¤ËÊݸ¤µ¤ì¤Þ¤¹¡£³ä¤ê¿¶¤ë¤³¤È¤¬¤Ç¤¤Ê¤¤¾ì¹ç¤Ï
|
|
.Dv NULL
|
|
¤¬ÊÖ¤µ¤ì¡¢
|
|
.Va errno
|
|
¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_get
|
|
¤Ï¡¢
|
|
.Ft MPOOL
|
|
¥Ý¥¤¥ó¥¿¤È¥Ú¡¼¥¸ÈÖ¹æ¤ò°ú¿ô¤È¤·¤Æ¼è¤ê¤Þ¤¹¡£
|
|
¥Ú¡¼¥¸¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï¡¢¥Ú¡¼¥¸¤Î¥Ý¥¤¥ó¥¿¤¬ÊÖ¤µ¤ì¤Þ¤¹¡£
|
|
¥Ú¡¼¥¸¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï
|
|
.Dv NULL
|
|
¤¬ÊÖ¤µ¤ì¡¢
|
|
.Va errno
|
|
¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
|
|
.Fa flags
|
|
¥Ñ¥é¥á¡¼¥¿¤Ï¡¢º£¤Î¤È¤³¤í»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_put
|
|
¤Ï¡¢
|
|
.Fa pgaddr
|
|
¤¬»²¾È¤¹¤ë¥Ú¡¼¥¸¤ò²òÊü¤·¤Þ¤¹¡£
|
|
.Fa pgaddr
|
|
¤Ï¡¢¤¢¤é¤«¤¸¤á
|
|
.Fn mpool_get
|
|
¤Þ¤¿¤Ï
|
|
.Fn mpool_new
|
|
¤¬ÊÖ¤·¤¿¥¢¥É¥ì¥¹¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
|
|
.Fa flags
|
|
¥Ñ¥é¥á¡¼¥¿¤Ï°Ê²¼¤ÎÃͤÎÏÀÍýÏ (
|
|
.Em or
|
|
) ¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤Þ¤¹¡£
|
|
.Bl -tag -width indent
|
|
.It Dv MPOOL_DIRTY
|
|
¥Ú¡¼¥¸¤¬½¤Àµ¤µ¤ì¤Æ¤ª¤ê¡¢Êݸ¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤àɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.El
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_put
|
|
¤Ï¡¢Àµ¾ï½ªÎ»»þ¤Ë¤Ï 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¤È¤¤Ï -1 ¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_sync
|
|
¤Ï¡¢
|
|
.Ft MPOOL
|
|
¥Ý¥¤¥ó¥¿¤ËÂФ·¤Æ¡¢Êѹ¹¤µ¤ì¤¿¤¹¤Ù¤Æ¤Î¥Ú¡¼¥¸¤ò
|
|
Êݸ¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤ß¤Þ¤¹¡£
|
|
.Fn mpool_sync
|
|
¤Ï¡¢Àµ¾ï½ªÎ»»þ¤Ë¤Ï 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¤È¤¤Ï -1 ¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_close
|
|
¤Ï¡¢¥á¥â¥ê¥×¡¼¥ë¥¯¥Ã¥¡¼¤ËÂФ·¤Æ³ä¤ê¿¶¤é¤ì¤¿¥á¥â¥ê¤ò²òÊü¤·¤Þ¤¹¡£
|
|
½¤Àµ¤µ¤ì¤¿¥Ú¡¼¥¸¤Ï¡¢Êݸ¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤Þ¤ì
|
|
.Em ¤Þ¤»¤ó
|
|
¡£
|
|
.Fn mpool_close
|
|
¤Ï¡¢Àµ¾ï½ªÎ»»þ¤Ë¤Ï 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¤È¤¤Ï -1 ¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Sh ¥¨¥é¡¼
|
|
´Ø¿ô
|
|
.Fn mpool_open
|
|
¤Ç¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
|
|
.Xr malloc 3
|
|
¤Ç»ØÄꤵ¤ì¤¿¥¨¥é¡¼¤Î
|
|
.Va errno
|
|
¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_get
|
|
¤Ç¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢°Ê²¼¤Î
|
|
.Va errno
|
|
¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
|
|
.Bl -tag -width Er
|
|
.It Bq Er EINVAL
|
|
Í׵ᤵ¤ì¤¿¥ì¥³¡¼¥É¤¬Â¸ºß¤·¤Ê¤¤¡£
|
|
.El
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_new
|
|
¤È
|
|
.Fn mpool_get
|
|
¤Ç¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
|
|
.Xr read 2 ,
|
|
.Xr write 2 ,
|
|
.Xr malloc 3
|
|
¤Ç»ØÄꤵ¤ì¤¿¥¨¥é¡¼¤Î
|
|
.Va errno
|
|
¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_sync
|
|
¤Ç¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
|
|
.Xr write 2
|
|
¤Ç»ØÄꤵ¤ì¤¿¥¨¥é¡¼¤Î
|
|
.Va errno
|
|
¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
´Ø¿ô
|
|
.Fn mpool_close
|
|
¤Ç¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
|
|
.Xr free 3
|
|
¤Ç
|
|
»ØÄꤷ¤¿¥¨¥é¡¼¤Î
|
|
.Va errno
|
|
¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr btree 3 ,
|
|
.Xr dbopen 3 ,
|
|
.Xr hash 3 ,
|
|
.Xr recno 3
|