From ef0f4bda2e369418cdbe0c02584ae75015fb97c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 20 Apr 2022 17:16:35 +0400 Subject: Use QEMU_SANITIZE_THREAD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé Reviewed-by: Richard Henderson --- include/qemu/atomic.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 112a299..7e8fc8e 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -15,6 +15,8 @@ #ifndef QEMU_ATOMIC_H #define QEMU_ATOMIC_H +#include "compiler.h" + /* Compiler barrier */ #define barrier() ({ asm volatile("" ::: "memory"); (void)0; }) @@ -81,7 +83,7 @@ * no processors except Alpha need a barrier here. Leave it in if * using Thread Sanitizer to avoid warnings, otherwise optimize it away. */ -#if defined(__SANITIZE_THREAD__) +#ifdef QEMU_SANITIZE_THREAD #define smp_read_barrier_depends() ({ barrier(); __atomic_thread_fence(__ATOMIC_CONSUME); }) #elif defined(__alpha__) #define smp_read_barrier_depends() asm volatile("mb":::"memory") @@ -146,7 +148,7 @@ /* See above: most compilers currently treat consume and acquire the * same, but this slows down qatomic_rcu_read unnecessarily. */ -#ifdef __SANITIZE_THREAD__ +#ifdef QEMU_SANITIZE_THREAD #define qatomic_rcu_read__nocheck(ptr, valptr) \ __atomic_load(ptr, valptr, __ATOMIC_CONSUME); #else @@ -254,7 +256,7 @@ #define qatomic_mb_read(ptr) \ qatomic_load_acquire(ptr) -#if !defined(__SANITIZE_THREAD__) && \ +#if !defined(QEMU_SANITIZE_THREAD) && \ (defined(__i386__) || defined(__x86_64__) || defined(__s390x__)) /* This is more efficient than a store plus a fence. */ # define qatomic_mb_set(ptr, i) ((void)qatomic_xchg(ptr, i)) -- cgit v1.1 From ad24b679d215c2f8eaab6125a68e864c2a5d7dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 29 Mar 2022 15:27:12 +0400 Subject: block: move fcntl_setfl() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is only used by block/file-posix.c, move it there. Signed-off-by: Marc-André Lureau Reviewed-by: Richard Henderson --- include/sysemu/os-posix.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index adbe19d..58de7c9 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -96,8 +96,6 @@ static inline void qemu_funlockfile(FILE *f) funlockfile(f); } -int fcntl_setfl(int fd, int flag); - #ifdef __cplusplus } #endif -- cgit v1.1 From a7241974ceca3a783ab010f3fd1926fa42346a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 29 Mar 2022 15:21:00 +0400 Subject: Replace qemu_pipe() with g_unix_open_pipe() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GLib g_unix_open_pipe() is essentially like qemu_pipe(), available since 2.30. Signed-off-by: Marc-André Lureau Reviewed-by: Richard Henderson --- include/qemu/osdep.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 52d81c0..1c1e7ec 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -547,10 +547,6 @@ static inline void qemu_timersub(const struct timeval *val1, ssize_t qemu_write_full(int fd, const void *buf, size_t count) G_GNUC_WARN_UNUSED_RESULT; -#ifndef _WIN32 -int qemu_pipe(int pipefd[2]); -#endif - void qemu_set_cloexec(int fd); /* Return a dynamically allocated directory path that is appropriate for storing -- cgit v1.1 From 05e50e8fe5fed707653e1e5e2f2871f253a70452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 25 Apr 2022 12:53:37 +0400 Subject: io: make qio_channel_command_new_pid() static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function isn't used outside of qio_channel_command_new_spawn(), which is !win32-specific. Signed-off-by: Marc-André Lureau Reviewed-by: Richard Henderson --- include/io/channel-command.h | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'include') diff --git a/include/io/channel-command.h b/include/io/channel-command.h index 27e42bd..305ac1d 100644 --- a/include/io/channel-command.h +++ b/include/io/channel-command.h @@ -46,31 +46,6 @@ struct QIOChannelCommand { /** - * qio_channel_command_new_pid: - * @writefd: the FD connected to the command's stdin - * @readfd: the FD connected to the command's stdout - * @pid: the PID of the running child command - * @errp: pointer to a NULL-initialized error object - * - * Create a channel for performing I/O with the - * previously spawned command identified by @pid. - * The two file descriptors provide the connection - * to command's stdio streams, either one or which - * may be -1 to indicate that stream is not open. - * - * The channel will take ownership of the process - * @pid and will kill it when closing the channel. - * Similarly it will take responsibility for - * closing the file descriptors @writefd and @readfd. - * - * Returns: the command channel object, or NULL on error - */ -QIOChannelCommand * -qio_channel_command_new_pid(int writefd, - int readfd, - pid_t pid); - -/** * qio_channel_command_new_spawn: * @argv: the NULL terminated list of command arguments * @flags: the I/O mode, one of O_RDONLY, O_WRONLY, O_RDWR -- cgit v1.1 From ff5927baa7ffb9c97873a071f6a8d85a3584182b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 25 Apr 2022 17:33:47 +0400 Subject: util: rename qemu_*block() socket functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The qemu_*block() functions are meant to be be used with sockets (the win32 implementation expects SOCKET) Over time, those functions where used with Win32 SOCKET or file-descriptors interchangeably. But for portability, they must only be used with socket-like file-descriptors. FDs can use g_unix_set_fd_nonblocking() instead. Rename the functions with "socket" in the name to prevent bad usages. This is effectively reverting commit f9e8cacc5557e43 ("oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()"). Signed-off-by: Marc-André Lureau Reviewed-by: Stefan Hajnoczi --- include/qemu/sockets.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 0c34bf2..038faa1 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -17,9 +17,9 @@ int qemu_socket(int domain, int type, int protocol); int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int socket_set_cork(int fd, int v); int socket_set_nodelay(int fd); -void qemu_set_block(int fd); -int qemu_try_set_nonblock(int fd); -void qemu_set_nonblock(int fd); +void qemu_socket_set_block(int fd); +int qemu_socket_try_set_nonblock(int fd); +void qemu_socket_set_nonblock(int fd); int socket_set_fast_reuse(int fd); #ifdef WIN32 -- cgit v1.1