This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
gnu_java_nio_VMChannel.c has this code: if (ioctl (fd, FIONREAD, &avail) == -1) JCL_ThrowException (env, IO_EXCEPTION, strerror (errno)); But FreeBSD's ioctl with FIONREAD fails because of errno = 25 (Inappropriate ioctl for device). native/jni/native-lib/cpio.c has a similar code: #if defined (FIONREAD) ssize_t n; if (ioctl (fd, FIONREAD, (char *)&n) != 0) return errno; This checking for FIONREAD does not work for FreeBSD because FreeBSD does have FIONREAD but it cannot be used for calculating available bytes.
It should work for sockets, but not files, right? Does it work on pipes? It might be better to redefine available() for files as (file.length - file.pos).
> It should work for sockets, but not files, right? Does it work on pipes? Right. No problem with sockets. I am not sure about pipes, but maybe OK. It works on named pipes.
Fixed. The cvs-commit message went to Bug #30377 by my mistake.