diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2023-03-13 13:44:17 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-03-13 13:44:17 +0000 |
commit | 284c52eec2d0a1b9c47f06c3eee46762c5fc0915 (patch) | |
tree | 2020afbc1d980f53767c061e01e23ee98e722c83 /include | |
parent | 29c8a9e31a982874ce4e2c15f2bf82d5f8dc3517 (diff) | |
parent | 4bf21c7f748bee42b6f4692f8c37a11d1033b2d1 (diff) | |
download | qemu-284c52eec2d0a1b9c47f06c3eee46762c5fc0915.zip qemu-284c52eec2d0a1b9c47f06c3eee46762c5fc0915.tar.gz qemu-284c52eec2d0a1b9c47f06c3eee46762c5fc0915.tar.bz2 |
Merge tag 'win-socket-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
QMP command to import win32 sockets
# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmQPDQ0cHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5eTUD/41+bodkctP9wtNQT5g
# 4P2XQysa9dhxIaQuPT48J5bN0velOAv+p+e9jNMojVPHogACRGkjJUGrh2AhaWJO
# bpqB5teNz3pbTLAHNrqiJdUrJDI0WSqBN2q7WgfbzvHMugBqul13n6UG/cVWH8D3
# pDX3miBl9Cv3zUDFzPjHH3eR/MHz+6wXmuzUGQdWqyGBoLwqgWA3Bqh39BDVOeJf
# 03Kq3TbJSP096EjGGrq1pTYDIIv9AKzUWgn8tT8S73sD3J0BN28Gl5HirXDx8e/4
# 2WtW/XLYKjqoUl7RmXOjfOarCV+kxzdoYCAUYfyH6DLWrkXc41L5ugFdyxxQ66Sh
# +on7hKCBzPEOPEXmlm6HlMj3bK4C/GI6mIoaZgCrsvj9xlehhQNtwpndAwAR8esH
# perQ6q+jPdoQnBvOBgC3amckS1kYdbQivTILkoopumw/q4waG5reyA4rshbhm/bs
# U33ZRzob0XyRWqvWAcq9hnWB5gvQCcppeJlu60gocnX5wdZOjbnsBXw3l+r2osIh
# izJbxwM6xmz9oHh50nhDCn42JrNdSnZJdJ/XA/lrOkTHQ6kbZO7v86Y/mKQz+Vyx
# Uyhb8/y8gKrUkZlGCEMvQVcyvOA8vneX8WhfZUm6w5MWWCNKfCrEl6UGmFkPAL0m
# +sUYIhN5PSxWSQU5MWogXtQEPA==
# =/Y/7
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 13 Mar 2023 11:46:21 GMT
# gpg: using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg: issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5
* tag 'win-socket-pull-request' of https://gitlab.com/marcandre.lureau/qemu: (25 commits)
monitor: restrict command getfd to POSIX hosts
qtest: enable vnc-display test on win32
libqtest: make qtest_qmp_add_client work on win32
qmp: add 'get-win32-socket'
monitor: release the lock before calling close()
qmp: 'add_client' actually expects sockets
osdep: implement qemu_socketpair() for win32
tests/docker: fix a win32 error due to portability
char: do not double-close fd when failing to add client
tests: fix path separator, use g_build_filename()
win32: replace closesocket() with close() wrapper
os-posix: remove useless ioctlsocket() define
win32: avoid mixing SOCKET and file descriptor space
slirp: open-code qemu_socket_(un)select()
slirp: unregister the win32 SOCKET
main-loop: remove qemu_fd_register(), win32/slirp/socket specific
aio/win32: aio_set_fd_handler() only supports SOCKET
aio: make aio_set_fd_poll() static to aio-posix.c
win32/socket: introduce qemu_socket_unselect() helper
win32/socket: introduce qemu_socket_select() helper
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/aio.h | 8 | ||||
-rw-r--r-- | include/qapi/error.h | 6 | ||||
-rw-r--r-- | include/qemu/main-loop.h | 2 | ||||
-rw-r--r-- | include/qemu/osdep.h | 14 | ||||
-rw-r--r-- | include/qemu/sockets.h | 2 | ||||
-rw-r--r-- | include/sysemu/os-posix.h | 3 | ||||
-rw-r--r-- | include/sysemu/os-win32.h | 15 |
7 files changed, 17 insertions, 33 deletions
diff --git a/include/block/aio.h b/include/block/aio.h index 8fba6a3..543717f 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -482,14 +482,6 @@ void aio_set_fd_handler(AioContext *ctx, IOHandler *io_poll_ready, void *opaque); -/* Set polling begin/end callbacks for a file descriptor that has already been - * registered with aio_set_fd_handler. Do nothing if the file descriptor is - * not registered. - */ -void aio_set_fd_poll(AioContext *ctx, int fd, - IOHandler *io_poll_begin, - IOHandler *io_poll_end); - /* Register an event notifier and associated callbacks. Behaves very similarly * to event_notifier_set_handler. Unlike event_notifier_set_handler, these callbacks * will be invoked when using aio_poll(). diff --git a/include/qapi/error.h b/include/qapi/error.h index d798fae..f21a231 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -520,6 +520,12 @@ static inline void error_propagator_cleanup(ErrorPropagator *prop) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(ErrorPropagator, error_propagator_cleanup); /* + * Special error destination to warn on error. + * See error_setg() and error_propagate() for details. + */ +extern Error *error_warn; + +/* * Special error destination to abort on error. * See error_setg() and error_propagate() for details. */ diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index c25f390..b3e54e0 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -387,8 +387,6 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms); /* internal interfaces */ -void qemu_fd_register(int fd); - #define qemu_bh_new(cb, opaque) \ qemu_bh_new_full((cb), (opaque), (stringify(cb))) QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name); diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 88c9fac..f68b5d8 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -665,20 +665,6 @@ void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, */ char *qemu_get_pid_name(pid_t pid); -/** - * qemu_fork: - * - * A version of fork that avoids signal handler race - * conditions that can lead to child process getting - * signals that are otherwise only expected by the - * parent. It also resets all signal handlers to the - * default settings. - * - * Returns 0 to child process, pid number to parent - * or -1 on failure. - */ -pid_t qemu_fork(Error **errp); - /* Using intptr_t ensures that qemu_*_page_mask is sign-extended even * when intptr_t is 32-bit and we are aligning a long long. */ diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 2b0698a..d935fd8 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -15,7 +15,6 @@ int inet_aton(const char *cp, struct in_addr *ia); bool fd_is_socket(int fd); int qemu_socket(int domain, int type, int protocol); -#ifndef WIN32 /** * qemu_socketpair: * @domain: specifies a communication domain, such as PF_UNIX @@ -30,7 +29,6 @@ int qemu_socket(int domain, int type, int protocol); * Return 0 on success. */ int qemu_socketpair(int domain, int type, int protocol, int sv[2]); -#endif int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); /* diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 58de7c9..1030d39 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -51,9 +51,6 @@ void os_daemonize(void); void os_setup_post(void); int os_mlock(void); -#define closesocket(s) close(s) -#define ioctlsocket(s, r, v) ioctl(s, r, v) - int os_set_daemonize(bool d); bool is_daemonized(void); diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index 97d0243..e2849f8 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -29,6 +29,7 @@ #include <winsock2.h> #include <windows.h> #include <ws2tcpip.h> +#include "qemu/typedefs.h" #ifdef HAVE_AFUNIX_H #include <afunix.h> @@ -164,10 +165,20 @@ static inline void qemu_funlockfile(FILE *f) #endif } +/* Helper for WSAEventSelect, to report errors */ +bool qemu_socket_select(int sockfd, WSAEVENT hEventObject, + long lNetworkEvents, Error **errp); + +bool qemu_socket_unselect(int sockfd, Error **errp); + /* We wrap all the sockets functions so that we can * set errno based on WSAGetLastError() */ +#undef close +#define close qemu_close_wrap +int qemu_close_wrap(int fd); + #undef connect #define connect qemu_connect_wrap int qemu_connect_wrap(int sockfd, const struct sockaddr *addr, @@ -199,10 +210,6 @@ int qemu_shutdown_wrap(int sockfd, int how); #define ioctlsocket qemu_ioctlsocket_wrap int qemu_ioctlsocket_wrap(int fd, int req, void *val); -#undef closesocket -#define closesocket qemu_closesocket_wrap -int qemu_closesocket_wrap(int fd); - #undef getsockopt #define getsockopt qemu_getsockopt_wrap int qemu_getsockopt_wrap(int sockfd, int level, int optname, |