亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lock_deadlock.c

?? File system using stacked.
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 1996-2002 *	Sleepycat Software.  All rights reserved. */#include "db_config.h"#ifndef lintstatic const char revid[] = "$Id: lock_deadlock.c,v 1.1.1.1 2004/08/19 23:53:56 gopalan Exp $";#endif /* not lint */#ifndef __KERNEL__# ifndef NO_SYSTEM_INCLUDES#  include <sys/types.h>#  include <string.h># endif#else # include <linux/types.h># include <linux/string.h>#endif#include "db_int.h"#include "dbinc/db_shash.h"#include "dbinc/lock.h"#include "dbinc/txn.h"#ifndef __KERNEL__#include "dbinc/rep.h"#endif#define	ISSET_MAP(M, N)	((M)[(N) / 32] & (1 << (N) % 32))#define	CLEAR_MAP(M, N) {						\	u_int32_t __i;							\	for (__i = 0; __i < (N); __i++)					\		(M)[__i] = 0;						\}#define	SET_MAP(M, B)	((M)[(B) / 32] |= (1 << ((B) % 32)))#define	CLR_MAP(M, B)	((M)[(B) / 32] &= ~(1 << ((B) % 32)))#define	OR_MAP(D, S, N)	{						\	u_int32_t __i;							\	for (__i = 0; __i < (N); __i++)					\		D[__i] |= S[__i];					\}#define	BAD_KILLID	0xfffffffftypedef struct {	int		valid;	int		self_wait;	u_int32_t	count;	u_int32_t	id;	u_int32_t	last_lock;	u_int32_t	last_locker_id;	db_pgno_t	pgno;} locker_info;static int  __dd_abort __P((DB_ENV *, locker_info *));static int  __dd_build __P((DB_ENV *,	    u_int32_t, u_int32_t **, u_int32_t *, u_int32_t *, locker_info **));static int  __dd_find __P((DB_ENV *,	    u_int32_t *, locker_info *, u_int32_t, u_int32_t, u_int32_t ***));static int  __dd_isolder __P((u_int32_t, u_int32_t, u_int32_t, u_int32_t));static int __dd_verify __P((locker_info *, u_int32_t *, u_int32_t *,	    u_int32_t *, u_int32_t, u_int32_t, u_int32_t));#ifdef DIAGNOSTICstatic void __dd_debug	    __P((DB_ENV *, locker_info *, u_int32_t *, u_int32_t, u_int32_t));#endif/* * lock_detect -- * * PUBLIC: int __lock_detect __P((DB_ENV *, u_int32_t, u_int32_t, int *)); */int__lock_detect(dbenv, flags, atype, abortp)	DB_ENV *dbenv;	u_int32_t flags, atype;	int *abortp;{	DB_LOCKREGION *region;	DB_LOCKTAB *lt;	DB_TXNMGR *tmgr;	locker_info *idmap;	u_int32_t *bitmap, *copymap, **deadp, **free_me, *tmpmap;	u_int32_t i, keeper, killid, limit, nalloc, nlockers;	u_int32_t lock_max, txn_max;	int ret;	PANIC_CHECK(dbenv);	ENV_REQUIRES_CONFIG(dbenv,	    dbenv->lk_handle, "DB_ENV->lock_detect", DB_INIT_LOCK);	/* Validate arguments. */	if ((ret = __db_fchk(dbenv, "DB_ENV->lock_detect", flags, 0)) != 0)		return (ret);	switch (atype) {	case DB_LOCK_DEFAULT:	case DB_LOCK_EXPIRE:	case DB_LOCK_MAXLOCKS:	case DB_LOCK_MINLOCKS:	case DB_LOCK_MINWRITE:	case DB_LOCK_OLDEST:	case DB_LOCK_RANDOM:	case DB_LOCK_YOUNGEST:		break;	default:		__db_err(dbenv,	    "DB_ENV->lock_detect: unknown deadlock detection mode specified");		return (EINVAL);	}	/*	 * If this environment is a replication client, then we must use the	 * MINWRITE detection discipline.	 */#ifndef __KERNEL__	if (__rep_is_client(dbenv))		atype = DB_LOCK_MINWRITE;#endif	free_me = NULL;	lt = dbenv->lk_handle;	if (abortp != NULL)		*abortp = 0;	/* Check if a detector run is necessary. */	LOCKREGION(dbenv, lt);	/* Make a pass only if auto-detect would run. */	region = lt->reginfo.primary;	if (region->need_dd == 0) {		UNLOCKREGION(dbenv, lt);		return (0);	}	/* Reset need_dd, so we know we've run the detector. */	region->need_dd = 0;	/* Build the waits-for bitmap. */	ret = __dd_build(dbenv, atype, &bitmap, &nlockers, &nalloc, &idmap);	lock_max = region->stat.st_cur_maxid;	UNLOCKREGION(dbenv, lt);	/*	 * We need the cur_maxid from the txn region as well.  In order	 * to avoid tricky synchronization between the lock and txn	 * regions, we simply unlock the lock region and then lock the	 * txn region.  This introduces a small window during which the	 * transaction system could then wrap.  We're willing to return	 * the wrong answer for "oldest" or "youngest" in those rare	 * circumstances.	 */	tmgr = dbenv->tx_handle;	if (tmgr != NULL) {		R_LOCK(dbenv, &tmgr->reginfo);		txn_max = ((DB_TXNREGION *)tmgr->reginfo.primary)->cur_maxid;		R_UNLOCK(dbenv, &tmgr->reginfo);	} else		txn_max = TXN_MAXIMUM;	if (ret != 0 || atype == DB_LOCK_EXPIRE)		return (ret);	if (nlockers == 0)		return (0);#ifdef DIAGNOSTIC	if (FLD_ISSET(dbenv->verbose, DB_VERB_WAITSFOR))		__dd_debug(dbenv, idmap, bitmap, nlockers, nalloc);#endif	/* Now duplicate the bitmaps so we can verify deadlock participants. */	if ((ret = __os_calloc(dbenv, (size_t)nlockers,	    sizeof(u_int32_t) * nalloc, &copymap)) != 0)		goto err;	memcpy(copymap, bitmap, nlockers * sizeof(u_int32_t) * nalloc);	if ((ret = __os_calloc(dbenv, sizeof(u_int32_t), nalloc, &tmpmap)) != 0)		goto err1;	/* Find a deadlock. */	if ((ret =	    __dd_find(dbenv, bitmap, idmap, nlockers, nalloc, &deadp)) != 0)		return (ret);	killid = BAD_KILLID;	free_me = deadp;	for (; *deadp != NULL; deadp++) {		if (abortp != NULL)			++*abortp;		killid = (u_int32_t)((*deadp - bitmap) / nalloc);		limit = killid;		keeper = BAD_KILLID;		if (atype == DB_LOCK_DEFAULT || atype == DB_LOCK_RANDOM)			goto dokill;		/*		 * It's conceivable that under XA, the locker could		 * have gone away.		 */		if (killid == BAD_KILLID)			break;		/*		 * Start with the id that we know is deadlocked		 * and then examine all other set bits and see		 * if any are a better candidate for abortion		 * and that they are genuinely part of the		 * deadlock.  The definition of "best":		 * OLDEST: smallest id		 * YOUNGEST: largest id		 * MAXLOCKS: maximum count		 * MINLOCKS: minimum count		 * MINWRITE: minimum count		 */		for (i = (killid + 1) % nlockers;		    i != limit;		    i = (i + 1) % nlockers) {			if (!ISSET_MAP(*deadp, i))				continue;			switch (atype) {			case DB_LOCK_OLDEST:				if (__dd_isolder(idmap[killid].id,				    idmap[i].id, lock_max, txn_max))					continue;				keeper = i;				break;			case DB_LOCK_YOUNGEST:				if (__dd_isolder(idmap[i].id,				    idmap[killid].id, lock_max, txn_max))					continue;				keeper = i;				break;			case DB_LOCK_MAXLOCKS:				if (idmap[i].count < idmap[killid].count)					continue;				keeper = i;				break;			case DB_LOCK_MINLOCKS:			case DB_LOCK_MINWRITE:				if (idmap[i].count > idmap[killid].count)					continue;				keeper = i;				break;			default:				killid = BAD_KILLID;				ret = EINVAL;				goto dokill;			}			if (__dd_verify(idmap, *deadp,			    tmpmap, copymap, nlockers, nalloc, i))				killid = i;		}dokill:		if (killid == BAD_KILLID)			continue;		/*		 * There are cases in which our general algorithm will		 * fail.  Returning 1 from verify indicates that the		 * particular locker is not only involved in a deadlock,		 * but that killing him will allow others to make forward		 * progress.  Unfortunately, there are cases where we need		 * to abort someone, but killing them will not necessarily		 * ensure forward progress (imagine N readers all trying to		 * acquire a write lock).  In such a scenario, we'll have		 * gotten all the way through the loop, we will have found		 * someone to keep (keeper will be valid), but killid will		 * still be the initial deadlocker.  In this case, if the		 * initial killid satisfies __dd_verify, kill it, else abort		 * keeper and indicate that we need to run deadlock detection		 * again.		 */		if (keeper != BAD_KILLID && killid == limit &&		    __dd_verify(idmap, *deadp,		    tmpmap, copymap, nlockers, nalloc, killid) == 0) {			LOCKREGION(dbenv, lt);			region->need_dd = 1;			UNLOCKREGION(dbenv, lt);			killid = keeper;		}		/* Kill the locker with lockid idmap[killid]. */		if ((ret = __dd_abort(dbenv, &idmap[killid])) != 0) {			/*			 * It's possible that the lock was already aborted;			 * this isn't necessarily a problem, so do not treat			 * it as an error.			 */			if (ret == DB_ALREADY_ABORTED)				ret = 0;			else				__db_err(dbenv,				    "warning: unable to abort locker %lx",				    (u_long)idmap[killid].id);		} else if (FLD_ISSET(dbenv->verbose, DB_VERB_DEADLOCK))			__db_err(dbenv,			    "Aborting locker %lx", (u_long)idmap[killid].id);	}	__os_free(dbenv, tmpmap);err1:	__os_free(dbenv, copymap);err:	if (free_me != NULL)		__os_free(dbenv, free_me);	__os_free(dbenv, bitmap);	__os_free(dbenv, idmap);	return (ret);}/* * ======================================================================== * Utilities */# define DD_INVALID_ID	((u_int32_t) -1)static int__dd_build(dbenv, atype, bmp, nlockers, allocp, idmap)	DB_ENV *dbenv;	u_int32_t atype, **bmp, *nlockers, *allocp;	locker_info **idmap;{	struct __db_lock *lp;	DB_LOCKER *lip, *lockerp, *child;	DB_LOCKOBJ *op, *lo;	DB_LOCKREGION *region;	DB_LOCKTAB *lt;	locker_info *id_array;	db_timeval_t now;	u_int32_t *bitmap, count, dd, *entryp, id, ndx, nentries, *tmpmap;	u_int8_t *pptr;	int expire_only, is_first, need_timeout, ret;	lt = dbenv->lk_handle;	region = lt->reginfo.primary;	LOCK_SET_TIME_INVALID(&now);	need_timeout = 0;	expire_only = atype == DB_LOCK_EXPIRE;	/*	 * While we always check for expired timeouts, if we are called	 * with DB_LOCK_EXPIRE, then we are only checking for timeouts	 * (i.e., not doing deadlock detection at all).  If we aren't	 * doing real deadlock detection, then we can skip a significant,	 * amount of the processing.  In particular we do not build	 * the conflict array and our caller needs to expect this.	 */	if (expire_only) {		count = 0;		nentries = 0;		goto obj_loop;	}	/*	 * We'll check how many lockers there are, add a few more in for	 * good measure and then allocate all the structures.  Then we'll	 * verify that we have enough room when we go back in and get the	 * mutex the second time.	 */retry:	count = region->stat.st_nlockers;	if (count == 0) {		*nlockers = 0;		return (0);	}	if (FLD_ISSET(dbenv->verbose, DB_VERB_DEADLOCK))		__db_err(dbenv, "%lu lockers", (u_long)count);	count += 20;	nentries = ALIGN(count, 32) / 32;	/*	 * Allocate enough space for a count by count bitmap matrix.	 *	 * XXX	 * We can probably save the malloc's between iterations just	 * reallocing if necessary because count grew by too much.	 */	if ((ret = __os_calloc(dbenv, (size_t)count,	    sizeof(u_int32_t) * nentries, &bitmap)) != 0)		return (ret);	if ((ret = __os_calloc(dbenv,	    sizeof(u_int32_t), nentries, &tmpmap)) != 0) {		__os_free(dbenv, bitmap);		return (ret);	}	if ((ret = __os_calloc(dbenv,	    (size_t)count, sizeof(locker_info), &id_array)) != 0) {		__os_free(dbenv, bitmap);		__os_free(dbenv, tmpmap);		return (ret);	}	/*	 * Now go back in and actually fill in the matrix.	 */	if (region->stat.st_nlockers > count) {		__os_free(dbenv, bitmap);		__os_free(dbenv, tmpmap);		__os_free(dbenv, id_array);		goto retry;	}	/*	 * First we go through and assign each locker a deadlock detector id.	 */	for (id = 0, lip = SH_TAILQ_FIRST(&region->lockers, __db_locker);	    lip != NULL;	    lip = SH_TAILQ_NEXT(lip, ulinks, __db_locker)) {		if (F_ISSET(lip, DB_LOCKER_INABORT))			continue;		if (lip->master_locker == INVALID_ROFF) {			lip->dd_id = id++;			id_array[lip->dd_id].id = lip->id;			if (atype == DB_LOCK_MINLOCKS ||			    atype == DB_LOCK_MAXLOCKS)				id_array[lip->dd_id].count = lip->nlocks;			if (atype == DB_LOCK_MINWRITE)				id_array[lip->dd_id].count = lip->nwrites;		} else			lip->dd_id = DD_INVALID_ID;	}	/*	 * We only need consider objects that have waiters, so we use	 * the list of objects with waiters (dd_objs) instead of traversing	 * the entire hash table.  For each object, we traverse the waiters	 * list and add an entry in the waitsfor matrix for each waiter/holder	 * combination.	 */obj_loop:	for (op = SH_TAILQ_FIRST(&region->dd_objs, __db_lockobj);	    op != NULL; op = SH_TAILQ_NEXT(op, dd_links, __db_lockobj)) {		if (expire_only)			goto look_waiters;		CLEAR_MAP(tmpmap, nentries);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
aaa国产一区| 美女视频网站久久| 99精品国产视频| 日韩理论电影院| 欧美午夜精品一区二区三区| 成人午夜短视频| 亚洲色图19p| 欧美日韩国产美| 久久99精品久久久久久久久久久久 | 亚洲国产日韩a在线播放性色| 91啪亚洲精品| 午夜视频一区二区| 久久亚洲一区二区三区四区| av亚洲精华国产精华精| 亚洲一卡二卡三卡四卡无卡久久| 91精品国产91久久综合桃花| 国产美女视频91| 亚洲欧美国产三级| 欧美福利视频导航| 国产激情一区二区三区四区| 一区二区三区色| 欧美电视剧在线观看完整版| 成人永久免费视频| 水蜜桃久久夜色精品一区的特点| 久久免费美女视频| 在线一区二区三区四区五区| 日本成人在线不卡视频| 国产精品国产三级国产有无不卡 | 欧美精品一二三| 国产成人在线免费| 日精品一区二区| 欧美韩国一区二区| 欧美福利视频导航| a级高清视频欧美日韩| 蜜桃一区二区三区在线| 亚洲品质自拍视频| 精品久久国产97色综合| 91在线看国产| 国产在线一区二区| 色激情天天射综合网| 精品一区在线看| 亚洲图片你懂的| 久久久久久久久岛国免费| 欧美日本国产视频| 91蜜桃免费观看视频| 国产伦精一区二区三区| 污片在线观看一区二区| 国产精品传媒入口麻豆| 久久亚洲综合色一区二区三区| 欧美色爱综合网| 91视频免费看| 成人午夜在线免费| 国产曰批免费观看久久久| 日韩黄色片在线观看| 综合婷婷亚洲小说| 国产嫩草影院久久久久| xnxx国产精品| 日韩一区二区三区免费看 | 成人午夜短视频| 国内精品国产三级国产a久久| 香蕉久久一区二区不卡无毒影院| 中文幕一区二区三区久久蜜桃| 精品国产污网站| 91麻豆精品国产91久久久久久久久| 色综合色综合色综合 | 91久久线看在观草草青青| 成人在线视频一区二区| 国产成人av电影在线| 狠狠色丁香婷婷综合| 麻豆高清免费国产一区| 青娱乐精品视频| 91视频免费看| 在线免费观看日韩欧美| 色噜噜夜夜夜综合网| 91精彩视频在线观看| 色综合天天综合网天天狠天天| 99久久精品免费看| 成人福利电影精品一区二区在线观看| 国产一区二区三区不卡在线观看| 欧美a级一区二区| 蜜桃精品视频在线| 极品少妇xxxx精品少妇| 国产东北露脸精品视频| 成人午夜视频福利| 99re热视频这里只精品| 欧美在线视频不卡| 欧美日本在线一区| 日韩欧美久久一区| 久久久精品人体av艺术| 中文一区二区在线观看| 自拍偷拍欧美激情| 亚洲午夜久久久久久久久久久 | 色八戒一区二区三区| 欧美三级电影在线看| 日韩精品一区在线| 国产亚洲成年网址在线观看| 国产精品色在线| 亚洲精品欧美综合四区| 日韩不卡手机在线v区| 日韩电影免费在线看| 久久成人羞羞网站| 高清日韩电视剧大全免费| 一本色道久久综合亚洲aⅴ蜜桃| 色欧美88888久久久久久影院| 欧美理论在线播放| 久久久精品综合| 一区二区三区在线观看动漫| 美女视频一区二区| 99re这里只有精品视频首页| 91精品国产综合久久久久久久久久| 精品处破学生在线二十三| 亚洲欧洲成人精品av97| 五月综合激情婷婷六月色窝| 国产精品正在播放| 欧美视频一区二区三区四区| 久久精品一区二区| 亚洲一区二区三区四区在线免费观看| 蜜桃av一区二区三区电影| 风间由美一区二区av101| 欧美日韩三级一区二区| 久久九九久久九九| 亚洲一区欧美一区| 韩国精品在线观看| 久久国产麻豆精品| eeuss鲁片一区二区三区在线看| 欧美视频在线一区二区三区| 91精品国产色综合久久| 国产精品久久久久影院亚瑟| 午夜精品一区二区三区电影天堂| 日本vs亚洲vs韩国一区三区| 日韩欧美一区在线| 中文字幕一区在线观看视频| 午夜精品一区二区三区三上悠亚| 不卡一卡二卡三乱码免费网站| 欧洲亚洲精品在线| 久久免费视频一区| 一区二区三区自拍| 免费人成在线不卡| 欧美三级午夜理伦三级中视频| 中文一区二区完整视频在线观看| 麻豆精品国产91久久久久久| 91麻豆精品一区二区三区| 欧美va天堂va视频va在线| 午夜精品福利视频网站| 成人白浆超碰人人人人| 91精品国产综合久久久久久久久久| 亚洲国产高清在线| 日韩国产精品久久久久久亚洲| 91免费观看国产| 久久先锋影音av鲁色资源网| 日韩精品三区四区| 色婷婷精品久久二区二区蜜臀av| 国产精品久久久久久一区二区三区 | 中文字幕一区二区三区在线播放| 日韩一区精品字幕| 色呦呦日韩精品| 国产精品入口麻豆原神| 免费看日韩精品| 欧美在线一二三| 亚洲色图都市小说| 成人精品gif动图一区| 日韩一卡二卡三卡四卡| 亚洲国产中文字幕| 色综合色狠狠综合色| 中文字幕av一区二区三区免费看| 日韩精品电影在线观看| 欧美一区二区三区视频免费| 亚洲成人动漫av| 色婷婷综合久久| 综合久久久久久| 成年人网站91| 久久精品这里都是精品| 亚洲国产视频一区| 日本韩国视频一区二区| 亚洲精品免费播放| 色综合久久中文综合久久97| 中文字幕制服丝袜成人av| 国产.欧美.日韩| 国产激情一区二区三区| 久久久久久久久99精品| 一区二区三区中文在线观看| 精品1区2区3区| 一区二区三区不卡在线观看| 色老汉av一区二区三区| 亚洲久本草在线中文字幕| 色婷婷av一区二区三区软件| 亚洲欧美另类在线| 在线精品亚洲一区二区不卡| 亚洲综合色婷婷| 欧美日韩国产高清一区二区三区 | 欧美高清视频一二三区| 午夜av区久久| 91麻豆精品国产91久久久久久| 天天av天天翘天天综合网色鬼国产| 在线观看欧美日本| 天堂av在线一区| 欧美zozo另类异族| 97久久超碰国产精品| 亚洲欧美成人一区二区三区| 色94色欧美sute亚洲线路一久|