summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-25 04:44:57 +0200
committerGitHub <noreply@github.com>2022-05-25 04:44:57 +0200
commit08e4e887f2d4650972272b2f4441485f3e1e9aab (patch)
tree14594e7645b5241947b510a672aed3de3f1f34e8 /Modules/socketmodule.h
parentac1dcb8ee7745561407130bb917de3277528d4f6 (diff)
downloadcpython-git-08e4e887f2d4650972272b2f4441485f3e1e9aab.tar.gz
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.
Diffstat (limited to 'Modules/socketmodule.h')
-rw-r--r--Modules/socketmodule.h7
1 files changed, 6 insertions, 1 deletions
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;