How to get errno when epoll_wait returns EPOLLERR?

前端 未结 4 1291
鱼传尺愫
鱼传尺愫 2021-02-07 12:51

Is there a way to find out the errno when epoll_wait returns EPOLLERR for a particular fd?

Is there any further information about

4条回答
  •  再見小時候
    2021-02-07 13:14

    Just a minor point: Your test won't work correctly, for two reasons. If EPOLLERR is defined as, say, 0x8, then your test will be comparing 8 with one (since == has higher precedence than &), giving you a zero, then anding that with the event mask.

    What you want is: (epoll_event.events & EPOLLERR) != 0 to test for the EPOLLERR bit being set.

提交回复
热议问题