1
<!--$Id: set_func_map.so,v 10.11 2001/05/05 01:49:17 bostic Exp $-->
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
6
<title>Berkeley DB: db_env_set_func_map</title>
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
11
<a name="2"><!--meow--></a>
12
<table width="100%"><tr valign=top>
14
<h1>db_env_set_func_map</h1>
17
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
25
db_env_set_func_map(int (*func_map)(char *path,
26
size_t len, int is_region, int is_rdonly, void **addr));
29
<p>The Berkeley DB library requires the ability to map a file into memory and to
30
create shared memory regions (which may or may not be backed by files).
31
The <b>func_map</b> argument must conform to the following interface:
32
<p><blockquote><pre>int map(char *path, size_t len,
33
int is_region, int is_rdonly, void **addr);</pre></blockquote>
34
<p>The <b>path</b> argument is the name of a file.
35
<p>The <b>is_region</b> argument will be zero if the intention is to map
36
a file into shared memory. In this case, the <b>map</b> function must
37
map the first <b>len</b> bytes of the file into memory and return a
38
pointer to the mapped location into the memory location to which the
39
argument <b>addr</b> refers. The <b>is_rdonly</b> argument will be
40
non-zero if the file is considered read-only by the caller.
41
<p>The <b>is_region</b> argument will be non-zero if the memory is
42
intended to be used as a shared memory region for synchronization
43
between Berkeley DB threads/processes. In this case, the returned memory may
44
be of any kind (for example, anonymous memory), but must be able to
45
support semaphores. In this case, the <b>path</b> argument may be
46
ignored (although future <b>map</b> calls using the same <b>path</b>
47
must return the same memory), and the <b>is_rdonly</b> argument will
49
<p>The <b>func_map</b> function must return the value of <b>errno</b> on
50
failure and 0 on success.
51
<p>The db_env_set_func_map interface affects the entire application, not a single
52
database or database environment.
53
<p>Although the db_env_set_func_map interface may be used to configure Berkeley DB at any time
54
during the life of the application, it should normally be called before
55
making any calls to the <a href="../api_c/env_create.html">db_env_create</a> or <a href="../api_c/db_create.html">db_create</a> functions.
56
<p>The db_env_set_func_map function returns a non-zero error value on failure and 0 on success.
58
<p>The db_env_set_func_map function may fail and return a non-zero error for the following conditions:
60
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
62
<p>The db_env_set_func_map function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.
63
If a catastrophic error has occurred, the db_env_set_func_map function may fail and return
64
<a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>, in which case all subsequent Berkeley DB calls will fail
67
<a href="../api_c/set_func_close.html">db_env_set_func_close</a>,
68
<a href="../api_c/set_func_dirfree.html">db_env_set_func_dirfree</a>,
69
<a href="../api_c/set_func_dirlist.html">db_env_set_func_dirlist</a>,
70
<a href="../api_c/set_func_exists.html">db_env_set_func_exists</a>,
71
<a href="../api_c/set_func_free.html">db_env_set_func_free</a>,
72
<a href="../api_c/set_func_fsync.html">db_env_set_func_fsync</a>,
73
<a href="../api_c/set_func_ioinfo.html">db_env_set_func_ioinfo</a>,
74
<a href="../api_c/set_func_malloc.html">db_env_set_func_malloc</a>,
75
<a href="../api_c/set_func_map.html">db_env_set_func_map</a>,
76
<a href="../api_c/set_func_open.html">db_env_set_func_open</a>,
77
<a href="../api_c/set_func_read.html">db_env_set_func_read</a>,
78
<a href="../api_c/set_func_realloc.html">db_env_set_func_realloc</a>,
79
<a href="../api_c/set_func_seek.html">db_env_set_func_seek</a>,
80
<a href="../api_c/set_func_sleep.html">db_env_set_func_sleep</a>,
81
<a href="../api_c/set_func_unlink.html">db_env_set_func_unlink</a>,
82
<a href="../api_c/set_func_unmap.html">db_env_set_func_unmap</a>,
83
<a href="../api_c/set_func_write.html">db_env_set_func_write</a>,
85
<a href="../api_c/set_func_yield.html">db_env_set_func_yield</a>.
87
<table width="100%"><tr><td><br></td><td align=right>
88
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
90
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>