在设备驱动程序中使用select()/poll() [英] Using select()/poll() in device driver

查看:92
本文介绍了在设备驱动程序中使用select()/poll()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个驱动程序,可以处理多个TCP连接.

I have a driver, which handles several TCP connections.

有没有一种方法可以在给定struct sock列表的情况下在内核中执行类似于用户空间应用程序api的select/poll()/epoll()?

Is there a way to perform something similar to user space application api's select/poll()/epoll() in kernel given a list of struct sock's?

谢谢

推荐答案

您可能想编写自己的自定义sk_buff处理程序,该处理程序调用试图锁定信号量的kernel_select()并在套接字时进行阻塞等待是打开的.

You may want to write your own custom sk_buff handler, which calls the kernel_select() that tries to lock the semaphore and does a blocking wait when the socket is open.

不确定您是否已经通过此链接模拟select()poll()在内核套接字编程中的作用

Not sure if you have already gone through this link Simulate effect of select() and poll() in kernel socket programming

这篇关于在设备驱动程序中使用select()/poll()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆