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

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

?? memlib.c

?? 嵌入式系統內存分配算法 memLib.c
?? C
?? 第 1 頁 / 共 3 頁
字號:
	    		    partId, pBlock, 2* (pHdr->nWords), nBytes);#endif	    partId->curWordsAllocated += pNextHdr->nWords;	/* fix stats */	    partId->cumWordsAllocated += pNextHdr->nWords;	    NEXT_HDR (pHdr)->pPrevHdr = pHdr;			/* fix next */	    /* if this combined block is too big, it will get fixed below */	    }	}    /* split off any extra and give it back;     * note that this covers both the case of a realloc for smaller space     * and the case of a realloc for bigger space that caused a coalesce     * with the next block that resulted in larger than required block */    pNextHdr = memBlockSplit (pHdr, pHdr->nWords - nWords,			      partId->minBlockWords);    semGive (&partId->sem);    if (pNextHdr != NULL)	{	(void) memPartFree (partId, HDR_TO_BLOCK (pNextHdr));	partId->curBlocksAllocated++;	/* memPartFree() is going to subtract one from the curBlocksAllocated	 * statistic. Since memPartRealloc() should not change the value of	 * curBlocksAllocated, it has to be corrected  (SPR 1407 & 3564)	 */	}    return ((void *) pBlock);    }/********************************************************************************* memPartFindMax - find the size of the largest available free block** This routine searches for the largest block in the memory partition free* list and returns its size.** RETURNS: The size, in bytes, of the largest available block.** ERRNO: S_smObjLib_NOT_INITIALIZED** SEE ALSO: smMemLib*/int memPartFindMax     (    FAST PART_ID partId         /* partition ID */    )    {    FAST BLOCK_HDR *	pHdr;    FAST DL_NODE *	pNode;    FAST unsigned	biggestWords = 0;    if (ID_IS_SHARED (partId))  /* partition is shared? */	{	if (smMemPartFindMaxRtn == NULL)	    {	    errno = S_smObjLib_NOT_INITIALIZED;	    return (ERROR);	    }        return ((*smMemPartFindMaxRtn) (SM_OBJ_ID_TO_ADRS (partId)));	}    /* partition is local */    if (OBJ_VERIFY (partId, memPartClassId) != OK)	return (ERROR);    semTake (&partId->sem, WAIT_FOREVER);    /* go through free list and find largest free */    for (pNode = DLL_FIRST (&partId->freeList);	 pNode != NULL;	 pNode = DLL_NEXT (pNode))	{	pHdr = NODE_TO_HDR (pNode);	if (pHdr->nWords > biggestWords)	    biggestWords = pHdr->nWords;	}    semGive (&partId->sem);    return (2 * biggestWords - sizeof (BLOCK_HDR));    }/********************************************************************************* memPartAllocError - handle allocation error*/LOCAL void memPartAllocError     (    PART_ID pPart,    unsigned nBytes     )    {    if ((_func_logMsg != NULL) &&	(pPart->options & MEM_ALLOC_ERROR_LOG_FLAG))	(* _func_logMsg) (memMsgBlockTooBig, nBytes, (int) pPart, 0, 0, 0, 0);    }/********************************************************************************* memPartBlockError - handle invalid block error*/LOCAL void memPartBlockError     (    PART_ID pPart,    char *pBlock,    char *label     )    {    if ((_func_logMsg != NULL) &&        (pPart->options & MEM_BLOCK_ERROR_LOG_FLAG))        (* _func_logMsg) (memMsgBlockError, (int)label, (int) pBlock, 			  (int) pPart, 0, 0, 0);    }/******************************************************************************* memBlockSplit - split a block into two blocks** This routine splits the block pointed to into two blocks.  The second* block will have nWords words in it.  A pointer is returned to this block.* If either resultant block would end up having less than minWords in it,* NULL is returned.** RETURNS: A pointer to the second block, or NULL.*/LOCAL BLOCK_HDR *memBlockSplit     (    FAST BLOCK_HDR *pHdr,    unsigned nWords,            /* number of words in second block */    unsigned minWords           /* min num of words allowed in a block */    )    {    FAST unsigned wordsLeft;    FAST BLOCK_HDR *pNewHdr;    /* check if block can be split */    if ((nWords < minWords) ||        ((wordsLeft = (pHdr->nWords - nWords)) < minWords))        return (NULL);                  /* not enough space left */    /* adjust original block size and create new block */    pHdr->nWords = wordsLeft;    pNewHdr = NEXT_HDR (pHdr);    pNewHdr->pPrevHdr = pHdr;    pNewHdr->nWords   = nWords;    pNewHdr->free     = pHdr->free;    /* fix next block */    NEXT_HDR (pNewHdr)->pPrevHdr = pNewHdr;    return (pNewHdr);    }/********************************************************************************* memOptionsSet - set the debug options for the system memory partition** This routine sets the debug options for the system memory partition.* Two kinds of errors are detected:  attempts to allocate more memory than* is available, and bad blocks found when memory is freed.  In both cases,* the following options can be selected for actions to be taken when the error* is detected:  (1) return the error status, (2) log an error message and* return the error status, or (3) log an error message and suspend the* calling task.** These options are discussed in detail in the library manual* entry for memLib.** RETURNS: N/A** SEE ALSO: memPartOptionsSet()*/void memOptionsSet     (    unsigned options    /* options for system partition */    )    {    memPartOptionsSet (memSysPartId, options);    }/********************************************************************************* calloc - allocate space for an array (ANSI)** This routine allocates a block of memory for an array that contains* <elemNum> elements of size <elemSize>.  This space is initialized to* zeros.** RETURNS:* A pointer to the block, or NULL if the call fails.** SEE ALSO:* .I "American National Standard for Information Systems -"* .I "Programming Language - C, ANSI X3.159-1989: General Utilities (stdlib.h)"*/void *calloc     (    size_t elemNum,	/* number of elements */    size_t elemSize	/* size of elements */    )    {    FAST void *pMem;    FAST size_t nBytes = elemNum * elemSize;        if ((pMem = memPartAlloc (memSysPartId, (unsigned) nBytes)) != NULL)	bzero ((char *) pMem, (int) nBytes);    return (pMem);    }/********************************************************************************* realloc - reallocate a block of memory (ANSI)** This routine changes the size of a specified block of memory and returns a* pointer to the new block of memory.  The contents that fit inside the new* size (or old size if smaller) remain unchanged.  The memory alignment of* the new block is not guaranteed to be the same as the original block.** RETURNS:* A pointer to the new block of memory, or NULL if the call fails.** SEE ALSO:* .I "American National Standard for Information Systems -"* .I "Programming Language - C, ANSI X3.159-1989: General Utilities (stdlib.h)"*/void *realloc     (    void *pBlock,	/* block to reallocate */    size_t newSize	/* new block size */    )    {        return (memPartRealloc (memSysPartId, (char *) pBlock, 				(unsigned) newSize));    }/********************************************************************************* cfree - free a block of memory** This routine returns to the free memory pool a block of memory * previously allocated with calloc().** It is an error to free a memory block that was not previously allocated.** RETURNS: OK, or ERROR if the the block is invalid.*/STATUS cfree     (    char *pBlock        /* pointer to block of memory to free */    )    {    return (memPartFree (memSysPartId, pBlock));    }/********************************************************************************* memFindMax - find the largest free block in the system memory partition** This routine searches for the largest block in the system memory partition* free list and returns its size.** RETURNS: The size, in bytes, of the largest available block.** SEE ALSO: memPartFindMax()*/int memFindMax (void)    {    return (memPartFindMax (memSysPartId));    }/********************************************************************************* memSemInit - initialize the partition semaphore as type mutex** This routine initializes the partition semaphore as a mutex semaphore with* the mutex options stored in mutexOptionsMemLib.  This function is called* indirectly from memPartInit ().  This coupling allows alternative semaphore* types to serve as the basis for memory partition interlocking.*/LOCAL void memSemInit    (    PART_ID partId		/* partition to initialize semaphore for */    )    {    semMInit (&partId->sem, mutexOptionsMemLib);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品高潮呻吟| 久久久久亚洲蜜桃| 日韩精品一区二区三区中文精品| 99久精品国产| 成人精品免费视频| 成人久久18免费网站麻豆 | 色屁屁一区二区| av一区二区三区| 色欲综合视频天天天| 色呦呦日韩精品| 欧美美女网站色| 欧美xxxx在线观看| 国产日韩三级在线| 日韩理论在线观看| 亚洲线精品一区二区三区| 亚洲18影院在线观看| 午夜久久久久久久久久一区二区| 婷婷中文字幕一区三区| 久草这里只有精品视频| 夫妻av一区二区| 日本韩国精品在线| 欧美一区二区三区日韩| 日韩一级视频免费观看在线| 久久综合久久综合久久| 国产精品你懂的| 亚洲丰满少妇videoshd| 国产专区综合网| 91激情五月电影| 91精品国产综合久久精品图片| 精品福利视频一区二区三区| 亚洲国产精品二十页| 一区二区三区中文免费| 久久成人免费日本黄色| 91丨porny丨在线| 欧美一级黄色片| 国产精品乱码久久久久久| 亚洲午夜久久久久久久久电影网| 青草av.久久免费一区| 成人av午夜电影| 欧美精品自拍偷拍| 中文字幕一区二区三区不卡| 青青草97国产精品免费观看 | 日韩欧美亚洲一区二区| 国产目拍亚洲精品99久久精品| 亚洲综合激情另类小说区| 精品无人码麻豆乱码1区2区| 色综合天天视频在线观看| 欧美精品一区二区三区在线播放| 亚洲少妇30p| 国产成人av福利| 7878成人国产在线观看| 亚洲人成网站影音先锋播放| 久久精品国产网站| 欧美精品一级二级三级| 国产精品国产三级国产aⅴ原创| 久久国产人妖系列| 欧美日韩精品是欧美日韩精品| 国产婷婷一区二区| 国产一区二区精品久久99| 91精品在线免费观看| 亚洲国产视频一区二区| 91美女蜜桃在线| 国产精品色婷婷久久58| 老司机精品视频导航| 欧美日韩成人激情| 亚洲国产欧美一区二区三区丁香婷| 成人深夜视频在线观看| 久久久91精品国产一区二区精品| 老司机精品视频一区二区三区| 欧美美女视频在线观看| 亚洲第一成年网| 欧美亚洲一区三区| 亚洲一区二区三区美女| 91免费看片在线观看| 亚洲人成影院在线观看| 91视频在线观看| 亚洲欧美激情视频在线观看一区二区三区| 国产成人午夜精品5599 | 91视频免费播放| 国产精品美女久久久久久久网站| 国产91精品露脸国语对白| 精品第一国产综合精品aⅴ| 精品在线你懂的| 中文字幕不卡在线播放| 成人午夜激情在线| 综合欧美亚洲日本| 在线视频综合导航| 亚洲成人免费在线观看| 欧美一级国产精品| 4438亚洲最大| 免费成人性网站| 国产亚洲欧美日韩在线一区| www.在线欧美| 亚洲一区二区精品久久av| 欧美一区二区视频观看视频| 久久精品国产亚洲高清剧情介绍 | 丝袜美腿亚洲色图| 精品国精品国产尤物美女| 粉嫩蜜臀av国产精品网站| 亚洲男人的天堂一区二区| 欧美在线观看视频一区二区三区| 日韩成人精品在线观看| 久久人人爽人人爽| 91亚洲国产成人精品一区二区三| 亚洲aⅴ怡春院| 久久精品男人天堂av| 欧美综合亚洲图片综合区| 国产一区二区三区四| 亚洲精品ww久久久久久p站| 91精品国产一区二区| 成人免费福利片| 日本中文字幕不卡| 国产精品乱码一区二三区小蝌蚪| 欧美美女一区二区| 大尺度一区二区| 人人精品人人爱| 亚洲精品写真福利| 久久综合色8888| 欧美色偷偷大香| 成人国产精品免费| 久久精品国产999大香线蕉| 亚洲九九爱视频| 日本一区二区免费在线| 制服丝袜一区二区三区| 91小视频在线免费看| 国精产品一区一区三区mba视频| 亚洲自拍偷拍欧美| 国产欧美日韩卡一| 日韩午夜在线观看视频| 色老汉一区二区三区| 成人国产精品视频| 国产成人一区在线| 精品一区二区久久| 婷婷久久综合九色综合伊人色| 欧美激情一区二区三区蜜桃视频 | 亚洲最快最全在线视频| 欧美激情一区不卡| 精品国产三级电影在线观看| 欧美日韩国产一区| 在线免费观看日本欧美| 菠萝蜜视频在线观看一区| 国产成人午夜高潮毛片| 国内精品国产成人国产三级粉色 | 中文字幕一区二区不卡| 久久精品欧美日韩| 久久精品网站免费观看| 久久综合成人精品亚洲另类欧美 | 椎名由奈av一区二区三区| 日本一区二区三区国色天香| 日韩视频免费观看高清在线视频| 欧美日韩国产天堂| 欧美猛男gaygay网站| 欧美卡1卡2卡| 欧美二区乱c少妇| 这里是久久伊人| 日韩一级免费一区| 精品美女一区二区三区| 欧美高清精品3d| 日韩一级片在线观看| www国产精品av| 国产欧美日韩亚州综合| 国产精品欧美久久久久无广告| 亚洲国产精华液网站w| 国产精品国产三级国产普通话三级 | 亚洲成人av资源| 青青青伊人色综合久久| 美腿丝袜亚洲色图| 国产成a人亚洲精品| 91丨九色丨黑人外教| 欧美久久久久久蜜桃| 欧美无砖专区一中文字| 4438成人网| 国产丝袜在线精品| 国产精品免费观看视频| 亚洲一区二区精品视频| 奇米精品一区二区三区在线观看一| 精品一区二区日韩| av亚洲精华国产精华精| 在线观看视频91| 日韩视频免费观看高清完整版| 国产日韩在线不卡| 性做久久久久久| 国产一区二区三区久久悠悠色av| 99国产精品久久久| 正在播放亚洲一区| 国产欧美日韩另类一区| 亚洲电影在线播放| 国产精品一线二线三线| 91激情在线视频| 久久综合色综合88| 亚洲午夜羞羞片| 成人激情小说网站| 51午夜精品国产| 亚洲精品视频免费看| 韩日欧美一区二区三区| 欧美三区在线观看| 国产日韩亚洲欧美综合| 日本成人在线电影网| 99riav一区二区三区| 久久久精品国产免费观看同学|