All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com,
	jasowang@redhat.com, qemu-devel@nongnu.org,
	mdroth@linux.vnet.ibm.com, owasserm@redhat.com, laine@redhat.com
Subject: [PATCH v5 1/4] sockets: introduce set_socket_error()
Date: Thu, 22 Mar 2012 11:52:35 +0800	[thread overview]
Message-ID: <20120322035235.2431.88671.stgit@dhcp-8-167.nay.redhat.com> (raw)
In-Reply-To: <20120322035052.2431.4994.stgit@dhcp-8-167.nay.redhat.com>

Introduce set_socket_error() to set the errno, use
WSASetLastError() for win32.
Sometimes, clean work would rewrite errno in error path,
we can use this function to restore real errno.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 qemu_socket.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu_socket.h b/qemu_socket.h
index fe4cf6c..a4c5170 100644
--- a/qemu_socket.h
+++ b/qemu_socket.h
@@ -8,6 +8,7 @@
 #include <ws2tcpip.h>
 
 #define socket_error() WSAGetLastError()
+#define set_socket_error(e) WSASetLastError(e)
 #undef EINTR
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define EINTR       WSAEINTR
@@ -26,6 +27,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
 #include <sys/un.h>
 
 #define socket_error() errno
+#define set_socket_error(e) errno = e
 #define closesocket(s) close(s)
 
 #endif /* !_WIN32 */


WARNING: multiple messages have this Message-ID (diff)
From: Amos Kong <akong@redhat.com>
To: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com,
	jasowang@redhat.com, qemu-devel@nongnu.org,
	mdroth@linux.vnet.ibm.com, owasserm@redhat.com, laine@redhat.com
Subject: [Qemu-devel] [PATCH v5 1/4] sockets: introduce set_socket_error()
Date: Thu, 22 Mar 2012 11:52:35 +0800	[thread overview]
Message-ID: <20120322035235.2431.88671.stgit@dhcp-8-167.nay.redhat.com> (raw)
In-Reply-To: <20120322035052.2431.4994.stgit@dhcp-8-167.nay.redhat.com>

Introduce set_socket_error() to set the errno, use
WSASetLastError() for win32.
Sometimes, clean work would rewrite errno in error path,
we can use this function to restore real errno.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 qemu_socket.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu_socket.h b/qemu_socket.h
index fe4cf6c..a4c5170 100644
--- a/qemu_socket.h
+++ b/qemu_socket.h
@@ -8,6 +8,7 @@
 #include <ws2tcpip.h>
 
 #define socket_error() WSAGetLastError()
+#define set_socket_error(e) WSASetLastError(e)
 #undef EINTR
 #define EWOULDBLOCK WSAEWOULDBLOCK
 #define EINTR       WSAEINTR
@@ -26,6 +27,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
 #include <sys/un.h>
 
 #define socket_error() errno
+#define set_socket_error(e) errno = e
 #define closesocket(s) close(s)
 
 #endif /* !_WIN32 */

  reply	other threads:[~2012-03-22  3:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 14:11 [PATCH v4 0/2] support to migrate with IPv6 address Amos Kong
2012-03-19 14:11 ` [Qemu-devel] " Amos Kong
2012-03-19 14:11 ` [PATCH v4 1/2] qemu-socket: change inet_connect() to to support nonblock socket Amos Kong
2012-03-19 14:11   ` [Qemu-devel] " Amos Kong
2012-03-20 10:58   ` Orit Wasserman
2012-03-21 23:46   ` Michael Roth
2012-03-21 23:46     ` [Qemu-devel] " Michael Roth
2012-03-22  3:13     ` Amos Kong
2012-03-22  3:13       ` [Qemu-devel] " Amos Kong
2012-03-22  3:52     ` [PATCH v5 0/2] support to migrate with IPv6 address Amos Kong
2012-03-22  3:52       ` [Qemu-devel] " Amos Kong
2012-03-22  3:52       ` Amos Kong [this message]
2012-03-22  3:52         ` [Qemu-devel] [PATCH v5 1/4] sockets: introduce set_socket_error() Amos Kong
2012-03-27 13:00         ` Orit Wasserman
2012-03-27 13:00           ` [Qemu-devel] " Orit Wasserman
2012-03-27 14:56           ` [PATCH v6 " Amos Kong
2012-03-27 14:56             ` [Qemu-devel] " Amos Kong
2012-03-22  3:52       ` [PATCH v5 2/4] qemu-socket: change inet_connect() to to support nonblock socket Amos Kong
2012-03-22  3:52         ` [Qemu-devel] " Amos Kong
2012-03-27 15:29         ` Orit Wasserman
2012-03-27 16:14           ` Amos Kong
2012-03-28  2:36             ` Amos Kong
2012-03-22  3:52       ` [PATCH v5 3/4] sockets: pass back errors in inet_listen() Amos Kong
2012-03-22  3:52         ` [Qemu-devel] " Amos Kong
2012-03-27 23:15         ` Michael Roth
2012-03-27 23:15           ` [Qemu-devel] " Michael Roth
2012-03-22  3:53       ` [PATCH v5 4/4] use inet_listen()/inet_connect() to support ipv6 migration Amos Kong
2012-03-22  3:53         ` [Qemu-devel] " Amos Kong
2012-03-19 14:12 ` [PATCH v4 2/2] " Amos Kong
2012-03-19 14:12   ` [Qemu-devel] " Amos Kong

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=20120322035235.2431.88671.stgit@dhcp-8-167.nay.redhat.com \
    --to=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=laine@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=owasserm@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.