miri icon indicating copy to clipboard operation
miri copied to clipboard

Support kqueue on macOS

Open danielsn opened this issue 1 year ago • 5 comments

I was trying to run Miri on this test, and got the following error message:

--- STDERR:              data-pipeline trace_exporter::tests::new_defaults ---
error: unsupported operation: can't call foreign function `kqueue` on OS `macos`
   --> /Users/daniel.schwartznarbonne/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mio-0.8.11/src/sys/unix/selector/kqueue.rs:73:18
    |
73  |         let kq = syscall!(kqueue())?;
    |                  ^^^^^^^^^^^^^^^^^^ can't call foreign function `kqueue` on OS `macos`
    |
    = help: if this is a basic API commonly used on this target, please report an issue with Miri
    = help: however, note that Miri does not aim to support every FFI function out there; for instance, we will not support APIs for things such as GUIs, scripting languages, or databases

I would argue that kqueue is a sufficiently common API that Miri should consider supporting it.

danielsn avatar Nov 01 '24 19:11 danielsn

Thanks for the report! We are currently in the process of implementing epoll support. So kqueue is definitely in scope. (IIUC, this is the macOS equivalent to epoll.)

However, I personally won't spend my time implementing APIs for a proprietary OS, so this will likely have to be driven by outside contributions (or maybe one of my fellow team members).

Meanwhile, you can use --target x86_64-unknown-linux-gnu even on a macOS host (no further tooling required) to execute the better-supported Linux codepaths.

RalfJung avatar Nov 01 '24 19:11 RalfJung

APIs for a proprietary OS

The BSDs also have an API called kqueue, though I don't know if it is exactly the same. The Solarish OSes use yet another mechanism for evented I/O called event ports.

saethlin avatar Nov 01 '24 20:11 saethlin

Hi I would like to work on this issue.

geetanshjuneja avatar Feb 05 '25 19:02 geetanshjuneja

@RalfJung how should I approach this issue? What all do I need to implement here to make kqueue working?

geetanshjuneja avatar Feb 06 '25 16:02 geetanshjuneja

I'm afraid I won't be able to provide mentoring for this, sorry.

RalfJung avatar Feb 06 '25 16:02 RalfJung