我们可以使用 epoll() 来轮询使用 ioctl 进行数据传输的描述符吗
Can we use epoll() to poll on a descriptor which is using ioctl for data transfer
我遇到了一种情况,我必须轮询文件描述符上的事件,该文件描述符使用 ioctl 命令进行数据传输(不使用 read())。我知道 epoll() 可以用在使用 read() 和 write() 进行数据传输的文件描述符上。但是一些驱动程序使用 ioctl 命令进行数据传输。我们可以在那些类型的文件描述符上使用 epoll() 吗?
这取决于驱动程序。来自 LDD3:
poll
, select
, and epoll
have essentially the same functionality [...]
Support for any of these calls requires support from the device
driver. This support (for all three calls) is provided through the
driver's poll
method. This method has the following prototype:
unsigned int (*poll) (struct file *filp, poll_table *wait);
换句话说,只有实现了内部 poll
函数,驱动程序管理的文件描述符才能与 select
/epoll
等一起使用。
我遇到了一种情况,我必须轮询文件描述符上的事件,该文件描述符使用 ioctl 命令进行数据传输(不使用 read())。我知道 epoll() 可以用在使用 read() 和 write() 进行数据传输的文件描述符上。但是一些驱动程序使用 ioctl 命令进行数据传输。我们可以在那些类型的文件描述符上使用 epoll() 吗?
这取决于驱动程序。来自 LDD3:
poll
,select
, andepoll
have essentially the same functionality [...]Support for any of these calls requires support from the device driver. This support (for all three calls) is provided through the driver's
poll
method. This method has the following prototype:unsigned int (*poll) (struct file *filp, poll_table *wait);
换句话说,只有实现了内部 poll
函数,驱动程序管理的文件描述符才能与 select
/epoll
等一起使用。