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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bget.c

?? COS 0.0.1.rar Cos操作系統源代碼
?? 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一区二区三区免费野_久草精品视频
精品亚洲欧美一区| 欧美一区二区大片| 国产精品1区2区3区在线观看| 婷婷综合五月天| 亚洲一级二级三级在线免费观看| 亚洲精品免费电影| 91成人在线免费观看| 一片黄亚洲嫩模| 国产欧美一区二区精品忘忧草 | 欧美在线免费视屏| 日本高清成人免费播放| 欧美手机在线视频| 欧美一区二区三区的| 国产欧美精品一区二区色综合朱莉| 日本一区二区三区久久久久久久久不 | 国产成人免费在线观看不卡| 精品一区二区三区视频| 国产福利一区二区三区视频在线| 国产suv一区二区三区88区| 97精品国产露脸对白| 91精品在线观看入口| 久久精品亚洲精品国产欧美| 亚洲欧洲性图库| 麻豆成人av在线| 欧美综合一区二区| 久久精品一区二区三区不卡| 亚洲大片在线观看| 99精品桃花视频在线观看| 欧美日本在线一区| 亚洲一区二区三区自拍| 国产成+人+日韩+欧美+亚洲| 欧美日韩精品一区视频| 国产精品久久久一区麻豆最新章节| 午夜精品影院在线观看| 欧美亚洲一区二区在线观看| 国产精品乱码妇女bbbb| 另类小说图片综合网| 欧美乱熟臀69xxxxxx| 亚洲乱码国产乱码精品精小说 | 国产欧美中文在线| 激情综合色播五月| 日韩欧美一区二区在线视频| 亚洲成在人线在线播放| 欧美三区免费完整视频在线观看| 国产精品免费久久| 波多野结衣中文字幕一区| 日本一区二区三区电影| 成人国产一区二区三区精品| 日本一区二区久久| 99精品国产91久久久久久 | 成人激情小说网站| 自拍偷拍国产亚洲| 欧美日韩电影一区| 人禽交欧美网站| 欧美激情一区二区三区在线| 成人免费av资源| 亚洲福利视频一区二区| 欧美日韩中文字幕一区| 日本女人一区二区三区| 国产日产欧美一区二区三区| 99re视频这里只有精品| 亚洲成av人片www| 国产精品国产三级国产aⅴ原创| 99久久777色| 国产精品女同互慰在线看| 成人欧美一区二区三区小说 | 日韩精品一区二区三区四区视频| 国内精品国产成人| 午夜欧美在线一二页| 欧美本精品男人aⅴ天堂| 色综合久久九月婷婷色综合| 蜜臀99久久精品久久久久久软件| 国产精品午夜电影| 日韩一区二区三区视频在线观看| 国产成人在线免费| 香港成人在线视频| 亚洲色图欧洲色图| 精品粉嫩aⅴ一区二区三区四区| 99riav一区二区三区| 黑人巨大精品欧美一区| 首页国产欧美日韩丝袜| 亚洲午夜一二三区视频| 136国产福利精品导航| 日本一区二区三区电影| 国产精品素人一区二区| 久久婷婷国产综合精品青草| 精品日韩欧美在线| 2020国产精品| 国产精品网站导航| 亚洲婷婷在线视频| 亚洲三级视频在线观看| 亚洲免费看黄网站| 亚洲超碰97人人做人人爱| 日韩主播视频在线| 男女视频一区二区| 狠狠色综合日日| 国产91丝袜在线播放0| jvid福利写真一区二区三区| 成人午夜精品一区二区三区| 国产91丝袜在线播放九色| 国产精品综合在线视频| 91视频精品在这里| 欧美日韩国产免费一区二区 | 首页综合国产亚洲丝袜| 日韩福利视频导航| 成人av在线一区二区三区| 一本大道久久a久久综合| 日韩美女主播在线视频一区二区三区| 欧美va亚洲va在线观看蝴蝶网| 日本一区二区三区四区在线视频| 一区二区三区在线视频观看| 麻豆免费看一区二区三区| 91麻豆成人久久精品二区三区| 777色狠狠一区二区三区| 国产精品久久久久久久午夜片| 五月激情综合网| 在线观看日韩精品| 久久久www免费人成精品| 亚洲成av人片一区二区梦乃| 99re热视频这里只精品| 精品久久久久久无| 日本女人一区二区三区| 在线亚洲一区观看| 综合av第一页| 91论坛在线播放| 欧美国产激情一区二区三区蜜月| 蜜臀av国产精品久久久久 | 一区二区三区在线免费播放 | 欧美激情在线看| 风间由美一区二区av101| 欧美电视剧在线看免费| 精品一区二区三区影院在线午夜| 欧美亚洲国产一区二区三区| 中文字幕一区av| 91亚洲大成网污www| 亚洲欧美视频在线观看视频| av不卡在线播放| 亚洲欧美日韩国产成人精品影院| 91蜜桃视频在线| 国产日产欧美精品一区二区三区| 久久精品日产第一区二区三区高清版| 中文字幕一区二区三区四区不卡| 成人美女视频在线看| 国产精品传媒视频| 欧美群妇大交群的观看方式| 日韩制服丝袜av| 欧美变态tickling挠脚心| 国产ts人妖一区二区| 悠悠色在线精品| 亚洲精品在线电影| 色综合久久久久久久久久久| 奇米四色…亚洲| 中文字幕av一区 二区| 欧美不卡激情三级在线观看| 激情文学综合网| 一区二区高清视频在线观看| 欧美精品一区二区蜜臀亚洲| 91视频你懂的| 成人午夜电影小说| 日本不卡一二三区黄网| 久久久不卡网国产精品二区| 欧美影院一区二区三区| 成人精品国产一区二区4080| 青椒成人免费视频| 亚洲高清三级视频| 亚洲国产日日夜夜| 亚洲精品乱码久久久久久久久| 国产日韩欧美激情| 久久伊99综合婷婷久久伊| 91麻豆精品国产91久久久资源速度| 久热成人在线视频| 免费在线观看精品| 午夜伊人狠狠久久| 91精品中文字幕一区二区三区| 青青草97国产精品免费观看无弹窗版| 国产精品久久毛片av大全日韩| 久久这里都是精品| 久久综合色之久久综合| 久久综合久久99| 久久奇米777| 国产精品乱码人人做人人爱| 亚洲国产成人私人影院tom| 国产欧美日韩亚州综合| 国产精品狼人久久影院观看方式| 国产欧美精品一区二区三区四区| 久久视频一区二区| 国产精品久久久久永久免费观看 | 亚洲黄色录像片| 香港成人在线视频| 国产精品一二三四| 99re热视频这里只精品| 欧美老人xxxx18| 久久久青草青青国产亚洲免观| 国产精品女主播av| 丝袜美腿亚洲色图| 99麻豆久久久国产精品免费| 欧美日韩欧美一区二区| 亚洲精品一区二区三区在线观看| 久久精子c满五个校花| 亚洲成av人片一区二区梦乃|