Berkeley DB: log_register
Полезная информация

log_register


#include <db.h>

int log_register(DB_LOG *logp, const DB *dbp, const char *name, DBTYPE type, u_int32_t *fidp);

Description

The log_register function registers a file name with the log manager and copies a file identification number into the memory location referenced by fidp.

This file identification number should be used in all subsequent log messages that refer to operations on the file. The log manager records all file name to file identification number mappings at each checkpoint so that a recovery process can identify the file to which a record in the log refers.

The log_register function is called when an access method registers the open of a file. The dbp parameter should be a pointer to the DB structure which is being returned by the access method.

The type parameter should be one of the types of databases specified in db_open, e.g., DB_HASH.

The log_register function returns the value of errno on failure, and 0 on success.

Errors

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

The log_register function may fail and return errno for any of the errors specified for the following Berkeley DB and C library functions: 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), lseek(3), malloc(3), memcmp(3), memcpy(3), memset(3), open(3), realloc(3), sigfillset(3), sigprocmask(3), snprintf(3), stat(3), strerror(3), strlen(3), time(3), unlink(3), vfprintf(3), vsnprintf(3), and write(3).

In addition, the log_register function may fail and return errno for the following conditions:

EINVAL
An invalid flag value or parameter was specified.

See Also

log_archive, log_close, log_compare, log_file, log_flush, log_get, log_open, log_put, log_register, log_stat, log_unlink and log_unregister.