字符设备驱动操作与内核时间管理详解
在开发字符设备驱动以及进行内核编程时,会涉及到许多关键的操作和概念。下面将详细介绍增强字符设备驱动操作以及内核时间管理相关的内容。
增强字符设备驱动操作
旧版 select 函数的使用
在特定条件下,会使用旧版的 select 函数,以下是 scull_p_poll 函数的代码:
#ifdef __USE_OLD_SELECT__
int scull_p_poll(struct inode *inode, struct file *filp,
int mode, select_table *table)
{
Scull_Pipe *dev = filp->private_data;
if (mode == SEL_IN) {
if (dev->rp != dev->wp) return 1; /* readable */
PDEBUG("Waiting to read\n");
select_wait(&dev->inq, table); /* wait for data */
return 0;
}
if (mode == SEL_OUT) {
/*
* The buffer is circular; it is considered full
* if "wp" is right behind "rp".
超级会员免费看
订阅专栏 解锁全文
1408

被折叠的 条评论
为什么被折叠?



