--- a/jdk/src/solaris/native/sun/nio/ch/Net.c Thu Oct 04 10:04:56 2012 -0700
+++ b/jdk/src/solaris/native/sun/nio/ch/Net.c Thu Oct 04 19:53:08 2012 +0100
@@ -38,6 +38,7 @@
#include "net_util_md.h"
#include "nio_util.h"
#include "nio.h"
+#include "sun_nio_ch_PollArrayWrapper.h"
#ifdef _ALLBSD_SOURCE
@@ -627,6 +628,26 @@
handleSocketError(env, errno);
}
+JNIEXPORT jint JNICALL
+Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlong timeout)
+{
+ struct pollfd pfd;
+ int rv;
+ pfd.fd = fdval(env, fdo);
+ pfd.events = events;
+ rv = poll(&pfd, 1, timeout);
+
+ if (rv >= 0) {
+ return pfd.revents;
+ } else if (errno == EINTR) {
+ return IOS_INTERRUPTED;
+ } else if (rv < 0) {
+ handleSocketError(env, errno);
+ return IOS_THROWN;
+ }
+}
+
+
/* Declared in nio_util.h */
jint