using the sendfile system call on Darwin

Michael Allman msa at allman.ms
Tue Jan 26 01:33:06 PST 2010


Hi Folks,

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?

2.  Are there tests that exercise 
Java_sun_nio_ch_FileChannelImpl_transferTo0 or the java method 
FileChannel.transferTo?

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.

Cheers,

Michael



More information about the bsd-port-dev mailing list