From: Laurent Vivier <laurent@vivier.eu>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Guoyi Tu" <tugy@chinatelecom.cn>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Laurent Vivier" <laurent@vivier.eu>
Subject: [PULL 01/15] Call qemu_socketpair() instead of socketpair() when possible
Date: Wed, 18 Jan 2023 08:52:20 +0100 [thread overview]
Message-ID: <20230118075234.2322131-2-laurent@vivier.eu> (raw)
In-Reply-To: <20230118075234.2322131-1-laurent@vivier.eu>
From: Guoyi Tu <tugy@chinatelecom.cn>
As qemu_socketpair() was introduced in commit 3c63b4e9
("oslib-posix: Introduce qemu_socketpair()"), it's time
to replace the other existing socketpair() calls with
qemu_socketpair() if possible
Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Acked-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <cd28916a-f1f3-b54e-6ade-8a3647c3a9a5@chinatelecom.cn>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
backends/tpm/tpm_emulator.c | 2 +-
tests/qtest/dbus-display-test.c | 5 +++--
tests/qtest/migration-test.c | 2 +-
tests/unit/test-crypto-tlssession.c | 4 ++--
tests/unit/test-io-channel-tls.c | 2 +-
5 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c
index 49cc3d749dc4..67e7b212e3eb 100644
--- a/backends/tpm/tpm_emulator.c
+++ b/backends/tpm/tpm_emulator.c
@@ -553,7 +553,7 @@ static int tpm_emulator_prepare_data_fd(TPMEmulator *tpm_emu)
Error *err = NULL;
int fds[2] = { -1, -1 };
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
+ if (qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
error_report("tpm-emulator: Failed to create socketpair");
return -1;
}
diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-test.c
index cb1b62d1d11a..fef025ac6f83 100644
--- a/tests/qtest/dbus-display-test.c
+++ b/tests/qtest/dbus-display-test.c
@@ -1,5 +1,6 @@
#include "qemu/osdep.h"
#include "qemu/dbus.h"
+#include "qemu/sockets.h"
#include <gio/gio.h>
#include <gio/gunixfdlist.h>
#include "libqtest.h"
@@ -36,7 +37,7 @@ test_setup(QTestState **qts, GDBusConnection **conn)
*qts = qtest_init("-display dbus,p2p=yes -name dbus-test");
- g_assert_cmpint(socketpair(AF_UNIX, SOCK_STREAM, 0, pair), ==, 0);
+ g_assert_cmpint(qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, pair), ==, 0);
qtest_qmp_add_client(*qts, "@dbus-display", pair[1]);
@@ -152,7 +153,7 @@ test_dbus_display_console(void)
test_setup(&qts, &conn);
- g_assert_cmpint(socketpair(AF_UNIX, SOCK_STREAM, 0, pair), ==, 0);
+ g_assert_cmpint(qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, pair), ==, 0);
fd_list = g_unix_fd_list_new();
idx = g_unix_fd_list_append(fd_list, pair[1], NULL);
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index dbde726adf8c..1dd32c9506bf 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1661,7 +1661,7 @@ static void *test_migrate_fd_start_hook(QTestState *from,
int pair[2];
/* Create two connected sockets for migration */
- ret = socketpair(PF_LOCAL, SOCK_STREAM, 0, pair);
+ ret = qemu_socketpair(PF_LOCAL, SOCK_STREAM, 0, pair);
g_assert_cmpint(ret, ==, 0);
/* Send the 1st socket to the target */
diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c
index 615a1344b4aa..b12e7b687927 100644
--- a/tests/unit/test-crypto-tlssession.c
+++ b/tests/unit/test-crypto-tlssession.c
@@ -82,7 +82,7 @@ static void test_crypto_tls_session_psk(void)
int ret;
/* We'll use this for our fake client-server connection */
- ret = socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
+ ret = qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
g_assert(ret == 0);
/*
@@ -236,7 +236,7 @@ static void test_crypto_tls_session_x509(const void *opaque)
int ret;
/* We'll use this for our fake client-server connection */
- ret = socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
+ ret = qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, channel);
g_assert(ret == 0);
/*
diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c
index cc39247556f3..e036ac5df4c2 100644
--- a/tests/unit/test-io-channel-tls.c
+++ b/tests/unit/test-io-channel-tls.c
@@ -121,7 +121,7 @@ static void test_io_channel_tls(const void *opaque)
GMainContext *mainloop;
/* We'll use this for our fake client-server connection */
- g_assert(socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == 0);
+ g_assert(qemu_socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == 0);
#define CLIENT_CERT_DIR "tests/test-io-channel-tls-client/"
#define SERVER_CERT_DIR "tests/test-io-channel-tls-server/"
--
2.38.1
next prev parent reply other threads:[~2023-01-18 7:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 7:52 [PULL 00/15] Trivial branch for 8.0 patches Laurent Vivier
2023-01-18 7:52 ` Laurent Vivier [this message]
2023-01-18 7:52 ` [PULL 02/15] hw/display: Move omap_lcdc.c out of target-specific source set Laurent Vivier
2023-01-18 7:52 ` [PULL 03/15] hw/intc: Move some files out of the " Laurent Vivier
2023-01-18 7:52 ` [PULL 04/15] hw/tpm: Move tpm_ppi.c out of " Laurent Vivier
2023-01-18 7:52 ` [PULL 05/15] hw/arm: Move various units to softmmu_ss[] Laurent Vivier
2023-01-18 7:52 ` [PULL 06/15] hw/cpu: Mark arm11 and realview mpcore as target-independent code Laurent Vivier
2023-01-18 7:52 ` [PULL 07/15] hw/intc: Mark more interrupt-controller files as target independent Laurent Vivier
2023-01-18 7:52 ` [PULL 08/15] hw/usb: Mark the XLNX_VERSAL-related files as target-independent Laurent Vivier
2023-01-18 7:52 ` [PULL 09/15] tests/qtest/test-hmp: Improve the check for verbose mode Laurent Vivier
2023-01-18 7:52 ` [PULL 10/15] hw/i386/pc: Remove unused 'owner' argument from pc_pci_as_mapping_init Laurent Vivier
2023-01-18 7:52 ` [PULL 11/15] ccid-card-emulated: fix cast warning/error Laurent Vivier
2023-01-18 7:52 ` [PULL 12/15] hw/pvrdma: Protect against buggy or malicious guest driver Laurent Vivier
2023-01-18 7:52 ` [PULL 13/15] hw/cxl/cxl-cdat.c: spelling: missmatch Laurent Vivier
2023-01-18 7:52 ` [PULL 14/15] hw/cxl/cxl-host: Fix an error message typo Laurent Vivier
2023-01-18 7:52 ` [PULL 15/15] hw/ssi/sifive_spi.c: spelling: reigster Laurent Vivier
2023-01-19 18:57 ` [PULL 00/15] Trivial branch for 8.0 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230118075234.2322131-2-laurent@vivier.eu \
--to=laurent@vivier.eu \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=thuth@redhat.com \
--cc=tugy@chinatelecom.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).