poll 和 epoll 事件标志兼容吗?

Are poll and epoll event flags compatible?

我正在尝试让 libusb 使用 epoll 而不是 poll,因为我已经在需要可扩展性的应用程序中使用 epoll 并且只会是 运行在 Linux。我想知道 libusb_get_pollfds 返回的 events 标志是否与 epoll 兼容。

例如,POLLIN 标志是否可以在 epoll 中注册并实现与 EPOLLIN 标志相同的行为,或者我是否需要将这些事件标志映射到它们的对应的epoll版本?

Can the POLLIN flag, for example, be registered with epoll and achieve the same behavior as the EPOLLIN flag, or do I need to map these event flags to their corresponding epoll version?

answer 很能说明问题。摘录:

The most glaring problem with epoll documentation is its failure to state in "bold caps" that epoll events, are, in fact, fully identical to poll (2) events.