From 08e4e887f2d4650972272b2f4441485f3e1e9aab Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 25 May 2022 04:44:57 +0200 Subject: 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. --- Modules/socketmodule.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Modules/socketmodule.h') diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index 66d9ccf24e..f31ba532a6 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -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; -- cgit v1.2.1