WebAssembly / wasi-libc

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

ioctl doesn't implement FIONREAD for wasi:socket handles #538

Open pavelsavara opened 1 month ago

pavelsavara commented 1 month ago

https://github.com/WebAssembly/wasi-libc/blob/7d4d3b83fc66c79b3faa5989e67ed2d1042dacaf/libc-bottom-half/cloudlibc/src/libc/sys/ioctl/ioctl.c#L22-L37

abrown commented 1 month ago

cc: @badeend, @dicej

badeend commented 1 month ago

I think wasi-libc can implement it like:

return if state == TCP_SOCKET_STATE_CONNECTED && input_pollable.ready() { 8192 } else { 0 };

Some additional info: https://github.com/WebAssembly/wasi-sockets/issues/17