qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] osdeps: Introduce qemu_socketpair()


From: Guoyi Tu
Subject: Re: [PATCH 1/2] osdeps: Introduce qemu_socketpair()
Date: Thu, 18 Aug 2022 19:50:53 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0



On 8/12/22 19:49, Peter Maydell wrote:
On Fri, 12 Aug 2022 at 12:44, <tugy@chinatelecom.cn> wrote:

From: Guoyi Tu <tugy@chinatelecom.cn>

qemu_socketpair() will create a pair of connected sockets
with FD_CLOEXEC set

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
---
  include/qemu/sockets.h |  3 +++
  util/osdep.c           | 24 ++++++++++++++++++++++++
  2 files changed, 27 insertions(+)

diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index 038faa157f..52cf2855df 100644
--- a/include/qemu/sockets.h
+++ b/include/qemu/sockets.h
@@ -14,6 +14,9 @@ int inet_aton(const char *cp, struct in_addr *ia);
  /* misc helpers */
  bool fd_is_socket(int fd);
  int qemu_socket(int domain, int type, int protocol);
+#ifndef WIN32
+int qemu_socketpair(int domain, int type, int protocol, int sv[2]);

Any new function declaration in a header file needs a
doc-comment documenting what it does, please.

OK, I'll add some comments

+#endif
  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);
diff --git a/util/osdep.c b/util/osdep.c
index 60fcbbaebe..4b1ab623c7 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -481,6 +481,30 @@ int qemu_socket(int domain, int type, int protocol)
      return ret;
  }

+#ifndef _WIN32

If this function only exists and is usable on posix
hosts, put it in util/oslib-posix.c rather than having
it here with a win32 ifdef.

will do

Thanks.

thanks
-- PMM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]