Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: runtime/bin/socket_macos.cc

Issue 2515643004: Fuchsia: Partial implementation of dart:io sockets (Closed)
Patch Set: Formatting Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/tests/vm/dart/hello_fuchsia_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_macos.cc
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
index 4d0f53d48d04a7d2a1ceff58bbf83332a4bf4e81..28c9a80786b9cbda5a0b70be956daf72dfb66c91 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -27,7 +27,7 @@
namespace dart {
namespace bin {
-static void SaveErrorAndClose(intptr_t fd) {
+static void FDUtils::SaveErrorAndClose(intptr_t fd) {
int err = errno;
VOID_TEMP_FAILURE_RETRY(close(fd));
errno = err;
@@ -65,11 +65,11 @@ static intptr_t Create(const RawAddr& addr) {
return -1;
}
if (!FDUtils::SetCloseOnExec(fd)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
if (!FDUtils::SetNonBlocking(fd)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
return fd;
@@ -82,7 +82,7 @@ static intptr_t Connect(intptr_t fd, const RawAddr& addr) {
if ((result == 0) || (errno == EINPROGRESS)) {
return fd;
}
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -107,7 +107,7 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
intptr_t result = TEMP_FAILURE_RETRY(
bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr)));
if ((result != 0) && (errno != EINPROGRESS)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -318,7 +318,7 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) {
}
if (!FDUtils::SetCloseOnExec(fd)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -330,12 +330,12 @@ intptr_t Socket::CreateBindDatagram(const RawAddr& addr, bool reuseAddress) {
if (NO_RETRY_EXPECTED(
bind(fd, &addr.addr, SocketAddress::GetAddrLength(addr))) < 0) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
if (!FDUtils::SetNonBlocking(fd)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
return fd;
@@ -409,7 +409,7 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
}
if (!FDUtils::SetCloseOnExec(fd)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -425,7 +425,7 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
if (NO_RETRY_EXPECTED(
bind(fd, &addr.addr, SocketAddress::GetAddrLength(addr))) < 0) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
@@ -435,17 +435,17 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
// Don't close the socket until we have created a new socket, ensuring
// that we do not get the bad port number again.
intptr_t new_fd = CreateBindListen(addr, backlog, v6_only);
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return new_fd;
}
if (NO_RETRY_EXPECTED(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
if (!FDUtils::SetNonBlocking(fd)) {
- SaveErrorAndClose(fd);
+ FDUtils::SaveErrorAndClose(fd);
return -1;
}
return fd;
@@ -473,11 +473,11 @@ intptr_t ServerSocket::Accept(intptr_t fd) {
}
} else {
if (!FDUtils::SetCloseOnExec(socket)) {
- SaveErrorAndClose(socket);
+ FDUtils::SaveErrorAndClose(socket);
return -1;
}
if (!FDUtils::SetNonBlocking(socket)) {
- SaveErrorAndClose(socket);
+ FDUtils::SaveErrorAndClose(socket);
return -1;
}
}
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/tests/vm/dart/hello_fuchsia_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698