version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
MPOOL |
|
|
2 |
!!!MPOOL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
ERRORS |
|
|
7 |
SEE ALSO |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
mpool - shared memory buffer pool |
|
|
13 |
!!SYNOPSIS |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
__#include |
|
|
17 |
__ |
|
|
18 |
!!DESCRIPTION |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
''Mpool'' is the library interface intended to provide |
|
|
22 |
page oriented buffer management of files. The buffers may be |
|
|
23 |
shared between processes. |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
The function ''mpool_open'' initializes a memory pool. |
|
|
27 |
The ''key'' argument is the byte string used to negotiate |
|
|
28 |
between multiple processes wishing to share buffers. If the |
|
|
29 |
file buffers are mapped in shared memory, all processes |
|
|
30 |
using the same key will share the buffers. If ''key'' is |
|
|
31 |
NULL, the buffers are mapped into private memory. The |
|
|
32 |
''fd'' argument is a file descriptor for the underlying |
|
|
33 |
file, which must be seekable. If ''key'' is non-NULL and |
|
|
34 |
matches a file already being mapped, the ''fd'' argument |
|
|
35 |
is ignored. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
The ''pagesize'' argument is the size, in bytes, of the |
|
|
39 |
pages into which the file is broken up. The ''maxcache'' |
|
|
40 |
argument is the maximum number of pages from the underlying |
|
|
41 |
file to cache at any one time. This value is not relative to |
|
|
42 |
the number of processes which share a file's buffers, but |
|
|
43 |
will be the largest value specified by any of the processes |
|
|
44 |
sharing the file. |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
The ''mpool_filter'' function is intended to make |
|
|
48 |
transparent input and output processing of the pages |
|
|
49 |
possible. If the ''pgin'' function is specified, it is |
|
|
50 |
called each time a buffer is read into the memory pool from |
|
|
51 |
the backing file. If the ''pgout'' function is specified, |
|
|
52 |
it is called each time a buffer is written into the backing |
|
|
53 |
file. Both functions are are called with the ''pgcookie'' |
|
|
54 |
pointer, the page number and a pointer to the page to being |
|
|
55 |
read or written. |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
The function ''mpool_new'' takes an MPOOL pointer and an |
|
|
59 |
address as arguments. If a new page can be allocated, a |
|
|
60 |
pointer to the page is returned and the page number is |
|
|
61 |
stored into the ''pgnoaddr'' address. Otherwise, NULL is |
|
|
62 |
returned and errno is set. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
The function ''mpool_get'' takes a MPOOL pointer and a |
|
|
66 |
page number as arguments. If the page exists, a pointer to |
|
|
67 |
the page is returned. Otherwise, NULL is returned and errno |
|
|
68 |
is set. The flags parameter is not currently |
|
|
69 |
used. |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
The function ''mpool_put'' unpins the page referenced by |
|
|
73 |
''pgaddr''. ''Pgaddr'' must be an address previously |
|
|
74 |
returned by ''mpool_get'' or ''mpool_new''. The flag |
|
|
75 |
value is specified by ''or'''ing any of the following |
|
|
76 |
values: |
|
|
77 |
|
|
|
78 |
|
|
|
79 |
MPOOL_DIRTY |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
The page has been modified and needs to be written to the |
|
|
83 |
backing file. |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
''Mpool_put'' returns 0 on success and -1 if an error |
|
|
87 |
occurs. |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
The function ''mpool_sync'' writes all modified pages |
|
|
91 |
associated with the MPOOL pointer to the backing file. |
|
|
92 |
''Mpool_sync'' returns 0 on success and -1 if an error |
|
|
93 |
occurs. |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
The ''mpool_close'' function free's up any allocated |
|
|
97 |
memory associated with the memory pool cookie. Modified |
|
|
98 |
pages are __not__ written to the backing file. |
|
|
99 |
''Mpool_close'' returns 0 on success and -1 if an error |
|
|
100 |
occurs. |
|
|
101 |
!!ERRORS |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
The ''mpool_open'' function may fail and set ''errno'' |
|
|
105 |
for any of the errors specified for the library routine |
|
|
106 |
malloc(3). |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
The ''mpool_get'' function may fail and set ''errno'' |
|
|
110 |
for the following: |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
[[EINVAL] |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
The requested record doesn't exist. |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
The ''mpool_new'' and ''mpool_get'' functions may fail |
|
|
120 |
and set ''errno'' for any of the errors specified for the |
|
|
121 |
library routines read(2)'', write''(2)'','' and |
|
|
122 |
malloc(3). |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
The ''mpool_sync'' function may fail and set ''errno'' |
|
|
126 |
for any of the errors specified for the library routine |
|
|
127 |
write(2). |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
The ''mpool_close'' function may fail and set |
|
|
131 |
''errno'' for any of the errors specified for the library |
|
|
132 |
routine free(3). |
|
|
133 |
!!SEE ALSO |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
dbopen(3), btree(3), hash(3), |
|
|
137 |
recno(3) |
|
|
138 |
---- |