Enable unix socket support on Windows
v3 cover 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/
Changes in v3:
- drop patch "util/oslib-win32: Add a helper to get the Windows version"
- drop patch "qga/commands-win32: Use os_get_win_version()"
- drop the run-time check afunix_available()
Changes in v2:
- move #include <afunix.h> to os-win32.h
- define WIN_BUILD_AF_UNIX only when CONFIG_WIN32
- drop #include <afunix.h> as it is now already included in osdep.h
- new patch: tests/unit: Update test-io-channel-socket.c for Windows
Bin Meng (4):
util/qemu-sockets: Replace the call to close a socket with
closesocket()
util/qemu-sockets: Enable unix socket support on Windows chardev/char-socket: Update AF_UNIX for Windows tests/unit: Update test-io-channel-socket.c for Windows
meson.build | 6 ++++++ include/sysemu/os-win32.h | 4 ++++ chardev/char-socket.c | 4 +++- tests/unit/test-io-channel-socket.c | 16 ++++++++++++++-- util/qemu-sockets.c | 18 +++++++++--------- 5 files changed, 36 insertions(+), 12 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/4 util/qemu-sockets: Replace the call to close a socket with closesocket()
From: Bin Meng <[email protected]>
close() is a *nix function. It works on any file descriptor, and sockets in *nix are an example of a file descriptor.
closesocket() is a Windows-specific function, which works only specifically with sockets. Sockets on Windows do not use *nix-style file descriptors, and socket() returns a handle to a kernel object instead, so it must be closed with closesocket().
In QEMU there is already a logic to handle such platform difference in os-posix.h and os-win32.h, that:
* closesocket maps to close on POSIX
* closesocket maps to a wrapper that calls the real closesocket() on Windows
Replace the call to close a socket with closesocket() instead.
---
(no changes since v1)
util/qemu-sockets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
util/qemu-sockets.c +2 -2
@@ -487,7 +487,7 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp)if (ret <0 ) {error_setg_errno (errp, errno,"Unable to set KEEPALIVE" ); -close (sock); +closesocket (sock);return -1 ; } }
@@ -1050,7 +1050,7 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp)return sock; err: -close (sock); +closesocket (sock);return -1 ; }
Signature · 1 line
2.34.1
PATCH v3 2/4 util/qemu-sockets: Enable unix socket support on Windows
In reply to Bin MengFrom: Bin Meng <[email protected]>
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/
---
Changes in v3:
- drop the run-time check afunix_available()
Changes in v2:
- move #include <afunix.h> to os-win32.h
- define WIN_BUILD_AF_UNIX only when CONFIG_WIN32
meson.build | 6 ++++++ include/sysemu/os-win32.h | 4 ++++ util/qemu-sockets.c | 14 +++++++------- 3 files changed, 17 insertions(+), 7 deletions(-)
meson.build +6 -0
@@ -2327,6 +2327,12 @@ have_afalg = get_option('crypto_afalg') \ '''), error_message: 'AF_ALG requested but could not be detected').allowed() config_host_data.set('CONFIG_AF_ALG', have_afalg) +if targetos != 'windows' + config_host_data.set('CONFIG_AF_UNIX', true) +else + config_host_data.set('CONFIG_AF_UNIX', cc.has_header('afunix.h')) +endif + config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol( 'linux/vm_sockets.h', 'AF_VSOCK', prefix: '#include <sys/socket.h>',
include/sysemu/os-win32.h +4 -0
@@ -30,6 +30,10 @@#include <windows.h> #include <ws2tcpip.h> +#ifdef CONFIG_AF_UNIX +# include <afunix.h> +#endif +#ifdef __cplusplusextern "C" {#endif
util/qemu-sockets.c +7 -7
@@ -880,7 +880,7 @@ static int vsock_parse(VsockSocketAddress *addr, const char *str, }#endif /* CONFIG_AF_VSOCK */ -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX static bool saddr_is_abstract (UnixSocketAddress *saddr) {
@@ -1060,14 +1060,14 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, int num, Error **errp) { - error_setg(errp, "unix sockets are not available on windows"); + error_setg(errp, "unix sockets are not available on your host"); errno =ENOTSUP ;return -1 ; }static int unix_connect_saddr (UnixSocketAddress *saddr,Error **errp) { -error_setg (errp,"unix sockets are not available on windows" ); +error_setg (errp,"unix sockets are not available on your host" ); errno =ENOTSUP ;return -1 ; }
@@ -1335,7 +1335,7 @@ socket_sockaddr_to_address_inet(struct sockaddr_storage *sa, } -#ifndef WIN32 +#ifdef CONFIG_AF_UNIX static SocketAddress * socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, socklen_t salen,
@@ -1362,7 +1362,7 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, addr->u.q_unix.path =g_strndup (su->sun_path, salen);return addr; } -#endif /* WIN32 */ +#endif /* CONFIG_AF_UNIX */ #ifdef CONFIG_AF_VSOCK static SocketAddress *
@@ -1394,10 +1394,10 @@ socket_sockaddr_to_address(struct sockaddr_storage *sa,case AF_INET6 :return socket_sockaddr_to_address_inet (sa, salen, errp); -#ifndef WIN32 +#ifdef CONFIG_AF_UNIX case AF_UNIX :return socket_sockaddr_to_address_unix (sa, salen, errp); -#endif /* WIN32 */ +#endif #ifdef CONFIG_AF_VSOCK case AF_VSOCK :
Signature · 1 line
2.34.1
Re: [PATCH v3 2/4] util/qemu-sockets: Enable unix socket support on Windows
Hi
Quoted 31 lines · Bin Meng
From: Bin Meng <[email protected]>
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_UNIXaddress 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 <[email protected]>Signed-off-by Bin Meng <[email protected]>---
Changes in v3:
- drop the run-time checkafunix_available()Changes in v2:
- move #include <afunix.h> toos-win32.h
- defineWIN_BUILD_AF_UNIXonly whenCONFIG_WIN32meson.build | 6 ++++++ include/sysemu/os-win32.h | 4 ++++ util/qemu-sockets.c | 14 +++++++------- 3 files changed, 17 insertions(+), 7 deletions(-)meson.build +0
-0
meson.build have_afalg = get_option('crypto_afalg') \ · line 2333
Quoted 7 lines
meson.build +2
-0@@ -2327,6 +2327,12 @@ have_afalg = get_option('crypto_afalg') \ '''), error_message: 'AF_ALG requested but could not be detected').allowed() config_host_data.set('CONFIG_AF_ALG', have_afalg) +if targetos != 'windows' + config_host_data.set('CONFIG_AF_UNIX', true)
Imho, we should simply define CONFIG_AFUNIX_H, regardless of the OS.
meson.build have_afalg = get_option('crypto_afalg') \
Quoted 4 lines
meson.build +3
-0+else + config_host_data.set('CONFIG_AF_UNIX', cc.has_header('afunix.h')) +endif
+
Quoted 8 lines
meson.build +0
-0config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol( 'linux/vm_sockets.h', 'AF_VSOCK', prefix: '#include <sys/socket.h>',include/sysemu/os-win32.h +0
-0
include/sysemu/os-win32.h line 36
Quoted 7 lines
include/sysemu/os-win32.h +3
-0@@ -30,6 +30,10 @@#include <windows.h> #include <ws2tcpip.h> +#ifdef CONFIG_AF_UNIX +# include <afunix.h> +#endif
we could also provide a fallback, the same I did for glib:
https://gitlab.gnome.org/GNOME/glib/-/commit/4339192b5391a37ecd55816c713537fb1990cd07
So all Windows build will have afunix code compiled.
+
Quoted 74 lines
include/sysemu/os-win32.h +0
-0#ifdef __cplusplusextern "C" {#endif util/qemu-sockets.c +1
-1@@ -880,7 +880,7 @@ static int vsock_parse(VsockSocketAddress *addr, const char *str, }#endif /* CONFIG_AF_VSOCK */ -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX static bool saddr_is_abstract (UnixSocketAddress *saddr){
util/qemu-sockets.c +2
-2@@ -1060,14 +1060,14 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, int num, Error **errp) { -error_setg (errp,"unix sockets are not available on windows" ); +error_setg (errp,"unix sockets are not available on your host" ); errno =ENOTSUP ;return -1 ; }static int unix_connect_saddr (UnixSocketAddress *saddr,Error **errp) { -error_setg (errp,"unix sockets are not available on windows" ); +error_setg (errp,"unix sockets are not available on your host" ); errno =ENOTSUP ;return -1 ;}
util/qemu-sockets.c +1
-1@@ -1335,7 +1335,7 @@ socket_sockaddr_to_address_inet(struct sockaddr_storage *sa, } -#ifndef WIN32 +#ifdef CONFIG_AF_UNIX static SocketAddress * socket_sockaddr_to_address_unix(struct sockaddr_storage *sa,
socklen_tsalen,util/qemu-sockets.c +1
-1@@ -1362,7 +1362,7 @@ socket_sockaddr_to_address_unix(struct sockaddr_storage *sa, addr->u.q_unix.path =g_strndup (su->sun_path, salen); return addr; } -#endif /* WIN32 */ +#endif /* CONFIG_AF_UNIX */ #ifdef CONFIG_AF_VSOCK static SocketAddress *
util/qemu-sockets.c +2
-2@@ -1394,10 +1394,10 @@ socket_sockaddr_to_address(struct sockaddr_storage *sa, case AF_INET6:return socket_sockaddr_to_address_inet (sa, salen, errp); -#ifndef WIN32 +#ifdef CONFIG_AF_UNIX case AF_UNIX :return socket_sockaddr_to_address_unix (sa, salen, errp); -#endif /* WIN32 */ +#endif #ifdef CONFIG_AF_VSOCK case
AF_VSOCK:
--
2.34.1
Signature · 1 line
Marc-André Lureau
Re: [PATCH v3 2/4] util/qemu-sockets: Enable unix socket support on Windows
Quoted 70 lines · Marc-André Lureau
Hi
Quoted 31 lines · Bin Meng
From: Bin Meng <[email protected]>
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_UNIXaddress 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 <[email protected]>Signed-off-by Bin Meng <[email protected]>---
Changes in v3:
- drop the run-time checkafunix_available()Changes in v2:
- move #include <afunix.h> toos-win32.h
- defineWIN_BUILD_AF_UNIXonly whenCONFIG_WIN32meson.build | 6 ++++++ include/sysemu/os-win32.h | 4 ++++ util/qemu-sockets.c | 14 +++++++------- 3 files changed, 17 insertions(+), 7 deletions(-)meson.build +0
-0meson.build have_afalg = get_option('crypto_afalg') \ · line 2333
Quoted 7 lines
meson.build +2
-0@@ -2327,6 +2327,12 @@ have_afalg = get_option('crypto_afalg') \ '''), error_message: 'AF_ALG requested but could not be detected').allowed() config_host_data.set('CONFIG_AF_ALG', have_afalg) +if targetos != 'windows' + config_host_data.set('CONFIG_AF_UNIX', true)Imho, we should simply define
CONFIG_AFUNIX_H, regardless of the OS.meson.build have_afalg = get_option('crypto_afalg') \
Quoted 4 lines
meson.build +3
-0+else + config_host_data.set('CONFIG_AF_UNIX', cc.has_header('afunix.h')) +endif+
Quoted 8 lines
meson.build +0
-0config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol( 'linux/vm_sockets.h', 'AF_VSOCK', prefix: '#include <sys/socket.h>',include/sysemu/os-win32.h +0
-0include/sysemu/os-win32.h line 36
Quoted 7 lines
include/sysemu/os-win32.h +3
-0@@ -30,6 +30,10 @@#include <windows.h> #include <ws2tcpip.h> +#ifdef CONFIG_AF_UNIX +# include <afunix.h> +#endif we could also provide a fallback, the same I did for glib:
https://gitlab.gnome.org/GNOME/glib/-/commit/4339192b5391a37ecd55816c713537fb1990cd07
Quoted 1 line
So all Windows build will have afunix code compiled.
That's much nicer. It lets us get rid of the conditionals around all the UNIX socket handling code across the codebase, except for the FD passing checks which have to remain.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v3 3/4 chardev/char-socket: Update AF_UNIX for Windows
In reply to Bin MengFrom: Bin Meng <[email protected]>
Now that AF_UNIX has come to Windows, update the existing logic in qemu_chr_compute_filename() and qmp_chardev_open_socket() for Windows.
---
(no changes since v2)
Changes in v2:
- drop #include <afunix.h> as it is now already included in osdep.h
chardev/char-socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
chardev/char-socket.c +3 -1
@@ -557,7 +557,7 @@ static char *qemu_chr_compute_filename(SocketChardev *s)const char *left ="" , *right ="" ;switch (ss->ss_family) { -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX case AF_UNIX : return g_strdup_printf("unix:%s%s", ((struct sockaddr_un *)(ss))->sun_path,
@@ -1372,10 +1372,12 @@ static void qmp_chardev_open_socket(Chardev *chr, }qemu_chr_set_feature (chr,QEMU_CHAR_FEATURE_RECONNECTABLE ); +#ifndef _WIN32/* TODO SOCKET_ADDRESS_FD where fd has AF_UNIX */ if (addr->type ==SOCKET_ADDRESS_TYPE_UNIX ) {qemu_chr_set_feature (chr,QEMU_CHAR_FEATURE_FD_PASS ); } +#endif /* * In the chardev-change special-case, we shouldn't register a new yank
Signature · 1 line
2.34.1
Re: [PATCH v3 3/4] chardev/char-socket: Update AF_UNIX for Windows
Hi
Quoted 33 lines · Bin Meng
From: Bin Meng <[email protected]>
Now that
AF_UNIXhas come to Windows, update the existing logic inqemu_chr_compute_filename()andqmp_chardev_open_socket()for Windows.Signed-off-by Bin Meng <[email protected]>Reviewed-by Marc-André Lureau <[email protected]>---
(no changes since v2)
Changes in v2:
- drop #include <afunix.h> as it is now already included inosdep.hchardev/char-socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)chardev/char-socket.c +1
-1@@ -557,7 +557,7 @@ static char *qemu_chr_compute_filename(SocketChardev *s)const char *left ="" , *right ="" ;switch (ss->ss_family) { -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX case AF_UNIX : return g_strdup_printf("unix:%s%s",((struct sockaddr_un *)(ss))->sun_path,chardev/char-socket.c +0
-0@@ -1372,10 +1372,12 @@ static void qmp_chardev_open_socket(Chardev *chr, }
chardev/char-socket.c static void qmp_chardev_open_socket(Chardev *chr, · line 1382
Quoted 10 lines
chardev/char-socket.c +2
-0qemu_chr_set_feature (chr,QEMU_CHAR_FEATURE_RECONNECTABLE ); +#ifndef _WIN32/* TODO SOCKET_ADDRESS_FD where fd has AF_UNIX */ if (addr->type ==SOCKET_ADDRESS_TYPE_UNIX ) {qemu_chr_set_feature (chr,QEMU_CHAR_FEATURE_FD_PASS ); } +#endif
With the fallback for afunix.h header on windows, we can enable various code paths with AF_UNIX, without condition.
Signature · 1 line
Marc-André Lureau
PATCH v3 4/4 tests/unit: Update test-io-channel-socket.c for Windows
In reply to Bin MengFrom: Bin Meng <[email protected]>
Enable the following 3 test cases for Windows when AF_UNIX is available:
* test_io_channel_unix_sync
* test_io_channel_unix_async
* test_io_channel_unix_listen_cleanup
---
(no changes since v2)
Changes in v2:
- new patch: tests/unit: Update test-io-channel-socket.c for Windows
tests/unit/test-io-channel-socket.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
tests/unit/test-io-channel-socket.c +14 -2
@@ -179,10 +179,12 @@ static void test_io_channel(bool async,test_io_channel_setup_async (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert (qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_SHUTDOWN ));g_assert (qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_SHUTDOWN ));
@@ -206,10 +208,12 @@ static void test_io_channel(bool async,test_io_channel_setup_async (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert (qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_SHUTDOWN ));g_assert (qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_SHUTDOWN ));
@@ -236,10 +240,12 @@ static void test_io_channel(bool async,test_io_channel_setup_sync (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert (qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_SHUTDOWN ));g_assert (qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_SHUTDOWN ));
@@ -263,10 +269,12 @@ static void test_io_channel(bool async,test_io_channel_setup_sync (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert (qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_SHUTDOWN ));g_assert (qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_SHUTDOWN ));
@@ -367,7 +375,7 @@ static void test_io_channel_ipv6_async(void) } -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX static void test_io_channel_unix (bool async) {SocketAddress *listen_addr =g_new0 (SocketAddress,1 );
@@ -398,6 +406,7 @@ static void test_io_channel_unix_async(void)return test_io_channel_unix (true); } +#ifndef _WIN32static void test_io_channel_unix_fd_pass (void ) {SocketAddress *listen_addr =g_new0 (SocketAddress,1 );
@@ -491,6 +500,7 @@ static void test_io_channel_unix_fd_pass(void) }g_free (fdrecv); } +#endif /* _WIN32 */ static void test_io_channel_unix_listen_cleanup (void ) {
@@ -588,13 +598,15 @@ int main(int argc, char **argv) test_io_channel_ipv6_async); } -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX g_test_add_func ("/io/channel/socket/unix-sync" , test_io_channel_unix_sync);g_test_add_func ("/io/channel/socket/unix-async" , test_io_channel_unix_async); +#ifndef _WIN32g_test_add_func ("/io/channel/socket/unix-fd-pass" , test_io_channel_unix_fd_pass); +#endif g_test_add_func ("/io/channel/socket/unix-listen-cleanup" , test_io_channel_unix_listen_cleanup);#endif /* _WIN32 */
Signature · 1 line
2.34.1
Re: [PATCH v3 4/4] tests/unit: Update test-io-channel-socket.c for Windows
Hi
Quoted 8 lines · Bin Meng
From: Bin Meng <[email protected]>
Enable the following 3 test cases for Windows when
AF_UNIXis available:*
test_io_channel_unix_sync
*test_io_channel_unix_async
*test_io_channel_unix_listen_cleanup
The test should runtime-check the availability of AF_UNIX socket, and skip those appropriately (not failing the test).
(for ex, in glib I wrote
https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/tests/gdbus-peer.c#L305)
Quoted 106 lines
tests/unit/test-io-channel-socket.c +2
-0@@ -179,10 +179,12 @@ static void test_io_channel(bool async,test_io_channel_setup_async (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert(qio_channel_has_feature(src,
QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst,QIO_CHANNEL_FEATURE_SHUTDOWN));tests/unit/test-io-channel-socket.c +2
-0@@ -206,10 +208,12 @@ static void test_io_channel(bool async,test_io_channel_setup_async (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert(qio_channel_has_feature(src,
QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst,QIO_CHANNEL_FEATURE_SHUTDOWN));tests/unit/test-io-channel-socket.c +2
-0@@ -236,10 +240,12 @@ static void test_io_channel(bool async,test_io_channel_setup_sync (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert(qio_channel_has_feature(src,
QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst,QIO_CHANNEL_FEATURE_SHUTDOWN));tests/unit/test-io-channel-socket.c +2
-0@@ -263,10 +269,12 @@ static void test_io_channel(bool async,test_io_channel_setup_sync (listen_addr, connect_addr, &srv, &src, &dst); +#ifndef _WIN32g_assert (!passFD ||qio_channel_has_feature (src,QIO_CHANNEL_FEATURE_FD_PASS ));g_assert (!passFD ||qio_channel_has_feature (dst,QIO_CHANNEL_FEATURE_FD_PASS )); +#endif g_assert(qio_channel_has_feature(src,
QIO_CHANNEL_FEATURE_SHUTDOWN));
g_assert(qio_channel_has_feature(dst,QIO_CHANNEL_FEATURE_SHUTDOWN));tests/unit/test-io-channel-socket.c +4
-2@@ -367,7 +375,7 @@ static void test_io_channel_ipv6_async(void) } -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX static void test_io_channel_unix (bool async) {SocketAddress *listen_addr =g_new0 (SocketAddress,1 );@@ -398,6 +406,7 @@ static void test_io_channel_unix_async(void)return test_io_channel_unix (true); } +#ifndef _WIN32static void test_io_channel_unix_fd_pass (void ) {SocketAddress *listen_addr =g_new0 (SocketAddress,1 );@@ -491,6 +500,7 @@ static void test_io_channel_unix_fd_pass(void) }g_free (fdrecv); } +#endif /* _WIN32 */ static void test_io_channel_unix_listen_cleanup (void ) {@@ -588,13 +598,15 @@ int main(int argc, char **argv) test_io_channel_ipv6_async); } -#ifndef _WIN32 +#ifdef CONFIG_AF_UNIX g_test_add_func("/io/channel/socket/unix-sync",
tests/unit/test-io-channel-socket.c int main(int argc, char **argv) · line 612
Quoted 10 lines
tests/unit/test-io-channel-socket.c +2
-0test_io_channel_unix_sync);g_test_add_func ("/io/channel/socket/unix-async" , test_io_channel_unix_async); +#ifndef _WIN32g_test_add_func ("/io/channel/socket/unix-fd-pass" , test_io_channel_unix_fd_pass); +#endif g_test_add_func ("/io/channel/socket/unix-listen-cleanup" , test_io_channel_unix_listen_cleanup);#endif /* _WIN32 */
The comments needs to be updated
Signature · 1 line
Marc-André Lureau