jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
changeset 12872 16fa902b1469
parent 12844 883981db17b3
child 14342 8435a30053c1
equal deleted inserted replaced
12871:b583b4c82a82 12872:16fa902b1469
    26 #include "jni.h"
    26 #include "jni.h"
    27 #include "jni_util.h"
    27 #include "jni_util.h"
    28 #include "jvm.h"
    28 #include "jvm.h"
    29 #include "jlong.h"
    29 #include "jlong.h"
    30 #include "sun_nio_ch_DevPollArrayWrapper.h"
    30 #include "sun_nio_ch_DevPollArrayWrapper.h"
    31 #include "java_lang_Integer.h"
       
    32 #include <sys/poll.h>
    31 #include <sys/poll.h>
    33 #include <sys/resource.h>
       
    34 #include <unistd.h>
    32 #include <unistd.h>
    35 #include <sys/time.h>
    33 #include <sys/time.h>
    36 
    34 
    37 #ifdef  __cplusplus
    35 #ifdef  __cplusplus
    38 extern "C" {
    36 extern "C" {
   176         return -1;
   174         return -1;
   177     }
   175     }
   178     return result;
   176     return result;
   179 }
   177 }
   180 
   178 
   181 JNIEXPORT jint JNICALL
       
   182 Java_sun_nio_ch_DevPollArrayWrapper_fdLimit(JNIEnv *env, jclass this)
       
   183 {
       
   184     struct rlimit rlp;
       
   185     if (getrlimit(RLIMIT_NOFILE, &rlp) < 0) {
       
   186         JNU_ThrowIOExceptionWithLastError(env,
       
   187                                           "getrlimit failed");
       
   188     }
       
   189     if (rlp.rlim_max < 0 || rlp.rlim_max > java_lang_Integer_MAX_VALUE) {
       
   190         return java_lang_Integer_MAX_VALUE;
       
   191     } else {
       
   192         return (jint)rlp.rlim_max;
       
   193     }
       
   194 }
       
   195 
       
   196 JNIEXPORT void JNICALL
   179 JNIEXPORT void JNICALL
   197 Java_sun_nio_ch_DevPollArrayWrapper_interrupt(JNIEnv *env, jclass this, jint fd)
   180 Java_sun_nio_ch_DevPollArrayWrapper_interrupt(JNIEnv *env, jclass this, jint fd)
   198 {
   181 {
   199     int fakebuf[1];
   182     int fakebuf[1];
   200     fakebuf[0] = 1;
   183     fakebuf[0] = 1;