[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 1/4] sockets: introduce set_socket_error()
From: |
Orit Wasserman |
Subject: |
Re: [Qemu-devel] [PATCH v5 1/4] sockets: introduce set_socket_error() |
Date: |
Tue, 27 Mar 2012 15:00:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 |
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 <address@hidden>
> ---
> 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 */
>
>
- [Qemu-devel] [PATCH v4 0/2] support to migrate with IPv6 address, Amos Kong, 2012/03/19
- [Qemu-devel] [PATCH v4 2/2] use inet_listen()/inet_connect() to support ipv6 migration, Amos Kong, 2012/03/19
- [Qemu-devel] [PATCH v4 1/2] qemu-socket: change inet_connect() to to support nonblock socket, Amos Kong, 2012/03/19
- [Qemu-devel] [PATCH v5 2/4] qemu-socket: change inet_connect() to to support nonblock socket, Amos Kong, 2012/03/21
- Re: [Qemu-devel] [PATCH v5 2/4] qemu-socket: change inet_connect() to to support nonblock socket, Orit Wasserman, 2012/03/27
- Re: [Qemu-devel] [PATCH v5 2/4] qemu-socket: change inet_connect() to to support nonblock socket, Amos Kong, 2012/03/27
- Re: [Qemu-devel] [PATCH v5 2/4] qemu-socket: change inet_connect() to to support nonblock socket, Amos Kong, 2012/03/27
- [Qemu-devel] [PATCH v5 3/4] sockets: pass back errors in inet_listen(), Amos Kong, 2012/03/21
- Re: [Qemu-devel] [PATCH v5 3/4] sockets: pass back errors in inet_listen(), Michael Roth, 2012/03/27
- [Qemu-devel] [PATCH v5 4/4] use inet_listen()/inet_connect() to support ipv6 migration, Amos Kong, 2012/03/21