Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2019 07:46:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 240590] Linuxulator: EPOLLONESHOT is broken
Message-ID:  <bug-240590-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

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@FreeBSD.org
          Reporter: iwtcex@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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240590-227>