am ad5dc53f: Merge "Remove EWOULDBLOCK from libcore."
* commit 'ad5dc53fbec2ad25132fb2307c381df1377dc160':
Remove EWOULDBLOCK from libcore.
diff --git a/luni/src/main/java/java/net/PlainSocketImpl.java b/luni/src/main/java/java/net/PlainSocketImpl.java
index 20dfcc2..e247ac3 100644
--- a/luni/src/main/java/java/net/PlainSocketImpl.java
+++ b/luni/src/main/java/java/net/PlainSocketImpl.java
@@ -104,7 +104,7 @@
newImpl.address = peerAddress.getAddress();
newImpl.port = peerAddress.getPort();
} catch (ErrnoException errnoException) {
- if (errnoException.errno == EAGAIN || errnoException.errno == EWOULDBLOCK) {
+ if (errnoException.errno == EAGAIN) {
throw new SocketTimeoutException(errnoException);
}
throw errnoException.rethrowAsSocketException();
diff --git a/luni/src/main/java/libcore/io/IoBridge.java b/luni/src/main/java/libcore/io/IoBridge.java
index f2f60db..089d0f8 100644
--- a/luni/src/main/java/libcore/io/IoBridge.java
+++ b/luni/src/main/java/libcore/io/IoBridge.java
@@ -490,7 +490,7 @@
return 0;
}
} else {
- if (errnoException.errno == EAGAIN || errnoException.errno == EWOULDBLOCK) {
+ if (errnoException.errno == EAGAIN) {
// We were asked to write to a non-blocking socket, but were told
// it would block, so report "no bytes written".
return 0;
@@ -539,7 +539,7 @@
private static int maybeThrowAfterRecvfrom(boolean isRead, boolean isConnected, ErrnoException errnoException) throws SocketException, SocketTimeoutException {
if (isRead) {
- if (errnoException.errno == EAGAIN || errnoException.errno == EWOULDBLOCK) {
+ if (errnoException.errno == EAGAIN) {
return 0;
} else {
throw errnoException.rethrowAsSocketException();
@@ -547,7 +547,7 @@
} else {
if (isConnected && errnoException.errno == ECONNREFUSED) {
throw new PortUnreachableException("", errnoException);
- } else if (errnoException.errno == EAGAIN || errnoException.errno == EWOULDBLOCK) {
+ } else if (errnoException.errno == EAGAIN) {
throw new SocketTimeoutException(errnoException);
} else {
throw errnoException.rethrowAsSocketException();
diff --git a/luni/src/main/java/libcore/io/OsConstants.java b/luni/src/main/java/libcore/io/OsConstants.java
index 78df386..bb5c766 100644
--- a/luni/src/main/java/libcore/io/OsConstants.java
+++ b/luni/src/main/java/libcore/io/OsConstants.java
@@ -134,7 +134,7 @@
public static final int ETIME = placeholder();
public static final int ETIMEDOUT = placeholder();
public static final int ETXTBSY = placeholder();
- public static final int EWOULDBLOCK = placeholder();
+ // On Linux, EWOULDBLOCK == EAGAIN. Use EAGAIN instead, to reduce confusion.
public static final int EXDEV = placeholder();
public static final int EXIT_FAILURE = placeholder();
public static final int EXIT_SUCCESS = placeholder();
@@ -707,9 +707,6 @@
if (errno == ETXTBSY) {
return "ETXTBSY";
}
- if (errno == EWOULDBLOCK) {
- return "EWOULDBLOCK";
- }
if (errno == EXDEV) {
return "EXDEV";
}
diff --git a/luni/src/main/native/libcore_io_OsConstants.cpp b/luni/src/main/native/libcore_io_OsConstants.cpp
index e23fc8b..56a159f 100644
--- a/luni/src/main/native/libcore_io_OsConstants.cpp
+++ b/luni/src/main/native/libcore_io_OsConstants.cpp
@@ -145,7 +145,9 @@
initConstant(env, c, "ETIME", ETIME);
initConstant(env, c, "ETIMEDOUT", ETIMEDOUT);
initConstant(env, c, "ETXTBSY", ETXTBSY);
- initConstant(env, c, "EWOULDBLOCK", EWOULDBLOCK);
+#if EWOULDBLOCK != EAGAIN
+#error EWOULDBLOCK != EAGAIN
+#endif
initConstant(env, c, "EXDEV", EXDEV);
initConstant(env, c, "EXIT_FAILURE", EXIT_FAILURE);
initConstant(env, c, "EXIT_SUCCESS", EXIT_SUCCESS);