Index: runtime/bin/socket_base_linux.cc |
diff --git a/runtime/bin/socket_base_linux.cc b/runtime/bin/socket_base_linux.cc |
index 7e60cf338f85ba6296bf6e72ac86e746ad959d19..d10f8f423519f55330ae2b4f86d5fc695e7219a2 100644 |
--- a/runtime/bin/socket_base_linux.cc |
+++ b/runtime/bin/socket_base_linux.cc |
@@ -38,13 +38,11 @@ SocketAddress::SocketAddress(struct sockaddr* sa) { |
memmove(reinterpret_cast<void*>(&addr_), sa, salen); |
} |
- |
bool SocketBase::Initialize() { |
// Nothing to do on Linux. |
return true; |
} |
- |
bool SocketBase::FormatNumericAddress(const RawAddr& addr, |
char* address, |
int len) { |
@@ -53,18 +51,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, |
@@ -80,7 +75,6 @@ intptr_t SocketBase::Read(intptr_t fd, |
return read_bytes; |
} |
- |
intptr_t SocketBase::RecvFrom(intptr_t fd, |
void* buffer, |
intptr_t num_bytes, |
@@ -98,7 +92,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, |
@@ -114,7 +107,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, |
@@ -133,7 +125,6 @@ intptr_t SocketBase::SendTo(intptr_t fd, |
return written_bytes; |
} |
- |
intptr_t SocketBase::GetPort(intptr_t fd) { |
ASSERT(fd >= 0); |
RawAddr raw; |
@@ -144,7 +135,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; |
@@ -156,7 +146,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); |
int err = 0; |
@@ -166,7 +155,6 @@ void SocketBase::GetError(intptr_t fd, OSError* os_error) { |
os_error->SetCodeAndMessage(OSError::kSystem, errno); |
} |
- |
int SocketBase::GetType(intptr_t fd) { |
struct stat64 buf; |
int result = TEMP_FAILURE_RETRY(fstat64(fd, &buf)); |
@@ -185,12 +173,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) { |
@@ -233,7 +219,6 @@ AddressList<SocketAddress>* SocketBase::LookupAddress(const char* host, |
return addresses; |
} |
- |
bool SocketBase::ReverseLookup(const RawAddr& addr, |
char* host, |
intptr_t host_len, |
@@ -251,7 +236,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) { |
@@ -264,7 +248,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. |
@@ -276,12 +259,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) { |
@@ -320,13 +301,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); |
@@ -338,7 +317,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, |
@@ -346,7 +324,6 @@ bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) { |
sizeof(on))) == 0; |
} |
- |
bool SocketBase::GetMulticastLoop(intptr_t fd, |
intptr_t protocol, |
bool* enabled) { |
@@ -363,7 +340,6 @@ bool SocketBase::GetMulticastLoop(intptr_t fd, |
return false; |
} |
- |
bool SocketBase::SetMulticastLoop(intptr_t fd, |
intptr_t protocol, |
bool enabled) { |
@@ -376,7 +352,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); |
@@ -391,7 +366,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; |
@@ -401,7 +375,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); |
@@ -413,7 +386,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, |
@@ -421,7 +393,6 @@ bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) { |
sizeof(on))) == 0; |
} |
- |
bool SocketBase::JoinMulticast(intptr_t fd, |
const RawAddr& addr, |
const RawAddr&, |
@@ -434,7 +405,6 @@ bool SocketBase::JoinMulticast(intptr_t fd, |
setsockopt(fd, proto, MCAST_JOIN_GROUP, &mreq, sizeof(mreq))) == 0; |
} |
- |
bool SocketBase::LeaveMulticast(intptr_t fd, |
const RawAddr& addr, |
const RawAddr&, |