Zig-aio: lightweight abstraction over io_uring and coroutines

I was curious, and aio has now libc-less wasi support. Every operation is supported apart from aio.ChildExit and all the socket operations. std.os.wasi has some socket functions, which may be able to give partial support for them later. wasix supports posix like sockets fully, but the only wasix runtime wasmer did not like zig stds threading implementation for whatever reason.

I also noticed that running the tests with wasmtime there’s random memory corruption which is why I’m not adding wasi tests to the CI test suite. I’m not yet sure where is the root cause for this.

coro has no wasm support, but might get it in future https://github.com/WebAssembly/stack-switching/blob/main/proposals/continuations/Explainer.md

This also increased posix compatibility of aio, and OpenBSD became supported. OpenBSD was unsupported because it lacked EVFILT_USER for kevent. I implemented pipe based EventSource as the last resort fallback that’s used on both OpenBSD and wasi. Although wasi doesn’t really have pipes outside wasix spec, I emulate them by creating a file and deleting it immediately. This gives me a fd that I can poll, and thus use as a event source.

You can check out the wasi posix glue here:

2 Likes

ChildExit is now implemented for windows. Windows should now cover all the operations. Test coverage is still unclear.

3 Likes