aboutsummaryrefslogtreecommitdiff
path: root/hw/mips
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-02-21 16:47:59 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 15:39:31 +0400
commitabe34282b088499f4e86fff9bb6d6dafd57ae1d0 (patch)
treec3e9b6a39880725ff0a199f47f357c1a467d9cf1 /hw/mips
parentfd3c3333157a8121e4ba9485677ef5860f8fb2db (diff)
downloadqemu-abe34282b088499f4e86fff9bb6d6dafd57ae1d0.zip
qemu-abe34282b088499f4e86fff9bb6d6dafd57ae1d0.tar.gz
qemu-abe34282b088499f4e86fff9bb6d6dafd57ae1d0.tar.bz2
win32: avoid mixing SOCKET and file descriptor space
Until now, 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 shouldn't mix them. Also, it is often forgotten that SOCKET must be closed with closesocket(), and not close(). Instead, let's make the win32 socket wrapper functions return and take a file descriptor, and let util/ wrappers do the fd/SOCKET conversion as necessary. A bit of adaptation is necessary in io/ as well. Unfortunately, we can't drop closesocket() usage, despite _open_osfhandle() documentation claiming transfer of ownership, testing shows bad behaviour if you forget to call closesocket(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-15-marcandre.lureau@redhat.com>
Diffstat (limited to 'hw/mips')
0 files changed, 0 insertions, 0 deletions