ChinaUnix.net
相关文章推荐:

poll_wait

poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 研究poll_wait,参数里面的等待队列wait_address,为什么都用add_wait_queue,加入队列中,然后调用while去等,要么就是用wait_event去等待唤醒? 最好说说这个队列应该怎么搞?

by superzx727 - 内核源码 - 2007-12-24 11:03:35 阅读(2781) 回复(0)

相关讨论

linux设备驱动程序第三版有如下代码: static unsigned int scull_p_poll(struct file *filp, poll_table *wait) { struct scull_pipe *dev = filp->private_data; unsigned int mask = 0; /* * The buffer is circular; it is considered full * if "wp" is right behind "rp" and empty if the * two are equal. */ down(&dev->sem); poll_...

by 相逢的日子 - Linux环境编程 - 2012-03-23 17:31:57 阅读(1833) 回复(3)

linux设备驱动程序第三版有如下代码: static unsigned int scull_p_poll(struct file *filp, poll_table *wait) { struct scull_pipe *dev = filp->private_data; unsigned int mask = 0; /* * The buffer is circular; it is considered full * if "wp" is right behind "rp" and empty if the * two are equal. */ down(&dev->sem); ...

by 相逢的日子 - 嵌入式开发 - 2012-08-10 18:50:15 阅读(1595) 回复(1)

ldd 第165页的 poll 函数,代码如下[code]unsigned int scullp_poll(struct file *filp,poll_table *wait) { unsigned int mask = 0; down(&scullp->sem); poll_wait(filp,&scullp->inq,wait); poll_wait(filp,&scullp->outq,wait); if(scullp->rp != scullp->wp) mask |= pollIN | pollRDNORM; if(spacefree()) mask |= pollOUT | pollWRNORM; up(&scullp->sem); return mask; }[/code]把这个p...

by nwcfafniw - 内核源码 - 2013-05-14 09:06:47 阅读(1466) 回复(3)

本帖最后由 lanlovehua 于 2010-09-27 15:59 编辑 [code]typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); typedef struct poll_table_struct { poll_queue_proc qproc; } poll_table; static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) { if (p && wait_address) p->qproc(filp, wait_ad...

by lanlovehua - 内核源码 - 2012-03-14 16:22:41 阅读(2765) 回复(4)

应用程序的select()系统调用,调用驱动中的poll()方法。 不理解的是在下面的poll()方法实现中,首先调用poll_wait将等待队列添加到wait结构中,接下来是个判断语句 if (dev->rp != dev->wp) mask |= pollIN | pollRDNORM; /* readable */ 只考虑可读情况。如果这个if语句的条件不满足,那么就不会返回可读,也就是返回0。那么在这里怎么实现阻塞的呢?也就是说如果在应用的select()系统中,指定一个等待时间,在...

by luanjian - 内核/嵌入技术 - 2006-07-19 12:30:54 阅读(14559) 回复(7)

应用程序的select()系统调用,调用驱动中的poll()方法。 不理解的是在下面的poll()方法实现中,首先调用poll_wait将等待队列添加到wait结构中,接下来是个判断语句 if (dev->rp != dev->wp) mask |= pollIN | pollRDNORM; /* readable */ 只考虑可读情况。如果这个if语句的条件不满足,那么就不会返回可读,也就是返回0。那么在这里怎么实现阻塞的呢?也就是说如果在应用的select()系统中,指定一个等待时间,在...

by luanjian - 内核源码 - 2010-05-25 23:40:49 阅读(13399) 回复(9)

poll_wait()的第一个参数fd有何用? 谢谢!

by chishanmingshen - 内核源码 - 2014-07-17 22:13:34 阅读(1004) 回复(0)

tatic unsigned int scull_p_poll(struct file *filp, poll_table *wait) { struct scull_pipe *dev = filp->private_data; unsigned int mask = 0; /* * The buffer is circular; it is considered full * if "wp" is right behind "rp" and empty if the * two are equal. */ down(&dev->sem); poll_wait(filp, &dev->inq, wait); // poll_wa...

by 0堕天使0 - Linux新手园地 - 2011-11-17 11:34:56 阅读(1589) 回复(1)

本帖最后由 zsmctfy 于 2011-04-11 21:36 编辑 我在看Linux驱动的书(书名:Linux设备驱动详解),书上讲到轮询,还列出了一段代码: static unsigned int XXX_poll(struct file *filp, poll_table *wait) { ...... poll_wait(filp, &dev->r_wait, wait); //加读等待队列头 poll_wait(filp, &dev->w_wait, wait); //加写等待队列头 ...... } 我就是不明白poll_wait这个函数做些什么工作? 还有,X...

by zsmctfy - 内核源码 - 2011-04-13 15:43:59 阅读(3512) 回复(2)

想用wait()来获得任一子进程的结束 #include "sys/types.h" #include "sys/wait.h" #include "stdio.h" main() { pid_t pid; if((pid=fork())<0) {printf("fork error."); exit(0); } else if (pid==0) { printf("1 ID:%d\n",getpid()); if ((pid=fork())<0) {printf("fork error."); exit(0); } else if (pid==0) { printf("2 ID:%d\n",getpid()); exit(0); } else sleep(2); } else printf("...

by andyY - C/C++ - 2003-06-13 18:30:35 阅读(3318) 回复(9)