Debian Codegraph @

docs/api_reference/C/mempset_fileid.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_MPOOLFILE-&gt;set_fileid()</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 8.  The DB_MPOOLFILE Handle" />
11 <link rel="prev" href="mempset_clear_len.html" title="DB_MPOOLFILE-&gt;set_clear_len()" />
12 <link rel="next" href="mempset_flags.html" title="DB_MPOOLFILE-&gt;set_flags()" />
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_MPOOLFILE-&gt;set_fileid()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="mempset_clear_len.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 8. 
26 The DB_MPOOLFILE Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="mempset_flags.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="mempset_fileid"></a>DB_MPOOLFILE-&gt;set_fileid()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_MPOOLFILE-&gt;set_fileid(DB_MPOOLFILE *mpf, u_int8_t *fileid); </pre>
45 <p>
46 The <code class="methodname">DB_MPOOLFILE-&gt;set_fileid()</code> method specifies a unique identifier
47 for the file. (The shared memory buffer pool functions must be able to
48 uniquely identify files in order that multiple processes wanting to
49 share a file will correctly identify it in the cache.)
50 </p>
51 <p>
52 On most UNIX/POSIX systems, the <span class="bold"><strong>fileid</strong></span> field will not need
53 to be set, and the memory pool functions will use the file's device and inode numbers for
54 this purpose. On Windows systems, the memory pool functions use the values returned by
55 <code class="methodname">GetFileInformationByHandle()</code> by default — these values are
56 known to be constant between processes and over reboot in the case of NTFS (in which they
57 are the NTFS MFT indices).
58 </p>
59 <p>
60 On other filesystems (for example, FAT or NFS), these default values
61 are not necessarily unique between processes or across system reboots.
62 <span class="bold"><strong>Applications wanting to maintain a shared
63 cache between processes or across system reboots, in which the
64 cache contains pages from files stored on such filesystems, must
65 specify a unique file identifier using the <code class="methodname">DB_MPOOLFILE-&gt;set_fileid()</code>
66 method, and each process opening the file must provide the same unique
67 identifier.</strong></span>
68 </p>
69 <p>
70 This call should not be necessary for most applications.
71 Specifically, it is not necessary if the cache is not shared
72 between processes and is reinstantiated after each system reboot, if
73 the application is using the Berkeley DB access methods instead of
74 calling the pool functions explicitly, or if the files in the
75 cache are stored on filesystems in which the default values as
76 described previously are invariant between process and across system
77 reboots.
78 </p>
79 <p>
80 The <code class="methodname">DB_MPOOLFILE-&gt;set_fileid()</code> method configures a file in the
81 cache, not only operations performed using the specified
82 <a class="link" href="memp.html" title="Chapter 8.  The DB_MPOOLFILE Handle">DB_MPOOLFILE</a> handle.
83 </p>
84 <p>
85 The <code class="methodname">DB_MPOOLFILE-&gt;set_fileid()</code> method may not be called after the
86 <a class="xref" href="mempfopen.html" title="DB_MPOOLFILE-&gt;open()">DB_MPOOLFILE-&gt;open()</a>
87 method is called. If the mpool file already exists when
88 <code class="methodname">DB_MPOOLFILE-&gt;open()</code> is called, the information
89 specified to <code class="methodname">DB_MPOOLFILE-&gt;set_fileid()</code> must be
90 the same as that historically used to create the mpool file or
91 corruption can occur.
92 </p>
93 <p>
94 The <code class="methodname">DB_MPOOLFILE-&gt;set_fileid()</code> <span>
95 <span>
96 method returns a non-zero error value on failure and 0 on success.
97 </span>
98
99 </span>
100 </p>
101 <div class="sect2" lang="en" xml:lang="en">
102 <div class="titlepage">
103 <div>
104 <div>
105 <h3 class="title"><a id="idp53583024"></a>Parameters</h3>
106 </div>
107 </div>
108 </div>
109 <div class="sect3" lang="en" xml:lang="en">
110 <div class="titlepage">
111 <div>
112 <div>
113 <h4 class="title"><a id="idp53582120"></a>fileid</h4>
114 </div>
115 </div>
116 </div>
117 <p>
118 The <span class="bold"><strong>fileid</strong></span> parameter is the unique
119 identifier for the file. Unique file identifiers must be a
120 <code class="literal">DB_FILE_ID_LEN</code> length array of bytes.
121 </p>
122 </div>
123 </div>
124 <div class="sect2" lang="en" xml:lang="en">
125 <div class="titlepage">
126 <div>
127 <div>
128 <h3 class="title"><a id="idp53576704"></a>Class</h3>
129 </div>
130 </div>
131 </div>
132 <p>
133 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>, <a class="link" href="memp.html" title="Chapter 8.  The DB_MPOOLFILE Handle">DB_MPOOLFILE</a>
134 </p>
135 </div>
136 <div class="sect2" lang="en" xml:lang="en">
137 <div class="titlepage">
138 <div>
139 <div>
140 <h3 class="title"><a id="idp53586120"></a>See Also</h3>
141 </div>
142 </div>
143 </div>
144 <p>
145 <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a>
146 </p>
147 </div>
148 </div>
149 <div class="navfooter">
150 <hr />
151 <table width="100%" summary="Navigation footer">
152 <tr>
153 <td width="40%" align="left"><a accesskey="p" href="mempset_clear_len.html">Prev</a> </td>
154 <td width="20%" align="center">
155 <a accesskey="u" href="memp.html">Up</a>
156 </td>
157 <td width="40%" align="right"> <a accesskey="n" href="mempset_flags.html">Next</a></td>
158 </tr>
159 <tr>
160 <td width="40%" align="left" valign="top">DB_MPOOLFILE-&gt;set_clear_len() </td>
161 <td width="20%" align="center">
162 <a accesskey="h" href="index.html">Home</a>
163 </td>
164 <td width="40%" align="right" valign="top"> DB_MPOOLFILE-&gt;set_flags()</td>
165 </tr>
166 </table>
167 </div>
168 </body>
169 </html>