NAME
cdb_init, cdb_initat, cdb_init_fromfd - initialize a cdb
SYNOPSIS
#include <limb/cdb.h>
int cdb_init(cdb *c, const char *file) int cdb_initat(cdb *c, int dfd, const char *file) int cdb_init_fromfd(cdb *c, int fd)
DESCRIPTION
The cdb_init
() function initializes the cdb pointed to by c
, which
must be CDB_ZERO
before the call, by mapping the file named file
, which must
be a valid cdb.
The cdb_initat
() function is similar to cdb_init
() except when file
refer
to a relative path, in which case it is relative to the directory described by
the file descriptor dfd
.
The cdb_init_fromfd
() function is similar to cdb_init
() except that the file
must already be opened and readable via file descriptor fd
.
RETURN VALUE
These functions return 1 on success. Otherwise, they return 0 and set errno
to
indicate the error.
ERRORS
These functions may fail if :
EOVERFLOW
The file is too large. A cdb database must be under 4 GiB.
They may also fail and set errno
for the errors described for fstat(3) and
mmap(3).
The cdb_init
() function may also fail and set errno
for the errors described
for openc_read(3).
The cdb_initat
() function may also fail and set errno
for the errors
described for openc_readat(3).