changeset 14367:5dd02e390cf8

8153192: (se) Selector.select(long) uses wrong timeout after EINTR (lnx) Summary: Pass what remains of the initial timeout to epoll_wait(2) (Linux) and ioctl(7d) (Solaris) instead of the original un-decremented timeout value. Reviewed-by: alanb, rriggs
author bpb
date Wed, 04 May 2016 08:04:22 -0700
parents 40832198b160
children 832e924b2ff8
files src/java.base/linux/native/libnio/ch/EPollArrayWrapper.c src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/linux/native/libnio/ch/EPollArrayWrapper.c	Wed May 04 16:55:03 2016 +0200
+++ b/src/java.base/linux/native/libnio/ch/EPollArrayWrapper.c	Wed May 04 08:04:22 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -53,7 +53,7 @@
     start = t.tv_sec * 1000 + t.tv_usec / 1000;
 
     for (;;) {
-        int res = epoll_wait(epfd, events, numfds, timeout);
+        int res = epoll_wait(epfd, events, numfds, remaining);
         if (res < 0 && errno == EINTR) {
             if (remaining >= 0) {
                 gettimeofday(&t, NULL);
--- a/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c	Wed May 04 16:55:03 2016 +0200
+++ b/src/java.base/solaris/native/libnio/ch/DevPollArrayWrapper.c	Wed May 04 08:04:22 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
@@ -94,6 +94,7 @@
                     return 0;
                 }
                 start = now;
+                a.dp_timeout = remaining;
             }
         } else {
             return res;