| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
| 9 #include <stdio.h> // NOLINT | 9 #include <stdio.h> // NOLINT |
| 10 #include <stdlib.h> // NOLINT | 10 #include <stdlib.h> // NOLINT |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 intptr_t fd; | 305 intptr_t fd; |
| 306 | 306 |
| 307 fd = TEMP_FAILURE_RETRY( | 307 fd = TEMP_FAILURE_RETRY( |
| 308 socket(addr->addr.sa_family, SOCK_DGRAM, IPPROTO_UDP)); | 308 socket(addr->addr.sa_family, SOCK_DGRAM, IPPROTO_UDP)); |
| 309 if (fd < 0) return -1; | 309 if (fd < 0) return -1; |
| 310 | 310 |
| 311 FDUtils::SetCloseOnExec(fd); | 311 FDUtils::SetCloseOnExec(fd); |
| 312 | 312 |
| 313 if (reuseAddress) { | 313 if (reuseAddress) { |
| 314 int optval = 1; | 314 int optval = 1; |
| 315 TEMP_FAILURE_RETRY( | 315 VOID_TEMP_FAILURE_RETRY( |
| 316 setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))); | 316 setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))); |
| 317 } | 317 } |
| 318 | 318 |
| 319 SocketAddress::SetAddrPort(addr, port); | 319 SocketAddress::SetAddrPort(addr, port); |
| 320 if (TEMP_FAILURE_RETRY( | 320 if (TEMP_FAILURE_RETRY( |
| 321 bind(fd, | 321 bind(fd, |
| 322 &addr->addr, | 322 &addr->addr, |
| 323 SocketAddress::GetAddrLength(addr))) < 0) { | 323 SocketAddress::GetAddrLength(addr))) < 0) { |
| 324 TEMP_FAILURE_RETRY(close(fd)); | 324 VOID_TEMP_FAILURE_RETRY(close(fd)); |
| 325 return -1; | 325 return -1; |
| 326 } | 326 } |
| 327 | 327 |
| 328 Socket::SetNonBlocking(fd); | 328 Socket::SetNonBlocking(fd); |
| 329 return fd; | 329 return fd; |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { | 333 static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) { |
| 334 if (ifa->ifa_addr == NULL) { | 334 if (ifa->ifa_addr == NULL) { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 654 |
| 655 bool Socket::LeaveMulticast( | 655 bool Socket::LeaveMulticast( |
| 656 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { | 656 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { |
| 657 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); | 657 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); |
| 658 } | 658 } |
| 659 | 659 |
| 660 } // namespace bin | 660 } // namespace bin |
| 661 } // namespace dart | 661 } // namespace dart |
| 662 | 662 |
| 663 #endif // defined(TARGET_OS_MACOS) | 663 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |