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

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

?? aiosysdrv.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* aioSysDrv.c - AIO system driver *//* Copyright 1984-1994 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history-------------------1c,01feb94,dvs	documentation changes.1b,12jan94,kdl  changed name to aioSysDrv.c; general cleanup.1a,04apr93,elh  written.*//* DESCRIPTIONThis library is the AIO system driver.  The system driver implementsasynchronous I/O with system AIO tasks performing the AIO requestsin a synchronous manner.  It is installed as the default driver for AIO.INTERNALTwo types of tasks are used to implement the system driver: the aioIoTask and the aioWaitTask.  The aioIoTask services the work queue and performs the I/O.  It gets an AIO request from the work queue, performs the I/O on behalf of the task that initiated the I/O request, and then notifies the caller of the I/O completion.  The number of aioIoTasks gets specifiedby the user in the call to aioSysInit.The aioWaitTask services the wait queue and is used for AIO requests that can not be performed immediately due to blocking I/O.  The aioWaitTask waits for data (or events) to arrive that will allow waiting AIO requests to complete successfully. Therefore, if the aioIoTask gets an AIO request that will block, the aioIoTask will not execute the I/O command but instead put the request in "wait" state, add it to the wait queue and notify the aioWaitTask that the I/Orequest is waiting on data.  Once the data arrives, the aioWaitTask moves the request back to the work queue and notifies the aioIoTask the request can now be completed.This library uses pipeDrv to communicate between the aioIoTasks and aioWaitTask.  Therefore pipeDrv must get dragged in to use the system driver.SEE ALSO: POSIX 1003.1b document*//* includes */#include "vxWorks.h" #include "aioSysDrv.h"#include "stdio.h"#include "taskLib.h"#include "private/iosLibP.h"#include "logLib.h"#include "selectLib.h"#include "string.h"	#include "pipeDrv.h"#include "ioLib.h"/* defines *//* other defines */#define AIO_TASK_BASE_NAME	"tAioIoTask"	/* task base name */#define AIO_TASK_NAME_LEN	50		/* expected task name length */#define AIO_WAIT_TASK_NAME	"tAioWait"	/* wait task name */#define AIO_PIPE_NAME		"/aioPipe"	/* pipe name */#define AIO_PIPE_MSG_MAX	50		/* max pipe messages */#define READ_OP			0		/* read operation */#define WRITE_OP		1		/* write operation */#define IO_OP(op)		((op) == IO_READ ? READ_OP : WRITE_OP)/* AIO system driver flags */#define DRV_SELECT		0x4		/* select device */#define	DRV_NOSELECT		0x8		/* not a select device *//* typedefs */typedef struct wait_msg				/* wait message */    {    int			op;			/* READ_OP || WRITE_OP */    int			fd;			/* file descriptor */    } WAIT_MSG;/* globals */FUNCPTR aioSysPrintRtn = NULL;			/* print routine */struct						/* aioWaitTask wait fds */    {    fd_set	ioWait [2];	    fd_set	io [2];	    } ioFds;/* locals */LOCAL AIO_DEV	aioDev;				/* AIO device structure */LOCAL SEMAPHORE aioIOSem;			/* I/O semaphore */LOCAL SEMAPHORE	aioSysQSem;			/* Q semaphore (work & done) */LOCAL SEMAPHORE	aioSysWorkSem;			/* work semaphore */LOCAL BOOL	aioSysInitialized = FALSE;	/* library initialized */LOCAL int	aioSysFd;			/* wait task control fd *//* forward declarations */void   		aioIoTask (AIO_DEV * pDev);void   		aioWaitTask (void);LOCAL STATUS 	aioSysInsert (int value, struct aiocb * pAiocb, int prio);LOCAL STATUS 	aioSysIoctl (int value, int function, int arg);LOCAL STATUS	aioSysRead (struct aiocb * pAiocb, int * pError);LOCAL STATUS 	aioSysWrite (struct aiocb * pAiocb, int * pError);LOCAL STATUS 	aioSysSyncReq (AIO_DEV * pDev, AIO_SYS * pReq);LOCAL BOOL 	aioSysOpWillBlock (int fd, int op);LOCAL BOOL 	aioSysBlockingDev (int fd);LOCAL BOOL 	aioSysWaitFind (AIO_SYS * pReq, IO_Q * pQ, int bogus4);/********************************************************************************* aioSysInit - initialize the AIO system driver* * This routine initializes the AIO system driver.  It should be called* once after the AIO library has been initialized.  It spawns* <numTasks> system I/O tasks to be executed at <taskPrio> priority level,* with a stack size of <taskStackSize>.  It also starts the wait task and sets * the system driver as the default driver for AIO. If <numTasks>, <taskPrio>,* or <taskStackSize> is 0, a default value (AIO_IO_TASKS_DFLT, AIO_IO_PRIO_DFLT,* or AIO_IO_STACK_DFLT, respectively) is used.** RETURNS: OK if successful, otherwise ERROR.*/STATUS aioSysInit     (    int			numTasks,		/* number of system tasks */    int			taskPrio,		/* AIO task priority */    int			taskStackSize		/* AIO task stack size */    )    {    int			ix;			/* index */    char 		taskName [AIO_TASK_NAME_LEN];								/* area to build task name */    if (aioSysInitialized)	return (OK);				/* already initialized */    /* Set default parameter values */    taskStackSize = (taskStackSize == 0) ? AIO_IO_STACK_DFLT : taskStackSize;    numTasks	  = (numTasks == 0) ? AIO_IO_TASKS_DFLT : numTasks;    taskPrio	  = (taskPrio == 0) ? AIO_IO_PRIO_DFLT : min (taskPrio, 254);    /* Initialize the I/O queues (workQ and waitQ) */    semMInit (&aioSysQSem, SEM_DELETE_SAFE | SEM_Q_PRIORITY);    ioQInit (&aioDev.ioQ, ioQLockSem, ioQUnlockSem, (int) &aioSysQSem);    /* Create IPC pipe for I/O tasks and wait task */    pipeDrv ();    if ((pipeDevCreate (AIO_PIPE_NAME, AIO_PIPE_MSG_MAX, 			sizeof (WAIT_MSG)) == ERROR) ||        (aioSysFd = open (AIO_PIPE_NAME, O_RDWR, 0666)) == ERROR)	return (ERROR);				/* pipe driver needed */    /* Start aioWaitTask.  It must have a lower priority than aioIoTasks. */    if (taskSpawn (AIO_WAIT_TASK_NAME, taskPrio + 1, AIO_TASK_OPT, 		   AIO_WAIT_STACK, (FUNCPTR) aioWaitTask, 		   0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == ERROR) 	return (ERROR);    /* Initialize the work and position semaphores */    semCInit (&aioSysWorkSem, SEM_Q_FIFO, SEM_EMPTY);    semMInit (&aioIOSem, SEM_DELETE_SAFE | SEM_Q_PRIORITY);    /* Spawn aioIoTasks */    while (numTasks-- > 0)	{	sprintf (taskName,"%s%d", AIO_TASK_BASE_NAME, numTasks); 	if (aioSysPrintRtn != NULL)	    (* aioSysPrintRtn) ("aioIoTask: %s starting\n", (int) taskName, 				0, 0, 0, 0, 0);	if (taskSpawn (taskName, taskPrio, AIO_TASK_OPT, taskStackSize, 		       (FUNCPTR) aioIoTask, (int) &aioDev, 0, 0, 0, 0, 0, 0, 		       0, 0, 0) == ERROR)	    return (ERROR);	}    /* Install AIO system driver as the default driver */    for (ix = 0 ; ix < maxDrivers; ix++)	aioDrvInstall (ix, aioSysInsert, aioSysIoctl, 0);    aioSysInitialized = TRUE;			/* mark as initialized */    return (OK);    }/******************************************************************************* aioSysInsert - Insert an AIO request into the system work queue** This routine accepts an AIO request into the driver.  If there are * other requests waiting on the fd (for the requested op) it adds * the AIO request to the wait queue and notifies the aioWaitTask.  * Otherwise it adds the request to the work queue and signals the aioIoTask.** RETURNS: OK if successfully inserted, ERROR otherwise.*/LOCAL STATUS aioSysInsert     (    int 		value,			/* not used */    struct aiocb *	pAiocb,			/* AIO control block */    int			prio			/* priority */    )    {    WAIT_MSG 		newFd;			/* new fd to wait on */    IO_Q *		pQ = &aioDev.ioQ;	/* I/O queue */    AIO_SYS *		pReq = &pAiocb->aio_sys;/* AIO request */    if (aioSysPrintRtn != NULL)	(* aioSysPrintRtn) ("aioSysInsert: aiocb (0%x) prio (%d) op %d\n", 			    (int) pAiocb, prio, pReq->ioNode.op, 0, 0, 0);    IOQ_LOCK (pQ);				/* lock access */         if (pReq->state != AIO_READY)   	{        IOQ_UNLOCK (pQ);	return (ERROR);				/* requests been mucked */ 	}    /* Check if the wait task is already waiting on the file descriptor     * for the requested op.       */    if (FD_ISSET (pAiocb->aio_fildes, &ioFds.ioWait [IO_OP(pReq->ioNode.op)]))	{        if (aioSysPrintRtn != NULL)	    (* aioSysPrintRtn) ("aioSysInsert: will block - move wait queue\n");	IOQ_WAIT_ADD (pQ, &pReq->ioNode, prio);		/* add to wait Q */	pReq->state = AIO_WAIT;    	IOQ_UNLOCK (pQ);			newFd.op = IO_OP (pReq->ioNode.op);		/* notify waitTask */	newFd.fd = pAiocb->aio_fildes;	write (aioSysFd, (caddr_t) &newFd, sizeof (WAIT_MSG));	}    else	{        if (aioSysPrintRtn != NULL)	    (* aioSysPrintRtn) ("aioSysInsert: move to work queue\n");    	IOQ_WORK_ADD (pQ, &pReq->ioNode, prio);		/* add it to work Q */     	pReq->state = AIO_QUEUED;    	IOQ_UNLOCK (pQ);    	semGive (&aioSysWorkSem);			/* notify I/O Task */	}    return (OK);    }/******************************************************************************* aioSysIoctl - control an AIO request** This routine performs a control operation on a previously submitted AIO * request.** RETURNS: OK if successful, otherwise ERROR.*/LOCAL STATUS aioSysIoctl     (    int		value,				/* not used */    int		function,			/* ioctl function */    int		arg				/* argument */    )    {    int		retVal = OK;			/* return value */    switch (function)	{ 	case FAIO_CANCEL : 			/* cancel request */	    retVal = aioCancel (&aioDev, (struct aiocb *) arg); 	    break;	case FAIO_PUSH :			/* move to head */	    retVal = aioPush (&aioDev, (struct aiocb *) arg);	    break;	default:				/* unknown function */ 	    errno = S_ioLib_UNKNOWN_REQUEST;	    retVal = ERROR;	    break;	}    return (retVal);    }/********************************************************************************* aioIoTask - AIO I/O task** This routine performs the I/O on behalf of the caller.  It gets a requests * from the work queue and if the operation will not block, performs the * requested operation.  If the request will block it moves the request to the* wait queue and notifies the wait server of the new addition.** RETURNS: N/A* NOMANUAL*/ void aioIoTask    (    AIO_DEV *           pDev			/* AIO device */    )     {    AIO_SYS *		pReq;			/* AIO request */    int			op;			/* operation */    int			fd;			/* file descriptor */    int                 retVal;			/* return value */    int                 errorVal;           	/* error value */    WAIT_MSG		waitMsg;		/* wait msg */      FOREVER        {        semTake (&aioSysWorkSem, WAIT_FOREVER);     /* wait for work */        if ((pReq = aioNext (pDev)) == NULL)	   /* Get I/O request */            continue; 	op = pReq->ioNode.op;	fd = pReq->pAiocb->aio_fildes;	if (aioSysPrintRtn != NULL)	    (* aioSysPrintRtn) ("aioIoTask: (0x%x) op: %d fd: %d\n", 				(int) pReq->pAiocb, op, fd);    	semTake (&aioIOSem, WAIT_FOREVER);	/* Sync function */   	if (op == IO_SYNC) 	    {	    aioSync (pDev, pReq->pAiocb, aioSysSyncReq);    	    semGive (&aioIOSem);	    continue;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品一区二区三区蜜桃| 免费人成在线不卡| 亚洲黄一区二区三区| 天天综合天天综合色| 激情亚洲综合在线| 日本精品视频一区二区| 日韩欧美国产三级| 中文字幕一区二| 日本亚洲欧美天堂免费| 99久久99久久精品免费观看| 欧美肥妇bbw| 亚洲天堂免费在线观看视频| 毛片一区二区三区| 色综合 综合色| 欧美激情在线一区二区| 日韩成人一区二区| 在线精品视频免费播放| 国产精品免费视频一区| 九九九精品视频| 在线观看免费亚洲| 亚洲国产精品综合小说图片区| 韩国一区二区在线观看| 51精品秘密在线观看| 亚洲精品视频在线看| 成人高清免费观看| 国产精品美女www爽爽爽| 日韩经典中文字幕一区| 欧美天堂亚洲电影院在线播放| 精品人在线二区三区| 亚洲超丰满肉感bbw| 91高清视频在线| 亚洲国产精品自拍| 欧美揉bbbbb揉bbbbb| 亚洲欧美日韩国产手机在线| 成人在线视频一区二区| 精品蜜桃在线看| 免费人成在线不卡| 欧美日韩国产在线播放网站| 亚洲欧美电影一区二区| 91亚洲午夜精品久久久久久| 亚洲六月丁香色婷婷综合久久 | 五月激情六月综合| 91在线观看地址| 亚洲视频电影在线| 欧美日韩视频一区二区| 91毛片在线观看| 奇米精品一区二区三区四区| 日韩美女主播在线视频一区二区三区| 国产精品美女久久久久久2018| 成人少妇影院yyyy| 亚洲国产乱码最新视频 | 夜夜嗨av一区二区三区中文字幕| 欧美在线观看禁18| 国产精品888| 日韩精品电影在线| 中文字幕亚洲一区二区av在线| 久久精品在线免费观看| 欧美日韩小视频| 9i看片成人免费高清| 国内精品伊人久久久久av影院 | 91在线无精精品入口| 麻豆视频一区二区| 亚洲成av人片| 一区二区三区中文字幕| 国产精品免费看片| 日韩欧美激情四射| 91精品国产黑色紧身裤美女| 欧美午夜不卡视频| 91激情五月电影| 欧美四级电影在线观看| 欧美在线免费观看视频| 成人一区二区三区在线观看| 久草这里只有精品视频| 视频一区视频二区中文字幕| 午夜在线成人av| 亚洲二区视频在线| 青青草一区二区三区| 美日韩黄色大片| 国产在线精品免费| av资源网一区| 在线亚洲精品福利网址导航| 欧美在线你懂的| 在线电影一区二区三区| 日韩一区二区在线观看视频播放| 欧美精品777| 精品成人免费观看| 欧美国产精品劲爆| 亚洲曰韩产成在线| 精品亚洲欧美一区| 粉嫩av亚洲一区二区图片| 波多野结衣中文字幕一区| 欧美在线观看视频在线| 欧美videos中文字幕| 一色屋精品亚洲香蕉网站| 亚洲永久精品国产| 国产剧情一区二区三区| 色又黄又爽网站www久久| 日韩午夜精品电影| 亚洲欧美日韩中文播放| 久久精品理论片| 色婷婷精品大在线视频| 欧美精品一区二区三区蜜桃视频 | 色屁屁一区二区| 久久综合给合久久狠狠狠97色69| 自拍偷拍亚洲综合| 久久99久久久欧美国产| 欧美日韩国产在线观看| 亚洲精品免费电影| eeuss国产一区二区三区| 亚洲精品一线二线三线 | 欧美日本韩国一区二区三区视频 | 亚洲精选视频免费看| 成年人网站91| 亚洲成av人片一区二区梦乃| 欧美一区二区网站| 成人av影视在线观看| 精品噜噜噜噜久久久久久久久试看| 一区二区三区加勒比av| 成人的网站免费观看| 久久先锋影音av鲁色资源网| 免费成人美女在线观看.| 在线观看不卡视频| 亚洲一线二线三线视频| 色综合久久99| 亚洲欧美另类小说| 欧美性xxxxx极品少妇| 亚洲成年人网站在线观看| 欧美在线不卡视频| 午夜精品一区二区三区免费视频 | 色天使久久综合网天天| 一区二区三区国产豹纹内裤在线| 91网站最新地址| 亚洲欧美综合在线精品| 在线观看视频一区二区欧美日韩| 亚洲va天堂va国产va久| 国产欧美日韩视频在线观看| 97se亚洲国产综合自在线| 亚洲线精品一区二区三区八戒| 3d动漫精品啪啪1区2区免费 | 日韩毛片在线免费观看| 欧美日韩另类国产亚洲欧美一级| 韩国精品久久久| 亚洲国产色一区| 国产精品九色蝌蚪自拍| 7777精品伊人久久久大香线蕉超级流畅 | 国精品**一区二区三区在线蜜桃| 日韩毛片视频在线看| 欧美精品一区二区三| 91精品国产免费| 欧美色国产精品| 97精品电影院| 丁香婷婷综合色啪| 国产一区二区不卡| 国产精品77777| 国产精品一级片在线观看| 国产综合色产在线精品| 国产精品一二三区| 色婷婷国产精品久久包臀| 欧美猛男男办公室激情| 制服丝袜成人动漫| 国产精品无码永久免费888| 成人精品免费看| 99精品一区二区三区| 欧美日韩国产免费一区二区| 欧美日韩亚洲丝袜制服| 天天爽夜夜爽夜夜爽精品视频| 日韩欧美国产1| 成人激情动漫在线观看| 亚洲综合免费观看高清完整版 | 亚洲成人tv网| 黄色资源网久久资源365| 99视频超级精品| 欧美一区二区啪啪| 中文字幕精品一区二区精品绿巨人| 亚洲人成影院在线观看| 青青草97国产精品免费观看 | 亚洲伦在线观看| 欧美高清一级片在线| 91丨porny丨户外露出| 岛国精品在线播放| 成人午夜av电影| 日韩av电影天堂| 一区二区日韩电影| 中文字幕中文乱码欧美一区二区 | 日韩视频不卡中文| 欧美日韩一区二区欧美激情| 91蜜桃免费观看视频| 色综合av在线| 在线成人av影院| 亚洲精品国产无套在线观| 国产在线精品一区二区| 久久久久久久网| 国产精品一二三四| 欧美一区二区在线免费观看| 国产尤物一区二区| 亚洲视频在线观看一区| 欧美性受极品xxxx喷水| 极品少妇一区二区三区精品视频| 国产欧美日韩麻豆91| 欧美在线一二三|