memp_fget |
#include <db.h>int memp_fget(DB_MPOOLFILE *mpf, db_pgno_t *pgnoaddr, u_int32_t flags, void **pagep);
The memp_fget function copies a pointer to the page with the page number specified by pgnoaddr, from the source file in the DB_MPOOLFILE, into the memory location to which pagep refers. If the page does not exist or cannot be retrieved, memp_fget will fail.
Page numbers begin at 0; that is, the first page in the file is page number 0, not page number 1.
The returned page is size_t type aligned.
The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values:
The DB_MPOOL_CREATE, DB_MPOOL_LAST, and DB_MPOOL_NEW flags are mutually exclusive.
Fully or partially created pages have all their bytes set to 0, unless other behavior was specified when the file was opened.
All pages returned by memp_fget will be retained (that is, pinned), in the pool until a subsequent call to memp_fput.
The memp_fget function returns a non-zero error value on failure, 0 on success, and returns DB_PAGE_NOTFOUND if the requested page does not exist and DB_MPOOL_CREATE was not set.
The memp_fget function may fail and return a non-zero error for the following conditions:
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.
The memp_fget function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the memp_fget function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.