diff options
author | Bin Meng <bin.meng@windriver.com> | 2022-08-02 15:51:58 +0800 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2022-09-02 15:54:46 +0400 |
commit | d409373b9d0482bbce312539d02a648cbb1c790a (patch) | |
tree | cb47b4d4406aae190c2e9a932f40f52fb414fe3f /include/sysemu/os-win32.h | |
parent | 93fac696d241dccb04ebb9d23da55fc1e9d8ee36 (diff) |
util/qemu-sockets: Enable unix socket support on Windows
Support for the unix socket has existed both in BSD and Linux for the
longest time, but not on Windows. Since Windows 10 build 17063 [1],
the native support for the unix socket has come to Windows. Starting
this build, two Win32 processes can use the AF_UNIX address family
over Winsock API to communicate with each other.
[1] https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
Signed-off-by: Xuzhou Cheng <xuzhou.cheng@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220802075200.907360-3-bmeng.cn@gmail.com>
Diffstat (limited to 'include/sysemu/os-win32.h')
-rw-r--r-- | include/sysemu/os-win32.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index edc3b38a57..5b38c7bd04 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -30,6 +30,23 @@ #include <windows.h> #include <ws2tcpip.h> +#ifdef HAVE_AFUNIX_H +#include <afunix.h> +#else +/* + * Fallback definitions of things we need in afunix.h, if not available from + * the used Windows SDK or MinGW headers. + */ +#define UNIX_PATH_MAX 108 + +typedef struct sockaddr_un { + ADDRESS_FAMILY sun_family; + char sun_path[UNIX_PATH_MAX]; +} SOCKADDR_UN, *PSOCKADDR_UN; + +#define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256) +#endif + #ifdef __cplusplus extern "C" { #endif |