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

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

?? rt_ipc.c

?? fsmlabs的real time linux的內核
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* *  rt_ipc.c -- intertask communication primitives for Real-Time Linux * *  Copyright (C) 1997 Jerry Epplin.  All rights reserved. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * *  History: *   17-Jul-97 jhe  V0.1 Original. *   28-Jul-97 jhe  V0.2 Timeouts on semaphores.  Message queues. *   15-Aug-97 jhe  V0.3 rt_ipc fifos.  Modified semantics of timeouts. */#define IPC_VERSION "0.3"#include <linux/module.h>#include <linux/config.h>#include <linux/kernel.h>#include <linux/version.h>#include <linux/errno.h>#include <asm/system.h>#include <linux/malloc.h>#include <rtl_sched.h>#include <rtl_sync.h>#include <rtl_fifo.h>#include <asm/rt_irq.h>#include "rt_ipc.h"extern int rtl_schedule(void);#include <rtl_sync.h>#ifdef CONFIG_SMP#error rt_ipc does not work on SMP yetextern spinlock_t fifo_spinlock;#define RTL_SPIN_LOCK fifo_spinlock#endif#define IPC_DATA_INDEX 0/************************************************************************* * rt_sem_init -- initialize a real-time semaphore * * Called to initialize a real-time semaphore.  'sem' must point to a * statically allocated structure.  'type' is RT_SEM_BINARY or  * RT_SEM_COUNTING.  'init_val' is the initial value of the semaphore * (usually 0). * * Returns 0 if successful, -EINVAL if called incorrectly. *************************************************************************/int rt_sem_init(rt_sem_t *sem, RT_SEMTYPE type, int init_val){  int ret = 0;  if (init_val < 0 || (type == RT_SEM_BINARY && init_val > 1))    ret = -EINVAL;		/* binary sem must have 0 or 1 */  else  {    sem->magic = RT_SEM_MAGIC;    sem->val = init_val;    sem->type = type;    sem->wait_list = NULL;  }  return ret;}/************************************************************************* * rt_sem_destroy -- remove a real-time semaphore * * Removes a semaphore previously created with rt_sem_init().  Semaphore * deletion safety is implemented; i.e., any tasks blocked on this  * semaphore when it is destroyed are allowed to run. * * Returns 0 if successful, -EINVAL if 'sem' is not a valid rt_sem_t. *************************************************************************/int rt_sem_destroy(rt_sem_t *sem){  int ret = 0;  if (sem->magic != RT_SEM_MAGIC)    ret = -EINVAL;  else    /* unblock any tasks blocked on this sem */    while (sem->val < 0)      rt_sem_post(sem);  return ret;}/************************************************************************* * unlink_sem_task -- remove a task from a wait list * * Removes a task from the list of tasks waiting on a semaphore. *************************************************************************/static void unlink_sem_task(RT_TASK_ENTRY *to_unlink, rt_sem_t *sem){  if (to_unlink->next != NULL)    to_unlink->next->prev = to_unlink->prev;  if (to_unlink->prev == NULL)    sem->wait_list = to_unlink->next;  else    to_unlink->prev->next = to_unlink->next;}/************************************************************************* * unlink_mq_task -- remove a task from a wait list * * Removes a task from the list of tasks waiting on a message queue. *************************************************************************/static void unlink_mq_task(RT_TASK_ENTRY *to_unlink, rt_mq_t *mq){  if (to_unlink->next != NULL)    to_unlink->next->prev = to_unlink->prev;  if (to_unlink->prev == NULL)    mq->wait_list = to_unlink->next;  else    to_unlink->prev->next = to_unlink->next;}/* cope with the changed priority system */#define GET_PRIO(task) (sched_get_priority_max(0) - (*(task))->sched_param.sched_priority)#define rtl_current (pthread_self()->user[IPC_DATA_INDEX])/* #define rtl_current ((LOCAL_SCHED)-> rtl_current); *//************************************************************************* * rt_sem_post -- semaphore post operation * * The semaphore post (sometimes known as 'give', 'signal', or 'V') operation. * If tasks are waiting for the semaphore, the one with the highest priority * is allowed to run. * * Returns 0 if successful, or -EINVAL if the semaphore is not valid. *************************************************************************/int rt_sem_post(rt_sem_t *sem){  int ret = 0;  int flags;  if (sem->magic != RT_SEM_MAGIC)    ret = -EINVAL;		/* invalid rt_sem_t structure */  else  {    RT_TASK_ENTRY *to_run = NULL;    rtl_critical(flags);    if (sem->val < 0)	/* one or more tasks are waiting for this sem */    {      /* find the waiting task with the highest priority */      RT_TASK_ENTRY *t;      /* 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=sem->wait_list ; t!=NULL ; t=t->next)        if (to_run == NULL || GET_PRIO(t->task) < GET_PRIO(to_run->task))          to_run = t;      /* remove the task to be run from the wait_list */      unlink_sem_task(to_run, sem);      /* mark that task as no longer waiting at sem */      ((RT_TASK_IPC *)(to_run->task))->sem_at = NULL;    }    /* binary semaphores never exceed 1 */    if (sem->val < 1 || sem->type == RT_SEM_COUNTING)      ++sem->val;    if (to_run != NULL)    {      /* rt_sem_wait() returned because of a post, not */      /* because of a timeout */      ((RT_TASK_IPC *)(to_run->task))->timed_out = 0;      rt_task_wakeup(to_run->task);    }    rtl_end_critical(flags);  }  return ret;}/************************************************************************* * rt_sem_wait -- semaphore wait operation (blocking) * * The semaphore wait (sometimes known as 'take' or 'P') operation. * If the semaphore is not available, the calling task blocks until * it is.  'timeout' is an optional timeout period.  If 'timeout' is * RT_WAIT_FOREVER, the function does not time out.  If 'timeout' is * RT_NO_WAIT and the semaphore is not available, rt_sem_wait() returns * immediately.  If 'timeout' is any other value, it represent a time  * at which the call to rt_sem_wait() should time out.  If that time * is reached, rt_sem_wait() returns with -ETIME. * * Returns 0 if successful, -ETIME if the operation timed out, -EAGAIN if * RT_NO_WAIT was specified and the semaphore was not available, or -EINVAL * if the semaphore is not valid. *************************************************************************/int rt_sem_wait(rt_sem_t *sem, RTIME timeout){  int ret = 0;  int flags;  if (sem->magic != RT_SEM_MAGIC)    ret = -EINVAL;		/* invalid rt_sem_t structure */  else  {	  rtl_critical(flags);    if (sem->val <= 0)		/* sem not available -- task must wait */    {      if (timeout == RT_NO_WAIT)        ret = -EAGAIN;      else      {        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 = sem->wait_list;        if (to_add->next != NULL)          to_add->next->prev = to_add;        sem->wait_list = to_add;        /* indicate which sem the task is blocked at */        ((RT_TASK_IPC *)rtl_current)->sem_at = sem;        /* and decrement sem value */        --sem->val;        /* and finally, block */        if (timeout == RT_WAIT_FOREVER)          rt_task_suspend(rtl_current);	/* suspend until post */        else        {          /* assume call timed out.  If this is not the case, */          /* rt_sem_post() will clear this flag */          ((RT_TASK_IPC *)rtl_current)->timed_out = 1;          /* delay until either post occurs or timeout occurs */          rt_task_delay(timeout);          if (((RT_TASK_IPC *)rtl_current)->timed_out)          {            /* timeout occurred -- undo everything and return */            unlink_sem_task(to_add, sem);            ++sem->val;            ret = -ETIME;          }        }      }    }    else      --sem->val;   rtl_end_critical(flags);  }  return ret;}/************************************************************************* * rt_sem_trywait -- semaphore wait operation (unblocking) * * The semaphore wait (sometimes known as 'take' or 'P') operation. * The function returns immediately whether or not the semaphore is * available. * * Returns 0 if successful, -EAGAIN if the semaphore is not available, * or -EINVAL if the semaphore is not valid. *************************************************************************/int rt_sem_trywait(rt_sem_t *sem){  int ret = 0;  int flags;  if (sem->magic != RT_SEM_MAGIC)    ret = -EINVAL;		/* invalid rt_sem_t structure */  else  {	  rtl_critical(flags);    if (sem->val <= 0)		/* sem not available -- task must wait */      ret = -EAGAIN;    else      --sem->val;    rtl_end_critical(flags);  }  return ret;}/************************************************************************* * rt_task_ipc_init -- rt_ipc version of rt_task_init() * * RT-Linux programs using rt_ipc should use rt_task_ipc_init instead of * rt_task_init().  It initializes some rt_ipc variables, then calls * rt_task_init().  Note that all parameters are the same as in rt_task_init() * except 'task', which is an RT_TASK_IPC instead of an RT_TASK. * * Returns 0 if successful, -EINVAL if the 'task' structure is already in * use by another task, or -ENOMEM if a memory allocation error occurred. *************************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品第一国产综合精品aⅴ| 国产亚洲欧美一区在线观看| 美女一区二区三区在线观看| 久久亚洲精精品中文字幕早川悠里| 91国产丝袜在线播放| 久久激情综合网| 亚洲日本青草视频在线怡红院| 欧美另类久久久品| 高清国产一区二区| 轻轻草成人在线| 一区二区三区欧美在线观看| 欧美成人三级电影在线| 97精品久久久久中文字幕| 免费的国产精品| 亚洲主播在线播放| 日本一区二区三区免费乱视频 | 91免费版在线| 久久精品国产99久久6| 亚洲色图清纯唯美| 欧美激情在线观看视频免费| 91精品国产综合久久福利软件 | 日韩一区二区三区四区| 成人激情开心网| 精品亚洲国内自在自线福利| 亚洲va中文字幕| 亚洲美女精品一区| 国产精品无人区| 久久女同精品一区二区| 日韩亚洲欧美中文三级| 欧美在线观看一区二区| eeuss鲁片一区二区三区| 国产精品一区二区三区99| 毛片av一区二区三区| 午夜欧美视频在线观看| 一区二区三区免费在线观看| 国产精品国产精品国产专区不片| 欧美精品一区二区久久婷婷| 日韩三级av在线播放| 欧美巨大另类极品videosbest | 欧美撒尿777hd撒尿| 91视频国产资源| 成人高清伦理免费影院在线观看| 国产剧情一区二区| 国产福利不卡视频| 成人永久免费视频| 国产黑丝在线一区二区三区| 色综合天天视频在线观看| 成人高清免费在线播放| av福利精品导航| 成人的网站免费观看| 99re这里只有精品首页| 色综合天天性综合| 在线观看av不卡| 欧美日韩aaa| 欧美一区二区三区公司| 26uuu久久天堂性欧美| 国产视频一区二区三区在线观看| 国产清纯在线一区二区www| 国产精品乱子久久久久| 中文字幕在线一区二区三区| 亚洲欧美一区二区在线观看| 最好看的中文字幕久久| 亚洲精品免费一二三区| 亚洲国产精品久久人人爱| 全部av―极品视觉盛宴亚洲| 久久99精品国产.久久久久久| 国产精品一区二区在线观看不卡 | 99国产精品久久久久久久久久久| 成人av资源站| 欧美日韩日日夜夜| 欧美电影免费观看高清完整版在线 | 亚洲人成网站在线| 亚洲综合激情小说| 奇米精品一区二区三区在线观看一| 美女久久久精品| 成人免费高清在线| 欧美在线观看一区| 亚洲精品一区二区在线观看| 中文字幕av资源一区| 伊人色综合久久天天人手人婷| 丝袜亚洲精品中文字幕一区| 国产精品亚洲人在线观看| 日韩欧美精品在线| 国产精品欧美一区二区三区| 亚洲综合视频在线观看| 精品在线播放午夜| 色综合天天综合网天天狠天天| 欧美一三区三区四区免费在线看 | 日韩一区二区免费在线电影| 欧美激情一区在线观看| 日日噜噜夜夜狠狠视频欧美人| 国产一区二区在线影院| 在线看国产日韩| 久久久午夜精品理论片中文字幕| 亚洲精品欧美激情| 国产揄拍国内精品对白| 欧美性猛交xxxx黑人交| 久久青草国产手机看片福利盒子| 亚洲综合图片区| 国产99久久久国产精品免费看| 欧美网站一区二区| 中文字幕精品—区二区四季| 免费av网站大全久久| 91丨九色丨黑人外教| 26uuu精品一区二区在线观看| 亚洲自拍偷拍图区| 国产传媒日韩欧美成人| 日韩无一区二区| 亚洲猫色日本管| 国产suv精品一区二区三区| 在线播放一区二区三区| 亚洲欧美日韩人成在线播放| 国产一区二区三区在线看麻豆| 欧美日韩国产首页在线观看| 国产精品美女久久久久久久久| 久热成人在线视频| 欧美性受xxxx黑人xyx性爽| 国产精品三级视频| 国产乱码精品一区二区三| 日韩一级成人av| 激情偷乱视频一区二区三区| 欧美色倩网站大全免费| 亚洲天堂免费在线观看视频| 国产成人在线视频播放| 精品久久久三级丝袜| 丝袜亚洲精品中文字幕一区| 99精品国产一区二区三区不卡| 国产肉丝袜一区二区| 国产美女一区二区三区| 精品福利av导航| 久久国产成人午夜av影院| 日韩一区二区三区免费看| 午夜视频一区在线观看| 欧美在线观看一区二区| 一区二区在线观看免费视频播放| 成人黄色电影在线 | 五月综合激情网| 欧美日韩精品专区| 亚洲一区二区三区四区中文字幕| 91在线精品一区二区| 亚洲图片激情小说| 91色在线porny| 亚洲精品一二三四区| 91国偷自产一区二区开放时间 | 亚洲欧洲日韩av| 国产成人精品亚洲日本在线桃色| 久久九九99视频| 国产成人精品一区二| 日本一区二区电影| 成人av资源下载| 亚洲男人天堂一区| 色欧美片视频在线观看在线视频| 亚洲精品欧美二区三区中文字幕| 在线免费不卡视频| 爽爽淫人综合网网站| 日韩女优av电影| 国产高清精品久久久久| 中文字幕亚洲一区二区va在线| 成人精品一区二区三区中文字幕| 久久丁香综合五月国产三级网站| 91精品国产福利| 国内欧美视频一区二区| 国产精品你懂的在线欣赏| 99精品国产一区二区三区不卡| 一区二区三区久久久| 欧美一区二区在线播放| 国内精品自线一区二区三区视频| 亚洲国产成人午夜在线一区| 色综合久久88色综合天天6| 婷婷综合另类小说色区| 精品国产91亚洲一区二区三区婷婷| 国产丶欧美丶日本不卡视频| 亚洲欧美在线高清| 欧美一级日韩不卡播放免费| 国产一区二区三区精品视频| 一区视频在线播放| 欧美私人免费视频| 黄色日韩三级电影| 亚洲精品成a人| 欧美成人a视频| 91色.com| 狠狠v欧美v日韩v亚洲ⅴ| 最新不卡av在线| 日韩欧美亚洲国产精品字幕久久久| 国产成人在线视频网站| 亚洲国产婷婷综合在线精品| www激情久久| 91国偷自产一区二区开放时间| 蜜臀久久久久久久| 亚洲毛片av在线| 久久综合成人精品亚洲另类欧美| 99re这里只有精品视频首页| 免费视频最近日韩| 一区二区三区在线免费观看| 亚洲另类春色国产| 亚洲精品一区在线观看| 欧美性生交片4| 国产福利精品一区二区| 午夜视频在线观看一区二区 | 免费在线看成人av|