WebAssembly/wasi-libc

ioctl doesn't implement FIONREAD for wasi:socket handles

Opened this issue · 2 comments

switch (request) {
case FIONBIO: {
va_list ap;
va_start(ap, request);
socket->blocking = *va_arg(ap, const int *) ==
0;
va_end(ap);
return 0;
}
default:
// TODO wasi-sockets: anything else we should support?
errno = EINVAL;
return -1;
}

I think wasi-libc can implement it like:

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

Some additional info: WebAssembly/wasi-sockets#17