G'day Michael, On Fri, Feb 19, 2010 at 01:07:35PM -0800, Michael Allman wrote: > Ok, I have a patch. How do I submit it?
Sending it to the list for review (either directly or by putting up a URL people can see it at) is a good first step :). > On Wed, 27 Jan 2010, Greg Lewis wrote: > > > On Tue, Jan 26, 2010 at 01:33:06AM -0800, Michael Allman wrote: > >> I would like to update jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c > >> so that the Java_sun_nio_ch_FileChannelImpl_transferTo0 function calls the > >> sendfile system call on Darwin. I have a few questions: > >> > >> 1. Is there a cpp #define for Darwin? If not, how do I tell cpp whether > >> the system is Darwin or not? > > > > The rest of the code uses > > > > #ifdef __APPLE__ > > > >> 2. Are there tests that exercise > >> Java_sun_nio_ch_FileChannelImpl_transferTo0 or the java method > >> FileChannel.transferTo? > > > > Some of the tests in jdk/test/java/nio/channels/FileChannel/ may be useful, > > I haven't looked them over though. > > > >> 3. Why doesn't the existing BSD code just return IOS_UNSUPPORTED? For > >> instance, look at lines 223 and 224. If there's no sendfile function on > >> Solaris, the function just returns IOS_UNSUPPORTED. The caller handles > >> that return value gracefully. The existing BSD code looks needlessly > >> complex to me. > > > > All of the BSDs have sendfile, its just limited to only sending the file to > > a stream socket rather than any file descriptor, which Solaris and Linux > > allow. It's fairly easy to implement code that will do that though, so > > that's what was done rather than throwing errors when a non-socket file > > descriptor was used. > > > > Note that MacOS X seems to have the same limitations as all the other BSDs > > in terms of what type of file descriptor can be used as the destination: > > > > http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man2/sendfile.2.html > > > > If NIO in general interests you, then a project we really need someone to > > work on is porting NIO2 to BSD. None of the BSDs have the epoll mechanism > > used on Linux or whatever Solaris uses (which I can't recall off the top of > > my head right now). The suggestion is to use kqueue(2) on BSD. > > > > -- > > Greg Lewis Email : gle...@eyesbeyond.com > > Eyes Beyond Web : http://www.eyesbeyond.com > > Information Technology FreeBSD : gle...@freebsd.org > > -- Greg Lewis Email : gle...@eyesbeyond.com Eyes Beyond Web : http://www.eyesbeyond.com Information Technology FreeBSD : gle...@freebsd.org