File: memp_fget.html

package info (click to toggle)
db4.4 4.4.20-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 39,948 kB
  • ctags: 26,257
  • sloc: ansic: 124,258; tcl: 46,590; java: 28,006; perl: 13,009; sh: 11,611; cpp: 9,192; makefile: 1,972; awk: 1,339; cs: 457; xml: 112; php: 22; asm: 14
file content (102 lines) | stat: -rw-r--r-- 4,596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!--$Id: memp_fget.so,v 10.43 2004/08/13 03:38:58 bostic Exp $-->
<!--Copyright 1997-2005 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB_MPOOLFILE-&gt;get</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_MPOOLFILE-&gt;get</h3>
</td>
<td align=right>
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include &lt;db.h&gt;
<p>
int
DB_MPOOLFILE-&gt;get(DB_MPOOLFILE *mpf,
    db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep);
</pre></h3>
<hr size=1 noshade>
<h3>Description: DB_MPOOLFILE-&gt;get</h3>
<p>The DB_MPOOLFILE-&gt;get method returns pages from the cache.</p>
<p>All pages returned by DB_MPOOLFILE-&gt;get will be retained (that is,
<i>pinned</i>), in the pool until a subsequent call to
<a href="../api_c/memp_fput.html">DB_MPOOLFILE-&gt;put</a>.</p>
<p>The returned page is <b>size_t</b> type aligned.</p>
<p>Fully or partially created pages have all their bytes set to a nul byte,
unless the <a href="../api_c/memp_set_clear_len.html">DB_MPOOLFILE-&gt;set_clear_len</a> method was called to specify other
behavior before the file was opened.</p>
<a name="2"><!--meow--></a>
<p>The DB_MPOOLFILE-&gt;get method
will return DB_PAGE_NOTFOUND if the requested page does not exist and DB_MPOOL_CREATE was
not set.
Unless otherwise specified, the DB_MPOOLFILE-&gt;get method
returns a non-zero error value on failure
and 0 on success.
</p>
<h3>Parameters</h3>
<dl compact>
<dt><b>flags</b><dd>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one
or more of the following values:
<dl compact>
<dt><a name="DB_MPOOL_CREATE">DB_MPOOL_CREATE</a><dd>If the specified page does not exist, create it.  In this case, the
<a href="memp_register.html#pgin">pgin</a> method, if specified, is
called.
<dt><a name="DB_MPOOL_LAST">DB_MPOOL_LAST</a><dd>Return the last page of the source file, and copy its page number into
the memory location to which <b>pgnoaddr</b> refers.
<dt><a name="DB_MPOOL_NEW">DB_MPOOL_NEW</a><dd>Create a new page in the file, and copy its page number into the memory
location to which <b>pgnoaddr</b> refers.  In this case, the
<a href="memp_register.html#pgin">pgin</a> method, if specified, is
<b>not</b> called.
</dl>
<p>The DB_MPOOL_CREATE, DB_MPOOL_LAST, and
DB_MPOOL_NEW flags are mutually exclusive.</p>
<dt><b>pagep</b><dd>The <b>pagep</b> parameter references memory into which
a pointer to the returned page is copied. 
<dt><b>pgnoaddr</b><dd>If the <b>flags</b> parameter is set to DB_MPOOL_LAST or
DB_MPOOL_NEW, the page number of the created page is copied
into the memory location to which the <b>pgnoaddr</b> parameter
refers.  Otherwise, the <b>pgnoaddr</b> parameter is the page to
create or retrieve.
<p><b>Page numbers begin at 0; that is, the first page in the file is page
number 0, not page number 1.</b></p>
</dl>
<h3>Errors</h3>
<p>The DB_MPOOLFILE-&gt;get method
may fail and return one of the following non-zero errors:</p>
<dl compact>
<dt>EAGAIN<dd>The page reference count has overflowed.  (This should never happen
unless there is a bug in the application.)
</dl>
<dl compact>
<dt>EINVAL<dd>If the DB_MPOOL_NEW flag was set, and the source file was not
opened for writing;
more than one of DB_MPOOL_CREATE, DB_MPOOL_LAST, and
DB_MPOOL_NEW was set; or if an
invalid flag value or parameter was specified.
</dl>
<dl compact>
<dt>ENOMEM<dd>The cache is full, and no more pages will fit in the pool.
</dl>
<hr size=1 noshade>
<h3>Class</h3>
<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/mempfile_class.html">DB_MPOOLFILE</a>
<h3>See Also</h3>
<a href="../api_c/memp_list.html">Memory Pools and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="../sleepycat/legal.html">Copyright (c) 1996-2005</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</body>
</html>