WebAssembly / wasi-libc

WASI libc implementation for WebAssembly
https://wasi.dev
Other
862 stars 203 forks source link

fcntl doesn't implement O_NONBLOCK for wasi:socket handles #536

Open pavelsavara opened 2 months ago

pavelsavara commented 2 months ago

fcntl doesn't implement O_NONBLOCK for wasi:socket handles

See https://github.com/WebAssembly/wasi-libc/blob/1b19fc65ad84b223876c50dd4fcd7d5a08c311dc/libc-bottom-half/cloudlibc/src/libc/fcntl/fcntl.c#L10-L61

dicej commented 2 months ago

We do already support both blocking and non-blocking sockets (e.g. https://github.com/WebAssembly/wasi-libc/blob/1b19fc65ad84b223876c50dd4fcd7d5a08c311dc/libc-bottom-half/headers/public/__header_sys_socket.h#L55 and https://github.com/WebAssembly/wasi-libc/blob/1b19fc65ad84b223876c50dd4fcd7d5a08c311dc/libc-bottom-half/sources/socket.c#L92), so presumably adding O_NONBLOCK support for toggling that should be pretty trivial.

dicej commented 2 months ago

BTW, we do already support setting FIONBIO on sockets via ioctl. I don't think there's a way to read the current state yet, though.