swift-nio
swift-nio copied to clipboard
Add support for WASILibc
Dispatch is not supported on WASI, and only Unix domain sockets are supported, which means we have to exclude those APIs on this platform.
There's work in progress to enable tests for this on CI, but nothing I can provide for this PR at the current moment.
@swift-server-bot add to allowlist
@MaxDesiatov / @Lukasa This looks like a PR that has bit rotting potential because it needs to touch a lot of pieces, most of the issues seem pretty tractable to me so I'd love to see this go in.
w.r.t. disabling locks on WASI: Honestly I think this can go in as is: Today this is fine and if threading really happens this will blow up very obviously and can be fixed.
Currently blocked on https://github.com/swiftlang/swift/pull/75618, which would make PF_INET and PF_INET6 available.
Currently blocked on swiftlang/swift#75618, which would make
PF_INETandPF_INET6available.
You can just hardcode the values for the time being, right? They are #defines and therefore ABI, so they can't change.
Currently blocked on swiftlang/swift#75618, which would make
PF_INETandPF_INET6available.You can just hardcode the values for the time being, right? They are
#defines and therefore ABI, so they can't change.
If that version bump is easy and we get it done quickly, I'd rather have that one merged and make this PR cleaner at the same time.
With changes I've pushed the build is now successful with latest development snapshots when building NIOCore and NIOHTTP1 targets for single-threaded WASI.
Pushed more changes so that it uses wasi_pthread when multi-threading is available with wasm32-unknown-wasip1-threads triples.
w.r.t. disabling locks on WASI: Honestly I think this can go in as is: Today this is fine and if threading really happens this will blow up very obviously and can be fixed.
@weissi In this PR we now conditionally enable locks when those are available in WASI.
CC @FranzBusch & @Lukasa