Debian Codegraph @

docs/api_reference/C/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>DB_ENV-&gt;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 DB_ENV Handle" />
11 <link rel="prev" href="envset_msgfile.html" title="DB_ENV-&gt;set_msgfile()" />
12 <link rel="next" href="envset_thread_count.html" title="DB_ENV-&gt;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">DB_ENV-&gt;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 DB_ENV 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>DB_ENV-&gt;set_shm_key()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;set_shm_key(DB_ENV *dbenv, 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">DB_ENV-&gt;set_shm_key()</code> method configures operations performed
86 using the specified <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a> handle, not all
87 operations performed on the underlying database environment.
88 </p>
89 <p>
90 The <code class="methodname">DB_ENV-&gt;set_shm_key()</code> method may not be called after the
91 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method is called.
92 If the database environment already exists when
93 <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> is called, the
94 information specified to <code class="methodname">DB_ENV-&gt;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">DB_ENV-&gt;set_shm_key()</code> <span>
99 <span>
100 method returns a non-zero error value on failure and 0 on success.
101 </span>
102
103 </span>
104 </p>
105 <div class="sect2" lang="en" xml:lang="en">
106 <div class="titlepage">
107 <div>
108 <div>
109 <h3 class="title"><a id="idp52209208"></a>Parameters</h3>
110 </div>
111 </div>
112 </div>
113 <div class="sect3" lang="en" xml:lang="en">
114 <div class="titlepage">
115 <div>
116 <div>
117 <h4 class="title"><a id="idp52219704"></a>shm_key</h4>
118 </div>
119 </div>
120 </div>
121 <p>
122 The <span class="bold"><strong>shm_key</strong></span> parameter is the base
123 segment ID for the database environment.
124 </p>
125 </div>
126 </div>
127 <div class="sect2" lang="en" xml:lang="en">
128 <div class="titlepage">
129 <div>
130 <div>
131 <h3 class="title"><a id="idp52214544"></a>Errors</h3>
132 </div>
133 </div>
134 </div>
135 <p>
136 The <code class="methodname">DB_ENV-&gt;set_shm_key()</code> <span>
137 <span>
138 method may fail and return one of the following non-zero errors:
139 </span>
140
141 </span>
142 </p>
143 <div class="sect3" lang="en" xml:lang="en">
144 <div class="titlepage">
145 <div>
146 <div>
147 <h4 class="title"><a id="idp52229336"></a>EINVAL</h4>
148 </div>
149 </div>
150 </div>
151 <p>
152 If the method was called after <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a>
153 was called; or if an invalid flag value or parameter was specified.
154 </p>
155 </div>
156 </div>
157 <div class="sect2" lang="en" xml:lang="en">
158 <div class="titlepage">
159 <div>
160 <div>
161 <h3 class="title"><a id="idp52228256"></a>Class</h3>
162 </div>
163 </div>
164 </div>
165 <p>
166 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
167 </p>
168 </div>
169 <div class="sect2" lang="en" xml:lang="en">
170 <div class="titlepage">
171 <div>
172 <div>
173 <h3 class="title"><a id="idp52209440"></a>See Also</h3>
174 </div>
175 </div>
176 </div>
177 <p>
178 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
179 </p>
180 </div>
181 </div>
182 <div class="navfooter">
183 <hr />
184 <table width="100%" summary="Navigation footer">
185 <tr>
186 <td width="40%" align="left"><a accesskey="p" href="envset_msgfile.html">Prev</a> </td>
187 <td width="20%" align="center">
188 <a accesskey="u" href="env.html">Up</a>
189 </td>
190 <td width="40%" align="right"> <a accesskey="n" href="envset_thread_count.html">Next</a></td>
191 </tr>
192 <tr>
193 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_msgfile() </td>
194 <td width="20%" align="center">
195 <a accesskey="h" href="index.html">Home</a>
196 </td>
197 <td width="40%" align="right" valign="top"> DB_ENV-&gt;set_thread_count()</td>
198 </tr>
199 </table>
200 </div>
201 </body>
202 </html>