Skip to content

pcap-linux: fix EFD_NONBLOCK rejected in old kernel#1667

Open
SmileyLemon wants to merge 1 commit intothe-tcpdump-group:libpcap-1.10from
SmileyLemon:libpcap-1.10
Open

pcap-linux: fix EFD_NONBLOCK rejected in old kernel#1667
SmileyLemon wants to merge 1 commit intothe-tcpdump-group:libpcap-1.10from
SmileyLemon:libpcap-1.10

Conversation

@SmileyLemon
Copy link
Copy Markdown

pcap-linux: fix EFD_NONBLOCK rejected in old kernel
Some older kernels don't accept EFD_NONBLOCK in eventfd(), this fix would fall back to plain eventfd and set O_NONBLOCK via fcntl() when it happends.
If eventfd isn't supported, continue without it; breakloop won't interrupt blocking poll(), but capture still works.

@infrastation
Copy link
Copy Markdown
Member

Please describe the problem and the solution in more detail.

  1. What are the steps to reproduce the problem?
  2. Which old Linux kernels does this change address? libpcap currently requires at least 2.6.27, and eventfd(2) says:
    EFD_NONBLOCK (since Linux 2.6.27)
                  Set the O_NONBLOCK file status flag on the open file
                  description (see open(2)) referred to by the new file
                  descriptor.  Using this flag saves extra calls to fcntl(2)
                  to achieve the same result.
    
  3. Where does ENOSYS come from? Neither eventfd(2) nor fcntl(2) document this as a possible value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants