8197498: (se) kevent polling should ignore signal interrupt (EINTR)
authorbpb
Mon, 12 Feb 2018 08:19:33 -0800
changeset 48848 81f3a5eaecb0
parent 48847 da4b1106787e
child 48849 64a52906b71f
child 49084 c372651def0e
8197498: (se) kevent polling should ignore signal interrupt (EINTR) 8179307: Java_sun_nio_ch_KQueue_keventPoll throws an exception with "kqueue failed" instead of "kevent poll failed". Reviewed-by: alanb
src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c
--- a/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c	Mon Feb 12 08:19:23 2018 -0800
+++ b/src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c	Mon Feb 12 08:19:33 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "jni_util.h"
 #include "jvm.h"
 #include "jlong.h"
+#include "nio_util.h"
 
 #include <sys/types.h>
 #include <sys/event.h>
@@ -153,15 +154,10 @@
         tsp = NULL;
     }
 
-    result = kevent(kq, NULL, 0, kevs, kevCount, tsp);
-
+    RESTARTABLE(kevent(kq, NULL, 0, kevs, kevCount, tsp), result);
     if (result < 0) {
-        if (errno == EINTR) {
-            // ignore EINTR, pretend nothing was selected
-            result = 0;
-        } else {
-            JNU_ThrowIOExceptionWithLastError(env, "KQueueArrayWrapper: kqueue failed");
-        }
+        JNU_ThrowIOExceptionWithLastError(env,
+            "KQueueArrayWrapper: kevent poll failed");
     }
 
     return result;