Berkeley DB: DB->fd
Google

ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++">

DB->fd


#include <db.h>

int DB->fd(DB *db, int *fdp);

Description

The DB->fd function copies a file descriptor representative of the underlying database into the memory referenced by fdp. A file descriptor referencing the same file will be returned to all processes that call db_open with the same file argument. This file descriptor may be safely used as an argument to the fcntl(2) and flock(2) locking functions. The file descriptor is not necessarily associated with any of the underlying files actually used by the access method.

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

The DB->fd function returns the value of errno on failure, and 0 on success.

Errors

If a fatal error occurs in Berkeley DB, the DB->fd function may fail and return DB_RUNRECOVERY, at which point all subsequent database calls will also return DB_RUNRECOVERY.

The DB->fd 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), fsync(3), getenv(3), getpid(3), getuid(3), isdigit(3), log_compare, log_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).

See Also

db_appexit, db_appinit, db_version, DB->close, DB->cursor, DB->del, DB->fd, DB->get, DB->join, db_open, DB->put, DB->stat, DB->sync, DBcursor->c_close, DBcursor->c_del, DBcursor->c_get and DBcursor->c_put.