[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 0/4] win32: do not mix SOCKET and fd space
From: |
marcandre . lureau |
Subject: |
[PATCH 0/4] win32: do not mix SOCKET and fd space |
Date: |
Mon, 13 Feb 2023 00:49:38 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Hi,
A win32 SOCKET handle is often cast to an int file descriptor, as this is what
other OS use for sockets. When necessary, QEMU eventually queries whether it's a
socket with the help of fd_is_socket(). However, there is no guarantee of
conflict between the fd and SOCKET space. Such conflict would have surprising
consequences. We can fix this by using FDs only.
After fixing a few missed closesocket(), this patch series makes the win32
socket API wrappers take FDs. It finally get rid of closesocket() usage by using
a close() wrapper instead. (note that fdopen/fclose would not be enough either
to close the underlying socket appropriately)
Marc-André Lureau (4):
tests: use closesocket()
io: use closesocket()
win32: stop mixing SOCKET and file descriptor space
win32: replace closesocket() with close() wrapper
include/sysemu/os-posix.h | 1 -
include/sysemu/os-win32.h | 8 +-
backends/tpm/tpm_emulator.c | 6 +-
crypto/afalg.c | 6 +-
hw/hyperv/syndbg.c | 4 +-
io/channel-socket.c | 22 +++--
io/channel-watch.c | 17 ++--
net/dgram.c | 14 +--
net/socket.c | 22 ++---
tests/qtest/libqtest.c | 8 +-
tests/qtest/microbit-test.c | 2 +-
tests/qtest/netdev-socket.c | 10 +--
tests/unit/socket-helpers.c | 2 +-
util/oslib-win32.c | 169 ++++++++++++++++++++++++++++++------
util/qemu-sockets.c | 22 ++---
15 files changed, 221 insertions(+), 92 deletions(-)
--
2.39.1
- [PATCH 0/4] win32: do not mix SOCKET and fd space,
marcandre . lureau <=
- [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, marcandre . lureau, 2023/02/12
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Marc-André Lureau, 2023/02/20
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Markus Armbruster, 2023/02/20
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Marc-André Lureau, 2023/02/20
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Daniel P . Berrangé, 2023/02/20
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Paolo Bonzini, 2023/02/21
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Marc-André Lureau, 2023/02/21
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Marc-André Lureau, 2023/02/21
- Re: [PATCH 3/4] win32: stop mixing SOCKET and file descriptor space, Paolo Bonzini, 2023/02/21
[PATCH 1/4] tests: use closesocket(), marcandre . lureau, 2023/02/12