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

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

?? bget.c

?? COS 0.0.1.rar Cos操作系統(tǒng)源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*	Edited and cut down extremely by Paul Barker (PaulB0100@aol.com)	for COS		First Modified:	04/08/04	Last Modified:	02/09/04*/// COS includes#include <cosbase.h>#include <cos/debug.h>#include <cos/mem.h>#include <cos/string.h>// we cannot do output to screen yet#define printf#define sprintf/*    BGET CONFIGURATION    ==================*/// #define TestProg    20000	      					/* Generate built-in test program					 if defined.  The value specifies					 how many buffer allocation attempts					 the test program should make. */#define SizeQuant   8		      /* Buffer allocation size quantum:					 all buffers allocated are a					 multiple of this size.  This					 MUST be a power of two. */// Set to 8 for extra safety#define BufDump     1		      /* Define this symbol to enable the					 bpoold() function which dumps the					 buffers in a buffer pool. */#define BufValid    1		      /* Define this symbol to enable the					 bpoolv() function for validating					 a buffer pool. */ #define DumpData    1		      /* Define this symbol to enable the					 bufdump() function which allows					 dumping the contents of an allocated					 or free buffer. */#define BufStats    1		      /* Define this symbol to enable the					 bstats() function which calculates					 the total free space in the buffer					 pool, the largest available					 buffer, and the total space					 currently allocated. */#define FreeWipe    1		      /* Wipe free buffers to a guaranteed					 pattern of garbage to trip up					 miscreants who attempt to use					 pointers into released buffers. */#define BestFit     0		      /* Use a best fit algorithm when					 searching for space for an					 allocation request.  This uses					 memory more efficiently, but					 allocation will be much slower. */// Lets see how this works for a faster kernel#define BECtl	    1		      /* Define this symbol to enable the					 bectl() function for automatic					 pool space control.  */// #include <stdio.h>// ... It dont exist yet// Will never use LINT so removed stuff#ifdef BufDump			      /* BufDump implies DumpData */#ifndef DumpData#define DumpData    1#endif#endif// removed inclusion of <ctype.h>/*  Declare the interface, including the requested buffer size type,    bufsize.  */#include <bget.h>#define MemSize     int 	      /* Type for size arguments to memxxx()					 functions such as memcmp(). *//* Queue links */struct qlinks {    struct bfhead *flink;	      /* Forward link */    struct bfhead *blink;	      /* Backward link */};/* Header in allocated and free buffers */struct bhead {    bufsize prevfree;		      /* Relative link back to previous					 free buffer in memory or 0 if					 previous buffer is allocated.	*/    bufsize bsize;		      /* Buffer size: positive if free,					 negative if allocated. */};#define BH(p)	((struct bhead *) (p))/*  Header in directly allocated buffers (by acqfcn) */struct bdhead {    bufsize tsize;		      /* Total size, including overhead */    struct bhead bh;		      /* Common header */};#define BDH(p)	((struct bdhead *) (p))/* Header in free buffers */struct bfhead {    struct bhead bh;		      /* Common allocated/free header */    struct qlinks ql;		      /* Links on free list */};#define BFH(p)	((struct bfhead *) (p))static struct bfhead freelist = {     /* List of free buffers */    {0, 0},    {&freelist, &freelist}};#ifdef BufStatsstatic bufsize totalloc = 0;	      /* Total space currently allocated */static long numget = 0, numrel = 0;   /* Number of bget() and brel() calls */#ifdef BECtlstatic long numpblk = 0;	      /* Number of pool blocks */static long numpget = 0, numprel = 0; /* Number of block gets and rels */static long numdget = 0, numdrel = 0; /* Number of direct gets and rels */#endif /* BECtl */#endif /* BufStats */#ifdef BECtl/* Automatic expansion block management functions */static int (*compfcn) (bufsize sizereq, int sequence) = NULL;static void *(*acqfcn) (bufsize size) = NULL;static void (*relfcn) (void *buf) = NULL;static bufsize exp_incr = 0;	      /* Expansion block size */static bufsize pool_len = 0;	      /* 0: no bpool calls have been made					 -1: not all pool blocks are					     the same size					 >0: (common) block size for all					     bpool calls made so far				      */#endif/*  Minimum allocation quantum: */#define QLSize	(sizeof(struct qlinks))#define SizeQ	((SizeQuant > QLSize) ? SizeQuant : QLSize)#define V   (void)		      /* To denote unwanted returned values *//* End sentinel: value placed in bsize field of dummy block delimiting   end of pool block.  The most negative number which will  fit  in  a   bufsize, defined in a way that the compiler will accept. */#define ESent	((bufsize) (-(((1L << (sizeof(bufsize) * 8 - 2)) - 1) * 2) - 2))/*  BGET  --  Allocate a buffer.  */void *bget(requested_size)  bufsize requested_size;{    bufsize size = requested_size;    struct bfhead *b;#ifdef BestFit    struct bfhead *best;#endif    void *buf;#ifdef BECtl    int compactseq = 0;#endif    assert(size > 0);    if (size < SizeQ) { 	      /* Need at least room for the */	size = SizeQ;		      /*    queue links.  */    }#ifdef SizeQuant#if SizeQuant > 1    size = (size + (SizeQuant - 1)) & (~(SizeQuant - 1));#endif#endif    size += sizeof(struct bhead);     /* Add overhead in allocated buffer					 to size required. */#ifdef BECtl    /* If a compact function was provided in the call to bectl(), wrap       a loop around the allocation process  to  allow	compaction  to       intervene in case we don't find a suitable buffer in the chain. */    while (1) {#endif	b = freelist.ql.flink;#ifdef BestFit	best = &freelist;#endif	/* Scan the free list searching for the first buffer big enough	   to hold the requested size buffer. */#ifdef BestFit	while (b != &freelist) {	    if (b->bh.bsize >= size) {		if ((best == &freelist) || (b->bh.bsize < best->bh.bsize)) {		    best = b;		}	    }	    b = b->ql.flink;		  /* Link to next buffer */	}	b = best;#endif /* BestFit */	while (b != &freelist) {	    if ((bufsize) b->bh.bsize >= size) {		/* Buffer  is big enough to satisfy  the request.  Allocate it		   to the caller.  We must decide whether the buffer is  large		   enough  to  split  into  the part given to the caller and a		   free buffer that remains on the free list, or  whether  the		   entire  buffer  should  be  removed	from the free list and		   given to the caller in its entirety.   We  only  split  the		   buffer if enough room remains for a header plus the minimum		   quantum of allocation. */		if ((b->bh.bsize - size) > (SizeQ + (sizeof(struct bhead)))) {		    struct bhead *ba, *bn;		    ba = BH(((char *) b) + (b->bh.bsize - size));		    bn = BH(((char *) ba) + size);		    assert(bn->prevfree == b->bh.bsize);		    /* Subtract size from length of free block. */		    b->bh.bsize -= size;		    /* Link allocated buffer to the previous free buffer. */		    ba->prevfree = b->bh.bsize;		    /* Plug negative size into user buffer. */		    ba->bsize = -(bufsize) size;		    /* Mark buffer after this one not preceded by free block. */		    bn->prevfree = 0;#ifdef BufStats		    totalloc += size;		    numget++;		  /* Increment number of bget() calls */#endif		    buf = (void *) ((((char *) ba) + sizeof(struct bhead)));		    return buf;		} else {		    struct bhead *ba;		    ba = BH(((char *) b) + b->bh.bsize);		    assert(ba->prevfree == b->bh.bsize);                    /* The buffer isn't big enough to split.  Give  the  whole		       shebang to the caller and remove it from the free list. */		    assert(b->ql.blink->ql.flink == b);		    assert(b->ql.flink->ql.blink == b);		    b->ql.blink->ql.flink = b->ql.flink;		    b->ql.flink->ql.blink = b->ql.blink;#ifdef BufStats		    totalloc += b->bh.bsize;		    numget++;		  /* Increment number of bget() calls */#endif		    /* Negate size to mark buffer allocated. */		    b->bh.bsize = -(b->bh.bsize);		    /* Zero the back pointer in the next buffer in memory		       to indicate that this buffer is allocated. */		    ba->prevfree = 0;		    /* Give user buffer starting at queue links. */		    buf =  (void *) &(b->ql);		    return buf;		}	    }	    b = b->ql.flink;		  /* Link to next buffer */	}#ifdef BECtl        /* We failed to find a buffer.  If there's a compact  function	   defined,  notify  it  of the size requested.  If it returns	   TRUE, try the allocation again. */	if ((compfcn == NULL) || (!(*compfcn)(size, ++compactseq))) {	    break;	}    }    /* No buffer available with requested size free. */    /* Don't give up yet -- look in the reserve supply. */    if (acqfcn != NULL) {	if (size > exp_incr - sizeof(struct bhead)) {	    /* Request	is  too  large	to  fit in a single expansion	       block.  Try to satisy it by a direct buffer acquisition. */	    struct bdhead *bdh;	    size += sizeof(struct bdhead) - sizeof(struct bhead);	    if ((bdh = BDH((*acqfcn)((bufsize) size))) != NULL) {		/*  Mark the buffer special by setting the size field		    of its header to zero.  */		bdh->bh.bsize = 0;		bdh->bh.prevfree = 0;		bdh->tsize = size;#ifdef BufStats		totalloc += size;		numget++;	      /* Increment number of bget() calls */		numdget++;	      /* Direct bget() call count */#endif		buf =  (void *) (bdh + 1);		return buf;	    }	} else {	    /*	Try to obtain a new expansion block */	    void *newpool;	    if ((newpool = (*acqfcn)((bufsize) exp_incr)) != NULL) {		bpool(newpool, exp_incr);                buf =  bget(requested_size);  /* This can't, I say, can't						 get into a loop. */		return buf;	    }	}    }    /*	Still no buffer available */#endif /* BECtl */    return NULL;}/*  BGETZ  --  Allocate a buffer and clear its contents to zero.  We clear	       the  entire  contents  of  the buffer to zero, not just the	       region requested by the caller. */void *bgetz(size)  bufsize size;{    char *buf = (char *) bget(size);    if (buf != NULL) {	struct bhead *b;	bufsize rsize;	b = BH(buf - sizeof(struct bhead));	rsize = -(b->bsize);	if (rsize == 0) {	    struct bdhead *bd;	    bd = BDH(buf - sizeof(struct bdhead));	    rsize = bd->tsize - sizeof(struct bdhead);	} else {	    rsize -= sizeof(struct bhead);	}	assert(rsize >= size);	V memset(buf, 0, (MemSize) rsize);    }    return ((void *) buf);}/*  BGETR  --  Reallocate a buffer.  This is a minimal implementation,	       simply in terms of brel()  and  bget().	 It  could  be	       enhanced to allow the buffer to grow into adjacent free	       blocks and to avoid moving data unnecessarily.  */void *bgetr(buf, size)  void *buf;  bufsize size;{    void *nbuf;    bufsize osize;		      /* Old size of buffer */    struct bhead *b;    if ((nbuf = bget(size)) == NULL) { /* Acquire new buffer */	return NULL;    }    if (buf == NULL) {	return nbuf;    }    b = BH(((char *) buf) - sizeof(struct bhead));    osize = -b->bsize;#ifdef BECtl    if (osize == 0) {	/*  Buffer acquired directly through acqfcn. */	struct bdhead *bd;	bd = BDH(((char *) buf) - sizeof(struct bdhead));	osize = bd->tsize - sizeof(struct bdhead);    } else#endif	osize -= sizeof(struct bhead);    assert(osize > 0);    V memcpy((char *) nbuf, (char *) buf, /* Copy the data */	     (MemSize) ((size < osize) ? size : osize));    brel(buf);    return nbuf;}/*  BREL  --  Release a buffer.  */void brel(buf)  void *buf;{    struct bfhead *b, *bn;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区免费视频| 中文字幕一区二区5566日韩| 亚洲3atv精品一区二区三区| 一本久久a久久免费精品不卡| 国产精品美女一区二区三区| 99综合影院在线| 亚洲精品乱码久久久久久日本蜜臀| 99re亚洲国产精品| 亚洲国产另类av| 91精品国模一区二区三区| 国产在线精品一区二区| 欧美国产激情二区三区| 一本一道久久a久久精品综合蜜臀| 亚洲影视在线观看| 精品日韩在线观看| 成人黄动漫网站免费app| 亚洲永久精品大片| 精品国精品自拍自在线| 风流少妇一区二区| 亚洲综合999| 日韩欧美123| 99久久精品免费看国产| 亚洲va欧美va天堂v国产综合| 日韩欧美国产午夜精品| 成人免费高清在线| 香蕉成人啪国产精品视频综合网| 欧美剧情电影在线观看完整版免费励志电影| 欧美丰满少妇xxxbbb| 久久99精品国产.久久久久| 亚洲欧美一区二区在线观看| 欧美一级一级性生活免费录像| 国产露脸91国语对白| 亚洲最大成人综合| xvideos.蜜桃一区二区| 欧美亚洲一区二区在线| 国产激情视频一区二区三区欧美 | 在线观看欧美黄色| 美女被吸乳得到大胸91| 日韩理论片在线| 精品国产乱码久久久久久夜甘婷婷| 成人激情小说网站| 蜜臀av性久久久久蜜臀av麻豆| 国产精品乱码妇女bbbb| 日韩一区二区三区三四区视频在线观看 | 亚洲高清免费在线| 中文字幕成人av| 7777精品伊人久久久大香线蕉经典版下载 | 欧美日韩精品福利| 床上的激情91.| 久久国产剧场电影| 丝袜美腿亚洲一区二区图片| 国产精品家庭影院| 久久久久久久久久看片| 69久久99精品久久久久婷婷| 91视频国产资源| 国产乱一区二区| 日韩国产在线观看一区| 亚洲三级在线播放| 国产性天天综合网| 精品国产一区二区三区不卡| 91精品国产aⅴ一区二区| 91九色最新地址| 成人一区二区三区| 成人午夜av在线| 免费成人av在线| 日韩影院精彩在线| 亚洲成av人片一区二区三区| 亚洲黄色在线视频| 最新日韩在线视频| 国产精品第一页第二页第三页 | 久久婷婷国产综合国色天香| 日韩免费电影网站| 日韩精品一区国产麻豆| 日韩免费高清视频| 欧美一区二区三区免费在线看| 欧美美女一区二区在线观看| 欧美日韩另类一区| 欧美精品丝袜久久久中文字幕| 91福利在线看| 欧美日韩高清不卡| 欧美精品xxxxbbbb| 日韩精品一区二区在线观看| 日韩精品一区二区三区在线播放 | 亚洲不卡一区二区三区| 亚洲成人你懂的| 午夜av区久久| 秋霞午夜鲁丝一区二区老狼| 久久99在线观看| 国产河南妇女毛片精品久久久| 国产精品99久久久久| 成人午夜视频在线观看| av资源站一区| 欧美日韩亚洲综合在线| 欧美一级电影网站| 国产欧美久久久精品影院| 国产精品免费丝袜| 亚洲国产精品影院| 日本亚洲最大的色成网站www| 美女视频黄久久| 国产乱子伦视频一区二区三区 | 久久99久久久久| 国产成人综合在线| 91啪亚洲精品| 欧美视频一区二区在线观看| 日韩精品中文字幕在线不卡尤物 | 麻豆91在线播放免费| 懂色中文一区二区在线播放| 91老师国产黑色丝袜在线| 在线91免费看| 亚洲国产精品激情在线观看| 亚洲午夜电影网| 国产酒店精品激情| 色婷婷综合久色| 欧美va在线播放| 一区二区三区在线视频观看58| 麻豆国产精品一区二区三区| 成人手机电影网| 日韩一区二区视频在线观看| 1024亚洲合集| 久久er99热精品一区二区| 91蜜桃视频在线| 久久综合九色综合97婷婷女人 | 亚洲天堂福利av| 免费观看一级欧美片| 99精品在线免费| 精品国精品自拍自在线| 亚洲综合视频网| 国产成人在线看| 欧美一区二区三区在| 亚洲欧美一区二区久久 | 成人在线一区二区三区| 欧美色窝79yyyycom| 国产欧美一区二区精品婷婷| 亚洲成人在线网站| 99久久国产免费看| wwwwxxxxx欧美| 三级不卡在线观看| 色婷婷一区二区| 国产精品久久久久四虎| 狠狠狠色丁香婷婷综合激情| 欧美日韩亚洲不卡| 国产精品护士白丝一区av| 美女视频免费一区| 3751色影院一区二区三区| 国产精品成人午夜| 国产一区二区三区久久久| 欧美一区二区视频在线观看2020 | 欧美一级理论片| 亚洲乱码国产乱码精品精可以看 | 奇米777欧美一区二区| 97aⅴ精品视频一二三区| 国产午夜精品久久久久久免费视 | 国产99一区视频免费 | 欧美日韩国产中文| 亚洲欧美日韩中文播放 | 美国三级日本三级久久99| 日本二三区不卡| 国产精品久久精品日日| 成人小视频免费观看| 国产亚洲成aⅴ人片在线观看| 极品少妇一区二区三区精品视频 | 精品国产一区二区三区久久影院| 天堂成人国产精品一区| 欧美视频完全免费看| 亚洲一区视频在线| 在线观看日韩一区| 亚洲高清免费在线| 欧美三片在线视频观看| 亚洲国产欧美在线人成| 欧美中文一区二区三区| 亚洲国产一区二区视频| 欧洲精品在线观看| 午夜精品久久久久久久99水蜜桃| 欧美日韩精品一区二区三区四区| 亚洲国产精品久久久久婷婷884 | 欧美一区在线视频| 视频一区二区三区在线| 91精品国产综合久久久久久 | 国产清纯美女被跳蛋高潮一区二区久久w| 国产精品一区二区在线看| 亚洲激情一二三区| **欧美大码日韩| 久久这里只有精品视频网| 色香色香欲天天天影视综合网| 亚洲少妇30p| 18涩涩午夜精品.www| 日韩成人精品在线| 日韩精品一区二区三区视频在线观看| 麻豆中文一区二区| 久久精品欧美一区二区三区麻豆| 国模无码大尺度一区二区三区| 国产精品视频一二三| 欧美色窝79yyyycom| 六月丁香婷婷久久| 欧美激情在线观看视频免费| 色悠悠亚洲一区二区| 美女尤物国产一区| 成人欧美一区二区三区小说| 欧美图片一区二区三区| 精品一区二区三区在线播放|