equal
deleted
inserted
replaced
29 #include "jlong.h" |
29 #include "jlong.h" |
30 |
30 |
31 #include "sun_nio_ch_EPollArrayWrapper.h" |
31 #include "sun_nio_ch_EPollArrayWrapper.h" |
32 |
32 |
33 #include <unistd.h> |
33 #include <unistd.h> |
34 #include <sys/resource.h> |
|
35 #include <sys/time.h> |
34 #include <sys/time.h> |
36 #include <sys/epoll.h> |
35 #include <sys/epoll.h> |
37 |
36 |
38 #define RESTARTABLE(_cmd, _result) do { \ |
37 #define RESTARTABLE(_cmd, _result) do { \ |
39 do { \ |
38 do { \ |
87 int epfd = epoll_create(256); |
86 int epfd = epoll_create(256); |
88 if (epfd < 0) { |
87 if (epfd < 0) { |
89 JNU_ThrowIOExceptionWithLastError(env, "epoll_create failed"); |
88 JNU_ThrowIOExceptionWithLastError(env, "epoll_create failed"); |
90 } |
89 } |
91 return epfd; |
90 return epfd; |
92 } |
|
93 |
|
94 JNIEXPORT jint JNICALL |
|
95 Java_sun_nio_ch_EPollArrayWrapper_fdLimit(JNIEnv *env, jclass this) |
|
96 { |
|
97 struct rlimit rlp; |
|
98 if (getrlimit(RLIMIT_NOFILE, &rlp) < 0) { |
|
99 JNU_ThrowIOExceptionWithLastError(env, "getrlimit failed"); |
|
100 } |
|
101 return (jint)rlp.rlim_max; |
|
102 } |
91 } |
103 |
92 |
104 JNIEXPORT jint JNICALL |
93 JNIEXPORT jint JNICALL |
105 Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent(JNIEnv* env, jclass this) |
94 Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent(JNIEnv* env, jclass this) |
106 { |
95 { |