<!--$Id: set_func_map.so,v 10.20 2004/08/13 03:39:02 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: db_env_set_func_map</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td> <h3>db_env_set_func_map</h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_c/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db.h> <p> int db_env_set_func_map(int (*func_map)(char *path, size_t len, int is_region, int is_rdonly, void **addr)); </pre></h3> <hr size=1 noshade> <h3>Description: db_env_set_func_map</h3> <p>The Berkeley DB library requires the ability to map a file into memory and to create shared memory regions (which may or may not be backed by files).</p> <p>The db_env_set_func_map method configures all operations performed by a process and all of its threads of control, not operations confined to a single database environment.</p> <p>Although the db_env_set_func_map method may be called at any time during the life of the application, it should normally be called before making calls to the <a href="../../db46-devel-4.6.21/api_c/env_class.html">db_env_create</a> or <a href="../../db46-devel-4.6.21/api_c/db_class.html">db_create</a> methods.</p> <p>The db_env_set_func_map method returns a non-zero error value on failure and 0 on success. </p> <h3>Parameters</h3> <dl compact> <dt><b>func_map</b><dd>The <b>func_map</b> parameter is the function which maps a file into memory and creates shared memory regions. <p>The <b>path</b> parameter is the name of a file.</p> <p>The <b>is_region</b> parameter will be zero if the intention is to map a file into shared memory. In this case, the <b>map</b> function must map the first <b>len</b> bytes of the file into memory and return a pointer to the mapped location into the memory location to which the parameter <b>addr</b> refers. The <b>is_rdonly</b> parameter will be non-zero if the file is considered read-only by the caller.</p> <p>The <b>is_region</b> parameter will be non-zero if the memory is intended to be used as a shared memory region for synchronization between Berkeley DB threads/processes. In this case, the returned memory may be of any kind (for example, anonymous memory), but must be able to support semaphores. In this case, the <b>path</b> parameter may be ignored (although future <b>map</b> calls using the same <b>path</b> must return the same memory), and the <b>is_rdonly</b> parameter will always be zero.</p> <p>The <b>func_map</b> function must return the value of <b>errno</b> on failure and 0 on success.</p> </dl> <h3>See Also</h3> <a href="../../db46-devel-4.6.21/ref/program/runtime.html">Run-time configuration</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_c/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>