wasi-libc icon indicating copy to clipboard operation
wasi-libc copied to clipboard

Some `SO_*` constants like `SO_BROADCAST` and `SO_LINGER` aren't defined

Open nickrum opened this issue 1 year ago • 2 comments

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.

nickrum avatar Aug 30 '24 17:08 nickrum

This makes sense; are you interested in adding these? (cc: @badeend, @dicej)

abrown avatar Sep 03 '24 17:09 abrown

Sure, I'll give it a shot 👍

nickrum avatar Sep 09 '24 16:09 nickrum

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.

alexcrichton avatar Jun 02 '25 22:06 alexcrichton