| 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_OPENBSD) |
| 7 | 7 |
| 8 #include <sys/socket.h> // NOLINT |
| 8 #include <errno.h> // NOLINT | 9 #include <errno.h> // NOLINT |
| 9 #include <stdio.h> // NOLINT | 10 #include <stdio.h> // NOLINT |
| 10 #include <stdlib.h> // NOLINT | 11 #include <stdlib.h> // NOLINT |
| 11 #include <string.h> // NOLINT | 12 #include <string.h> // NOLINT |
| 12 #include <sys/stat.h> // NOLINT | 13 #include <sys/stat.h> // NOLINT |
| 13 #include <unistd.h> // NOLINT | 14 #include <unistd.h> // NOLINT |
| 14 #include <net/if.h> // NOLINT | 15 #include <net/if.h> // NOLINT |
| 15 #include <netinet/tcp.h> // NOLINT | 16 #include <netinet/tcp.h> // NOLINT |
| 16 #include <ifaddrs.h> // NOLINT | 17 #include <ifaddrs.h> // NOLINT |
| 17 | 18 |
| 18 #include "bin/fdutils.h" | 19 #include "bin/fdutils.h" |
| 19 #include "bin/file.h" | 20 #include "bin/file.h" |
| 20 #include "bin/socket.h" | 21 #include "bin/socket.h" |
| 22 #include "bin/socket_openbsd.h" |
| 21 | 23 |
| 22 #include "platform/signal_blocker.h" | 24 #include "platform/signal_blocker.h" |
| 23 | 25 |
| 24 | 26 |
| 25 namespace dart { | 27 namespace dart { |
| 26 namespace bin { | 28 namespace bin { |
| 27 | 29 |
| 28 SocketAddress::SocketAddress(struct sockaddr* sa) { | 30 SocketAddress::SocketAddress(struct sockaddr* sa) { |
| 29 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN); | 31 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN); |
| 30 if (!Socket::FormatNumericAddress( | 32 if (!Socket::FormatNumericAddress( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 NULL, | 47 NULL, |
| 46 0, | 48 0, |
| 47 NI_NUMERICHOST)) != 0) { | 49 NI_NUMERICHOST)) != 0) { |
| 48 return false; | 50 return false; |
| 49 } | 51 } |
| 50 return true; | 52 return true; |
| 51 } | 53 } |
| 52 | 54 |
| 53 | 55 |
| 54 bool Socket::Initialize() { | 56 bool Socket::Initialize() { |
| 55 // Nothing to do on Mac OS. | 57 // Nothing to do on OpenBSD. |
| 56 return true; | 58 return true; |
| 57 } | 59 } |
| 58 | 60 |
| 59 | 61 |
| 60 static intptr_t Create(const RawAddr& addr) { | 62 static intptr_t Create(const RawAddr& addr) { |
| 61 intptr_t fd; | 63 intptr_t fd; |
| 62 fd = NO_RETRY_EXPECTED(socket(addr.ss.ss_family, SOCK_STREAM, 0)); | 64 fd = NO_RETRY_EXPECTED(socket(addr.ss.ss_family, SOCK_STREAM, 0)); |
| 63 if (fd < 0) { | 65 if (fd < 0) { |
| 64 return -1; | 66 return -1; |
| 65 } | 67 } |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 bool Socket::LeaveMulticast(intptr_t fd, | 612 bool Socket::LeaveMulticast(intptr_t fd, |
| 611 const RawAddr& addr, | 613 const RawAddr& addr, |
| 612 const RawAddr& interface, | 614 const RawAddr& interface, |
| 613 int interfaceIndex) { | 615 int interfaceIndex) { |
| 614 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); | 616 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); |
| 615 } | 617 } |
| 616 | 618 |
| 617 } // namespace bin | 619 } // namespace bin |
| 618 } // namespace dart | 620 } // namespace dart |
| 619 | 621 |
| 620 #endif // defined(TARGET_OS_MACOS) | 622 #endif // defined(TARGET_OS_OPENBSD) |
| OLD | NEW |