6772303: (se) IOException: Invalid argument" thrown on a call to Selector.select(value) with -d64
authoralanb
Fri, 27 Mar 2009 16:04:05 +0000
changeset 2434 aae0b77424ae
parent 2433 9f0ab7f726b8
child 2435 5c063c7a9f51
6772303: (se) IOException: Invalid argument" thrown on a call to Selector.select(value) with -d64 Reviewed-by: sherman
jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
--- a/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c	Fri Mar 27 15:24:37 2009 +0000
+++ b/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c	Fri Mar 27 16:04:05 2009 +0000
@@ -28,6 +28,7 @@
 #include "jvm.h"
 #include "jlong.h"
 #include "sun_nio_ch_DevPollArrayWrapper.h"
+#include "java_lang_Integer.h"
 #include <sys/poll.h>
 #include <sys/resource.h>
 #include <unistd.h>
@@ -192,7 +193,11 @@
         JNU_ThrowIOExceptionWithLastError(env,
                                           "getrlimit failed");
     }
-    return (jint)rlp.rlim_max;
+    if (rlp.rlim_max < 0 || rlp.rlim_max > java_lang_Integer_MAX_VALUE) {
+        return java_lang_Integer_MAX_VALUE;
+    } else {
+        return (jint)rlp.rlim_max;
+    }
 }
 
 JNIEXPORT void JNICALL