⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db.h

📁 这是国外的resip协议栈
💻 H
📖 第 1 页 / 共 5 页
字号:
/* Per-process DB_MPOOLFILE information. */struct __db_mpoolfile {	DB_FH	  *fhp;			/* Underlying file handle. */	/*	 * !!!	 * The ref, pinref and q fields are protected by the region lock.	 */	u_int32_t  ref;			/* Reference count. */	u_int32_t pinref;		/* Pinned block reference count. */	/*	 * !!!	 * Explicit representations of structures from queue.h.	 * TAILQ_ENTRY(__db_mpoolfile) q;	 */	struct {		struct __db_mpoolfile *tqe_next;		struct __db_mpoolfile **tqe_prev;	} q;				/* Linked list of DB_MPOOLFILE's. */	/*	 * !!!	 * The rest of the fields (with the exception of the MP_FLUSH flag)	 * are not thread-protected, even when they may be modified at any	 * time by the application.  The reason is the DB_MPOOLFILE handle	 * is single-threaded from the viewpoint of the application, and so	 * the only fields needing to be thread-protected are those accessed	 * by checkpoint or sync threads when using DB_MPOOLFILE structures	 * to flush buffers from the cache.	 */	DB_ENV	       *dbenv;		/* Overlying DB_ENV. */	MPOOLFILE      *mfp;		/* Underlying MPOOLFILE. */	u_int32_t	clear_len;	/* Cleared length on created pages. */	u_int8_t			/* Unique file ID. */			fileid[DB_FILE_ID_LEN];	int		ftype;		/* File type. */	int32_t		lsn_offset;	/* LSN offset in page. */	u_int32_t	gbytes, bytes;	/* Maximum file size. */	DBT	       *pgcookie;	/* Byte-string passed to pgin/pgout. */	DB_CACHE_PRIORITY		/* Cache priority. */			priority;	void	       *addr;		/* Address of mmap'd region. */	size_t		len;		/* Length of mmap'd region. */	u_int32_t	config_flags;	/* Flags to DB_MPOOLFILE->set_flags. */					/* Methods. */	int (*close) __P((DB_MPOOLFILE *, u_int32_t));	int (*get) __P((DB_MPOOLFILE *, db_pgno_t *, u_int32_t, void *));	int (*open) __P((DB_MPOOLFILE *, const char *, u_int32_t, int, size_t));	int (*put) __P((DB_MPOOLFILE *, void *, u_int32_t));	int (*set) __P((DB_MPOOLFILE *, void *, u_int32_t));	int (*get_clear_len) __P((DB_MPOOLFILE *, u_int32_t *));	int (*set_clear_len) __P((DB_MPOOLFILE *, u_int32_t));	int (*get_fileid) __P((DB_MPOOLFILE *, u_int8_t *));	int (*set_fileid) __P((DB_MPOOLFILE *, u_int8_t *));	int (*get_flags) __P((DB_MPOOLFILE *, u_int32_t *));	int (*set_flags) __P((DB_MPOOLFILE *, u_int32_t, int));	int (*get_ftype) __P((DB_MPOOLFILE *, int *));	int (*set_ftype) __P((DB_MPOOLFILE *, int));	int (*get_lsn_offset) __P((DB_MPOOLFILE *, int32_t *));	int (*set_lsn_offset) __P((DB_MPOOLFILE *, int32_t));	int (*get_maxsize) __P((DB_MPOOLFILE *, u_int32_t *, u_int32_t *));	int (*set_maxsize) __P((DB_MPOOLFILE *, u_int32_t, u_int32_t));	int (*get_pgcookie) __P((DB_MPOOLFILE *, DBT *));	int (*set_pgcookie) __P((DB_MPOOLFILE *, DBT *));	int (*get_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY *));	int (*set_priority) __P((DB_MPOOLFILE *, DB_CACHE_PRIORITY));	int (*sync) __P((DB_MPOOLFILE *));	/*	 * MP_FILEID_SET, MP_OPEN_CALLED and MP_READONLY do not need to be	 * thread protected because they are initialized before the file is	 * linked onto the per-process lists, and never modified.	 *	 * MP_FLUSH is thread protected because it is potentially read/set by	 * multiple threads of control.	 */#define	MP_FILEID_SET	0x001		/* Application supplied a file ID. */#define	MP_FLUSH	0x002		/* Was opened to flush a buffer. */#define	MP_OPEN_CALLED	0x004		/* File opened. */#define	MP_READONLY	0x008		/* File is readonly. */	u_int32_t  flags;};/* Mpool statistics structure. */struct __db_mpool_stat {	u_int32_t st_gbytes;		/* Total cache size: GB. */	u_int32_t st_bytes;		/* Total cache size: B. */	u_int32_t st_ncache;		/* Number of caches. */	roff_t	  st_regsize;		/* Region size. */	size_t	  st_mmapsize;		/* Maximum file size for mmap. */	int	  st_maxopenfd;		/* Maximum number of open fd's. */	int	  st_maxwrite;		/* Maximum buffers to write. */	int	  st_maxwrite_sleep;	/* Sleep after writing max buffers. */	u_int32_t st_map;		/* Pages from mapped files. */	u_int32_t st_cache_hit;		/* Pages found in the cache. */	u_int32_t st_cache_miss;	/* Pages not found in the cache. */	u_int32_t st_page_create;	/* Pages created in the cache. */	u_int32_t st_page_in;		/* Pages read in. */	u_int32_t st_page_out;		/* Pages written out. */	u_int32_t st_ro_evict;		/* Clean pages forced from the cache. */	u_int32_t st_rw_evict;		/* Dirty pages forced from the cache. */	u_int32_t st_page_trickle;	/* Pages written by memp_trickle. */	u_int32_t st_pages;		/* Total number of pages. */	u_int32_t st_page_clean;	/* Clean pages. */	u_int32_t st_page_dirty;	/* Dirty pages. */	u_int32_t st_hash_buckets;	/* Number of hash buckets. */	u_int32_t st_hash_searches;	/* Total hash chain searches. */	u_int32_t st_hash_longest;	/* Longest hash chain searched. */	u_int32_t st_hash_examined;	/* Total hash entries searched. */	u_int32_t st_hash_nowait;	/* Hash lock granted with nowait. */	u_int32_t st_hash_wait;		/* Hash lock granted after wait. */	u_int32_t st_hash_max_wait;	/* Max hash lock granted after wait. */	u_int32_t st_region_nowait;	/* Region lock granted with nowait. */	u_int32_t st_region_wait;	/* Region lock granted after wait. */	u_int32_t st_alloc;		/* Number of page allocations. */	u_int32_t st_alloc_buckets;	/* Buckets checked during allocation. */	u_int32_t st_alloc_max_buckets;	/* Max checked during allocation. */	u_int32_t st_alloc_pages;	/* Pages checked during allocation. */	u_int32_t st_alloc_max_pages;	/* Max checked during allocation. */};/* Mpool file statistics structure. */struct __db_mpool_fstat {	char *file_name;		/* File name. */	u_int32_t st_pagesize;		/* Page size. */	u_int32_t st_map;		/* Pages from mapped files. */	u_int32_t st_cache_hit;		/* Pages found in the cache. */	u_int32_t st_cache_miss;	/* Pages not found in the cache. */	u_int32_t st_page_create;	/* Pages created in the cache. */	u_int32_t st_page_in;		/* Pages read in. */	u_int32_t st_page_out;		/* Pages written out. */};/******************************************************* * Transactions and recovery. *******************************************************/#define	DB_TXNVERSION	1typedef enum {	DB_TXN_ABORT=0,			/* Public. */	DB_TXN_APPLY=1,			/* Public. */	DB_TXN_BACKWARD_ALLOC=2,	/* Internal. */	DB_TXN_BACKWARD_ROLL=3,		/* Public. */	DB_TXN_FORWARD_ROLL=4,		/* Public. */	DB_TXN_OPENFILES=5,		/* Internal. */	DB_TXN_POPENFILES=6,		/* Internal. */	DB_TXN_PRINT=7			/* Public. */} db_recops;/* * BACKWARD_ALLOC is used during the forward pass to pick up any aborted * allocations for files that were created during the forward pass. * The main difference between _ALLOC and _ROLL is that the entry for * the file not exist during the rollforward pass. */#define	DB_UNDO(op)	((op) == DB_TXN_ABORT ||			\		(op) == DB_TXN_BACKWARD_ROLL || (op) == DB_TXN_BACKWARD_ALLOC)#define	DB_REDO(op)	((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY)struct __db_txn {	DB_TXNMGR	*mgrp;		/* Pointer to transaction manager. */	DB_TXN		*parent;	/* Pointer to transaction's parent. */	DB_LSN		last_lsn;	/* Lsn of last log write. */	u_int32_t	txnid;		/* Unique transaction id. */	u_int32_t	tid;		/* Thread id for use in MT XA. */	roff_t		off;		/* Detail structure within region. */	db_timeout_t	lock_timeout;	/* Timeout for locks for this txn. */	db_timeout_t	expire;		/* Time this txn expires. */	void		*txn_list;	/* Undo information for parent. */	/*	 * !!!	 * Explicit representations of structures from queue.h.	 * TAILQ_ENTRY(__db_txn) links;	 * TAILQ_ENTRY(__db_txn) xalinks;	 */	struct {		struct __db_txn *tqe_next;		struct __db_txn **tqe_prev;	} links;			/* Links transactions off manager. */	struct {		struct __db_txn *tqe_next;		struct __db_txn **tqe_prev;	} xalinks;			/* Links active XA transactions. */	/*	 * !!!	 * Explicit representations of structures from queue.h.	 * TAILQ_HEAD(__events, __txn_event) events;	 */	struct {		struct __txn_event *tqh_first;		struct __txn_event **tqh_last;	} events;	/*	 * !!!	 * Explicit representations of structures from queue.h.	 * STAILQ_HEAD(__logrec, __txn_logrec) logs;	 */	struct {		struct __txn_logrec *stqh_first;		struct __txn_logrec **stqh_last;	} logs;				/* Links deferred events. */	/*	 * !!!	 * Explicit representations of structures from queue.h.	 * TAILQ_HEAD(__kids, __db_txn) kids;	 */	struct __kids {		struct __db_txn *tqh_first;		struct __db_txn **tqh_last;	} kids;	/*	 * !!!	 * Explicit representations of structures from queue.h.	 * TAILQ_ENTRY(__db_txn) klinks;	 */	struct {		struct __db_txn *tqe_next;		struct __db_txn **tqe_prev;	} klinks;	void	*api_internal;		/* C++ API private. */	void	*xml_internal;		/* XML API private. */	u_int32_t	cursors;	/* Number of cursors open for txn */					/* Methods. */	int	  (*abort) __P((DB_TXN *));	int	  (*commit) __P((DB_TXN *, u_int32_t));	int	  (*discard) __P((DB_TXN *, u_int32_t));	u_int32_t (*id) __P((DB_TXN *));	int	  (*prepare) __P((DB_TXN *, u_int8_t *));	void	  (*set_begin_lsnp) __P((DB_TXN *txn, DB_LSN **));	int	  (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t));#define	TXN_CHILDCOMMIT	0x001		/* Transaction that has committed. */#define	TXN_COMPENSATE	0x002		/* Compensating transaction. */#define	TXN_DEADLOCK	0x004		/* Transaction has deadlocked. */#define	TXN_DEGREE_2	0x008		/* Has degree 2 isolation. */#define	TXN_DIRTY_READ	0x010		/* Transaction does dirty reads. */#define	TXN_LOCKTIMEOUT	0x020		/* Transaction has a lock timeout. */#define	TXN_MALLOC	0x040		/* Structure allocated by TXN system. */#define	TXN_NOSYNC	0x080		/* Do not sync on prepare and commit. */#define	TXN_NOWAIT	0x100		/* Do not wait on locks. */#define	TXN_RESTORED	0x200		/* Transaction has been restored. */#define	TXN_SYNC	0x400		/* Sync on prepare and commit. */	u_int32_t	flags;};/* * Structure used for two phase commit interface.  Berkeley DB support for two * phase commit is compatible with the X/open XA interface. * * The XA #define XIDDATASIZE defines the size of a global transaction ID.  We * have our own version here (for name space reasons) which must have the same * value. */#define	DB_XIDDATASIZE	128struct __db_preplist {	DB_TXN	*txn;	u_int8_t gid[DB_XIDDATASIZE];};/* Transaction statistics structure. */struct __db_txn_active {	u_int32_t txnid;		/* Transaction ID */	u_int32_t parentid;		/* Transaction ID of parent */	DB_LSN	  lsn;			/* LSN when transaction began */	u_int32_t xa_status;		/* XA status */	u_int8_t  xid[DB_XIDDATASIZE];	/* XA global transaction ID */};struct __db_txn_stat {	DB_LSN	  st_last_ckp;		/* lsn of the last checkpoint */	time_t	  st_time_ckp;		/* time of last checkpoint */	u_int32_t st_last_txnid;	/* last transaction id given out */	u_int32_t st_maxtxns;		/* maximum txns possible */	u_int32_t st_naborts;		/* number of aborted transactions */	u_int32_t st_nbegins;		/* number of begun transactions */	u_int32_t st_ncommits;		/* number of committed transactions */	u_int32_t st_nactive;		/* number of active transactions */	u_int32_t st_nrestores;		/* number of restored transactions					   after recovery. */	u_int32_t st_maxnactive;	/* maximum active transactions */	DB_TXN_ACTIVE *st_txnarray;	/* array of active transactions */	u_int32_t st_region_wait;	/* Region lock granted after wait. */	u_int32_t st_region_nowait;	/* Region lock granted without wait. */	roff_t	  st_regsize;		/* Region size. */};/******************************************************* * Replication. *******************************************************//* Special, out-of-band environment IDs. */#define	DB_EID_BROADCAST	-1#define	DB_EID_INVALID		-2/* rep_start flags values */#define	DB_REP_CLIENT		0x001#define	DB_REP_MASTER		0x002/* Replication statistics. */struct __db_rep_stat {	/* !!!	 * Many replication statistics fields cannot be protected by a mutex	 * without an unacceptable performance penalty, since most message	 * processing is done without the need to hold a region-wide lock.	 * Fields whose comments end with a '+' may be updated without holding	 * the replication or log mutexes (as appropriate), and thus may be	 * off somewhat (or, on unreasonable architectures under unlucky	 * circumstances, garbaged).	 */	u_int32_t st_status;		/* Current replication status. */	DB_LSN st_next_lsn;		/* Next LSN to use or expect. */	DB_LSN st_waiting_lsn;		/* LSN we're awaiting, if any. */	db_pgno_t st_next_pg;		/* Next pg we expect. */	db_pgno_t st_waiting_pg;	/* pg we're awaiting, if any. */	u_int32_t st_dupmasters;	/* # of times a duplicate master					   condition was detected.+ */	int st_env_id;			/* Current environment ID. */	int st_env_priority;		/* Current environment priority. */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -