1<!--$Id: memp_fopen.so,v 10.53 2006/08/08 05:24:05 mjc 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->open</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->open</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->open(DB_MPOOLFILE *mpf, 26 char *file, u_int32_t flags, int mode, size_t pagesize); 27</pre></b> 28<hr size=1 noshade> 29<b>Description: DB_MPOOLFILE->open</b> 30<p>The DB_MPOOLFILE->open method opens a file in the shared memory buffer pool.</p> 31<p>The DB_MPOOLFILE->open method 32returns a non-zero error value on failure 33and 0 on success. 34</p> 35<b>Parameters</b> <br> 36 <b>file</b><ul compact><li>The <b>file</b> parameter is the name of the file to be opened. If 37<b>file</b> is NULL, a private temporary file is created that 38cannot be shared with any other process (although it may be shared with 39other threads of control in the same process).</ul> 40<p>When using a Unicode build on Windows (the default), the <b>file</b> 41argument will be interpreted as a UTF-8 string, which is equivalent to 42ASCII for Latin characters.</p> 43 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one 44or more of the following values: 45<br> 46<b><a name="DB_CREATE">DB_CREATE</a></b><ul compact><li>Create any underlying files, as necessary. If the files do not already 47exist and the DB_CREATE flag is not specified, the call will 48fail.</ul> 49<a name="2"><!--meow--></a> 50<b><a name="DB_DIRECT">DB_DIRECT</a></b><ul compact><li>If set and supported by the system, turn off system buffering of the 51file to avoid double caching.</ul> 52<b><a name="DB_MULTIVERSION">DB_MULTIVERSION</a></b><ul compact><li>Open the file with support for <a href="../ref/transapp/read.html">multiversion concurrency control</a>. Calls to <a href="../api_c/memp_fget.html">DB_MPOOLFILE->get</a> which 53dirty pages will cause copies to be made in the cache.</ul> 54<b><a name="DB_NOMMAP">DB_NOMMAP</a></b><ul compact><li>Always copy this file into the local cache instead of potentially mapping 55it into process memory (see the description of the 56<a href="../api_c/env_set_mp_mmapsize.html">DB_ENV->set_mp_mmapsize</a> method for further information).</ul> 57<b><a name="DB_ODDFILESIZE">DB_ODDFILESIZE</a></b><ul compact><li>Attempts to open files which are not a multiple of the page size in 58length will fail, by default. If the DB_ODDFILESIZE flag is 59set, any partial page at the end of the file will be ignored and the 60open will proceed.</ul> 61<b><a name="DB_RDONLY">DB_RDONLY</a></b><ul compact><li>Open any underlying files for reading only. Any attempt to write the file 62using the pool functions will fail, regardless of the actual permissions 63of the file.</ul> 64<br></ul> 65 <b>mode</b><ul compact><li>On Windows systems, the mode parameter is ignored. 66<p>On UNIX systems or in IEEE/ANSI Std 1003.1 (POSIX) environments, files created by DB_MPOOLFILE->open 67are created with mode <b>mode</b> (as described in <b>chmod</b>(2)) 68and modified by the process' umask value at the time of creation (see 69<b>umask</b>(2)). Created files are owned by the process owner; the 70group ownership of created files is based on the system and directory 71defaults, and is not further specified by Berkeley DB. System shared memory 72segments created by DB_MPOOLFILE->open are created with mode <b>mode</b>, unmodified 73by the process' umask value. If <b>mode</b> is 0, DB_MPOOLFILE->open will use a 74default mode of readable and writable by both owner and group.</p></ul> 75 <b>pagesize</b><ul compact><li>The <b>pagesize</b> parameter is the size, in bytes, of the unit of 76transfer between the application and the cache, although it is not 77necessarily the unit of transfer between the cache and the underlying 78filesystem.</ul> 79<br> 80<br><b>Errors</b> 81<p>The DB_MPOOLFILE->open method 82may fail and return one of the following non-zero errors:</p> 83<br> 84<b>EINVAL</b><ul compact><li>If the file has already been entered into the pool, and the <b>pagesize</b> 85value is not the same as when the file was entered into the pool, or the 86length of the file is not zero or a multiple of the <b>pagesize</b>; 87the DB_RDONLY flag was specified for an in-memory pool; or if an 88invalid flag value or parameter was specified.</ul> 89<br> 90<br> 91<b>ENOMEM</b><ul compact><li>The maximum number of open files has been reached.</ul> 92<br> 93<hr size=1 noshade> 94<br><b>Class</b> 95<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/mempfile_class.html">DB_MPOOLFILE</a> 96<br><b>See Also</b> 97<a href="../api_c/memp_list.html">Memory Pools and Related Methods</a> 98</tt> 99<table width="100%"><tr><td><br></td><td align=right> 100<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> 101</td></tr></table> 102<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 103</body> 104</html> 105