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

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

?? rt_ipc.c

?? fsmlabs的real time linux的內核
?? C
?? 第 1 頁 / 共 3 頁
字號:
 * Dequeues the data 'msg' from the message queue 'mq'.  The data will  * be of the size with which rt_mq_init() was called.  'wait' specifies an * optional timeout period.  If 'wait' is RT_NO_WAIT, rt_mq_receive() * returns immediately even if no messages are present.  If * 'wait' is RT_WAIT_FOREVER, no timeout occurs.  If 'wait' is any other * value, it reflects the time at which rt_mq_receive() will wake up * and return with -ETIME. * * Returns 0 if successful, -ETIME if the operation timed out, -EAGAIN if * RT_NO_WAIT was specified and the operation could not be completed * immediately, or -EINVAL if the rt_mq_t is not valid. *************************************************************************/int rt_mq_receive(rt_mq_t *mq, char *msg, RTIME wait){  int ret = 0;  if (mq->magic != RT_MQ_MAGIC)    ret = -EINVAL;		/* invalid rt_mq_t structure */  else  {    int flags;    rtl_critical(flags);    switch (mq->status)    {    case RT_MQ_EMPTY:	/* q empty -- this task must wait */    {      if (wait == RT_NO_WAIT)        ret = -EAGAIN;	/* can't dequeue it -- just report error */      else	/* wait is allowed */      {        RT_TASK_ENTRY *to_add = &(((RT_TASK_IPC *)rtl_current)->rte);        /* put task on wait_list */        to_add->task = rtl_current;        to_add->prev = NULL;        to_add->next = mq->wait_list;        if (to_add->next != NULL)          to_add->next->prev = to_add;        mq->wait_list = to_add;        /* indicate which mq the task is blocked at */        ((RT_TASK_IPC *)rtl_current)->mq_at = mq;        if (wait == RT_WAIT_FOREVER)          rt_task_suspend(rtl_current);	/* suspend until receive */        else        {          /* assume call timed out.  If this is not the case, */          /* rt_mq_send() will clear this flag */          ((RT_TASK_IPC *)rtl_current)->timed_out = 1;          /* delay until either send occurs or timeout occurs */          rt_task_delay(wait);          if (((RT_TASK_IPC *)rtl_current)->timed_out)          {            /* timed out -- undo everything and return */            unlink_mq_task(to_add, mq);            ret = -ETIME;            break;          }        }        /* when again allowed to run, enqueue the data */        dequeue(mq, msg);		/* finally, dequeue the data */      }      break;    }    case RT_MQ_FULL:	/* q full -- this operation might unblock a task */    {      RT_TASK_ENTRY *t, *to_run;      dequeue(mq, msg);		/* first, go ahead and dequeue the data */      /* find the waiting task with the highest priority */      /* search exhaustively all waiting tasks.  I don't want to keep */      /* the list in priority order because I don't want to assume    */      /* the task priorities won't change.                            */      for (t=mq->wait_list, to_run=NULL ; t!=NULL ; t=t->next)        if (to_run == NULL || GET_PRIO(t->task) < GET_PRIO(to_run->task))          to_run = t;      if (to_run != NULL)      {        /* remove the task to be run from the wait_list */        unlink_mq_task(to_run, mq);        /* mark that task as no longer waiting at mq */        ((RT_TASK_IPC *)(to_run->task))->mq_at = NULL;        /* rt_mq_send() will return because of a receive, not */        /* because of a timeout */        ((RT_TASK_IPC *)(to_run->task))->timed_out = 0;        rt_task_wakeup(to_run->task);      }      break;    }    case RT_MQ_NEITHER:		/* data is present -- take it out */      dequeue(mq, msg);      break;    }    rtl_end_critical(flags);  }  return ret;}typedef struct{  rt_sem_t sem;} RT_IPC_FIFO;		/* structure holding rt_ipc rt-fifo-specific data */static RT_IPC_FIFO ipc_fifos[IPC_RTF_NO];	/* rt_ipc-specific fifo data *//************************************************************************* * rtf_ipc_handler -- handler for read/write operations on rt_ipc rt-fifo * * Called when a read or write operation is performed on an rt_ipc rt-fifo * by a Linux process. * * Returns 0. *************************************************************************/static int rtf_ipc_handler(unsigned int fifo){  return rt_sem_post(&ipc_fifos[fifo].sem);}/************************************************************************* * rtf_ipc_create -- create an rt_ipc rt-fifo * * Creates the rt_ipc rt-fifo 'fifo'.  This has the same capabilities as * the standard RT-Linux rt-fifos but adds blocking.  'size' is the size * of the fifo in bytes.  If 'rtl_to_linux' is 1, the fifo is used for * transferring data from RT-Linux tasks to a Linux process.  If 'rtl_to_linux' * is 0, the fifo is used for transferring data from a Linux process to * one or more RT-Linux tasks. * * Returns 0 if successful, -ENODEV if 'fifo' is not less than IPC_RTF_NO * and RTF_NO, -EBUSY if 'fifo' is in use, or -ENOMEM if 'size' bytes could * not be allocated. *************************************************************************/int rtf_ipc_create(unsigned int fifo, int size, int rtl_to_linux){  int ret = 0;  if (fifo >= IPC_RTF_NO)    ret = -ENODEV;  else if ((ret = rtf_create(fifo, size)) >= 0)  {    /* init the semaphores -- initially no data is ready to receive, but */    /* data can be sent */    if ((ret = rt_sem_init(&ipc_fifos[fifo].sem, RT_SEM_BINARY, rtl_to_linux)) >= 0)      ret = rtf_create_handler(fifo, &rtf_ipc_handler);  }  return ret;}/************************************************************************* * rtf_ipc_destroy -- destroy an rt_ipc rt-fifo * * Removes the rt_ipc rt-fifo 'fifo' previously created with rt_ipc_create(). * * Returns 0 if successful, -EINVAL if 'fifo' is not a valid fifo identifier. *************************************************************************/int rtf_ipc_destroy(unsigned int fifo){  int ret;  if ((ret = rt_sem_destroy(&ipc_fifos[fifo].sem)) >= 0)    ret = rtf_destroy(fifo);  return ret;}/************************************************************************* * rtf_receive -- get data from an rt_ipc rt-fifo * * Gets data from the rt-fifo 'fifo'.  The data, up to size 'count', is put * into 'buf'.  If 'timeout' is RT_NO_WAIT, the function returns immediately * even if 'count' bytes are not available.  If 'timeout' is RT_WAIT_FOREVER, * the function blocks until 'count' bytes are available.  If 'timeout' is * any other value, it represents the time at which the function will return * with a timeout after unsuccessfully waiting for data.  In any case, as * many bytes as possible are returned, even if a timeout occurs or * RT_NO_WAIT is specified. * * Returns -ENODEV if 'fifo' is greater than or equal to RTF_NO, -EINVAL if * 'fifo' is not a valid fifo identifier.  If the return value is greater * than or equal to zero, it represents the number of bytes received. * This might be less than 'count' if the function timed out or RT_NO_WAIT * was specified and less than 'count' bytes were available. *************************************************************************/int rtf_receive(unsigned int fifo, void *buf, int count, RTIME timeout){  int ret = 0, bytes_still_to_get=count;  for ( ; bytes_still_to_get > 0 ; )  {    if ((ret = rtf_get(fifo, buf, bytes_still_to_get)) < 0)      break;    bytes_still_to_get -= ret;    buf += ret;    if (bytes_still_to_get != 0)      if ((ret = rt_sem_wait(&ipc_fifos[fifo].sem, timeout)) < 0)        break;  }  if (ret == -ETIME || ret == -EAGAIN)    return count - bytes_still_to_get;  else if (ret < 0)    return ret;  else  {    /* Note the questionable assumption -- I signal that data is available    */    /* for receiving any time rtf_receive() returns successfully.  Thus the   */    /* assumption is that if 'count' bytes are available, there must be more. */    /* Obviously wrong if the fifo has exactly 'count' bytes available when   */    /* called.  I have to make this assumption because I have no way of       */    /* knowing how many bytes are available in the fifo.  The only effect of  */    /* this is that a task waiting on the semaphore may go one more time      */    /* through the loop before again waiting at the semaphore.                */    if ((ret = rt_sem_post(&ipc_fifos[fifo].sem)) < 0)      return ret;    else      return count;  }}/************************************************************************* * rtf_send -- send data to an rt_ipc rt-fifo * * Sends data to the rt-fifo 'fifo'.  The data, of size 'count', is taken * from 'buf'.  If 'timeout' is RT_NO_WAIT, the function returns immediately * even if 'count' bytes cannot be sent.  If 'timeout' is RT_WAIT_FOREVER, * the function blocks until 'count' bytes can be sent.  If 'timeout' is * any other value, it represents the time at which the function will return * with a timeout after unsuccessfully waiting to send the data.  If  * rtf_send() cannot send the entire block, no data is sent. * * Returns -ENODEV if 'fifo' is greater than or equal to RTF_NO, -EINVAL if * 'fifo' is not a valid fifo identifier.  If the return value is greater * than or equal to zero, it represents the number of bytes sent. * This might be zero if the function timed out or RT_NO_WAIT * was specified and less than 'count' bytes could be sent. *************************************************************************/int rtf_send(unsigned int fifo, void *buf, int count, RTIME timeout){  int ret = 0, bytes_still_to_send=count;  for ( ; bytes_still_to_send > 0 ; )  {    /* Note the asymmetry between rtf_send() and rtf_receive() due to the   */    /* fact that rtf_put() returns -ENOSPC if it cannot place all bytes on  */    /* the fifo, whereas rtf_get() returns as many bytes as it can, even if */    /* it cannot return all bytes requested.  Also, rtf_put() returns the   */    /* number of bytes not written, whereas rtf_get() returns the number of */    /* bytes successfully read. */    ret = rtf_put(fifo, buf, bytes_still_to_send);    if (ret == -ENOSPC)      ret = 0;    else if (ret < 0)      break;    /* correct for fact that ret is number of bytes NOT yet sent */    ret = (bytes_still_to_send - ret);    bytes_still_to_send -= ret;    buf += ret;    if (bytes_still_to_send != 0)      if ((ret = rt_sem_wait(&ipc_fifos[fifo].sem, timeout)) < 0)        break;  }  if (ret == -ETIME || ret == -EAGAIN)    return count - bytes_still_to_send;  else if (ret < 0)    return ret;  else  {    /* Note the questionable assumption -- I signal that space is available   */    /* for sending any time rtf_send() returns successfully.  Thus the        */    /* assumption is that if 'count' bytes could be sent, there must be room  */    /* for more.  Obviously wrong if the fifo has exactly 'count' bytes empty */    /* when called.  I have to make this assumption because I have no way of  */    /* knowing how many bytes are available in the fifo.  The only effect of  */    /* this is that a task waiting on the semaphore may go one more time      */    /* through the loop before again waiting at the semaphore.                */    if ((ret = rt_sem_post(&ipc_fifos[fifo].sem)) < 0)      return ret;    else      return count;  }}int init_module(void){  printk("rt_ipc V" IPC_VERSION " -- IPC primitives for use with Real-Time Linux\n");  printk("Copyright (C) 1997 Jerry Epplin.  All rights reserved.\n");  return 0;}void cleanup_module(void){  printk("rt_ipc -- removed.\n");}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品国产精品国产专区不片| 一区二区不卡在线播放| 中文字幕日韩精品一区| 五月婷婷色综合| 99久久亚洲一区二区三区青草| 69堂亚洲精品首页| 亚洲美女少妇撒尿| 成人自拍视频在线| 日韩精品一区二区三区蜜臀| 亚洲欧美另类久久久精品| 秋霞午夜鲁丝一区二区老狼| av男人天堂一区| 久久精品夜色噜噜亚洲a∨| 日韩av在线播放中文字幕| 97精品国产97久久久久久久久久久久| 日韩免费性生活视频播放| 一区二区三区欧美| 91丨九色丨蝌蚪丨老版| 国产欧美日韩亚州综合| 国产综合成人久久大片91| 日韩欧美久久久| 奇米影视7777精品一区二区| 欧美色图在线观看| 亚洲一区影音先锋| 欧美视频在线一区二区三区| **欧美大码日韩| 波多野结衣视频一区| 国产精品入口麻豆原神| 国产高清一区日本| 欧美国产精品一区二区三区| 国产精品一区二区三区网站| 精品国产乱码久久久久久蜜臀 | 国产一区二区视频在线播放| 88在线观看91蜜桃国自产| 亚洲国产综合在线| 欧美精品第1页| 视频一区视频二区中文| 欧美色综合网站| 偷拍一区二区三区四区| 777亚洲妇女| 免费久久99精品国产| 在线不卡的av| 久久精品久久综合| 久久久久久久久久久久久女国产乱| 人妖欧美一区二区| 久久精品一区蜜桃臀影院| 懂色一区二区三区免费观看| 国产精品水嫩水嫩| 欧美在线影院一区二区| 午夜精品久久久久久久蜜桃app| 欧美日韩国产综合一区二区三区| 婷婷六月综合亚洲| 精品av综合导航| 成人激情小说网站| 亚洲欧美日韩综合aⅴ视频| 欧美色综合久久| 久久av资源网| 最新国产の精品合集bt伙计| 91久久线看在观草草青青| 午夜久久电影网| 精品电影一区二区三区| av资源站一区| 日韩成人免费看| 国产精品久久久一本精品| 在线视频国内自拍亚洲视频| 天天色 色综合| 日本一区二区三区国色天香| 91麻豆自制传媒国产之光| 日本怡春院一区二区| 亚洲国产精品ⅴa在线观看| 色综合一个色综合| 麻豆91精品视频| 亚洲人成网站在线| 337p粉嫩大胆色噜噜噜噜亚洲| 99久久亚洲一区二区三区青草| 亚洲.国产.中文慕字在线| 久久天天做天天爱综合色| 在线免费亚洲电影| 国产一区二区免费看| 亚洲一区二区三区激情| 国产丝袜欧美中文另类| 欧美四级电影网| 成人爱爱电影网址| 免费在线看一区| 亚洲精品五月天| 久久久久99精品一区| 欧美久久久一区| 成人久久视频在线观看| 精品一区二区三区av| 亚洲国产精品欧美一二99| 中文一区在线播放| 日韩欧美一级二级三级| 在线精品国精品国产尤物884a| 国产成人久久精品77777最新版本| 亚洲v日本v欧美v久久精品| 国产精品久久久久久一区二区三区| 日韩一区二区三区精品视频| 欧美中文字幕一区二区三区| 成人精品一区二区三区中文字幕| 毛片基地黄久久久久久天堂| 一区二区三区中文字幕电影| 中文在线免费一区三区高中清不卡| 欧美一区二区三区四区五区 | 综合色中文字幕| 国产性做久久久久久| 欧美草草影院在线视频| 在线综合视频播放| 欧美性三三影院| 欧美色成人综合| 色狠狠综合天天综合综合| 成人美女视频在线观看18| 国产成人在线观看免费网站| 激情图片小说一区| 久久99精品国产.久久久久久| 天堂在线一区二区| 视频一区在线播放| 青青草国产精品97视觉盛宴| 婷婷综合在线观看| 青青草国产精品亚洲专区无| 日韩电影在线一区二区| 蜜桃视频在线观看一区二区| 日韩制服丝袜av| 久久精品国产久精国产爱| 久久福利视频一区二区| 激情综合色丁香一区二区| 麻豆freexxxx性91精品| 美女网站一区二区| 国产做a爰片久久毛片| 国产精品99久久久久久久vr | 中文字幕乱码一区二区免费| 久久精品欧美日韩| 国产精品视频看| 亚洲视频在线一区观看| 亚洲成国产人片在线观看| 蜜臀av一区二区在线观看| 韩国午夜理伦三级不卡影院| 国产jizzjizz一区二区| 岛国av在线一区| 欧美影院午夜播放| 日韩欧美亚洲国产另类| 国产欧美久久久精品影院| 国产精品国产三级国产aⅴ入口| 亚洲免费观看在线观看| 亚洲一区二区三区中文字幕在线| 五月激情六月综合| 精品一区在线看| 不卡av在线免费观看| 欧美日韩精品欧美日韩精品一综合| 日韩欧美成人激情| 国产精品乱人伦| 日韩av网站免费在线| 高潮精品一区videoshd| 欧美色网一区二区| 国产清纯在线一区二区www| 亚洲一区二区免费视频| 韩国毛片一区二区三区| 91在线观看美女| 日韩精品一区二区三区视频| 亚洲欧美另类综合偷拍| 狠狠色狠狠色综合日日91app| 色老汉av一区二区三区| 欧美白人最猛性xxxxx69交| 国产女人aaa级久久久级| 亚洲成a人在线观看| 国产高清视频一区| 日韩欧美视频在线| 一区二区久久久久久| 成人一级片网址| 国产日韩一级二级三级| 91免费国产在线观看| 日韩一级免费一区| 亚洲欧美乱综合| av网站免费线看精品| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲欧美日本在线| 成人免费视频国产在线观看| 91精品午夜视频| 亚洲另类中文字| 成人h版在线观看| 欧美精品一区二区三区一线天视频| 亚洲午夜久久久久| 91免费看`日韩一区二区| 欧美极品aⅴ影院| 国产在线精品一区二区不卡了| 欧美性感一类影片在线播放| 中文字幕中文乱码欧美一区二区| 久久精品国产精品青草| 欧美乱妇一区二区三区不卡视频| 1区2区3区国产精品| 国产成人精品综合在线观看| 久久久久99精品国产片| 国产精品一区二区在线播放| 精品日韩在线一区| 秋霞电影一区二区| 91精品国产综合久久精品图片 | 中文字幕欧美日本乱码一线二线| 日本亚洲最大的色成网站www| 91激情在线视频| 一区二区不卡在线播放 | 亚洲第一精品在线|