diff --git a/make/java/nio/mapfile-linux b/make/java/nio/mapfile-linux index 61153101df70d0d179c9b744068f023deafddd94..63c9cbf14437549cbf8451b86d2f96f4bbef901e 100644 --- a/make/java/nio/mapfile-linux +++ b/make/java/nio/mapfile-linux @@ -88,6 +88,7 @@ SUNWprivate_1.1 { Java_sun_nio_ch_IOUtil_fdVal; Java_sun_nio_ch_IOUtil_fdLimit; Java_sun_nio_ch_IOUtil_initIDs; + Java_sun_nio_ch_IOUtil_iovMax; Java_sun_nio_ch_IOUtil_makePipe; Java_sun_nio_ch_IOUtil_randomBytes; Java_sun_nio_ch_IOUtil_setfdVal; diff --git a/make/java/nio/mapfile-solaris b/make/java/nio/mapfile-solaris index 7767d13a78efd610f5311d8ae7c8a8fbb6d09395..5a4908e1f6dae9166c84c2a05d2b16eb2cf8c3a4 100644 --- a/make/java/nio/mapfile-solaris +++ b/make/java/nio/mapfile-solaris @@ -76,6 +76,7 @@ SUNWprivate_1.1 { Java_sun_nio_ch_IOUtil_fdLimit; Java_sun_nio_ch_IOUtil_fdVal; Java_sun_nio_ch_IOUtil_initIDs; + Java_sun_nio_ch_IOUtil_iovMax; Java_sun_nio_ch_IOUtil_makePipe; Java_sun_nio_ch_IOUtil_randomBytes; Java_sun_nio_ch_IOUtil_setfdVal; diff --git a/src/share/classes/sun/nio/ch/IOUtil.java b/src/share/classes/sun/nio/ch/IOUtil.java index 6b4dc6f3affe5bb9bacae3f560a63819737f574c..a8267534cb6f367fc32df9638e20188ac2cc5746 100644 --- a/src/share/classes/sun/nio/ch/IOUtil.java +++ b/src/share/classes/sun/nio/ch/IOUtil.java @@ -36,6 +36,11 @@ import java.nio.ByteBuffer; public class IOUtil { + /** + * Max number of iovec structures that readv/writev supports + */ + static final int IOV_MAX; + private IOUtil() { } // No instantiation static int write(FileDescriptor fd, ByteBuffer src, long position, @@ -111,7 +116,8 @@ public class IOUtil { // Iterate over buffers to populate native iovec array. int count = offset + length; - for (int i=offset; i bufferCache = diff --git a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c index 6808dbea9c17ffee441c023f4170b6990f6a7092..4d987b91f05d624d4d38c0e31c8bc8c39b993740 100644 --- a/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c +++ b/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c @@ -94,9 +94,6 @@ Java_sun_nio_ch_FileDispatcherImpl_readv0(JNIEnv *env, jclass clazz, { jint fd = fdval(env, fdo); struct iovec *iov = (struct iovec *)jlong_to_ptr(address); - if (len > 16) { - len = 16; - } return convertLongReturnVal(env, readv(fd, iov, len), JNI_TRUE); } @@ -126,9 +123,6 @@ Java_sun_nio_ch_FileDispatcherImpl_writev0(JNIEnv *env, jclass clazz, { jint fd = fdval(env, fdo); struct iovec *iov = (struct iovec *)jlong_to_ptr(address); - if (len > 16) { - len = 16; - } return convertLongReturnVal(env, writev(fd, iov, len), JNI_FALSE); } diff --git a/src/solaris/native/sun/nio/ch/IOUtil.c b/src/solaris/native/sun/nio/ch/IOUtil.c index 4bea68826939fc98d2d291186b8f8001aba3a893..77ea58060cf10d48dbdad7db8989cdecaab852b0 100644 --- a/src/solaris/native/sun/nio/ch/IOUtil.c +++ b/src/solaris/native/sun/nio/ch/IOUtil.c @@ -136,6 +136,16 @@ Java_sun_nio_ch_IOUtil_fdLimit(JNIEnv *env, jclass this) } } +JNIEXPORT jint JNICALL +Java_sun_nio_ch_IOUtil_iovMax(JNIEnv *env, jclass this) +{ + jlong iov_max = sysconf(_SC_IOV_MAX); + if (iov_max == -1) + iov_max = 16; + return (jint)iov_max; +} + + /* Declared in nio_util.h for use elsewhere in NIO */ jint diff --git a/src/windows/native/sun/nio/ch/IOUtil.c b/src/windows/native/sun/nio/ch/IOUtil.c index 7549b994f6aaa4c37459d4e435e9e4d4db25b66c..8b03be4b37c77853aeadfadb0461a2f16f3a97a8 100644 --- a/src/windows/native/sun/nio/ch/IOUtil.c +++ b/src/windows/native/sun/nio/ch/IOUtil.c @@ -41,9 +41,6 @@ static jfieldID handle_fdID; /* field id for jint 'fd' in java.io.FileDescriptor used for socket fds */ static jfieldID fd_fdID; -/* false for 95/98/ME, true for NT/W2K */ -static jboolean onNT = JNI_FALSE; - JNIEXPORT jboolean JNICALL Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed (JNIEnv *env, jclass clazz, jbyteArray randArray); @@ -55,13 +52,6 @@ Java_sun_security_provider_NativeSeedGenerator_nativeGenerateSeed JNIEXPORT void JNICALL Java_sun_nio_ch_IOUtil_initIDs(JNIEnv *env, jclass clazz) { - OSVERSIONINFO ver; - ver.dwOSVersionInfoSize = sizeof(ver); - GetVersionEx(&ver); - if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { - onNT = JNI_TRUE; - } - clazz = (*env)->FindClass(env, "java/io/FileDescriptor"); fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"); handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J"); @@ -80,6 +70,13 @@ Java_sun_nio_ch_IOUtil_randomBytes(JNIEnv *env, jclass clazz, randArray); } +JNIEXPORT jint JNICALL +Java_sun_nio_ch_IOUtil_iovMax(JNIEnv *env, jclass this) +{ + return 16; +} + + jint convertReturnVal(JNIEnv *env, jint n, jboolean reading) { @@ -205,9 +202,3 @@ handleval(JNIEnv *env, jobject fdo) { return (*env)->GetLongField(env, fdo, handle_fdID); } - -jboolean -isNT() -{ - return onNT; -} diff --git a/src/windows/native/sun/nio/ch/SocketDispatcher.c b/src/windows/native/sun/nio/ch/SocketDispatcher.c index 373d92da7a7e69c42195a3f230bca7f978c5a3d5..e765149eb64c4b6c9ee605020ef17562cf5c6154 100644 --- a/src/windows/native/sun/nio/ch/SocketDispatcher.c +++ b/src/windows/native/sun/nio/ch/SocketDispatcher.c @@ -97,10 +97,6 @@ Java_sun_nio_ch_SocketDispatcher_readv0(JNIEnv *env, jclass clazz, jobject fdo, return IOS_THROWN; } - if ((isNT() == JNI_FALSE) && (len > 16)) { - len = 16; - } - /* copy iovec into WSABUF */ for(i=0; i 16)) { - len = 16; - } - /* copy iovec into WSABUF */ for(i=0; i