qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Orit Wasserman <owasserm@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com,
	jasowang@redhat.com, qemu-devel@nongnu.org,
	mdroth@linux.vnet.ibm.com, laine@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 1/4] sockets: introduce set_socket_error()
Date: Tue, 27 Mar 2012 15:00:55 +0200	[thread overview]
Message-ID: <4F71BA07.9040007@redhat.com> (raw)
In-Reply-To: <20120322035235.2431.88671.stgit@dhcp-8-167.nay.redhat.com>

On 03/22/2012 05:52 AM, Amos Kong wrote:
> 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

how about creating a function set_errno(int e) and use it in the macro.

Orit
>  #define closesocket(s) close(s)
>  
>  #endif /* !_WIN32 */
> 
> 

  reply	other threads:[~2012-03-27 13:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 14:11 [Qemu-devel] [PATCH v4 0/2] support to migrate with IPv6 address Amos Kong
2012-03-19 14:11 ` [Qemu-devel] [PATCH v4 1/2] qemu-socket: change inet_connect() to to support nonblock socket Amos Kong
2012-03-20 10:58   ` Orit Wasserman
2012-03-21 23:46   ` Michael Roth
2012-03-22  3:13     ` Amos Kong
2012-03-22  3:52     ` [Qemu-devel] [PATCH v5 0/2] support to migrate with IPv6 address Amos Kong
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 [this message]
2012-03-27 14:56           ` [Qemu-devel] [PATCH v6 " Amos Kong
2012-03-22  3:52       ` [Qemu-devel] [PATCH v5 2/4] qemu-socket: change inet_connect() to to support nonblock socket 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       ` [Qemu-devel] [PATCH v5 3/4] sockets: pass back errors in inet_listen() Amos Kong
2012-03-27 23:15         ` Michael Roth
2012-03-22  3:53       ` [Qemu-devel] [PATCH v5 4/4] use inet_listen()/inet_connect() to support ipv6 migration Amos Kong
2012-03-19 14:12 ` [Qemu-devel] [PATCH v4 2/2] " 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=4F71BA07.9040007@redhat.com \
    --to=owasserm@redhat.com \
    --cc=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=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 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).