1<!--$Id: memp_set_fileid.so,v 10.14 2005/04/14 13:08:06 sue Exp $--> 2<!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> 3<!--See the file LICENSE for redistribution information.--> 4<html> 5<head> 6<title>Berkeley DB: DB_MPOOLFILE->set_fileid</title> 7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> 8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> 9</head> 10<body bgcolor=white> 11<table width="100%"><tr valign=top> 12<td> 13<b>DB_MPOOLFILE->set_fileid</b> 14</td> 15<td align=right> 16<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a> 17<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td> 18</tr></table> 19<hr size=1 noshade> 20<tt> 21<b><pre> 22#include <db.h> 23<p> 24int 25DB_MPOOLFILE->set_fileid(DB_MPOOLFILE *mpf, u_int8_t *fileid); 26<p> 27int 28DB_MPOOLFILE->get_fileid(DB_MPOOLFILE *mpf, u_int8_t *fileid); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_MPOOLFILE->set_fileid</b> 32<p>The DB_MPOOLFILE->set_fileid method specifies a unique identifier for the file. 33(The shared memory buffer pool functions must be able to uniquely 34identify files in order that multiple processes wanting to share a file 35will correctly identify it in the pool.)</p> 36<p>On most UNIX/POSIX systems, the <b>fileid</b> field will not need to 37be set, and the memory pool functions will use the file's device and 38inode numbers for this purpose. On Windows systems, the memory pool 39functions use the values returned by GetFileInformationByHandle() by 40default -- these values are known to be constant between processes and 41over reboot in the case of NTFS (in which they are the NTFS MFT 42indices).</p> 43<p>On other filesystems (for example, FAT or NFS), these default values 44are not necessarily unique between processes or across system reboots. 45<b>Applications wanting to maintain a shared memory buffer pool 46between processes or across system reboots, in which the pool contains 47pages from files stored on such filesystems, must specify a unique file 48identifier using the DB_MPOOLFILE->set_fileid method, and each process opening 49the file must provide the same unique identifier.</b></p> 50<p>This call should not be necessary for most applications. Specifically, 51it is not necessary if the memory pool is not shared between processes 52and is reinstantiated after each system reboot, if the application is 53using the Berkeley DB access methods instead of calling the pool functions 54explicitly, or if the files in the memory pool are stored on filesystems 55in which the default values as described previously are invariant 56between process and across system reboots.</p> 57<p>The DB_MPOOLFILE->set_fileid method configures a file in the memory pool, not only 58operations performed using the specified <a href="../api_c/mempfile_class.html">DB_MPOOLFILE</a> handle.</p> 59<p>The DB_MPOOLFILE->set_fileid method may not be called after the <a href="../api_c/memp_fopen.html">DB_MPOOLFILE->open</a> method is 60called. 61</p> 62<p>The DB_MPOOLFILE->set_fileid method 63returns a non-zero error value on failure 64and 0 on success. 65</p> 66<b>Parameters</b> <br> 67 <b>fileid</b><ul compact><li>The <b>fileid</b> parameter is the unique identifier for the file. 68Unique file identifiers must be a DB_FILE_ID_LEN length array of bytes.</ul> 69<br> 70<hr size=1 noshade> 71<b>Description: DB_MPOOLFILE->get_fileid</b> 72<p>The DB_MPOOLFILE->get_fileid method copies the file's identifier into the 73memory location referenced by <b>fileid</b>.</p> 74<p>The DB_MPOOLFILE->get_fileid method 75returns a non-zero error value on failure 76and 0 on success. 77</p> 78<p>The DB_MPOOLFILE->get_fileid method may be called at any time during the life of the 79application.</p> 80<hr size=1 noshade> 81<br><b>Class</b> 82<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/mempfile_class.html">DB_MPOOLFILE</a> 83<br><b>See Also</b> 84<a href="../api_c/memp_list.html">Memory Pools and Related Methods</a> 85</tt> 86<table width="100%"><tr><td><br></td><td align=right> 87<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 88</td></tr></table> 89<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 90</body> 91</html> 92