Debian Codegraph @

docs/api_reference/CXX/mempfopen.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DbMpoolFile::open()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10 <link rel="up" href="memp.html" title="Chapter 9.  The DbMpoolFile Handle" />
11 <link rel="prev" href="mempfget.html" title="DbMpoolFile::get()" />
12 <link rel="next" href="mempput.html" title="DbMpoolFile::put()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbMpoolFile::open()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="mempfget.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 9. 
26 The DbMpoolFile Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="mempput.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="mempfopen"></a>DbMpoolFile::open()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbMpoolFile::open(const char *file, u_int32_t flags, int mode,
45 size_t pagesize);</pre>
46 <p>
47 The <code class="methodname">DbMpoolFile::open()</code> method opens a file in the in-memory cache.
48 </p>
49 <p>
50 The <code class="methodname">DbMpoolFile::open()</code> <span>
51
52 <span>
53 method either returns a non-zero error value or throws an
54 exception that encapsulates a non-zero error value on
55 failure, and returns 0 on success.
56 </span>
57 </span>
58 </p>
59 <div class="sect2" lang="en" xml:lang="en">
60 <div class="titlepage">
61 <div>
62 <div>
63 <h3 class="title"><a id="idp8860296"></a>Parameters</h3>
64 </div>
65 </div>
66 </div>
67 <div class="sect3" lang="en" xml:lang="en">
68 <div class="titlepage">
69 <div>
70 <div>
71 <h4 class="title"><a id="idp8894392"></a>file</h4>
72 </div>
73 </div>
74 </div>
75 <p>
76 The <span class="bold"><strong>file</strong></span> parameter is the name of the
77 file to be opened. If <span class="bold"><strong>file</strong></span> is NULL,
78 a private temporary file is created that cannot be shared with any
79 other process (although it may be shared with other threads of control
80 in the same process).
81 </p>
82 <p>
83 When using a Unicode build on Windows (the default), the
84 <span class="bold"><strong>file</strong></span> argument will
85 be interpreted as a UTF-8 string, which is equivalent to ASCII for Latin
86 characters.
87 </p>
88 </div>
89 <div class="sect3" lang="en" xml:lang="en">
90 <div class="titlepage">
91 <div>
92 <div>
93 <h4 class="title"><a id="idp8880536"></a>flags</h4>
94 </div>
95 </div>
96 </div>
97 <p>
98 The <span class="bold"><strong>flags</strong></span> parameter must be set to zero or
99 by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together one
100 or more of the following values:
101 </p>
102 <div class="itemizedlist">
103 <ul type="disc">
104 <li>
105 <p><a id="mempopen_DB_CREATE"></a>
106 <code class="literal">DB_CREATE</code>
107 </p>
108 <p>
109 Create any underlying files, as necessary. If the database do not already exist
110 and the <code class="literal">DB_CREATE</code> flag is not specified, the
111 call will fail.
112 </p>
113 </li>
114 <li>
115 <p><a id="mempopen_DB_EXCL"></a>
116 <code class="literal">DB_DIRECT</code>
117 </p>
118 <p>
119 If set and supported by the system, turn off system buffering of the file to
120 avoid double caching.
121 </p>
122 </li>
123 <li>
124 <p><a id="mempopen_DB_MULTIVERSION"></a>
125 <code class="literal">DB_MULTIVERSION</code>
126 </p>
127 <p>
128 Open the file with support for
129 <a href="../../programmer_reference/transapp_read.html" class="olink">multiversion concurrency control</a>.
130 Calls to <a class="xref" href="mempfget.html" title="DbMpoolFile::get()">DbMpoolFile::get()</a>
131 with dirty pages will cause copies to be made in the cache.
132 </p>
133 </li>
134 <li>
135 <p><a id="mempopen_DB_NOMMAP"></a>
136 <code class="literal">DB_NOMMAP</code>
137 </p>
138 <p>
139 Always copy this file into the local cache instead of potentially mapping it
140 into process memory (see the
141 <a class="xref" href="envset_mp_mmapsize.html" title="DbEnv::set_mp_mmapsize()">DbEnv::set_mp_mmapsize()</a>
142 method for further information).
143 </p>
144 </li>
145 <li>
146 <p><a id="mempopen_DB_ODDFILESIZE"></a>
147 <code class="literal">DB_ODDFILESIZE</code>
148 </p>
149 <p>
150 Attempts to open files which are not a multiple of the page size in length will
151 fail, by default. If the DB_ODDFILESIZE flag is set, any partial page at the end
152 of the file will be ignored and the open will proceed.
153 </p>
154 </li>
155 <li>
156 <p><a id="mempopen_DB_RDONLY"></a>
157 <code class="literal">DB_RDONLY</code>
158 </p>
159 <p>
160 Open any underlying files for reading only. Any attempt to modify
161 the file using the memory pool (cache) functions will fail, regardless of the actual
162 permissions of the file.
163 </p>
164 </li>
165 </ul>
166 </div>
167 </div>
168 <div class="sect3" lang="en" xml:lang="en">
169 <div class="titlepage">
170 <div>
171 <div>
172 <h4 class="title"><a id="idp8931136"></a>mode</h4>
173 </div>
174 </div>
175 </div>
176 <p>
177 On Windows systems, the mode parameter is ignored.
178 </p>
179 <p>
180 On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, files
181 created by <code class="methodname">DbMpoolFile::open()</code> are created with mode
182 <span class="bold"><strong>mode</strong></span> (as described in <span class="bold"><strong>chmod</strong></span>(2)) and modified by the process' umask
183 value at the time of creation (see <span class="bold"><strong>umask</strong></span>(2)). Created files are owned by the
184 process owner; the group ownership of created files is based on the system
185 and directory defaults, and is not further specified by Berkeley DB. System
186 shared memory segments created by <code class="methodname">DbMpoolFile::open()</code> are
187 created with mode <span class="bold"><strong>mode</strong></span>, unmodified by the
188 process' umask value. If <span class="bold"><strong>mode</strong></span> is 0,
189 <code class="methodname">DbMpoolFile::open()</code> will use a default mode of readable
190 and writable by both owner and group.
191 </p>
192 </div>
193 <div class="sect3" lang="en" xml:lang="en">
194 <div class="titlepage">
195 <div>
196 <div>
197 <h4 class="title"><a id="idp8896216"></a>pagesize</h4>
198 </div>
199 </div>
200 </div>
201 <p>
202 The <span class="bold"><strong>pagesize</strong></span> parameter is the size,
203 in bytes, of the unit of transfer between the application and the
204 cache, although it is not necessarily the unit of transfer between the
205 cache and the underlying filesystem.
206 </p>
207 </div>
208 </div>
209 <div class="sect2" lang="en" xml:lang="en">
210 <div class="titlepage">
211 <div>
212 <div>
213 <h3 class="title"><a id="idp8898200"></a>Errors</h3>
214 </div>
215 </div>
216 </div>
217 <p>
218 The <code class="methodname">DbMpoolFile::open()</code> <span>
219
220 <span>
221 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
222 exception, encapsulating one of the following non-zero errors, or return one
223 of the following non-zero errors:
224 </span>
225 </span>
226 </p>
227 <div class="sect3" lang="en" xml:lang="en">
228 <div class="titlepage">
229 <div>
230 <div>
231 <h4 class="title"><a id="idp8920272"></a>EINVAL</h4>
232 </div>
233 </div>
234 </div>
235 <p>
236 If the file has already been entered into the cache, and the <span class="bold"><strong>pagesize</strong></span> value is not the same as when the file
237 was entered into the cache, or the length of the file is not zero or a
238 multiple of the <span class="bold"><strong>pagesize</strong></span>; the
239 DB_RDONLY flag was specified for an in-memory cache; or if an invalid
240 flag value or parameter was specified.
241 </p>
242 </div>
243 <div class="sect3" lang="en" xml:lang="en">
244 <div class="titlepage">
245 <div>
246 <div>
247 <h4 class="title"><a id="idp8918928"></a>ENOMEM</h4>
248 </div>
249 </div>
250 </div>
251 <p>
252 The maximum number of open files has been reached.
253 </p>
254 </div>
255 </div>
256 <div class="sect2" lang="en" xml:lang="en">
257 <div class="titlepage">
258 <div>
259 <div>
260 <h3 class="title"><a id="idp8924056"></a>Class</h3>
261 </div>
262 </div>
263 </div>
264 <p>
265 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, <a class="link" href="memp.html" title="Chapter 9.  The DbMpoolFile Handle">DbMpoolFile</a>
266 </p>
267 </div>
268 <div class="sect2" lang="en" xml:lang="en">
269 <div class="titlepage">
270 <div>
271 <div>
272 <h3 class="title"><a id="idp8933496"></a>See Also</h3>
273 </div>
274 </div>
275 </div>
276 <p>
277 <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a>
278 </p>
279 </div>
280 </div>
281 <div class="navfooter">
282 <hr />
283 <table width="100%" summary="Navigation footer">
284 <tr>
285 <td width="40%" align="left"><a accesskey="p" href="mempfget.html">Prev</a> </td>
286 <td width="20%" align="center">
287 <a accesskey="u" href="memp.html">Up</a>
288 </td>
289 <td width="40%" align="right"> <a accesskey="n" href="mempput.html">Next</a></td>
290 </tr>
291 <tr>
292 <td width="40%" align="left" valign="top">DbMpoolFile::get() </td>
293 <td width="20%" align="center">
294 <a accesskey="h" href="index.html">Home</a>
295 </td>
296 <td width="40%" align="right" valign="top"> DbMpoolFile::put()</td>
297 </tr>
298 </table>
299 </div>
300 </body>
301 </html>