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

Unified Diff: runtime/bin/socket_macos.cc

Issue 1293533002: DO NOT SUBMIT: Unix domain sockets. From CL 1061283003. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Added Mac OS fix Created 5 years, 4 months 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_macos.h ('k') | runtime/bin/socket_patch.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 205793bc11689161d110091970eb11f8c7faff9f..83517908a1a5e837e9fe31c024fd6ddea6b75186 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -109,6 +109,22 @@ intptr_t Socket::CreateBindConnect(const RawAddr& addr,
}
+intptr_t Socket::CreateConnectUnix(const RawAddr& addr) {
+ intptr_t fd = Create(addr);
+ if (fd < 0) {
+ return fd;
+ }
+
+ intptr_t result = TEMP_FAILURE_RETRY(
+ connect(fd, &addr.addr, sizeof(struct sockaddr_un)));
+ if (result == 0 || errno == EINPROGRESS) {
+ return fd;
+ }
+ VOID_TEMP_FAILURE_RETRY(close(fd));
+ return -1;
+}
+
+
intptr_t Socket::Available(intptr_t fd) {
return FDUtils::AvailableBytes(fd);
}
@@ -416,6 +432,32 @@ intptr_t ServerSocket::CreateBindListen(const RawAddr& addr,
}
+intptr_t ServerSocket::CreateBindListenUnix(const RawAddr& addr,
+ intptr_t backlog) {
+ intptr_t fd;
+
+ fd = NO_RETRY_EXPECTED(
+ socket(addr.ss.ss_family, SOCK_STREAM, 0));
+ if (fd < 0) return -1;
+
+ FDUtils::SetCloseOnExec(fd);
+
+ if (NO_RETRY_EXPECTED(
+ bind(fd, &addr.addr, sizeof(struct sockaddr_un))) < 0) {
+ VOID_TEMP_FAILURE_RETRY(close(fd));
+ return -1;
+ }
+
+ if (NO_RETRY_EXPECTED(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) {
+ VOID_TEMP_FAILURE_RETRY(close(fd));
+ return -1;
+ }
+
+ FDUtils::SetNonBlocking(fd);
+ return fd;
+}
+
+
bool ServerSocket::StartAccept(intptr_t fd) {
USE(fd);
return true;
« no previous file with comments | « runtime/bin/socket_macos.h ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698