#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 referenced by pagep. If the page does not exist or cannot be retrieved, memp_fget will fail.
Page numbers begin at 0, i.e., the first page in the file is page number 0, not page number 1.
The returned page is size_t type aligned.
The flags argument is specified by logically 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.
Created pages have all their bytes set to 0, unless otherwise specified when the file was opened.
All pages returned by memp_fget will be retained (i.e. pinned in the pool until a subsequent call to memp_fput.
The memp_fget function returns the value of errno on failure, and 0 on success.
The memp_fget function may fail and return errno for any of the errors specified for the following Berkeley DB and C library functions: DBmemp->pgin(3), DBmemp->pgout(3), abort(3), close(3), dbenv->db_paniccall(3), fcntl(3), fflush(3), fprintf(3), free(3), fstat(3), fsync(3), getenv(3), getpid(3), getuid(3), isdigit(3), log_compare, log_flush, lseek(3), malloc(3), memcmp(3), memcpy(3), memset(3), mmap(3), open(3), pread(3), pstat_getdynamic(3), pwrite(3), read(3), sigfillset(3), sigprocmask(3), stat(3), strerror(3), strlen(3), sysconf(3), time(3), unlink(3), vfprintf(3), vsnprintf(3), and write(3).
In addition, the memp_fget function may fail and return errno for the following conditions:
The DB_MPOOL_NEW flag was set and the source file was not opened for writing.
The requested page does not exist and DB_MPOOL_CREATE was not set.
More than one of DB_MPOOL_CREATE, DB_MPOOL_LAST and DB_MPOOL_NEW was set.