gh-92658: AF_HYPERV is only supported on Windows (#93192)

Only build the AF_HYPERV support on Windows for the _socket extension.
FreeBSD defines the AF_HYPERV macro but doesn't have the SOCKADDR_HV
type.
This commit is contained in:
Victor Stinner 2022-05-25 04:44:57 +02:00 committed by GitHub
parent ac1dcb8ee7
commit 08e4e887f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View file

@ -249,6 +249,11 @@ typedef int SOCKET_T;
#define PyLong_AsSocket_t(fd) (SOCKET_T)PyLong_AsLongLong(fd)
#endif
// AF_HYPERV is only supported on Windows
#if defined(AF_HYPERV) && defined(MS_WINDOWS)
# define HAVE_AF_HYPERV
#endif
/* Socket address */
typedef union sock_addr {
struct sockaddr_in in;
@ -297,7 +302,7 @@ typedef union sock_addr {
#ifdef HAVE_LINUX_TIPC_H
struct sockaddr_tipc tipc;
#endif
#ifdef AF_HYPERV
#ifdef HAVE_AF_HYPERV
SOCKADDR_HV hv;
#endif
} sock_addr_t;