RTEMS | Anonymous pipes (pipe()) cannot be made non-blocking; fcntl(F_SETFL, O_NONBLOCK)/ioctl(FIONBIO) have no effect (#5623)
Heinz Junkes (@junkes)
gitlab at rtems.org
Mon Jun 15 22:30:15 UTC 2026
Heinz Junkes created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5623
## Summary
Location: cpukit/libfs/src/pipe/{pipe.c,fifo.c}
Root cause: pipe() clears LIBIO_FLAGS_NO_DELAY on the read fd after open (pipe.c:89).
pipe_ioctl (fifo.c:435) only implements FIONREAD, with no FIONBIO case and no fcntl(F_SETFL) passthrough that updates iop flags
Effect: pipe_read's LIBIO_NODELAY(iop) check (fifo.c:309) is dead code for any fd obtained via pipe()
[reads on an empty pipe always block, regardless of subsequent non-blocking calls]
## Steps to reproduce
breaks any library relying on the standard non-blocking-pipe self-pipe/notification pattern (libevent, EPICS extension PVXS, on RTEMS 7 ( origin/main )
I'm currently working on libevent (EPICS PVXS):
evutil_make_internal_pipe_ in bundled libevent used pipe() + O_NONBLOCK for cross-thread event loop notification. On RTEMS libbsd, O_NONBLOCK on pipe file descriptors is unreliable — reads block instead of returning EAGAIN. This caused evthread_notify_drain_default to block holding the libevent internal lock, deadlocking event_base_loop in all evbase instances, preventing acceptor_loop.call() from ever completing.
Fix: Add && !defined(__rtems__) to the #if defined(EVENT__HAVE_PIPE) guard in bundle/libevent/evutil.c, forcing libevent to use socketpair(AF_UNIX, SOCK_STREAM) instead on RTEMS — which works correctly.
<!-- Pre-set options
- milestone
-->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5623
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260615/53e4287c/attachment.htm>
More information about the bugs
mailing list