NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56718: eventfd: fcntl(O_NONBLOCK) doesn't work

>Number:         56718
>Category:       kern
>Synopsis:       eventfd: fcntl(O_NONBLOCK) doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 16 15:25:00 +0000 2022
>Originator:     Thomas Klausner
>Release:        NetBSD 9.99.93

Architecture: x86_64
Machine: amd64
Setting an eventfd() to non-blocking mode using fcntl() returns
'operation not supported'.
However, software expects this to work (e.g. net/zeromq).
Run net/zeromq's self tests.

Or this program:

#include <sys/eventfd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>

int main() {
    int cflags = 0x400000;
    int s_ = eventfd (0, cflags);

    int flags = fcntl (s_, F_GETFL, 0);
    printf("eventfd flags are %d, O_NONBLOCK is %d\n", flags, O_NONBLOCK);
    if (flags == -1)
        flags = 0;
    int rc = fcntl (s_, F_SETFL, flags | O_NONBLOCK);
    printf("fcntl returned %d: %s\n", rc, strerror(errno));

It should return a success, but currently it prints

eventfd flags are 2, O_NONBLOCK is 4
fcntl returned -1: Operation not supported



Home | Main Index | Thread Index | Old Index