wasi-libc
wasi-libc copied to clipboard
Some `SO_*` constants like `SO_BROADCAST` and `SO_LINGER` aren't defined
While WASI does not (yet) support UDP broadcast or TCP linger, it would still be useful if these constants were defined, similar to how all the IP_*, IPV6_* and TCP_* constants are defined, even though WASI doesn't support all the related functionality.
Specifically, this came up while adding socket support to the Rust wasm32-wasip2 target. Since the part of the implementation that is common to all targets makes use of these constants, adding them to wasi-libc would allow this to be done without introducing conditional compilation to the common implementation.
This makes sense; are you interested in adding these? (cc: @badeend, @dicej)
Sure, I'll give it a shot 👍
I'm going to close this as it's currently intentional that wasi-libc doesn't support these options. Adding these options will require work in the wasi-sockets proposal itself. @badeend has prepared an excellent table at https://github.com/WebAssembly/wasi-sockets/blob/main/Posix-compatibility.md#socket-options which shows that these options are widely supported on hosts and are probably quite reasonable to propose, but they were not in the initial set of options.
Effectively the work items here are
- Work with upstream to add these options to wasi-sockets itself
- Work on getting that proposal standardized, which would involve host implementations and a guest implementation (here)
- Implement support via such a new wasi-sockets API in wasi-libc.
I'm going to close this as the initial work items are upstream rather than here, and as such should probably best be tracked upstream first.