.\" 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 .\" .\" Japanese Version Copyright (c) 1999 Shouichi Saito .\" all rights reserved. .\" Translated Mon Jul 26 21:51:36 JST 1999 .\" by Shouichi Saito .\" Proofed Tue Aug 19 1999 by NAKANO Takeo .\" .\"WORD: descriptor デスクリプタ .TH MPOOL 3 1993-06-04 "" "Linux Programmer's Manual" .UC 7 .SH 名前 .\"O mpool \- shared memory buffer pool mpool \- 共有メモリバッファプール .SH 書式 .nf .B #include .B #include .sp .BI "MPOOL *mpool_open(DBT *" key ", int " fd ", pgno_t " pagesize \ ", pgno_t " maxcache ); .sp .BI "void mpool_filter(MPOOL *" mp ", void (*pgin)(void *, pgno_t, void *)," .BI " void (*" pgout ")(void *, pgno_t, void *)," .BI " void *" pgcookie ); .sp .BI "void *mpool_new(MPOOL *" mp ", pgno_t *" pgnoaddr ); .sp .BI "void *mpool_get(MPOOL *" mp ", pgno_t " pgno ", unsigned int " flags ); .sp .BI "int mpool_put(MPOOL *" mp ", void *" pgaddr ", unsigned int " flags ); .sp .BI "int mpool_sync(MPOOL *" mp ); .sp .BI "int mpool_close(MPOOL *" mp ); .fi .SH 説明 .\"O .I Mpool .\"O is the library interface intended to provide page oriented buffer management .\"O of files. .\"O The buffers may be shared between processes. .I mpool は、ファイルに対するページ指向のバッファ管理を実装した ライブラリインターフェイスである。 .PP .\"O The function .\"O .BR mpool_open () .\"O initializes a memory pool. 関数 .BR mpool_open () はメモリプールを初期化する。 .\"O The .\"O .I key .\"O argument is the byte string used to negotiate between multiple .\"O processes wishing to share buffers. .\"O If the file buffers are mapped in shared memory, all processes using .\"O the same key will share the buffers. .I key 引数はバイト文字列であり、バッファを共有したい複数プロセス間 でのネゴシエーションに使われる。 ファイルバッファが共有メモリにマップされると、 同じキーを使うプロセスは全てバッファを共有する。 .\"O If .\"O .I key .\"O is NULL, the buffers are mapped into private memory. .I key が NULL だと、バッファはプライベートなメモリに割り付けられる。 .\"O The .\"O .I fd .\"O argument is a file descriptor for the underlying file, which must be seekable. .I fd 引数はもとになるファイルのファイルデスクリプタである。 このファイルデスクリプタはシーク可能でなくてはならない。 .\"O If .\"O .I key .\"O is non-NULL and matches a file already being mapped, the .\"O .I fd .\"O argument is ignored. .I key が NULL でなく、かつ既にマップされているファイルにマッチした場合、 .I fd 引数は無視される。 .PP .\"O The .\"O .I pagesize .\"O argument is the size, in bytes, of the pages into which the file is broken up. .I pagesize 引数はバイト単位でのページサイズであり、ファイルはこのサイズに分割される。 .\"O The .\"O .I maxcache .\"O argument is the maximum number of pages from the underlying file to cache .\"O at any one time. .I maxcache 引数は基ファイルをキャッシュするときに用いる最大ページ数である。 .\"NAKANO "at any one time" は「どんな瞬間においても (最大)」ですが、 .\"NAKANO 省略可能でしょう。 .\"O This value is not relative to the number of processes which share a file's .\"O buffers, but will be the largest value specified by any of the processes .\"O sharing the file. この値はファイルバッファを共有しているプロセスの数には関係ないが、 ファイルを共有するプロセスが指定したうちの最大値が実際に用いられる。 .PP .\"O The .\"O .BR mpool_filter () .\"O function is intended to make transparent input and output processing of the .\"O pages possible. 関数 .BR mpool_filter () は透過的なページ入出力処理を可能にする。 .\"O If the .\"O .I pgin .\"O function is specified, it is called each time a buffer is read into the memory .\"O pool from the backing file. 関数 .I pgin が指定されていると、 ファイルからメモリプールに読み込まれる度にこの関数が呼び出される。 .\"O If the .\"O .I pgout .\"O function is specified, it is called each time a buffer is written into the .\"O backing file. 関数 .I pgout が指定されていと、 バッファからファイルに書き出される度にこの関数が呼び出される。 .\"O Both functions are called with the .\"O .I pgcookie .\"O pointer, the page number and a pointer to the page to being read or written. どちらの関数も、 .I pgcookie ポインタ、ページ数、読み書きされるページへのポインタを引数にとる。 .PP .\"O The function .\"O .BR mpool_new () .\"O takes an .\"O .I MPOOL .\"O pointer and an address as arguments. 関数 .BR mpool_new () は .I MPOOL ポインタとアドレスを引数にとる。 .\"O If a new page can be allocated, a pointer to the page is returned and .\"O the page number is stored into the .\"O .I pgnoaddr .\"O address. 新しいページが割り当て可能な場合、ページへのポインタが返され、 ページ数が .I pgnoaddr アドレスに納められる。 .\"O Otherwise, NULL is returned and .\"O .I errno .\"O is set. 割り当てが不可能な場合は NULL が返され、 .I errno がセットされる。 .PP .\"O The function .\"O .BR mpool_get () .\"O takes a .\"O .I MPOOL .\"O pointer and a page number as arguments. .\"O If the page exists, a pointer to the page is returned. .\"O Otherwise, NULL is returned and .\"O .I errno .\"O is set. .\"O The .\"O .I flags .\"O argument is not currently used. 関数 .BR mpool_get () は .I MPOOL ポインタとページ数を引数にとる。ページが存在していると、 ページへのポインタが返される。 存在していないと NULL が返され、 .I errno がセットされる。 .I flags 引き数は現在使用されていない。 .PP .\"O The function .\"O .BR mpool_put () .\"O unpins the page referenced by .\"O .IR pgaddr . 関数 .BR mpool_put () は .I pgaddr が参照するページを解放する。 .\"O .I pgaddr .\"O must be an address previously returned by .\"O .BR mpool_get () .\"O or .\"O .BR mpool_new (). .I pgaddr は以前に .BR mpool_get () か .BR mpool_new () が返したアドレスでなければならない。 .\"O The flag value is specified by ORing .\"O any of the following values: flag の値は以下の値の論理和で指定する。 .TP .B MPOOL_DIRTY .\"O The page has been modified and needs to be written to the backing file. ページは変更されており、ファイルに書き出す必要がある。 .PP .\"O .BR mpool_put () .\"O returns 0 on success and \-1 if an error occurs. .BR mpool_put () は成功すると 0 を、エラーがあると \-1 を返す。 .PP .\"O The function .\"O .BR mpool_sync () .\"O writes all modified pages associated with the .\"O .I MPOOL .\"O pointer to the .\"O backing file. 関数 .BR mpool_sync () は .I MPOOL ポインタの示すページのうち、 変更されたものを全てファイルに書き出す。 .\"O .BR mpool_sync () .\"O returns 0 on success and \-1 if an error occurs. .BR mpool_sync () は成功すると 0 を、エラーがあると \-1 を返す。 .PP .\"O The .\"O .BR mpool_close () .\"O function free's up any allocated memory associated with the memory pool .\"O cookie. 関数 .BR mpool_close () はメモリプールクッキーの示す割り当て済みのメモリを解放する。 .\"O Modified pages are .\"O .B not .\"O written to the backing file. 変更されたページはファイルに\fB書き出されない\fP。 .\"O .BR mpool_close () .\"O returns 0 on success and \-1 if an error occurs. .I mpool_close () は成功すると 0 を、エラーがあると \-1 を返す。 .SH エラー .\"O The .\"O .BR mpool_open () .\"O function may fail and set .\"O .I errno .\"O for any of the errors specified for the library routine .\"O .BR malloc (3). 関数 .BR mpool_open () は失敗するとライブラリルーチン .BR malloc (3) で指定されているエラーに応じた .I errno をセットする。 .PP .\"O The .\"O .BR mpool_get () .\"O function may fail and set .\"O .I errno .\"O for the following: 関数 .BR mpool_get () は失敗すると次のような .I errno をセットする。 .TP 15 .B EINVAL .\"O The requested record doesn't exist. 要求のあったレコードは存在しない。 .PP .\"O The .\"O .BR mpool_new () .\"O and .\"O .BR mpool_get () .\"O functions may fail and set .\"O .I errno .\"O for any of the errors specified for the library routines .\"O .BR read (2), .\"O .BR write (2), .\"O and .\"O .BR malloc (3). 関数 .BR mpool_new () と .BR mpool_get () は失敗するとライブラリルーチン .BR read (2), .BR write (2), .BR malloc (3) で指定されているエラーに応じた .I errno をセットする。 .PP .\"O The .\"O .BR mpool_sync () .\"O function may fail and set .\"O .I errno .\"O for any of the errors specified for the library routine .\"O .BR write (2). 関数 .BR mpool_sync () は失敗するとライブラリルーチン .BR write (2) で指定されているエラーに応じた .I errno をセットする。 .PP .\"O The .\"O .BR mpool_close () .\"O function may fail and set .\"O .I errno .\"O for any of the errors specified for the library routine .\"O .BR free (3). 関数 .BR mpool_close () は失敗するとライブラリルーチン .BR free (3) で指定されているエラーに応じた .I errno をセットする。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O Not in POSIX.1-2001. .\"O Present on the BSDs. POSIX.1-2001 にはない。 BSD 系に存在する。 .SH 関連項目 .BR btree (3), .BR dbopen (3), .BR hash (3), .BR recno (3)