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

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

?? unixlib.c

?? vxworks下的實現網絡TCPIP協議的原代碼
?? C
字號:
/* unixLib.c - UNIX kernel compatability library *//* Copyright 1984-1994 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------02n,25nov97,vin  changed mBufClGet() to netTupleGet().02m,14nov97,vin  added panic hook.02l,08mar97,vin  added hashinit() for pcb hash look ups (FREEBSD 2.2.1).02k,03dec96,vin  added _netMalloc(..) & _netFree(..) which use network buffers02j,19mar95,dvs  removed tron references.02i,15nov94,tmk  added 29k fix from philm02h,07nov94,tmk  added MC68LC040 support.02g,31oct94,kdl  merge cleanup.02f,02aug94,tpr  added MC68060 cpu support.02e,09jun93,hdn  added a support for I80X8602d,29jul92,smb  moved perror() to fioLib.c.02c,17jun92,jwt  removed SPARC from !PORTABLE list - it no longer works.02b,16jun92,jwt  added SPARC to !PORTABLE list; fixed 02a version number.02a,26may92,rrr  the tree shuffle		  -changed includes to have absolute path from h/01z,17oct91,yao  added support for CPU32.01y,04oct91,rrr  passed through the ansification filter		  -changed includes to have absolute path from h/		  -fixed #else and #endif		  -changed VOID to void		  -changed copyright notice01x,26aug91,rrr  clean up function decls01w,23jul91,hdn  added conditional macro for optimized TRON codes.01v,26apr91,hdn  modified to use portable version of checksum routine.01u,26jun90,jcf  added semSplSemInit ().  Changed splSem to mutex.01t,20mar90,jcf  added timeout of WAIT_FOREVER to semTake calls.01s,18mar90,hjb  ifdef's to use optimized assembly checksum routine for 68k.01r,20aug89,gae  #if'd out un-portable in_cksum.01q,16apr89,gae  updated to 4.3BSD.01p,15oct88,dnw  changed name of sleep() to ksleep() to avoid confusion		   with C library routine of same name.		 changed 'panic' to not suspend unless panicSuspend=TRUE.01o,22jun88,dnw  removed ovbcopy(), copyin(), copyout(), and imin() which		   are now macros in systm.h.		 made spl...() use taskIdCurrent directly.		 made spl...() return 0/1 for "previous level" instead of		   task id.01n,29may88,dnw  removed bcmp() and bzero() now in bLib.		 changed to v4 names.01m,04may88,jcf  changed splSem to splSemId, and sem calls for new semLib.01l,28jan88,jcf  made kernel independent.01k,23jan88,rdc  brought back spl routines because of size issues.01j,04jan88,rdc  made spl{net,imp,x} macro's in systm.h01i,17nov87,dnw  removed printStatus from perror.01h,13nov87,rdc  added perror;01g,22oct87,ecs  delinted.01f,02may87,dnw  added suspend to panic().01e,03apr87,ecs  added copyright.01d,02apr87,jlf  delinted.01c,27feb87,dnw  change myTaskId() to vxMyTaskId().01b,22dec86,dnw  added bcmp.01a,28jul86,rdc  written.*//*DESCRIPTIONThis library provides routines that simulate or replace Unix kernel functionsthat are used in the network code.  This includes the spl...() processorlevel locking routines, wakeup() and sleep() (renamed ksleep() to avoidconfusion with the C library routine called sleep()), perror() and panic(),and a checksum routine.*/#include "vxWorks.h"#include "semLib.h"#include "sys/types.h"#include "net/mbuf.h"#include "taskLib.h"#include "netinet/in.h"#include "netinet/in_systm.h"#include "lstLib.h"#include "net/systm.h"#include "logLib.h"#include "intLib.h"/* local variables */LOCAL SEMAPHORE splSem;		/* the semaphore used by splnet, splimp, etc *//* global variables */BOOL   panicSuspend;		/* TRUE = suspend task causing panic */int    splTid;			/* owner of network processor level semaphore */SEM_ID splSemId = &splSem;	/* spl mutex semaphore id */int mutexOptionsUnixLib = SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE;FUNCPTR	_panicHook = NULL;	/* panicHook for error recovery mechanism *//********************************************************************************* splSemInit - initialize the semaphore used by splnet, splimp, etc.** This routine is called by netLibInit () to initialize the spl semaphore.** NOMANUAL*/void splSemInit ()    {    semMInit (&splSem, mutexOptionsUnixLib);    }/******************************************************************************** splnet - set network processor level** splnet may be used to insure mutual exclusion among processes which* share common network data structures.  In UNIXland, this is done by* setting the processor interrupt level.  Here in VxWorksLand, however,* we use a simple semaphore mechanism.  splx should be called after* completion of the critical section.  We must check first to see if we're* already at network level.** RETURNS: previous "processor level"*/int splnet ()    {    if ((ULONG) taskIdCurrent == splTid)	return (1);    semTake (splSemId, WAIT_FOREVER);    splTid = (ULONG) taskIdCurrent;    return (0);    }/********************************************************************************* splimp - set imp processor level** This routine is indentical to splnet().* Currently, all network interlocking uses the same network semaphore.** RETURNS: previous "processor level"*/int splimp ()    {    if ((ULONG) taskIdCurrent == splTid)	return (1);    semTake (splSemId, WAIT_FOREVER);    splTid = (ULONG) taskIdCurrent;    return (0);    }/********************************************************************************* splx - set processor level** splx is used in UNIX to restore the processor level.* It is used in VxWorks in conjunction with splnet() and splimp() to provide* mutual exclusion of network data structures.  splx marks the end of the* critical section.*/void splx (x)    int x;	/* processor level to restore */    {    if (x == 0)	{	splTid = 0;	semGive (splSemId);	}    }/********************************************************************************* ksleep -  put a process to sleep** In Unix, processes can sleep on any value (typically an address).* In VxWorks, we substitute a semaphore mechanism so sleep()* calls have to be changed to provide the address of a semaphore.** Note: In Unix there are two "sleep" routines.  In the kernel, the sleep* routine causes a process to block until a wakeup is done on the same* value that sleep was called with.  This routine, and the wakeup routine* below, are replacements for that mechanism.  However, in the C library* there is another sleep() routine that will suspend a process for a* specified number of seconds.  Since VxWorks users porting an application* may have calls to the latter but not the former, there is potential for* vast confusion.  Thus this routine has been renamed "ksleep" ("kernel sleep")* and all calls to it in network code have been changed.*/void ksleep (semId)    SEM_ID semId;    {    BOOL hadSplSem;    /* first see if we've got the network semaphore (splSemId);     * if so, give it, and then take it back when we are awakened.     */    hadSplSem = (splTid == (ULONG) taskIdCurrent);    if (hadSplSem)	{	splTid = 0;	semGive (splSemId);	}    semTake (semId, WAIT_FOREVER);    if (hadSplSem)	{	semTake (splSemId, WAIT_FOREVER);	splTid = (ULONG) taskIdCurrent;	}    }/********************************************************************************* wakeup - wakeup a sleeping process*/void wakeup (semId)    SEM_ID semId;    {    semGive (semId);    }#ifdef unixLib_PORTABLE/********************************************************************************* _insque - insert node in list after specified node.** Portable version of _insque ().*/void _insque (pNode, pPrev)    NODE *pNode;    NODE *pPrev;    {    NODE *pNext;    pNext = pPrev->next;    pPrev->next = pNode;    pNext->previous = pNode;    pNode->next = pNext;    pNode->previous = pPrev;    }/********************************************************************************* _remque - remove specified node in list.** Portable version of _remque ().*/void _remque (pNode)    NODE *pNode;    {    pNode->previous->next = pNode->next;    pNode->next->previous = pNode->previous;    }#endif	/* unixLib_PORTABLE *//********************************************************************************* panic - something is very wrong** panic simply logs a message to the console prepended with "panic".* If the panic occurs at task level, the current task is suspended.*/void panic (msg)    char *msg;    {    /* execute the panic hook if one exists */    if (_panicHook != NULL)        {        (*_panicHook) (msg);         return;         }            logMsg ("panic: %s\n", (int)msg, 0,0,0,0,0);    if (!intContext () && panicSuspend)	taskSuspend (0);    }/********************************************************************************* _netMalloc - allocates network buffers** This function allocates the relevant cluster and returns the * the pointer to the memory allocated.* * INTERNAL* The first 4 bytes of the cluster allocated hold a back pointer to the mBlk* The actual cluster size allocated is the user requested size + size of * mBlk pointer to pointer.** NOMANUAL** RETURNS: char pointer /NULL */char * _netMalloc    (    int			bufSize,		/* size of the buffer to get */    UCHAR		type,			/* type of mbuf to allocate */    int 		canWait			/* M_WAIT/M_DONTWAIT */    )    {     FAST struct mbuf * 	pMblk;     FAST struct mbuf ** pPtrMblk;     pMblk = netTupleGet (_pNetSysPool, (bufSize + sizeof(struct mbuf *)),                         canWait, type, TRUE);    if (pMblk != NULL) 	{ 	pPtrMblk = mtod(pMblk, struct mbuf **); 	*pPtrMblk = pMblk; 	pMblk->m_data += sizeof(struct mbuf **); 	return (mtod(pMblk, char *));	}     else 	return (NULL);     }/********************************************************************************* _netFree - frees network buffers** This function allocates the relevant cluster and returns the * the pointer to the memory allocated.* * INTERNAL* The first 4 bytes of the cluster allocated hold a back pointer to the mBlk* The actual cluster size allocated is the user requested size + 4.* Since the mBlk will retain the type,m_free() will automatically free the * relevant type** NOMANUAL** RETURNS: pointer/NULL */void _netFree    (    char * pBuf		/* pointer to buffer to free */	     )     {    if (pBuf != NULL)	(void)m_free (*((struct mbuf **)(pBuf - sizeof(struct mbuf **))));    }/********************************************************************************* hashinit - initialize a hash table of a given size.** This function initializes the hashtable of a given number of elements.* It returns a pointer to the hash mask. * * NOMANUAL** RETURNS: pointer/NULL */void * hashinit    (    int 	elements,	/* number of elements in the hash table */    int 	type,		/* type of entries PCB/IFADDR etc */    u_long *	hashmask	/* ptr to the hash mask */    )    {    long 	hashsize;    int 	ix;    LIST_HEAD(generic, generic) *hashtbl;    if (elements <= 0)        panic("hashinit: bad elements");        for (hashsize = 1; hashsize <= elements; hashsize <<= 1)        continue;        hashsize >>= 1;    hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl));    for (ix = 0; ix < hashsize; ix++)        LIST_INIT(&hashtbl[ix]);    *hashmask = hashsize - 1;    return (hashtbl);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲日本中文字幕区| 美女爽到高潮91| 欧美电影一区二区| 91传媒视频在线播放| 91丨porny丨户外露出| 国产91精品在线观看| 成人av在线电影| 色综合天天在线| 色综合网站在线| 欧美人狂配大交3d怪物一区| 欧美美女黄视频| 日韩欧美色综合网站| wwwwww.欧美系列| 欧美国产97人人爽人人喊| 国产精品青草久久| 亚洲最大成人综合| 青青草国产精品97视觉盛宴| 久久99精品久久久久久国产越南 | 欧美丰满少妇xxxbbb| 欧美伦理影视网| 亚洲精品一区二区三区精华液 | 一区二区三区四区高清精品免费观看| 最新热久久免费视频| 一区二区三区国产精华| 日韩有码一区二区三区| 国产一区二区免费在线| 色综合久久99| 日韩精品一区国产麻豆| 国产精品美日韩| 蜜桃精品视频在线| 国产精品一品二品| 欧美性欧美巨大黑白大战| 91麻豆精品91久久久久久清纯 | 91社区在线播放| 91精品国产麻豆国产自产在线 | 欧美在线观看18| 欧美成人一级视频| 亚洲图片另类小说| 九色综合国产一区二区三区| 北条麻妃一区二区三区| 欧美一区二区三区的| 中文字幕在线观看不卡视频| 日韩激情视频在线观看| 成人av免费在线观看| 欧美一区二区三区免费在线看| 国产日韩欧美高清在线| 亚洲午夜久久久| caoporn国产精品| 日韩视频123| 亚洲福利国产精品| 成人黄色777网| 欧美精品一区二区三区高清aⅴ | 国产一区二区三区观看| 欧美在线你懂的| 成人欧美一区二区三区白人| 极品尤物av久久免费看| 欧美性猛片xxxx免费看久爱| 一区在线观看免费| 国产99久久久国产精品潘金| 日韩视频在线你懂得| 天天综合色天天综合色h| 91免费版在线看| 亚洲欧美综合在线精品| 粉嫩久久99精品久久久久久夜| 精品黑人一区二区三区久久| 视频一区二区国产| 7777精品伊人久久久大香线蕉 | 国产精品久久久久久久裸模| 九九在线精品视频| 精品理论电影在线观看| 另类调教123区| 精品免费视频.| 国产一区二区成人久久免费影院| 日韩一区二区三区免费观看| 天天做天天摸天天爽国产一区| 欧美日韩国产首页在线观看| 亚洲国产精品综合小说图片区| 91精品办公室少妇高潮对白| 亚洲激情第一区| 欧美性生交片4| 五月天亚洲婷婷| 日韩欧美aaaaaa| 国产高清不卡一区| 国产精品久久看| 91成人免费电影| 午夜影院在线观看欧美| 欧美一区二区视频在线观看2020 | 国产一区福利在线| 久久久久97国产精华液好用吗| 国产激情视频一区二区三区欧美 | 中文字幕国产一区二区| 国产.欧美.日韩| 综合色中文字幕| 91在线视频免费观看| 欧美国产综合色视频| 91猫先生在线| 日精品一区二区| 精品久久久久久无| 91丝袜国产在线播放| 亚洲第一电影网| 久久老女人爱爱| 欧美在线观看一区| 国产一区二区视频在线| 亚洲色图在线看| 日韩久久精品一区| 99综合影院在线| 免费高清不卡av| 国产精品乱码一区二三区小蝌蚪| 欧美日韩黄视频| 国产99精品视频| 亚洲一区二区三区中文字幕| 精品欧美一区二区三区精品久久 | 亚洲激情第一区| 精品理论电影在线| 91久久精品一区二区三| 狠狠色狠狠色综合系列| 亚洲一区二区三区四区五区黄 | 成人动漫一区二区三区| 亚洲成av人在线观看| 久久精品亚洲一区二区三区浴池 | 在线视频国内一区二区| 国产一区二区三区在线观看免费| 亚洲色图另类专区| 精品成人免费观看| 欧美日韩高清不卡| 91麻豆产精品久久久久久 | 亚洲影视在线观看| 欧美极品美女视频| 欧美α欧美αv大片| 欧美日韩一区在线| 91亚洲精品久久久蜜桃网站| 国产在线播放一区三区四| 日韩二区三区在线观看| 亚洲欧美偷拍三级| 国产精品视频线看| 久久精品视频网| 欧美videos中文字幕| 制服丝袜国产精品| 欧美日韩免费一区二区三区| 91网站在线观看视频| 国产91精品精华液一区二区三区| 日韩精品欧美成人高清一区二区| 国产欧美精品一区二区三区四区 | 亚洲免费资源在线播放| 亚洲国产高清aⅴ视频| 久久综合成人精品亚洲另类欧美| 日韩一区二区免费在线观看| 欧美久久久久免费| 欧美欧美欧美欧美| 欧美一区二区三区免费视频| 欧美一区二区三区四区视频| 欧美精品tushy高清| 欧美男男青年gay1069videost| 在线观看视频一区| 欧美三级电影网| 91精品久久久久久久久99蜜臂| 在线不卡欧美精品一区二区三区| 欧美日韩国产综合一区二区三区| 欧美日韩另类国产亚洲欧美一级| 欧美色手机在线观看| 欧美日韩久久一区二区| 日韩区在线观看| 国产午夜精品久久| 国产精品色哟哟| 亚洲人成网站精品片在线观看| 一区二区三区在线视频免费| 亚洲va国产va欧美va观看| 偷拍一区二区三区四区| 久久99精品一区二区三区| 国产高清一区日本| 一本一本久久a久久精品综合麻豆| 欧美色图天堂网| 精品国产凹凸成av人导航| 国产精品久久久久影院色老大| 一区二区三区精品久久久| 日韩经典一区二区| 成人av一区二区三区| 欧美日韩一区三区四区| 久久综合久久鬼色| 亚洲你懂的在线视频| 日韩黄色免费网站| 大胆亚洲人体视频| 精品婷婷伊人一区三区三| 精品粉嫩aⅴ一区二区三区四区| 日本一区二区三区电影| 一级特黄大欧美久久久| 黄网站免费久久| 日本高清免费不卡视频| 欧美电影免费观看高清完整版在| 日本一区二区三区久久久久久久久不 | 欧美中文字幕一区二区三区| 精品国产一区二区亚洲人成毛片| 亚洲免费观看高清完整版在线| 蜜臀国产一区二区三区在线播放 | 一区二区三区精品在线观看| 麻豆一区二区三区| 欧美亚洲另类激情小说| 亚洲国产高清在线观看视频| 日韩电影在线观看网站| 色综合天天在线|