[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 06/28] util: move socket_init() to osdep.c
From: |
Alon Levy |
Subject: |
[Qemu-devel] [PATCH v3 06/28] util: move socket_init() to osdep.c |
Date: |
Mon, 22 Apr 2013 18:04:36 +0300 |
From: Marc-André Lureau <address@hidden>
vscclient needs to call socket_init() for portability.
Moving to osdep.c since it has no internal dependency.
Signed-off-by: Marc-André Lureau <address@hidden>
---
util/osdep.c | 23 +++++++++++++++++++++++
util/qemu-sockets.c | 24 ------------------------
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/util/osdep.c b/util/osdep.c
index bd59ac9..6ae5aaf 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -406,3 +406,26 @@ bool fips_get_state(void)
return fips_enabled;
}
+#ifdef _WIN32
+static void socket_cleanup(void)
+{
+ WSACleanup();
+}
+#endif
+
+int socket_init(void)
+{
+#ifdef _WIN32
+ WSADATA Data;
+ int ret, err;
+
+ ret = WSAStartup(MAKEWORD(2, 2), &Data);
+ if (ret != 0) {
+ err = WSAGetLastError();
+ fprintf(stderr, "WSAStartup: %d\n", err);
+ return -1;
+ }
+ atexit(socket_cleanup);
+#endif
+ return 0;
+}
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 94581aa..fdd8dc4 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -974,27 +974,3 @@ int socket_dgram(SocketAddress *remote, SocketAddress
*local, Error **errp)
qemu_opts_del(opts);
return fd;
}
-
-#ifdef _WIN32
-static void socket_cleanup(void)
-{
- WSACleanup();
-}
-#endif
-
-int socket_init(void)
-{
-#ifdef _WIN32
- WSADATA Data;
- int ret, err;
-
- ret = WSAStartup(MAKEWORD(2,2), &Data);
- if (ret != 0) {
- err = WSAGetLastError();
- fprintf(stderr, "WSAStartup: %d\n", err);
- return -1;
- }
- atexit(socket_cleanup);
-#endif
- return 0;
-}
--
1.8.2
- [Qemu-devel] [PATCH v3 00/28] ccid and libcacard fixes for windows/mingw, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 02/28] ccid-card-emul: do not crash if backend is not provided, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 01/28] libcacard: correct T0 historical bytes size, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 04/28] ccid: declare DEFAULT_ATR table to be "static const", Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 03/28] ccid: make backend_enum_table "static const" and adjust users, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 07/28] build-sys: must link with -fstack-protector, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 08/28] libcacard: fix mingw64 cross-compilation, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 06/28] util: move socket_init() to osdep.c,
Alon Levy <=
- [Qemu-devel] [PATCH v3 05/28] libcacard: use system config directory for nss db on win32, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 09/28] libcacard: split vscclient main() from socket reading, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 13/28] libcacard: remove default libcoolkey loading, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 12/28] libcacard: remove sql: prefix, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 11/28] libcacard: teach vscclient to use GMainLoop for portability, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 15/28] dev-smartcard-reader: nicer debug messages, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 16/28] dev-smartcard-reader: remove aborts (never triggered, but just in case), Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 17/28] dev-smartcard-reader: support windows guest, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 14/28] dev-smartcard-reader: white space fixes, Alon Levy, 2013/04/22
- [Qemu-devel] [PATCH v3 18/28] dev-smartcard-reader: reuse usb.h definitions, Alon Levy, 2013/04/22