RFR 8203369 : Check for both EAGAIN and EWOULDBLOCK error codes (original) (raw)

vyom tewari vyom.tewari at oracle.com
Fri May 25 06:09:46 UTC 2018


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 <ivan.gerasimov at oracle.com> 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 redundant test, so no observable changes is expected on supported platforms. And it silently compiles without showing any warning, right? Good if yes. --Max Yep, all is good. I've built/tested the patched JDK on all supported platforms with no issues. And we already have places, where both EAGAIN and EWOULDBLOCK are used in one if clause (as I just replied to David): java.base/unix/native/libnet/SocketInputStream.c, in NETReadWithTimeout(): result = NETNonBlockingRead(fd, bufP, len); if (result == -1 && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) {

i  wrote this code and that time even i wanted to fix the other native code (check error code for both EAGAIN & EWOULDBLOCK)  as you did ,but i did not . So the fix basically proposes to use this approach consistently. we can at least fix the native part of code.

Vyom

With kind regards, Ivan



More information about the core-libs-dev mailing list