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

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

?? selectlib.c

?? VxWorks操作系統(tǒng)內(nèi)核源代碼
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* selectLib.c - UNIX BSD 4.3 select library *//* Copyright 1984-2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------02b,20may02,gls  Added semTake to select to prevent race condition (SPR #77032)02a,30nov01,sbs  Added documentation about FD_SETSIZE (SPR 9377)01z,12oct01,brk  added SELECT functionality to ptyLib (SPR 65498) 01y,20sep01,aeg  removed dependence on FD_SETSIZE from select() (SPR #31319).01x,10jul97,dgp  doc: fix SPR 6476, correct no. bits examined by select()01w,09jul97,dgp  doc: add max number of file descripters (SPR 7695)01v,13feb95,jdi  doc tweaks.01u,03feb93,jdi  doc changes based on review by rdc.01t,21jan93,jdi  documentation cleanup for 5.1.01s,23aug92,jcf  added tyLib select stuff here to make tyLib standalone.01r,18jul92,smb  Changed errno.h to errnoLib.h.01q,04jul92,jcf  scalable/ANSI/cleanup effort.01p,26may92,rrr  the tree shuffle01o,10jan92,rdc  Fixed bug in selNodeAdd - release semaphore after malloc error.01n,09jan92,rdc  integrated fix from 5.0.2 that fixed timeout bug in select		 causing incorrect return fdsets.01m,13dec91,gae  ANSI cleanup.01l,04oct91,rrr  passed through the ansification filter                  -changed functions to ansi style		  -changed includes to have absolute path from h/		  -changed VOID to void		  -changed copyright notice01k,01aug91,yao  fixed to pass 6 args to excJobAdd() call.01j,29apr91,hdn  changed how quitTime is calculated to optimize code01i,05apr91,jdi	 documentation -- removed header parens and x-ref numbers;		 doc review by rdc.01h,24mar91,jaa  documentation cleanup.01g,25oct90,dnw  deleted include of utime.h.01f,01aug90,jcf  changed tcb selWakeupNode to pSelWakeupNode.01e,13jul90,rdc  added mechanism to clean up after tasks that get deleted		 while pended in select.01d,26jun90,jcf  changed binary semaphore interface01c,17may90,rdc  changed to use binary sem's and timeouts instead of WDOGS.01b,14apr90,jcf  removed tcb extension dependencies.01a,02jan90,rdc  written.*//*DESCRIPTIONThis library provides a BSD 4.3 compatible \f2select\fP facility to waitfor activity on a set of file descriptors.  selectLib provides a mechanismthat gives a driver the ability to detect pended tasks that are awaitingactivity on the driver's device.  This allows a driver's interrupt serviceroutine to wake up such tasks directly, eliminating the need for polling.Applications can use select() with pipes and serial devices, in additionto sockets.  Also, select() examines \f2write\f1 file descriptors in additionto \f2read\f1 file descriptors; however, exception file descriptors remainunsupported.Typically, application developers need concern themselves only with theselect() call.  However, driver developers should become familiar with theother routines that may be used with select(), if they wish to support theselect() mechanism.The select facility is included in a system when VxWorks is configuredwith the INCLUDE_SELECT component.INCLUDE FILES: selectLib.hSEE ALSO:.pG "I/O System"*/#include "vxWorks.h"#include "ioLib.h"#include "memLib.h"#include "errnoLib.h"#include "vwModNum.h"#include "net/systm.h"#include "semLib.h"#include "logLib.h"#include "string.h"#include "sysLib.h"#include "intLib.h"#include "stdlib.h"#include "taskHookLib.h"#include "selectLib.h"#include "tyLib.h"#include "ptyDrv.h"#include "private/funcBindP.h"#include "private/selectLibP.h"#include "private/iosLibP.h"		/* maxFiles *//* global variables */int mutexOptionsSelectLib = SEM_Q_FIFO | SEM_DELETE_SAFE;/* forward declarations */void selWakeupAll ();/* forward static functions */LOCAL void selTyAdd		(TY_DEV *pTyDev, int arg);LOCAL void selTyDelete		(TY_DEV *pTyDev, int arg);LOCAL void selPtyAdd            (PSEUDO_DEV *pPtyDev, int arg);LOCAL void selPtyDelete         (PSEUDO_DEV *pPtyDev, int arg);LOCAL void selTaskDeleteHook 	(WIND_TCB *pTcb);LOCAL STATUS selTaskCreateHook	(WIND_TCB *pNewTcb);LOCAL STATUS selDoIoctls	(fd_set *pFdSet, int fdSetWidth, int ioctlFunc,				 SEL_WAKEUP_NODE *pWakeupNode, BOOL stopOnErr);/********************************************************************************* selectInit - initialize the select facility** This routine initializes the UNIX BSD 4.3 select facility.  It should be* called only once, and typically is called from the root task, usrRoot(),* in usrConfig.c.  It installs a task create hook such that a select context* is initialized for each task.** RETURNS: N/A** INTERNAL* The <numFiles> parameter is supplied so that the root task can have a* properly defined select context area. This is needed for any init routines* executed as part of the root task which call select, e.g. nfsMountAll().*/void selectInit     (    int		numFiles	/* maximum number of open files */    )    {    _func_selTyAdd		= (FUNCPTR) selTyAdd;    _func_selTyDelete		= (FUNCPTR) selTyDelete;    _func_selPtyAdd		= (FUNCPTR) selPtyAdd;    _func_selPtyDelete		= (FUNCPTR) selPtyDelete;     _func_selWakeupAll		= (FUNCPTR) selWakeupAll;    _func_selWakeupListInit	= (FUNCPTR) selWakeupListInit;    _func_selWakeupListTerm	= (FUNCPTR) selWakeupListTerm;    if (taskCreateHookAdd ((FUNCPTR) selTaskCreateHook) != OK)	{	if (_func_logMsg != NULL)	    {	    _func_logMsg ("selectInit: couldn't install task create hook!\n",			   0, 0, 0, 0, 0, 0);	    }	return;	}    /*     * Make sure maxFiles has the correct value in it. This will be overridden     * later, but this will allow the root task to use select too.     */    if (maxFiles == 0)	maxFiles = numFiles;    /*     * Create the select context for the calling task too.  This should be     * the root task, but we don't check.  Instead we just make sure that     * the task doesn't already have a select context.     */    if (taskIdCurrent->pSelectContext == NULL)	{	if (selTaskCreateHook (taskIdCurrent) == ERROR)	    {	    if (_func_logMsg != NULL)		{		_func_logMsg ("selectInit: couldn't install create hook for the caller! 0x%x\n",			       errno, 0, 0, 0, 0, 0);		}	    return;	    }	}    }/********************************************************************************* selTaskDeleteHookAdd - initialize the select facility (part 2)** This routine installs a select task delete hook so that tasks pended in* select() can be cleaned up properly.  This routine should only be called* once, and typically is called from the root task, usrRoot(), in usrConfig.c.* It should be called after RPC initialization so that the select task delete* hook is invoked before the RPC task delete hook whenever a task dies.** RETURNS: N/A** NOMANUAL*/void selTaskDeleteHookAdd    (    void    )    {    if (taskDeleteHookAdd ((FUNCPTR) selTaskDeleteHook) != OK)	{	if (_func_logMsg != NULL)	    {	    _func_logMsg ("selTaskDeleteHookAdd: couldn't install task delete hook!\n",		     0, 0, 0, 0, 0, 0);	    }	}    }/********************************************************************************* select - pend on a set of file descriptors** This routine permits a task to pend until one of a set of file descriptors* becomes ready.  Three parameters -- <pReadFds>, <pWriteFds>, and* <pExceptFds> -- point to file descriptor sets in which each bit* corresponds to a particular file descriptor.   Bits set in the read file* descriptor set (<pReadFds>) will cause select() to pend until data is* available on any of the corresponding file descriptors, while bits set in* the write file descriptor set (<pWriteFds>) will cause select() to pend* until any of the corresponding file descriptors become writable.  (The* <pExceptFds> parameter is currently unused, but is provided for UNIX call* compatibility.)** The following macros are available for setting the appropriate bits* in the file descriptor set structure:* .CS*     FD_SET(fd, &fdset)*     FD_CLR(fd, &fdset)*     FD_ZERO(&fdset)* .CE** If either <pReadFds> or <pWriteFds> is NULL, they are ignored.  The* <width> parameter defines how many bits will be examined in the file* descriptor sets, and should be set to either the maximum file descriptor* value in use plus one, or simply to FD_SETSIZE.  When select() returns, * it zeros out the file descriptor sets, and sets only the bits that * correspond to file descriptors that are ready.  The FD_ISSET macro may * be used to determine which bits are set.** If <pTimeOut> is NULL, select() will block indefinitely.  If <pTimeOut> is* not NULL, but points to a `timeval' structure with an effective time of* zero, the file descriptors in the file descriptor sets will be polled and* the results returned immediately.  If the effective time value is greater* than zero, select() will return after the specified time has elapsed, even* if none of the file descriptors are ready.** Applications can use select() with pipes and serial devices, in addition* to sockets.  Also, select() now examines write file descriptors in* addition to read file descriptors; however, exception file descriptors* remain unsupported.** The value for the maximum number of file descriptors configured in the* system (NUM_FILES) should be less than or equal to the value of * FD_SETSIZE (2048).** Driver developers should consult the * .I "VxWorks Programmer's Guide: I/O System"* for details on writing drivers that will use select().** INTERNAL* The select library can handle arbitrarily large fd_sets, i.e. up to* the maximum number of file descriptors configured in the system* (NUM_FILES).  To maintain this capability, the use of the macro* FD_SETSIZE must be restricted.  For example, instead of using FD_ZERO,* use bzero().* * RETURNS:* The number of file descriptors with activity, 0 if timed out, or* ERROR if an error occurred when the driver's select() routine* was invoked via ioctl().** ERRNOS* Possible errnos generated by this routine include:* .iP 'S_selectLib_NO_SELECT_SUPPORT_IN_DRIVER'* A driver associated with one or more fds does not support select().* .iP 'S_selectLib_NO_SELECT_CONTEXT'* The task's select context was not initialized at task creation time.* .iP 'S_selectLib_WIDTH_OUT_OF_RANGE'* The width parameter is greater than the maximum possible fd.* .LP** SEE ALSO:* .pG "I/O System"*/int select    (    int             width,      /* number of bits to examine from 0 */    FAST fd_set    *pReadFds,   /* read fds */    FAST fd_set    *pWriteFds,  /* write fds */    fd_set         *pExceptFds, /* exception fds (unsupported) */    struct timeval *pTimeOut    /* max time to wait, NULL = forever */    )    {    FAST int fd;    FAST int partMask;    SEL_WAKEUP_NODE wakeupNode;    int widthInBytes;    int status;    int numFound = 0;    int quitTime = 0;    int clockRate;    SEL_CONTEXT *pSelectContext = taskIdCurrent->pSelectContext;    /* ensure that the task's select context was successfully initialized */    if (pSelectContext == NULL)	{	errno = S_selectLib_NO_SELECT_CONTEXT;	return (ERROR);	}    /* gracefully handle situation where width is larger than maxFiles */    if ((width < 0) || ((width > maxFiles) && (width > FD_SETSIZE)))	{	errno = S_selectLib_WIDTH_OUT_OF_RANGE;	return (ERROR);	}    /* truncate width to maxFiles for cases when FD_SETSIZE is specifed */    if (width > maxFiles)	width = maxFiles;    widthInBytes = howmany(width, NFDBITS) * sizeof (fd_mask);    /*     * Make a copy of the original read/write fd_set for potential use     * by the task delete hook. Note that FD_ZERO is not used since it     * uses FD_SETSIZE.     */    if (pReadFds != NULL)	bcopy ((char*) pReadFds, (char *) pSelectContext->pOrigReadFds,		widthInBytes);	    else	bzero ((char *) pSelectContext->pOrigReadFds, widthInBytes);    if (pWriteFds != NULL)	bcopy ((char*) pWriteFds, (char *) pSelectContext->pOrigWriteFds,		widthInBytes);    else	bzero ((char *) pSelectContext->pOrigWriteFds, widthInBytes);    if (pTimeOut != NULL)	{	clockRate = sysClkRateGet ();	/* convert to ticks */	quitTime = (pTimeOut->tv_sec * clockRate) +            ((((pTimeOut->tv_usec * clockRate) / 100)/100)/100);	}    /* initialize select context and wakeup node fields */    pSelectContext->pReadFds = pReadFds;    pSelectContext->pWriteFds = pWriteFds;    /*     * The reason we would want to take the semaphore here is that it     * serves to prevent a race condition.  Without this semTake it is     * possible for the call to select to be interrupted after acquiring     * the semaphore but BEFORE the driver's FIOUNSELECT routine is called.     * If another 'event' occurs on the driver's device during this time     * it will be handled by the current call to select(), but not detected.     * That is to say, the wakeup semaphore will remain available.  The next     * call to select will take this semaphore but find that there is no     * 'event' to handle and return this, which is interpreted as a     * timeout.     *     * By taking the semaphore prior to calling the FIOSELECT routine of the     * driver we will then properly wait for a valid 'event' in this case.       * If the semaphore is already empty we will pass through as NO_WAIT      * is specified.       */    semTake(&pSelectContext->wakeupSem, NO_WAIT);    wakeupNode.taskId = taskIdSelf ();    /* clear out the read and write fd_sets in task's context */    if (pReadFds != NULL)	bzero ((char *)pReadFds, widthInBytes);    if (pWriteFds != NULL)	bzero ((char *)pWriteFds, widthInBytes);    /* Clear out caller's copy of exception fds for completeness */    if (pExceptFds != NULL)	bzero ((char *)pExceptFds, widthInBytes);    status = OK;    /* do the read fd's */    if (pReadFds != NULL)	{	wakeupNode.type = SELREAD;	if (selDoIoctls (pSelectContext->pOrigReadFds, width,			 FIOSELECT, &wakeupNode, TRUE) != OK)	    {	    status = ERROR;	    }	}    /* do the write fd's */    if (status != ERROR)	if (pWriteFds != NULL)	    {	    wakeupNode.type = SELWRITE;	    if (selDoIoctls (pSelectContext->pOrigWriteFds, width,			     FIOSELECT, &wakeupNode, TRUE) != OK)		{		status = ERROR;		}	    }    if (status != OK)	{	status = errnoGet ();	wakeupNode.type = SELREAD;	selDoIoctls (pSelectContext->pOrigReadFds, width, FIOUNSELECT, 		     &wakeupNode, FALSE);	wakeupNode.type = SELWRITE;	selDoIoctls (pSelectContext->pOrigWriteFds, width, FIOUNSELECT,		     &wakeupNode, FALSE);	/* if no select support in driver, inform the naive user */	if (status == S_ioLib_UNKNOWN_REQUEST)	    errnoSet (S_selectLib_NO_SELECT_SUPPORT_IN_DRIVER);	return (ERROR);	}    /* if the user specified a zero quittime, we don't pend.     * a NULL pointer indicates wait for ever     */    if ((pTimeOut != NULL) && (quitTime == 0))	quitTime = NO_WAIT;    else	if (pTimeOut == NULL)	    quitTime = WAIT_FOREVER;    /*     * Indicate that the current task is pended in select().  In the     * event the current task is deleted, the task delete hook will     * be able to remove the various wakeup nodes from driver lists.     */    pSelectContext->width 	   = width;    pSelectContext->pendedOnSelect = TRUE;    semTake (&pSelectContext->wakeupSem, quitTime);    /* clean up after ourselves */    /* first the read fd's ... */    status = OK;    if (pReadFds != NULL)	{	wakeupNode.type = SELREAD;	if (selDoIoctls (pSelectContext->pOrigReadFds, width,			 FIOUNSELECT, &wakeupNode, FALSE) != OK)	    {	    status = ERROR;	    }	}    /* ... now the write fd's. */    if (pWriteFds != NULL)	{	wakeupNode.type = SELWRITE;	if (selDoIoctls (pSelectContext->pOrigWriteFds, width,			 FIOUNSELECT, &wakeupNode, FALSE) != OK)	    {	    status = ERROR;	    }	}    /* indicate that current task is no longer pended in select() */    pSelectContext->pendedOnSelect = FALSE;    if (status == ERROR)	return (ERROR);    /* find out how many bits are set in the read and write fd sets */    if (pReadFds != NULL)	for (fd = 0; fd < width; fd++)	    {	    /* look at the fd_set a long word at a time */	    partMask = pReadFds->fds_bits[((unsigned)fd) / NFDBITS];	    if (partMask == 0)		{		fd += NFDBITS - 1;		}	    else if (partMask & (1 << (((unsigned) fd) % NFDBITS)))		{		numFound++;		}	    }

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜免费视频| 国产精品免费免费| 国产在线播放一区三区四| 亚洲h在线观看| 亚洲国产成人tv| 午夜伊人狠狠久久| 香蕉加勒比综合久久| 婷婷一区二区三区| 美女www一区二区| 激情综合网最新| 寂寞少妇一区二区三区| 日韩精品一区国产麻豆| 日韩一级精品视频在线观看| 欧美成人一区二区三区片免费 | 日韩欧美综合一区| 日韩亚洲欧美成人一区| 精品福利一区二区三区免费视频| www欧美成人18+| 国产精品美女久久久久高潮| 亚洲日本在线视频观看| 天天影视色香欲综合网老头| 久久国内精品视频| 成人av在线资源| 91福利在线播放| 日韩欧美一区二区久久婷婷| 国产喂奶挤奶一区二区三区| 亚洲丝袜另类动漫二区| 亚洲成人av一区二区三区| 久久99久久99小草精品免视看| 国产精品影视天天线| 91视视频在线观看入口直接观看www| 91福利视频网站| 欧美成人免费网站| 国产精品久久久久久久久动漫| 一二三区精品视频| 国模无码大尺度一区二区三区| 99久久精品国产毛片| 欧美一区二区三区公司| 亚洲国产精品成人久久综合一区| 一区二区三区四区亚洲| 国产主播一区二区三区| 日本道色综合久久| 日韩精品中文字幕一区| 亚洲欧洲综合另类| 经典三级一区二区| 一本色道a无线码一区v| 日韩精品一区二区在线| 樱桃视频在线观看一区| 激情成人综合网| 欧美视频中文一区二区三区在线观看| 欧美大肚乱孕交hd孕妇| 夜夜亚洲天天久久| 国产成人99久久亚洲综合精品| 欧美日韩午夜影院| 亚洲欧洲av在线| 精品亚洲成a人在线观看 | 中文字幕一区二区三区在线不卡| 午夜精品久久一牛影视| 暴力调教一区二区三区| 欧美电影免费观看完整版| 一区二区在线电影| 粉嫩av一区二区三区粉嫩| 欧美高清视频不卡网| 亚洲欧洲精品天堂一级| 国产精品自在在线| 88在线观看91蜜桃国自产| 亚洲欧美偷拍卡通变态| 国产真实乱偷精品视频免| 欧美妇女性影城| 亚洲精品免费一二三区| 国产成人免费在线观看| 日韩精品一区二区三区蜜臀| 午夜欧美大尺度福利影院在线看| 国产精品久久久久久久久免费相片| 日韩极品在线观看| 欧美视频中文一区二区三区在线观看| 国产精品久久久久久久久快鸭| 精品中文av资源站在线观看| 这里只有精品免费| 亚洲最快最全在线视频| www.欧美日韩| 国产精品久久久久久久久动漫 | 99久久精品国产一区| 国产日韩亚洲欧美综合| 精彩视频一区二区三区| 日韩限制级电影在线观看| 亚洲第一av色| 欧美日韩免费一区二区三区视频| 亚洲欧美视频在线观看| 91丝袜国产在线播放| 亚洲国产精品v| 成人动漫视频在线| 国产精品色噜噜| 国产91丝袜在线播放0| 久久久久国产精品免费免费搜索| 精品一区二区免费在线观看| 精品三级在线观看| 国产综合色在线| 精品国产精品网麻豆系列| 狠狠色丁香婷综合久久| xnxx国产精品| 国产乱码一区二区三区| 国产亚洲制服色| 成人午夜av在线| 国产精品久久久久久久蜜臀| 99精品欧美一区二区三区小说| 中文字幕一区二区三区av| 91在线无精精品入口| 亚洲精品自拍动漫在线| 在线免费观看日本一区| 亚洲一区二三区| 欧美精品在线视频| 日韩av一二三| 26uuu色噜噜精品一区二区| 国产一区不卡在线| 国产精品美女久久久久久久久| 99国产欧美另类久久久精品| 一区二区在线观看视频| 91 com成人网| 国产一区二区影院| 国产精品免费网站在线观看| 色婷婷av一区二区三区软件| 天天色图综合网| 欧美精品一区二区三区高清aⅴ | 国产成人自拍高清视频在线免费播放| 久久精品日韩一区二区三区| 99视频超级精品| 午夜精品影院在线观看| 2020国产精品久久精品美国| 国产不卡在线播放| 亚洲黄色在线视频| 欧美大胆一级视频| 国产精品视频一二| 在线观看一区二区视频| 毛片av一区二区| 亚洲视频你懂的| 在线电影院国产精品| 韩国毛片一区二区三区| 亚洲丝袜另类动漫二区| 91麻豆精品国产91久久久更新时间 | 精品美女一区二区三区| 国产精品亚洲一区二区三区在线 | 波多野结衣在线aⅴ中文字幕不卡| 亚洲免费av在线| 日韩女优视频免费观看| 波多野结衣欧美| 日韩国产精品久久久久久亚洲| 国产网红主播福利一区二区| 欧美视频一区在线观看| 国产原创一区二区| 亚洲综合色婷婷| 久久久久99精品一区| 欧美图片一区二区三区| 国产91丝袜在线18| 调教+趴+乳夹+国产+精品| 国产精品天天看| 在线电影欧美成精品| 99久久免费视频.com| 蜜桃视频在线观看一区| 亚洲精品免费在线播放| 久久精品一区二区三区四区| 欧美乱妇20p| 色综合网站在线| 国产九色精品成人porny| 午夜成人免费视频| 综合婷婷亚洲小说| 久久久影视传媒| 制服丝袜av成人在线看| 91首页免费视频| 国产aⅴ综合色| 麻豆91小视频| 偷窥少妇高潮呻吟av久久免费| 国产精品国产a| 久久久三级国产网站| 欧美一区二区三区四区在线观看 | 91.com视频| 欧美影院一区二区| 成人va在线观看| 国产精品正在播放| 久久国产精品72免费观看| 亚洲成人综合在线| 亚洲精品免费播放| 亚洲色图视频网站| 欧美国产激情一区二区三区蜜月| 精品日韩一区二区三区免费视频| 欧美日韩一卡二卡三卡| 色呦呦一区二区三区| www.亚洲国产| 国产99久久精品| 国产成人亚洲精品狼色在线| 精品亚洲免费视频| 精品在线播放午夜| 加勒比av一区二区| 另类小说图片综合网| 美女视频免费一区| 日本欧美大码aⅴ在线播放| 琪琪一区二区三区| 免费在线一区观看| 欧美日韩国产a| 欧美疯狂做受xxxx富婆|