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 --- util/event_notifier-posix.c | 2 +- util/oslib-posix.c | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) (limited to 'util') diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 2aa14eabb3..76420c5b56 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -49,7 +49,7 @@ int event_notifier_init(EventNotifier *e, int active) if (errno != ENOSYS) { return -errno; } - if (qemu_pipe(fds) < 0) { + if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { return -errno; } if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) { diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 289efca3fa..2a6f6248ad 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -274,28 +274,6 @@ void qemu_set_cloexec(int fd) assert(f != -1); } -/* - * Creates a pipe with FD_CLOEXEC set on both file descriptors - */ -int qemu_pipe(int pipefd[2]) -{ - int ret; - -#ifdef CONFIG_PIPE2 - ret = pipe2(pipefd, O_CLOEXEC); - if (ret != -1 || errno != ENOSYS) { - return ret; - } -#endif - ret = pipe(pipefd); - if (ret == 0) { - qemu_set_cloexec(pipefd[0]); - qemu_set_cloexec(pipefd[1]); - } - - return ret; -} - char * qemu_get_local_state_dir(void) { -- cgit v1.2.3