Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-25 Thread Chris Hegarty
Alan, On 25/05/18 12:27, Alan Bateman wrote: On 24/05/2018 21:57, Ivan Gerasimov wrote: .. WEBREV: http://cr.openjdk.java.net/~igerasim/8203369/00/webrev/ The changes in 01/webrev look okay to me but I'm curious if there are any ports in OpenJDK where the values are different. HPUX 11.31 (

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-25 Thread Alan Bateman
On 24/05/2018 21:57, Ivan Gerasimov wrote: Hello! On Unix systems several system calls (including pread, read, readv, recvfrom, recvmsg, send, sendfile, sendmsg, sendto) may set errno to either EAGAIN or EWOULDBLOCK on the same condition. On Linux these two constants are the same, but they

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-25 Thread David Holmes
On 25/05/2018 4:14 PM, Ivan Gerasimov wrote: Hi David! If gcc, then we already have the same test for both constants in code with no issues. For example, java.base/unix/native/libnet/SocketInputStream.c, in NET_ReadWithTimeout(): result = NET_NonBlockingRead(fd, bufP, len);

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-25 Thread Ivan Gerasimov
On 5/24/18 10:25 PM, Weijun Wang wrote: https://stackoverflow.com/questions/27509061/macro-to-avoid-duplicate-case-value Someone has already used them in a switch expression... Interesting! I like the very first solution: #if EAGAIN != EWOULDBLOCK case EAGAIN: #endif case

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-25 Thread Ivan Gerasimov
Hi David! If gcc, then we already have the same test for both constants in code with no issues. For example, java.base/unix/native/libnet/SocketInputStream.c, in NET_ReadWithTimeout(): result = NET_NonBlockingRead(fd, bufP, len); if (result == -1 && ((errno == EAGAIN) ||

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-25 Thread vyom tewari
On Friday 25 May 2018 11:19 AM, Ivan Gerasimov wrote: Hi Wiijun! On 5/24/18 10:13 PM, Weijun Wang wrote: On May 25, 2018, at 11:58 AM, Ivan Gerasimov wrote: I also wonder whether a smart compiler might not flag code where the errors do infact have the same

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread Ivan Gerasimov
Hi Wiijun! On 5/24/18 10:13 PM, Weijun Wang wrote: On May 25, 2018, at 11:58 AM, Ivan Gerasimov wrote: I also wonder whether a smart compiler might not flag code where the errors do infact have the same value: if (errno == 11 || errno == 11) ... At least gcc

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread David Holmes
On 25/05/2018 3:34 PM, Ivan Gerasimov wrote: Hi David! On 5/24/18 9:45 PM, David Holmes wrote: I looked but did not review - it was just an observation :) Well, thank you anyway :) It seems pointless to double up these condition checks everywhere just in case there is some platform

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread Ivan Gerasimov
Hi David! On 5/24/18 9:45 PM, David Holmes wrote: I looked but did not review - it was just an observation :) Well, thank you anyway :) It seems pointless to double up these condition checks everywhere just in case there is some platform (do we know of one?) where this may be

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread Weijun Wang
https://stackoverflow.com/questions/27509061/macro-to-avoid-duplicate-case-value Someone has already used them in a switch expression... > On May 25, 2018, at 12:45 PM, David Holmes wrote: > >>> I also wonder whether a smart compiler might not flag code where the

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread Weijun Wang
> On May 25, 2018, at 11:58 AM, Ivan Gerasimov > wrote: > >> I also wonder whether a smart compiler might not flag code where the errors >> do infact have the same value: >> >> if (errno == 11 || errno == 11) ... >> > At least gcc -O completely removes the second

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread David Holmes
Hi Ivan, On 25/05/2018 1:58 PM, Ivan Gerasimov wrote: Hi David! Thank you for reviewing the fix! I looked but did not review - it was just an observation :) On 5/24/18 7:44 PM, David Holmes wrote: Hi Ivan, Just a thought, but just because the actual native function may return either

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread Ivan Gerasimov
Hi David! Thank you for reviewing the fix! On 5/24/18 7:44 PM, David Holmes wrote: Hi Ivan, Just a thought, but just because the actual native function may return either code, that doesn't mean our native wrapper can't treat them the same and present them to the Java code as one error?

Re: RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes

2018-05-24 Thread David Holmes
Hi Ivan, Just a thought, but just because the actual native function may return either code, that doesn't mean our native wrapper can't treat them the same and present them to the Java code as one error? It seems pointless to double up these condition checks everywhere just in case there is