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

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

?? memlib.c

?? 嵌入式系統內存分配算法 memLib.c
?? C
?? 第 1 頁 / 共 3 頁
字號:
			          MEM_BLOCK_CHECK;	memLibInstalled = TRUE;	}    return ((memLibInstalled) ? OK : ERROR);    }/********************************************************************************* memInit - initialize the system memory partition** This routine initializes the system partition free list with the* specified memory block.  It must be called exactly once before invoking any* other routine in memLib.  It is called by kernelInit() in usrRoot()* in usrConfig.c.** RETURNS: OK or ERROR.** NOMANUAL*/STATUS memInit     (    char *pPool,        /* pointer to memory block */    unsigned poolSize   /* block size in bytes */    )    {    memLibInit ();		/* attach memLib functions to memPartLib */    return (memPartLibInit (pPool, poolSize));    }/********************************************************************************* memPartOptionsSet - set the debug options for a memory partition** This routine sets the debug options for a specified 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 error status is returned.  There are four error-handling* options that can be individually selected:* * .iP "MEM_ALLOC_ERROR_LOG_FLAG" 8* Log a message when there is an error in allocating memory.* .iP "MEM_ALLOC_ERROR_SUSPEND_FLAG"* Suspend the task when there is an error in allocating memory (unless* the task was spawned with the VX_UNBREAKABLE option, in which case it* cannot be suspended).* .iP "MEM_BLOCK_ERROR_LOG_FLAG"* Log a message when there is an error in freeing memory.* .iP "MEM_BLOCK_ERROR_SUSPEND_FLAG"* Suspend the task when there is an error in freeing memory (unless* the task was spawned with the VX_UNBREAKABLE option, in which case it* cannot be suspended).* .LP* * These options are discussed in detail in the library manual entry for* memLib.* * RETURNS: OK or ERROR.** ERRNO: S_smObjLib_NOT_INITIALIZED** SEE ALSO: smMemLib*/STATUS memPartOptionsSet     (    PART_ID  	partId,    /* partition to set option for */    unsigned  	options    /* memory management options */    )    {    if ((!memLibInstalled) && (memLibInit () != OK))	/* initialize package */	return (ERROR);    if (ID_IS_SHARED (partId))  /* partition is shared? */	{	if (smMemPartOptionsSetRtn == NULL)	    {	    errno = S_smObjLib_NOT_INITIALIZED;	    return (ERROR);	    }        return ((*smMemPartOptionsSetRtn)(SM_OBJ_ID_TO_ADRS (partId), options));	}    /* partition is local */    if (OBJ_VERIFY (partId, memPartClassId) != OK)	return (ERROR);    semTake (&partId->sem, WAIT_FOREVER);    /*     * Need to convert old-style options to new-style options     */    if (options & (MEM_ALLOC_ERROR_MASK | MEM_BLOCK_ERROR_MASK))	{	if (options & MEM_ALLOC_ERROR_LOG_MSG)	   options |= MEM_ALLOC_ERROR_LOG_FLAG;	if (options & MEM_ALLOC_ERROR_LOG_AND_SUSPEND)	    options |= (MEM_ALLOC_ERROR_LOG_FLAG |			MEM_ALLOC_ERROR_SUSPEND_FLAG);	if (options & MEM_BLOCK_ERROR_LOG_MSG)	   options |= MEM_BLOCK_ERROR_LOG_FLAG;	if (options & MEM_BLOCK_ERROR_LOG_AND_SUSPEND)	    options |= (MEM_BLOCK_ERROR_LOG_FLAG |			MEM_BLOCK_ERROR_SUSPEND_FLAG);	}    /*     * If either of the MEM_BLOCK options have been set, also set     * MEM_BLOCK_CHECK.     */    if (options & (MEM_BLOCK_ERROR_LOG_FLAG | MEM_BLOCK_ERROR_SUSPEND_FLAG))        options |= MEM_BLOCK_CHECK;        partId->options = options;    semGive (&partId->sem);    return (OK);    }/********************************************************************************* memalign - allocate aligned memory ** This routine allocates a buffer of size <size> from the system memory * partition.  Additionally, it insures that the allocated buffer begins * on a memory address evenly divisible by the specified alignment parameter.* The alignment parameter must be a power of 2.** RETURNS:* A pointer to the newly allocated block, or NULL if the buffer could not be* allocated.*/void *memalign     (    unsigned alignment,		/* boundary to align to (power of 2) */    unsigned size               /* number of bytes to allocate */    )    {    return (memPartAlignedAlloc (memSysPartId, size, alignment));    }/********************************************************************************* valloc - allocate memory on a page boundary ** This routine allocates a buffer of <size> bytes from the system memory* partition.  Additionally, it insures that the allocated buffer* begins on a page boundary.  Page sizes are architecture-dependent.** RETURNS:* A pointer to the newly allocated block, or NULL if the buffer could not be* allocated or the memory management unit (MMU) support library has not been* initialized.** ERRNO: S_memLib_PAGE_SIZE_UNAVAILABLE*/void * valloc     (    unsigned size	/* number of bytes to allocate */    )    {    int pageSize = VM_PAGE_SIZE_GET();    if (pageSize == ERROR)	{	errno = S_memLib_PAGE_SIZE_UNAVAILABLE;	return (NULL);	}    return (memalign (pageSize, size));    }/********************************************************************************* memPartRealloc - reallocate a block of memory in a specified partition** This routine changes the size of a specified block of memory and returns a* pointer to the new block.  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.** If <pBlock> is NULL, this call is equivalent to memPartAlloc().** RETURNS:* A pointer to the new block of memory, or NULL if the call fails.** ERRNO: S_smObjLib_NOT_INITIALIZED** SEE ALSO: smMemLib*/void *memPartRealloc     (    PART_ID partId,             /* partition ID */    char *pBlock,               /* block to be reallocated */    unsigned nBytes             /* new block size in bytes */    )    {    FAST BLOCK_HDR *pHdr = BLOCK_TO_HDR (pBlock);    FAST BLOCK_HDR *pNextHdr;    FAST unsigned nWords;    void *pNewBlock;    if (ID_IS_SHARED (partId))  /* partition is shared? */	{	if (smMemPartReallocRtn == NULL)	    {	    errno = S_smObjLib_NOT_INITIALIZED;	    return (NULL);	    }        return ((void *) (*smMemPartReallocRtn) (SM_OBJ_ID_TO_ADRS (partId), 						 pBlock, nBytes));	}    /* partition is local */    if (OBJ_VERIFY (partId, memPartClassId) != OK)	return (NULL);    /* Call memPartAlloc() if user passed us a NULL pointer */    if (pBlock == NULL)        return (memPartAlloc (partId, (unsigned) nBytes));       /* Call memPartFree() if nBytes=0 (SPR 5858) */    if (nBytes == 0)	{	(void) memPartFree (memSysPartId, pBlock);	return (NULL);	}    /* get exclusive access to the partition */    semTake (&partId->sem, WAIT_FOREVER);    /* get actual new size; round-up, add overhead, check for minimum */    nWords = (MEM_ROUND_UP (nBytes) + sizeof (BLOCK_HDR)) >> 1;    if (nWords < partId->minBlockWords)	nWords = partId->minBlockWords;    /* optional check for validity of block */    if ((partId->options & MEM_BLOCK_CHECK) &&        !memPartBlockIsValid (partId, pHdr, FALSE))	{	semGive (&partId->sem);			/* release mutual exclusion */	memPartBlockError (partId, pBlock, "memPartRealloc");	return (NULL);	}    /* test if we are trying to increase size of block */    if (nWords > pHdr->nWords)	{	/* increase size of block -	 * check if next block is free and is big enough to satisfy request*/	pNextHdr = NEXT_HDR (pHdr);	if (!pNextHdr->free || ((pHdr->nWords + pNextHdr->nWords) < nWords))	    {	    /* can't use adjacent free block -	     * allocate an entirely new block and copy data */	    semGive (&partId->sem);	    if ((pNewBlock = memPartAlloc (partId, nBytes)) == NULL)		return (NULL);	    bcopy (pBlock, (char *) pNewBlock,		   (int) (2 * pHdr->nWords - sizeof (BLOCK_HDR)));	    (void) memPartFree (partId, pBlock);	    return (pNewBlock);		/* RETURN, don't fall through */	    }	else	    {	    /* append next block to this one -	     *  - delete next block from freelist,	     *  - add its size to this block,	     *  - update allocation statistics,	     *  - fix prev info in new "next" block header */	    dllRemove (&partId->freeList, HDR_TO_NODE (pNextHdr));	    pHdr->nWords += pNextHdr->nWords;			/* fix size */#ifdef WV_INSTRUMENTATION	    /*	     * The following call to instrumentation will log an a greater	     * than needed nBytesPlusHeaderAlign. This is because, at this	     * point, nBytesPlusHeaderAlign includes the total size of the	     * newly freed memory block. The unused portion will be returned	     * to the free list (see memBlockSplit() just below, at which	     * time the excess will be logged as an EVENT_MEMFREE	     */	    EVT_OBJ_4 (OBJ, partId, memPartClassId, EVENT_MEMREALLOC,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本在线不卡视频| 欧美综合一区二区| 成人免费看的视频| 欧美日韩亚洲综合在线| 国产亚洲综合av| 青青草国产精品97视觉盛宴| 色网站国产精品| 久久久夜色精品亚洲| 五月开心婷婷久久| 97久久精品人人做人人爽 | 色婷婷久久99综合精品jk白丝 | 26uuu另类欧美亚洲曰本| 一区二区三区在线免费视频| 国产成人精品亚洲777人妖| 91精选在线观看| 一区二区三区在线观看网站| 精久久久久久久久久久| 欧美精品在线观看一区二区| 亚洲综合在线免费观看| 97成人超碰视| 亚洲欧洲精品一区二区精品久久久 | 国产99久久久国产精品潘金| 欧美一区二区三区日韩视频| 亚洲五月六月丁香激情| 欧洲色大大久久| 亚洲欧美日韩一区二区三区在线观看| 国产一区二区精品久久99| 日韩一区二区视频| 日韩福利电影在线| 欧美日本国产视频| 日韩精品欧美成人高清一区二区| 欧美日韩小视频| 香蕉成人啪国产精品视频综合网 | 成人激情av网| 亚洲欧洲日韩女同| 99久久99久久免费精品蜜臀| 亚洲少妇30p| 91极品美女在线| 亚洲一区二区在线观看视频 | 成人免费看视频| 成人免费在线观看入口| 91丨九色丨尤物| 亚洲成在人线免费| 日韩视频免费直播| 国产一区二区中文字幕| 亚洲国产经典视频| 日本韩国欧美在线| 天天影视色香欲综合网老头| 日韩午夜激情av| 成人午夜视频福利| 亚洲免费观看高清完整版在线观看 | 精品亚洲国内自在自线福利| 久久综合色鬼综合色| 国产麻豆成人传媒免费观看| 中文字幕亚洲区| 在线免费观看视频一区| 日韩精品1区2区3区| 久久综合九色综合欧美亚洲| eeuss国产一区二区三区| 亚洲激情图片小说视频| 6080国产精品一区二区| 国产综合色精品一区二区三区| 国产亚洲精品资源在线26u| 一本久久a久久精品亚洲| 视频一区在线播放| 久久久国产午夜精品| 欧美专区日韩专区| 国产精品一区二区久激情瑜伽| 中文字幕一区二区三区精华液| 欧美精品xxxxbbbb| 成人免费毛片高清视频| 日本午夜一区二区| 国产精品嫩草影院av蜜臀| 欧美视频一区二区在线观看| 激情六月婷婷综合| 亚洲第一狼人社区| 国产欧美日韩在线看| 91麻豆精品国产91久久久久久久久 | 麻豆一区二区三区| 亚洲乱码日产精品bd | 欧美三级在线播放| 黄色日韩三级电影| 亚洲午夜一二三区视频| 久久久精品影视| 在线成人av影院| 色综合久久精品| 国产a久久麻豆| 免费成人av资源网| 一区二区三区在线视频观看 | 日韩视频免费观看高清在线视频| 97久久久精品综合88久久| 极品少妇xxxx精品少妇偷拍| 亚洲一区二区三区爽爽爽爽爽| 久久理论电影网| 精品久久五月天| 欧美一区二区在线不卡| 欧美三电影在线| 99精品视频免费在线观看| 国产高清成人在线| 老司机免费视频一区二区三区| 亚洲成a人片在线观看中文| 亚洲欧美区自拍先锋| 国产女人aaa级久久久级 | 日韩一区二区免费在线观看| 欧美亚洲日本国产| 色爱区综合激月婷婷| 91黄色免费版| 色视频成人在线观看免| 色婷婷久久久综合中文字幕| av一区二区不卡| 91丨九色丨尤物| 在线观看免费视频综合| 91福利资源站| 欧美日韩免费视频| 在线91免费看| 91精品国产综合久久久久久久久久 | aaa国产一区| 99国产精品久| 色婷婷激情综合| 欧美影院一区二区三区| 欧美性videosxxxxx| 欧美亚洲自拍偷拍| 7777精品伊人久久久大香线蕉的| 91精品国产综合久久国产大片| 制服丝袜av成人在线看| 日韩精品综合一本久道在线视频| 日韩欧美激情在线| 久久青草欧美一区二区三区| 国产日韩欧美制服另类| 中文字幕亚洲电影| 亚洲一区二区三区视频在线播放| 亚洲一区二区三区四区在线免费观看| 亚洲在线观看免费视频| 免费一级片91| 福利一区福利二区| 91在线高清观看| 欧美嫩在线观看| 2020国产精品久久精品美国| 国产精品久久三区| 亚洲国产一区二区a毛片| 亚洲国产精品久久艾草纯爱| 另类欧美日韩国产在线| 不卡欧美aaaaa| 欧美精品乱码久久久久久| 久久色在线视频| 亚洲免费资源在线播放| 美女一区二区久久| av一区二区不卡| 日韩欧美国产三级| 亚洲图片另类小说| 麻豆成人久久精品二区三区红| 成人国产精品视频| 欧美精品三级在线观看| 国产精品乱人伦| 日韩—二三区免费观看av| 成人黄色在线看| 日韩欧美一级在线播放| 亚洲人成精品久久久久| 久久国产综合精品| 在线观看视频一区二区| 久久久亚洲高清| 一区二区三区国产| 粉嫩欧美一区二区三区高清影视 | 色香色香欲天天天影视综合网| 日韩欧美资源站| 亚洲色图第一区| 国产高清一区日本| 欧美丰满美乳xxx高潮www| 国产精品色噜噜| 国产在线精品一区二区夜色| 欧美三区在线视频| 亚洲欧洲无码一区二区三区| 激情综合五月婷婷| 欧美精品久久久久久久久老牛影院| 亚洲欧洲日产国产综合网| 国产专区欧美精品| 日韩欧美一区二区不卡| 亚洲一区在线观看视频| 99久久精品免费| 国产欧美日韩三级| 国产主播一区二区三区| 日韩欧美一区中文| 亚洲成a人v欧美综合天堂| 91麻豆国产福利精品| 国产精品网站导航| 国产福利一区二区三区| 久久亚洲一区二区三区四区| 午夜精品一区二区三区免费视频| 成人激情视频网站| 国产精品免费视频观看| 国产jizzjizz一区二区| 欧美国产激情一区二区三区蜜月| 精品亚洲成a人| 日韩欧美在线一区二区三区| 蜜桃精品视频在线| 日韩一区二区免费高清| 毛片一区二区三区| 日韩欧美一级在线播放| 久久99国产精品麻豆| 精品国产a毛片|