[Bug 240590] Linuxulator: EPOLLONESHOT is broken

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Sep 15 07:46:39 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240590

            Bug ID: 240590
           Summary: Linuxulator: EPOLLONESHOT is broken
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: iwtcex at gmail.com

Here's a reproducer:

#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/epoll.h>

int main() {

  int epfd = epoll_create(8);
  assert(epfd);

  struct epoll_event event = {
    .events = EPOLLOUT | EPOLLONESHOT,
    .data   = 0
  };

  int err1 = epoll_ctl(epfd, EPOLL_CTL_ADD, STDIN_FILENO, &event);
  assert(err1 == 0);

  struct epoll_event events[1];
  int n = epoll_wait(epfd, events, 1, -1);
  assert(n > 0);

  int err2 = epoll_ctl(epfd, EPOLL_CTL_MOD, STDIN_FILENO, &event);
  if (err2 == 0) {
    printf("ok\n");
  } else {
    perror("EPOLL_CTL_MOD failed");
  }

  return 0;
}

This program runs fine on Linux, while on FreeBSD it prints "EPOLL_CTL_MOD
failed: No such file or directory". The man page on kevent says about
EV_ONESHOT "After the user retrieves the event from the kqueue, it is deleted",
so presumably that's why.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list