2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

socket-util: Move sock_errno() to socket-util.

And add more users.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Gurucharan Shetty
2014-02-18 10:25:13 -08:00
parent 53fd5c7c6d
commit 0f0b5401fe
3 changed files with 39 additions and 34 deletions

View File

@@ -17,6 +17,7 @@
#ifndef SOCKET_UTIL_H
#define SOCKET_UTIL_H 1
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -99,4 +100,15 @@ static inline int rpl_setsockopt(int sock, int level, int optname,
}
#endif
/* In Windows platform, errno is not set for socket calls.
* The last error has to be gotten from WSAGetLastError(). */
static inline int sock_errno(void)
{
#ifdef _WIN32
return WSAGetLastError();
#else
return errno;
#endif
}
#endif /* socket-util.h */