Debian Codegraph @

docs/api_reference/CXX/envset_shm_key.html

raw symbols SCIP
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>DbEnv::set_shm_key()</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="env.html" title="Chapter 5.  The DbEnv Handle" />
11 <link rel="prev" href="envset_msgfile.html" title="DbEnv::set_msgfile()" />
12 <link rel="next" href="envset_thread_count.html" title="DbEnv::set_thread_count()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbEnv::set_shm_key()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envset_msgfile.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. 
26 The DbEnv Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envset_thread_count.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="envset_shm_key"></a>DbEnv::set_shm_key()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::set_shm_key(long shm_key); </pre>
45 <p>
46 Specify a base segment ID for Berkeley DB environment shared memory
47 regions created in system memory on VxWorks or systems supporting
48 X/Open-style shared memory interfaces; for example, UNIX systems
49 supporting <span class="bold"><strong>shmget</strong></span>(2) and related
50 System V IPC interfaces.
51 </p>
52 <p>
53 This base segment ID will be used when Berkeley DB shared memory
54 regions are first created. It will be incremented a small integer
55 value each time a new shared memory region is created; that is, if the
56 base ID is 35, the first shared memory region created will have a
57 segment ID of 35, and the next one will have a segment ID between 36
58 and 40 or so. A Berkeley DB environment always creates a master
59 shared memory region; an additional shared memory region for each of
60 the subsystems supported by the environment (Locking, Logging, Memory
61 Pool and Transaction); plus an additional shared memory region for
62 each additional memory pool cache that is supported. Already existing
63 regions with the same segment IDs will be removed. See
64 <a href="../../programmer_reference/env_region.html" class="olink">Shared Memory Regions</a>
65 for more information.
66 </p>
67 <p>
68 The intent behind this method is two-fold: without it, applications
69 have no way to ensure that two Berkeley DB applications don't attempt
70 to use the same segment IDs when creating different Berkeley DB
71 environments. In addition, by using the same segment IDs each time
72 the environment is created, previously created segments will be
73 removed, and the set of segments on the system will not grow without
74 bound.
75 </p>
76 <p>
77 The database environment's base segment ID may also be configured
78 using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax of the entry
79 in that file is a single line with the string "set_shm_key", one
80 or more whitespace characters, and the ID. Because the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
81 file is read when the database environment is opened, it will
82 silently overrule configuration done before that time.
83 </p>
84 <p>
85 The <code class="methodname">DbEnv::set_shm_key()</code> method configures operations performed
86 using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a> handle, not all
87 operations performed on the underlying database environment.
88 </p>
89 <p>
90 The <code class="methodname">DbEnv::set_shm_key()</code> method may not be called after the
91 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method is called.
92 If the database environment already exists when
93 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> is called, the
94 information specified to <code class="methodname">DbEnv::set_shm_key()</code> must be consistent
95 with the existing environment or corruption can occur.
96 </p>
97 <p>
98 The <code class="methodname">DbEnv::set_shm_key()</code> <span>
99
100 <span>
101 method either returns a non-zero error value or throws an
102 exception that encapsulates a non-zero error value on
103 failure, and returns 0 on success.
104 </span>
105 </span>
106 </p>
107 <div class="sect2" lang="en" xml:lang="en">
108 <div class="titlepage">
109 <div>
110 <div>
111 <h3 class="title"><a id="idp7586408"></a>Parameters</h3>
112 </div>
113 </div>
114 </div>
115 <div class="sect3" lang="en" xml:lang="en">
116 <div class="titlepage">
117 <div>
118 <div>
119 <h4 class="title"><a id="idp7585760"></a>shm_key</h4>
120 </div>
121 </div>
122 </div>
123 <p>
124 The <span class="bold"><strong>shm_key</strong></span> parameter is the base
125 segment ID for the database environment.
126 </p>
127 </div>
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="idp7569640"></a>Errors</h3>
134 </div>
135 </div>
136 </div>
137 <p>
138 The <code class="methodname">DbEnv::set_shm_key()</code> <span>
139
140 <span>
141 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
142 exception, encapsulating one of the following non-zero errors, or return one
143 of the following non-zero errors:
144 </span>
145 </span>
146 </p>
147 <div class="sect3" lang="en" xml:lang="en">
148 <div class="titlepage">
149 <div>
150 <div>
151 <h4 class="title"><a id="idp7600000"></a>EINVAL</h4>
152 </div>
153 </div>
154 </div>
155 <p>
156 If the method was called after <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a>
157 was called; or if an invalid flag value or parameter was specified.
158 </p>
159 </div>
160 </div>
161 <div class="sect2" lang="en" xml:lang="en">
162 <div class="titlepage">
163 <div>
164 <div>
165 <h3 class="title"><a id="idp7601328"></a>Class</h3>
166 </div>
167 </div>
168 </div>
169 <p>
170 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
171 </p>
172 </div>
173 <div class="sect2" lang="en" xml:lang="en">
174 <div class="titlepage">
175 <div>
176 <div>
177 <h3 class="title"><a id="idp7588600"></a>See Also</h3>
178 </div>
179 </div>
180 </div>
181 <p>
182 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
183 </p>
184 </div>
185 </div>
186 <div class="navfooter">
187 <hr />
188 <table width="100%" summary="Navigation footer">
189 <tr>
190 <td width="40%" align="left"><a accesskey="p" href="envset_msgfile.html">Prev</a> </td>
191 <td width="20%" align="center">
192 <a accesskey="u" href="env.html">Up</a>
193 </td>
194 <td width="40%" align="right"> <a accesskey="n" href="envset_thread_count.html">Next</a></td>
195 </tr>
196 <tr>
197 <td width="40%" align="left" valign="top">DbEnv::set_msgfile() </td>
198 <td width="20%" align="center">
199 <a accesskey="h" href="index.html">Home</a>
200 </td>
201 <td width="40%" align="right" valign="top"> DbEnv::set_thread_count()</td>
202 </tr>
203 </table>
204 </div>
205 </body>
206 </html>