Opened 5 months ago

Last modified 5 months ago

#16846 new enhancement

The future of fd stateful monitoring / eventing in Haiku

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Kernel Kit Version: R1/Development
Keywords: epoll kqueue io_uring Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by kallisti5)

Today Haiku offers a "wait_for_objects" API (stateless) which is as close as we get to epoll / kqueue which exists on OS X / FreeBSD / Linux.

Pulkomandy pointed out a great overview here:

... and some previous work around event polling here:

A good model would likely be:

  1. Implement a fairly standard/complete io_uring (fd and sockets)
  2. Add epoll/kqueue compatibility functions which silently leverage io_uring
  3. Drop wait_for_objects or make it official. (only consumer seems to be power daemon

That video mentions performance improvements at large scale for things leveraging epoll/kqueue/io_uring over the POSIX poll/select

Change History (6)

comment:1 by kallisti5, 5 months ago

Description: modified (diff)
Summary: Better document wait_for_objects API calls, or reimplement?The future of fd stateful monitoring / eventing in Haiku

comment:2 by kallisti5, 5 months ago

Description: modified (diff)
Keywords: io_uring added

comment:3 by kallisti5, 5 months ago

Side note, a lot of this was spawned due to Rust's mio crate not working under Haiku. Their design assumes a stateful fd monitoring API.. which we don't have.

comment:4 by korli, 5 months ago

This is partly misleading.

OpenJDK uses wait_for_objects

It's part of the official public API:

comment:5 by kallisti5, 5 months ago

/* WARNING: Experimental API! */


Either way.. wait_for_objects is stateless (which has caused mio to pretty much list us as unsupported outright), and likely suffers the same performance issues at scale as poll/select mentioned in the video above.

in reply to:  5 comment:6 by korli, 5 months ago

Replying to kallisti5:

/* WARNING: Experimental API! */


Yeah it might be removed or changed in a future release, after R1. To be documented at

Note: See TracTickets for help on using tickets.