bsd implementation of Java_sun_nio_ch_FileChannelImpl_transferTo0
ignores "count" argument
Michael Allman
msa at allman.ms
Thu Jan 17 20:30:59 PST 2008
There's a bug in the bsd patch to FileChannelImpl.c, as described in the
subject of this message. FYI, I have verified this using the "current"
jdk16 freebsd patchset found here:
http://www.eyesbeyond.com/freebsddom/java/JDK16JRLConfirm.html
I haven't fully analyzed the impact of this defect. I can say that in my
case, if I call FileChannel.transferTo(0, 100, socketChannel), where 100
is less than the length of the file in question, it transfers the entire
file to the destination. According to the docs for this method, it should
only transfer a maximum of 100 bytes. This is key to my particular usage
of this method.
I can attempt to provide a patch, but C is not my thing, and I could not
make a reliable claim as to the correctness of my patch. Also, there's
the whole license issue. Fixing this seems simple enough, though. I
would like to help insofar as I can.
Also, I know this is getting pushy, but it seems like fixing this issue
would be a great time to replace the current implementation of this method
with a true bsd sendfile() call. I could give that a try, too.
Cheers,
Michael
(CC'ing Landon Fuller because this is a bug in Soylatte, too)
More information about the freebsd-java
mailing list