net/SocketDescriptor: SO_PROTOCOL is really Linux-specific

This commit is contained in:
Max Kellermann 2023-11-25 23:03:29 +01:00
parent f757dfdc4f
commit 0dfd7e3d8c
2 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ SocketDescriptor::IsStream() const noexcept
return GetType() == SOCK_STREAM; return GetType() == SOCK_STREAM;
} }
#ifndef _WIN32 #ifdef __linux__
int int
SocketDescriptor::GetProtocol() const noexcept SocketDescriptor::GetProtocol() const noexcept
@ -40,7 +40,7 @@ SocketDescriptor::GetProtocol() const noexcept
return GetIntOption(SOL_SOCKET, SO_PROTOCOL, -1); return GetIntOption(SOL_SOCKET, SO_PROTOCOL, -1);
} }
#endif // !_WIN32 #endif // __linux__
#ifdef _WIN32 #ifdef _WIN32

View File

@ -101,14 +101,14 @@ public:
[[gnu::pure]] [[gnu::pure]]
bool IsStream() const noexcept; bool IsStream() const noexcept;
#ifndef _WIN32 #ifdef __linux__
/** /**
* Determine the socket protocol (SO_PROTOCOL), * Determine the socket protocol (SO_PROTOCOL),
* e.g. IPPROTO_SCTP. Returns -1 on error. * e.g. IPPROTO_SCTP. Returns -1 on error.
*/ */
[[gnu::pure]] [[gnu::pure]]
int GetProtocol() const noexcept; int GetProtocol() const noexcept;
#endif // !_WIN32 #endif // __linux__
static constexpr SocketDescriptor Undefined() noexcept { static constexpr SocketDescriptor Undefined() noexcept {
#ifdef _WIN32 #ifdef _WIN32