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