From owner-freebsd-java@FreeBSD.ORG Fri Jan 18 04:30:59 2008 Return-Path: Delivered-To: freebsd-java@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27D7A16A46B for ; Fri, 18 Jan 2008 04:30:59 +0000 (UTC) (envelope-from msa@allman.ms) Received: from mail102.csoft.net (mail102.csoft.net [205.205.219.4]) by mx1.freebsd.org (Postfix) with ESMTP id DABAA13C4CC for ; Fri, 18 Jan 2008 04:30:58 +0000 (UTC) (envelope-from msa@allman.ms) Received: by mail102.csoft.net (Postfix, from userid 3922) id 5CAD21D2D3; Thu, 17 Jan 2008 23:13:00 -0500 (EST) Date: Thu, 17 Jan 2008 20:13:00 -0800 (PST) From: Michael Allman To: freebsd-java@FreeBSD.org Message-ID: <20080117200016.P64623@yvyyl.pfbsg.arg> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: landonf@macports.org Subject: bsd implementation of Java_sun_nio_ch_FileChannelImpl_transferTo0 ignores "count" argument X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2008 04:30:59 -0000 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)