| Index: runtime/bin/socket_base_macos.cc
|
| diff --git a/runtime/bin/socket_base_macos.cc b/runtime/bin/socket_base_macos.cc
|
| index d8e423b408f06ef198d9f7bbd3f8715e3f045810..473e651cae545e62d31a502054ecdcb7b5b37877 100644
|
| --- a/runtime/bin/socket_base_macos.cc
|
| +++ b/runtime/bin/socket_base_macos.cc
|
| @@ -37,13 +37,11 @@ SocketAddress::SocketAddress(struct sockaddr* sa) {
|
| memmove(reinterpret_cast<void*>(&addr_), sa, salen);
|
| }
|
|
|
| -
|
| bool SocketBase::Initialize() {
|
| // Nothing to do on Mac OS.
|
| return true;
|
| }
|
|
|
| -
|
| bool SocketBase::FormatNumericAddress(const RawAddr& addr,
|
| char* address,
|
| int len) {
|
| @@ -52,18 +50,15 @@ bool SocketBase::FormatNumericAddress(const RawAddr& addr,
|
| 0, NI_NUMERICHOST)) == 0);
|
| }
|
|
|
| -
|
| bool SocketBase::IsBindError(intptr_t error_number) {
|
| return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
|
| error_number == EINVAL;
|
| }
|
|
|
| -
|
| intptr_t SocketBase::Available(intptr_t fd) {
|
| return FDUtils::AvailableBytes(fd);
|
| }
|
|
|
| -
|
| intptr_t SocketBase::Read(intptr_t fd,
|
| void* buffer,
|
| intptr_t num_bytes,
|
| @@ -79,7 +74,6 @@ intptr_t SocketBase::Read(intptr_t fd,
|
| return read_bytes;
|
| }
|
|
|
| -
|
| intptr_t SocketBase::RecvFrom(intptr_t fd,
|
| void* buffer,
|
| intptr_t num_bytes,
|
| @@ -97,7 +91,6 @@ intptr_t SocketBase::RecvFrom(intptr_t fd,
|
| return read_bytes;
|
| }
|
|
|
| -
|
| intptr_t SocketBase::Write(intptr_t fd,
|
| const void* buffer,
|
| intptr_t num_bytes,
|
| @@ -113,7 +106,6 @@ intptr_t SocketBase::Write(intptr_t fd,
|
| return written_bytes;
|
| }
|
|
|
| -
|
| intptr_t SocketBase::SendTo(intptr_t fd,
|
| const void* buffer,
|
| intptr_t num_bytes,
|
| @@ -132,7 +124,6 @@ intptr_t SocketBase::SendTo(intptr_t fd,
|
| return written_bytes;
|
| }
|
|
|
| -
|
| intptr_t SocketBase::GetPort(intptr_t fd) {
|
| ASSERT(fd >= 0);
|
| RawAddr raw;
|
| @@ -143,7 +134,6 @@ intptr_t SocketBase::GetPort(intptr_t fd) {
|
| return SocketAddress::GetAddrPort(raw);
|
| }
|
|
|
| -
|
| SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) {
|
| ASSERT(fd >= 0);
|
| RawAddr raw;
|
| @@ -155,7 +145,6 @@ SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) {
|
| return new SocketAddress(&raw.addr);
|
| }
|
|
|
| -
|
| void SocketBase::GetError(intptr_t fd, OSError* os_error) {
|
| int len = sizeof(errno);
|
| getsockopt(fd, SOL_SOCKET, SO_ERROR, &errno,
|
| @@ -163,7 +152,6 @@ void SocketBase::GetError(intptr_t fd, OSError* os_error) {
|
| os_error->SetCodeAndMessage(OSError::kSystem, errno);
|
| }
|
|
|
| -
|
| int SocketBase::GetType(intptr_t fd) {
|
| struct stat buf;
|
| int result = fstat(fd, &buf);
|
| @@ -182,12 +170,10 @@ int SocketBase::GetType(intptr_t fd) {
|
| return File::kOther;
|
| }
|
|
|
| -
|
| intptr_t SocketBase::GetStdioHandle(intptr_t num) {
|
| return num;
|
| }
|
|
|
| -
|
| AddressList<SocketAddress>* SocketBase::LookupAddress(const char* host,
|
| int type,
|
| OSError** os_error) {
|
| @@ -224,7 +210,6 @@ AddressList<SocketAddress>* SocketBase::LookupAddress(const char* host,
|
| return addresses;
|
| }
|
|
|
| -
|
| bool SocketBase::ReverseLookup(const RawAddr& addr,
|
| char* host,
|
| intptr_t host_len,
|
| @@ -242,7 +227,6 @@ bool SocketBase::ReverseLookup(const RawAddr& addr,
|
| return true;
|
| }
|
|
|
| -
|
| bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) {
|
| int result;
|
| if (type == SocketAddress::TYPE_IPV4) {
|
| @@ -254,7 +238,6 @@ bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) {
|
| return (result == 1);
|
| }
|
|
|
| -
|
| static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) {
|
| if (ifa->ifa_addr == NULL) {
|
| // OpenVPN's virtual device tun0.
|
| @@ -266,12 +249,10 @@ static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) {
|
| ((family == AF_INET) || (family == AF_INET6))));
|
| }
|
|
|
| -
|
| bool SocketBase::ListInterfacesSupported() {
|
| return true;
|
| }
|
|
|
| -
|
| AddressList<InterfaceSocketAddress>* SocketBase::ListInterfaces(
|
| int type,
|
| OSError** os_error) {
|
| @@ -310,13 +291,11 @@ AddressList<InterfaceSocketAddress>* SocketBase::ListInterfaces(
|
| return addresses;
|
| }
|
|
|
| -
|
| void SocketBase::Close(intptr_t fd) {
|
| ASSERT(fd >= 0);
|
| VOID_TEMP_FAILURE_RETRY(close(fd));
|
| }
|
|
|
| -
|
| bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) {
|
| int on;
|
| socklen_t len = sizeof(on);
|
| @@ -328,7 +307,6 @@ bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) {
|
| return (err == 0);
|
| }
|
|
|
| -
|
| bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) {
|
| int on = enabled ? 1 : 0;
|
| return NO_RETRY_EXPECTED(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
|
| @@ -336,7 +314,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) {
|
| sizeof(on))) == 0;
|
| }
|
|
|
| -
|
| bool SocketBase::GetMulticastLoop(intptr_t fd,
|
| intptr_t protocol,
|
| bool* enabled) {
|
| @@ -353,7 +330,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd,
|
| return false;
|
| }
|
|
|
| -
|
| bool SocketBase::SetMulticastLoop(intptr_t fd,
|
| intptr_t protocol,
|
| bool enabled) {
|
| @@ -366,7 +342,6 @@ bool SocketBase::SetMulticastLoop(intptr_t fd,
|
| 0;
|
| }
|
|
|
| -
|
| bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) {
|
| uint8_t v;
|
| socklen_t len = sizeof(v);
|
| @@ -381,7 +356,6 @@ bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) {
|
| return false;
|
| }
|
|
|
| -
|
| bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) {
|
| int v = value;
|
| int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6;
|
| @@ -391,7 +365,6 @@ bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) {
|
| fd, level, optname, reinterpret_cast<char*>(&v), sizeof(v))) == 0;
|
| }
|
|
|
| -
|
| bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) {
|
| int on;
|
| socklen_t len = sizeof(on);
|
| @@ -403,7 +376,6 @@ bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) {
|
| return (err == 0);
|
| }
|
|
|
| -
|
| bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) {
|
| int on = enabled ? 1 : 0;
|
| return NO_RETRY_EXPECTED(setsockopt(fd, SOL_SOCKET, SO_BROADCAST,
|
| @@ -411,7 +383,6 @@ bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) {
|
| sizeof(on))) == 0;
|
| }
|
|
|
| -
|
| static bool JoinOrLeaveMulticast(intptr_t fd,
|
| const RawAddr& addr,
|
| const RawAddr& interface,
|
| @@ -454,7 +425,6 @@ bool SocketBase::JoinMulticast(intptr_t fd,
|
| return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, true);
|
| }
|
|
|
| -
|
| bool SocketBase::LeaveMulticast(intptr_t fd,
|
| const RawAddr& addr,
|
| const RawAddr& interface,
|
|
|