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:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user