Using semaphore in scull - from ldd3
来源:互联网 发布:战争之王 知乎 编辑:程序博客网 时间:2024/06/08 07:34
struct scull_dev {
struct scull_qset *data; /* Pointer to first quantum set */
int quantum; /* the current quantum size */
int qset; /* the current array size */
unsigned long size; /* amount of data stored here */
unsigned int access_key; /* used by sculluid and scullpriv */
struct semaphore sem; /* mutual exclusion semaphore */
struct cdev cdev; /* Char device structure */
};
each virtual scull device uses a semaphore seperately.
semaphore has to be intialized before the other section of scull device initialization.
for (i = 0; i < scull_nr_devs; i++) {
scull_devices[i].quantum = scull_quantum;
scull_devices[i].qset = scull_qset;
init_MUTEX(&scull_devices[i].sem);
scull_setup_cdev(&scull_devices[i], i);
}
scull_write starts from the following:
if (down_interruptible(&dev->sem))
return -ERESTARTSYS;
and release semaphore as follow(whether it can successfully carry out its other task):
out:
up(&dev->sem);
return retval;
if some mistake ocurrs during scull_write operating, use : "goto out" to release semaphore correctly.
- Using semaphore in scull - from ldd3
- Implementation of linux semaphore - from ldd3
- ldd3 scull代码理解
- LDD3 scull pipe 模块
- LDD3 scull内存驱动程序改写
- ldd3 scull错误移除
- ldd3-3-scull初步失败
- ldd3 scull错误移除
- ldd3 驱动--测试scull
- ldd3 读书笔记 —— scull 2 运行
- LDD3学习笔记--scull的编译
- ubuntu 1204 kernel 3.2编译ldd3 scull
- 编译LDD3的scull驱动问题总结
- ARM-LINUX-2.6.36-LDD3-scull
- LDD3学习笔记scull编译错误解决
- Using SQLite from Shell in Android
- Using Android monkeyrunner from Eclipse in Windows
- LDD3笔记——scull模块加载与卸载函数
- 《MS SQL Server2005 技术内幕—T-SQL查询》读书笔记一:SQL逻辑查询处理
- unix学习第二天
- Escape,encodeURI,encodeURIComponent
- webservice 概念
- ORACLE中查询系统中的所有表和查询某张表中所有字段的名称的SQL写法
- Using semaphore in scull - from ldd3
- OGRE中Demo_Water程序注释(1)
- 关于漂亮控件的说明 收藏
- js+css 模仿淘宝评分效果
- linux 学习前言
- HTML中flash 有关object embed 属性参数详解
- php 中查找某个字符在字符串中出现的所有位置
- 获取外网IP的几种方法
- OGRE中Demo_Water程序注释(2)