I have a question regarding polling of epoll descriptor and EPOLLERR event.

I have several descriptors registered in epoll, I listen for EPOLLIN on some and only for EPOLLERR for the one for file "/proc/self/mountinfo". Every time "/proc/self/mountinfo" file changes (e.g. CD-ROM gets mounted or unmounted) I get correct event for this descriptor (EPOLLERR) when using epoll_wait().

But I want my library to be easily integrated into other applications including those using Qt and GTK. I provide epoll descriptor through public API so that it can be used with e.g. QSocketNotifier or ordinary poll() and when the descriptor gets readable ( = there are events in epoll) user have to call function provided by the library to process the events.

Problem is, that when epoll descriptor is poll()ed, poll (with infinite timeout) returns only if there are EPOLLIN events pending in epoll descriptor, but does not return when there is only EPOLLERR pending. Moreover, the event seems to get lost (without even calling epoll_wait()) when any EPOLLIN event for another descriptor becomes available.

Why is that? Is this normal/defined behavior if poll()ing epoll descriptor? Is it BUG? Am I doing something wrong?