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->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->set_clear_len()" /> 12 <link rel="next" href="mempset_flags.html" title="DB_MPOOLFILE->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">DB_MPOOLFILE->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 8. 23 The DB_MPOOLFILE 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>DB_MPOOLFILE->set_fileid()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_MPOOLFILE->set_fileid(DB_MPOOLFILE *mpf, u_int8_t *fileid); </pre> 42 <p> 43 The <code class="methodname">DB_MPOOLFILE->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">DB_MPOOLFILE->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">DB_MPOOLFILE->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 8. The DB_MPOOLFILE Handle">DB_MPOOLFILE</a> handle. 80 </p> 81 <p> 82 The <code class="methodname">DB_MPOOLFILE->set_fileid()</code> method may not be called after the 83 <a class="xref" href="mempfopen.html" title="DB_MPOOLFILE->open()">DB_MPOOLFILE->open()</a> 84 method is called. 85 </p> 86 <p> 87 The <code class="methodname">DB_MPOOLFILE->set_fileid()</code> <span> 88 <span> 89 method returns a non-zero error value on failure and 0 on success. 90 </span> 91 92 </span> 93 </p> 94 <div class="sect2" lang="en" xml:lang="en"> 95 <div class="titlepage"> 96 <div> 97 <div> 98 <h3 class="title"><a id="id1691808"></a>Parameters</h3> 99 </div> 100 </div> 101 </div> 102 <div class="sect3" lang="en" xml:lang="en"> 103 <div class="titlepage"> 104 <div> 105 <div> 106 <h4 class="title"><a id="id1692038"></a>fileid</h4> 107 </div> 108 </div> 109 </div> 110 <p> 111 The <span class="bold"><strong>fileid</strong></span> parameter is the unique 112 identifier for the file. Unique file identifiers must be a 113 <code class="literal">DB_FILE_ID_LEN</code> length array of bytes. 114 </p> 115 </div> 116 </div> 117 <div class="sect2" lang="en" xml:lang="en"> 118 <div class="titlepage"> 119 <div> 120 <div> 121 <h3 class="title"><a id="id1691876"></a>Class</h3> 122 </div> 123 </div> 124 </div> 125 <p> 126 <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> 127 </p> 128 </div> 129 <div class="sect2" lang="en" xml:lang="en"> 130 <div class="titlepage"> 131 <div> 132 <div> 133 <h3 class="title"><a id="id1691753"></a>See Also</h3> 134 </div> 135 </div> 136 </div> 137 <p> 138 <a class="xref" href="memp.html#memplist" title="Memory Pools and Related Methods">Memory Pools and Related Methods</a> 139 </p> 140 </div> 141 </div> 142 <div class="navfooter"> 143 <hr /> 144 <table width="100%" summary="Navigation footer"> 145 <tr> 146 <td width="40%" align="left"><a accesskey="p" href="mempset_clear_len.html">Prev</a> </td> 147 <td width="20%" align="center"> 148 <a accesskey="u" href="memp.html">Up</a> 149 </td> 150 <td width="40%" align="right"> <a accesskey="n" href="mempset_flags.html">Next</a></td> 151 </tr> 152 <tr> 153 <td width="40%" align="left" valign="top">DB_MPOOLFILE->set_clear_len() </td> 154 <td width="20%" align="center"> 155 <a accesskey="h" href="index.html">Home</a> 156 </td> 157 <td width="40%" align="right" valign="top"> DB_MPOOLFILE->set_flags()</td> 158 </tr> 159 </table> 160 </div> 161 </body> 162</html> 163