)I"Berkeley DB: Db::fd[P

Db::fd





#include <db_cxx.h>

intDb::fd(int *fdp);





Description



The Db::fd methodGcopies a file descriptor representative of the underlying database intoGthe memory referenced by fdp. A file descriptor referencing thelsame file will be returned to all processes that call Db::open withGthe same file argument. This file descriptor may be safely usedAas an argument to the fcntl(2) and flock(2) lockingIfunctions. The file descriptor is not necessarily associated with any of8the underlying files actually used by the access method.

IThe Db_fd function only supports a coarse-grained form of locking.8Applications should use the lock manager where possible.

The Db::fd>method either returns errno or throws an exception that:encapsulates an errno on failure, and 0 on success.



Errors

MIf a fatal error occurs in Berkeley DB, the Db::fd method may fail and eitherIreturn DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY,Gat which point all subsequent database calls will also fail in the sameFway. Methods marked as returning errno will, by default, throwHan exception that encapsulates the error information. The default error\behavior can be changed, see DbException.

The Db::fd&method may fail and throw an exceptionKfor 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), fsync(3), getenv(3), getpid(3), getuid(3), isdigit(3),>DbLog::compare,:DbLog::flush, lseek(3), malloc(3), memcpy(3), memset(3),open(3), pread(3), pwrite(3), qsort(3),read(3), realloc(3),sigfillset(3),sigprocmask(3),stat(3), strerror(3), strlen(3), unlink(3), vfprintf(3), vsnprintf(3),and write(3).



Class

,Db



See Also

4Db::close,6Db::cursor,0Db::del,Db::fd,0Db::get,HDb::get_byteswapped,:Db::get_type,2Db::join,2Db::open,0Db::put,1Db::statand2Db::sync.
ÿÿ