免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1927 | 回复: 3
打印 上一主题 下一主题

怎么理解proto_ops{}结构中的成员——poll()函数 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-13 22:16 |只看该作者 |倒序浏览
proto_ops{}结构在linux\net.h中定义。是对应于socket套接口的操作集。但是我对其中的poll()函数不明白。它在proto_ops{}结构中定义如下:
  unsigned int (*poll) (struct file *file, struct socket *sock, struct poll_table_struct *wait);
我看了《UNIX网络编程》中对poll函数的介绍:
poll 函数
原型:

int poll (struct pollfd *fdarray, unsigned long nfds, int timeout )

第一个参数是指向结构数组第一个元素的指针:
struct pollfd{
int fd; // descriptor
short events // events of interest on fd
short revents // events that occured on fd
}
第二个参数是套接字个数,第三个参数是等待时间

可是还不明白,觉得乱乱的哪位朋友帮忙给解释下好不好,谢谢

论坛徽章:
0
2 [报告]
发表于 2006-01-14 13:22 |只看该作者
你要说清楚你到底对什么不明白,老兄!

论坛徽章:
0
3 [报告]
发表于 2006-01-14 17:02 |只看该作者
嘿嘿,回答snow_insky :怎么理解proto_ops{}结构中的成员——poll()函数 ?它是什么作用?

论坛徽章:
0
4 [报告]
发表于 2006-01-14 17:34 |只看该作者
可以让你在打开的文件描述符上执行select和poll操作
也就是异步的读写操作
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP