Debian Codegraph @

docs/api_reference/C/db_env_set_func_file_map.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>db_env_set_func_file_map</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="setfunc.html" title="Appendix C.  Berkeley DB Application Space Static Functions" />
11 <link rel="prev" href="db_env_set_func_exists.html" title="db_env_set_func_exists" />
12 <link rel="next" href="db_env_set_func_free.html" title="db_env_set_func_free" />
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">db_env_set_func_file_map</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="db_env_set_func_exists.html">Prev</a> </td>
25 <th width="60%" align="center">Appendix C. 
26 Berkeley DB Application Space Static Functions
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="db_env_set_func_free.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="db_env_set_func_file_map"></a>db_env_set_func_file_map</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 db_env_set_func_file_map(int (*func_file_map)(DB_ENV *dbenv, char *path,
45 size_t len, int is_rdonly, void **addr),
46 int (*func_file_unmap)(DB_ENV *dbenv, void *addr)); </pre>
47 <p>
48 The Berkeley DB library optionally uses the ability to map a file into
49 memory.
50 </p>
51 <p>
52 The <code class="function">db_env_set_func_file_map()</code> function configures all operations
53 performed by a process and all of its threads of control, not
54 operations confined to a single database environment.
55 </p>
56 <p>
57 Although the <code class="function">db_env_set_func_file_map()</code> function may be called at any time
58 during the life of the application, it should normally be called
59 before making calls to the <a class="xref" href="envcreate.html" title="db_env_create">db_env_create</a> or
60 <a class="xref" href="dbcreate.html" title="db_create">db_create</a> methods.
61 </p>
62 <p>
63 The <code class="function">db_env_set_func_file_map()</code> <span>
64 function returns a non-zero error value on failure and 0 on success.
65 </span>
66 </p>
67 <div class="sect2" lang="en" xml:lang="en">
68 <div class="titlepage">
69 <div>
70 <div>
71 <h3 class="title"><a id="idp55594528"></a>Parameters</h3>
72 </div>
73 </div>
74 </div>
75 <div class="sect3" lang="en" xml:lang="en">
76 <div class="titlepage">
77 <div>
78 <div>
79 <h4 class="title"><a id="idp55594720"></a>func_file_map</h4>
80 </div>
81 </div>
82 </div>
83 <p>
84 The <span class="bold"><strong>func_file_map</strong></span> parameter is the
85 function which maps a file into memory. The function takes 5
86 parameters:
87 </p>
88 <div class="itemizedlist">
89 <ul type="disc">
90 <li>
91 <p>
92 <span class="bold"><strong>dbenv</strong></span>
93 </p>
94 <p>
95 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
96 database environment handle.
97 </p>
98 </li>
99 <li>
100 <p>
101 <span class="bold"><strong>path</strong></span>
102 </p>
103 <p>
104 The <span class="bold"><strong>path</strong></span> parameter is the name of
105 file. Repeated requests for the mapping of the same name should
106 return a reference to the same memory.
107 </p>
108 </li>
109 <li>
110 <p>
111 <span class="bold"><strong>len</strong></span>
112 </p>
113 <p>
114 The <span class="bold"><strong>len</strong></span> parameter is the length, in
115 bytes, of the file.
116 </p>
117 </li>
118 <li>
119 <p>
120 <span class="bold"><strong>is_rdonly</strong></span>
121 </p>
122 <p>
123 The <span class="bold"><strong>is_rdonly</strong></span> parameter will be
124 non-zero if the mapped file is read-only.
125 </p>
126 </li>
127 <li>
128 <p>
129 <span class="bold"><strong>addr</strong></span>
130 </p>
131 <p>
132 The <span class="bold"><strong>addr</strong></span> parameter is the memory
133 location into which a pointer to the mapped file is returned.
134 </p>
135 </li>
136 </ul>
137 </div>
138 <p>
139 The <span class="bold"><strong>func_file_map</strong></span> function must
140 return the value of <span class="bold"><strong>errno</strong></span> on failure
141 and 0 on success.
142 </p>
143 </div>
144 <div class="sect3" lang="en" xml:lang="en">
145 <div class="titlepage">
146 <div>
147 <div>
148 <h4 class="title"><a id="idp55579416"></a>func_file_unmap</h4>
149 </div>
150 </div>
151 </div>
152 <p>
153 The <span class="bold"><strong>func_file_unmap</strong></span> parameter is the
154 function which unmaps a file from memory. The function takes 2
155 parameters:
156 </p>
157 <div class="itemizedlist">
158 <ul type="disc">
159 <li>
160 <p>
161 <span class="bold"><strong>dbenv</strong></span>
162 </p>
163 <p>
164 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
165 database environment handle.
166 </p>
167 </li>
168 <li>
169 <p>
170 <code class="literal">addr</code>
171 </p>
172 <p>
173 The <span class="bold"><strong>addr</strong></span> parameter is the value
174 returned by the <span class="bold"><strong>func_file_map</strong></span>
175 function when the file or region was mapped into memory.
176 </p>
177 </li>
178 </ul>
179 </div>
180 </div>
181 </div>
182 <div class="sect2" lang="en" xml:lang="en">
183 <div class="titlepage">
184 <div>
185 <div>
186 <h3 class="title"><a id="idp55599592"></a>See Also</h3>
187 </div>
188 </div>
189 </div>
190 <p>
191 <a href="../../programmer_reference/program_runtime.html" class="olink">Run-time configuration</a>
192
193 </p>
194 </div>
195 </div>
196 <div class="navfooter">
197 <hr />
198 <table width="100%" summary="Navigation footer">
199 <tr>
200 <td width="40%" align="left"><a accesskey="p" href="db_env_set_func_exists.html">Prev</a> </td>
201 <td width="20%" align="center">
202 <a accesskey="u" href="setfunc.html">Up</a>
203 </td>
204 <td width="40%" align="right"> <a accesskey="n" href="db_env_set_func_free.html">Next</a></td>
205 </tr>
206 <tr>
207 <td width="40%" align="left" valign="top">db_env_set_func_exists </td>
208 <td width="20%" align="center">
209 <a accesskey="h" href="index.html">Home</a>
210 </td>
211 <td width="40%" align="right" valign="top"> db_env_set_func_free</td>
212 </tr>
213 </table>
214 </div>
215 </body>
216 </html>