• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/db-4.8.30/docs/api_reference/C/
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;lock_detect()</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="lock.html" title="Chapter��6.�� The DB_LOCK Handle" />
11    <link rel="prev" href="envset_lk_partitions.html" title="DB_ENV-&gt;set_lk_partitions()" />
12    <link rel="next" href="lockget.html" title="DB_ENV-&gt;lock_get()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DB_ENV-&gt;lock_detect()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="envset_lk_partitions.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��6.��
23                The DB_LOCK Handle
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="lockget.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="lockdetect"></a>DB_ENV-&gt;lock_detect()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db.h&gt;
39
40int
41DB_ENV-&gt;lock_detect(DB_ENV *env,
42    u_int32_t flags, u_int32_t atype, int *rejected);  </pre>
43      <p>
44         The <code class="methodname">DB_ENV-&gt;lock_detect()</code> method runs one iteration of the deadlock
45         detector. The deadlock detector traverses the lock table and marks one
46         of the participating lock requesters for rejection in each deadlock it
47         finds.
48    </p>
49      <p>
50         The <code class="methodname">DB_ENV-&gt;lock_detect()</code> method is the underlying method used by the
51         <a class="link" href="db_deadlock.html" title="db_deadlock">db_deadlock</a> utility.
52         See the <a class="link" href="db_deadlock.html" title="db_deadlock">db_deadlock</a>
53         utility source code for an example of using <code class="methodname">DB_ENV-&gt;lock_detect()</code> in
54         a IEEE/ANSI Std 1003.1 (POSIX) environment.
55    </p>
56      <p>
57         The <code class="methodname">DB_ENV-&gt;lock_detect()</code> <span>
58            <span>
59                  method returns a non-zero error value on failure and 0 on success.
60            </span>
61            
62        </span>
63    </p>
64      <div class="sect2" lang="en" xml:lang="en">
65        <div class="titlepage">
66          <div>
67            <div>
68              <h3 class="title"><a id="id1676489"></a>Parameters</h3>
69            </div>
70          </div>
71        </div>
72        <div class="sect3" lang="en" xml:lang="en">
73          <div class="titlepage">
74            <div>
75              <div>
76                <h4 class="title"><a id="id1676717"></a>rejected</h4>
77              </div>
78            </div>
79          </div>
80          <p>
81                          If the <span class="bold"><strong>rejected</strong></span> parameter is
82                          non-NULL, the memory location to which it refers will be set to the
83                          number of lock requests that were rejected.
84                     </p>
85        </div>
86        <div class="sect3" lang="en" xml:lang="en">
87          <div class="titlepage">
88            <div>
89              <div>
90                <h4 class="title"><a id="id1676718"></a>atype</h4>
91              </div>
92            </div>
93          </div>
94          <p>
95                          The <span class="bold"><strong>atype</strong></span> parameter specifies which
96                          lock request(s) to reject. It must be set to one of the following
97                          list:
98                     </p>
99          <div class="itemizedlist">
100            <ul type="disc">
101              <li>
102                <p><a id="detect_DB_LOCK_DEFAULT"></a>
103                  <code class="literal">DB_LOCK_DEFAULT</code>
104            </p>
105                <p>
106                 Use whatever lock policy was specified when the database environment
107                 was created.  If no lock policy has yet been specified, set the lock
108                 policy to DB_LOCK_RANDOM.
109            </p>
110              </li>
111              <li>
112                <p><a id="detect_DB_LOCK_EXPIRE"></a>
113                  <code class="literal">DB_LOCK_EXPIRE</code>
114            </p>
115                <p>
116                 Reject lock requests which have timed out.  No other deadlock
117                 detection is performed.
118            </p>
119              </li>
120              <li>
121                <p><a id="detect_DB_LOCK_MAXLOCKS"></a>
122                  <code class="literal">DB_LOCK_MAXLOCKS</code>
123            </p>
124                <p>
125                 Reject the lock request for the locker ID with the most locks.
126            </p>
127              </li>
128              <li>
129                <p><a id="detect_DB_LOCK_MAXWRITE"></a>
130                  <code class="literal">DB_LOCK_MAXWRITE</code>
131            </p>
132                <p>
133                 Reject the lock request for the locker ID with the most write locks.
134            </p>
135              </li>
136              <li>
137                <p><a id="detect_DB_LOCK_MINLOCKS"></a>
138                  <code class="literal">DB_LOCK_MINLOCKS</code>
139            </p>
140                <p>
141                 Reject the lock request for the locker ID with the fewest locks.
142            </p>
143              </li>
144              <li>
145                <p><a id="detect_DB_LOCK_MINWRITE"></a>
146                  <code class="literal">DB_LOCK_MINWRITE</code>
147            </p>
148                <p>
149                 Reject the lock request for the locker ID with the fewest write locks.
150            </p>
151              </li>
152              <li>
153                <p><a id="detect_DB_LOCK_OLDEST"></a>
154                  <code class="literal">DB_LOCK_OLDEST</code>
155            </p>
156                <p>
157                 Reject the lock request for the locker ID with the oldest lock.
158            </p>
159              </li>
160              <li>
161                <p><a id="detect_DB_LOCK_RANDOM"></a>
162                  <code class="literal">DB_LOCK_RANDOM</code>
163            </p>
164                <p>
165                Reject the lock request for a random locker ID.
166            </p>
167              </li>
168              <li>
169                <p><a id="detect_DB_LOCK_YOUNGEST"></a>
170                  <code class="literal">DB_LOCK_YOUNGEST</code>
171            </p>
172                <p>
173                 Reject the lock request for the locker ID with the youngest lock.
174            </p>
175              </li>
176            </ul>
177          </div>
178        </div>
179        <div class="sect3" lang="en" xml:lang="en">
180          <div class="titlepage">
181            <div>
182              <div>
183                <h4 class="title"><a id="id1677140"></a>flags</h4>
184              </div>
185            </div>
186          </div>
187          <p>
188                          The <span class="bold"><strong>flags</strong></span> parameter is currently
189                          unused, and must be set to 0.
190                     </p>
191        </div>
192      </div>
193      <div class="sect2" lang="en" xml:lang="en">
194        <div class="titlepage">
195          <div>
196            <div>
197              <h3 class="title"><a id="id1676901"></a>Errors</h3>
198            </div>
199          </div>
200        </div>
201        <p>
202                         The <code class="methodname">DB_ENV-&gt;lock_detect()</code> <span>
203            <span>
204                 method may fail and return one of the following non-zero errors:
205            </span>
206            
207        </span>
208                    </p>
209        <div class="sect3" lang="en" xml:lang="en">
210          <div class="titlepage">
211            <div>
212              <div>
213                <h4 class="title"><a id="id1676856"></a>EINVAL</h4>
214              </div>
215            </div>
216          </div>
217          <p>
218                An invalid flag value or parameter was specified.
219            </p>
220        </div>
221      </div>
222      <div class="sect2" lang="en" xml:lang="en">
223        <div class="titlepage">
224          <div>
225            <div>
226              <h3 class="title"><a id="id1677152"></a>Class</h3>
227            </div>
228          </div>
229        </div>
230        <p>
231                 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a>, <a class="link" href="lock.html" title="Chapter��6.�� The DB_LOCK Handle">DB_LOCK</a> 
232            </p>
233      </div>
234      <div class="sect2" lang="en" xml:lang="en">
235        <div class="titlepage">
236          <div>
237            <div>
238              <h3 class="title"><a id="id1677095"></a>See Also</h3>
239            </div>
240          </div>
241        </div>
242        <p>
243                     <a class="xref" href="lock.html#locklist" title="Locking Subsystem and Related Methods">Locking Subsystem and Related Methods</a> 
244                </p>
245      </div>
246    </div>
247    <div class="navfooter">
248      <hr />
249      <table width="100%" summary="Navigation footer">
250        <tr>
251          <td width="40%" align="left"><a accesskey="p" href="envset_lk_partitions.html">Prev</a>��</td>
252          <td width="20%" align="center">
253            <a accesskey="u" href="lock.html">Up</a>
254          </td>
255          <td width="40%" align="right">��<a accesskey="n" href="lockget.html">Next</a></td>
256        </tr>
257        <tr>
258          <td width="40%" align="left" valign="top">DB_ENV-&gt;set_lk_partitions()��</td>
259          <td width="20%" align="center">
260            <a accesskey="h" href="index.html">Home</a>
261          </td>
262          <td width="40%" align="right" valign="top">��DB_ENV-&gt;lock_get()</td>
263        </tr>
264      </table>
265    </div>
266  </body>
267</html>
268