,I$Berkeley DB: log_stat[P

log_stat





#include <db.h>

intlog_stat(DB_LOG *logp,3 DB_LOG_STAT **spp, void *(*db_malloc)(size_t));





Description



@The log_stat function creates a statistical structure and copies8a pointer to it into the user-specified memory location.

6Statistical structure are created in allocated memory.IfBdb_malloc is non-NULL, it is called to allocate the memory,:otherwise, the library function malloc(3)) is used.CThe function db_malloc must match the calling conventions of&the malloc(3)) library routine.CRegardless, the caller is responsible for deallocating the returnedmemory.ETo deallocate the returned memory, free each returned memory pointer;@pointers inside the memory do not need to be individually freed.

HThe log region statistics are stored in a structure of type DB_LOG_STAT.3The following DB_LOG_STAT fields will be filled in:

Q
u_int32_t st_magic;
The magic number that identifies a file as a log file.>
u_int32_t st_version;
The version of the log file type.C
u_int32_t st_refcnt;
The number of references to the region.4
u_int32_t st_regsize;
The size of the region.6
int st_mode;
The mode of any created log files.W
u_int32_t st_lg_max;
The maximum size of any individual file comprising the log.J
u_int32_t st_w_mbytes;
The number of megabytes written to this log.g
u_int32_t st_w_bytes;
The number of bytes over and above st_w_mbytes written to this log.e
u_int32_t st_wc_mbytes;
The number of megabytes written to this log since the last checkpoint.h
u_int32_t st_wc_bytes;
The number of bytes over and above st_wc_mbytes written to this logsince the last checkpoint.Q
u_int32_t st_wcount;
The number of times the log has been written to disk.Q
u_int32_t st_scount;
The number of times the log has been flushed to disk.:
u_int32_t st_cur_file;
The current log file number.H
u_int32_t st_cur_offset;
The byte offset in the current log file.g
u_int32_t st_region_wait;
The number of times that a thread of control was forced to wait beforeobtaining the region lock.b
u_int32_t st_region_nowait;
The number of times that a thread of control was able to obtain the region lock without waiting.


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



Errors

QIf a fatal error occurs in Berkeley DB, the log_stat function may fail and returnFDB_RUNRECOVERY, at which point all subsequent database calls will alsoreturn DB_RUNRECOVERY.

The log_stat)function may fail and return errnoKfor any of the errors specified for the following Berkeley DB and C library functions: abort(3), fcntl(3), fprintf(3), getpid(3), malloc(3),and memset(3).



See Also

9log_archive,5log_close,9log_compare,3log_file,5log_flush,1log_get,3log_open,1log_put,>log_register, log_stat,6log_unlinkandBlog_unregister.
ÿÿ