int len;
// ioctl_arg n;
RubyIO io = (RubyIO)_io;
fptr = io.getOpenFileChecked();
fptr.checkReadable(context);
len = fptr.readPending();
if (len > 0) return runtime.newFixnum(len);
// TODO: better effort to get available bytes from our channel
// if (!FIONREAD_POSSIBLE_P(fptr->fd)) return INT2FIX(0);
// if (ioctl(fptr->fd, FIONREAD, &n)) return INT2FIX(0);