38#define SOCK_EINTR WSAEINTR
39#define SOCK_EAGAIN WSAEINPROGRESS
40#define SOCK_EWOULDBLOCK WSAEWOULDBLOCK
41#define SOCK_EINPROGRESS WSAEINPROGRESS
42#define SOCK_EALREADY WSAEALREADY
43#define SOCK_ECONNREFUSED WSAECONNREFUSED
44#define SOCK_ECONNRESET WSAECONNRESET
45#define SOCK_ERRNO task_errno
46#define SOCK_OPT_REUSEADDR SO_EXCLUSIVEADDRUSE
47#define GET_OS_ERR WSAGetLastError()
48#define SET_OS_ERR(x) WSASetLastError(x)
49#define CLOSESOCKET(x) closesocket(x)
50#define SOCK_SHUT_RDWR SD_BOTH
62#if (_WIN32_WINNT < 0x0600)
63#error "Need _WIN32_WINNT >= 0x0600"
69 return nfds == 0 ? 0 : WSAPoll(fds, nfds,
timeout);
77#include <netinet/in.h>
78#include <netinet/tcp.h>
79#include <sys/socket.h>
87#define IPPROTO_TCP SOL_TCP
90#define SOCK_EINTR EINTR
91#define SOCK_EAGAIN EAGAIN
92#define SOCK_EWOULDBLOCK EWOULDBLOCK
93#define SOCK_EINPROGRESS EINPROGRESS
94#define SOCK_EALREADY EALREADY
95#define SOCK_ECONNREFUSED ECONNREFUSED
96#define SOCK_ECONNRESET ECONNRESET
97#define SOCK_ERRNO task_errno
98#define SOCK_OPT_REUSEADDR SO_REUSEADDR
99#define GET_OS_ERR errno
100#define SET_OS_ERR(x) errno = (x)
101#define CLOSESOCKET(x) close(x)
102#define SOCK_SHUT_RDWR (SHUT_RD | SHUT_WR)
103#define SOCK_SHUT_RW SHUT_WR
104#define SOCK_SHUT_RD SHUT_RD
125 static LPFN_DISCONNECTEX DisconnectEx =
nullptr;
126 if (DisconnectEx ==
nullptr) {
127 DWORD dwBytesReturned;
128 GUID guidDisconnectEx = WSAID_DISCONNECTEX;
129 WSAIoctl(*
sock, SIO_GET_EXTENSION_FUNCTION_POINTER, &guidDisconnectEx,
130 sizeof(GUID), &DisconnectEx,
sizeof(DisconnectEx),
131 &dwBytesReturned,
nullptr,
nullptr);
133 if (DisconnectEx !=
nullptr) {
134 DisconnectEx(*
sock, (LPOVERLAPPED)
nullptr, (DWORD)0, (DWORD)0);
141 socklen_t *namelen) {
145 *namelen = (socklen_t)x;
156 socklen_t *namelen) {
#define IFDBG(mask, body)
Definition: gcs_debug.h:279
#define FN
Definition: gcs_debug.h:308
@ D_FILEOP
Definition: gcs_debug.h:187
#define STRLIT(x)
Definition: gcs_debug.h:316
#define NDBG(x, f)
Definition: gcs_debug.h:318
static MYSQL * sock
Definition: mysqlcheck.cc:57
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:498
MYSQL_STRINGS_EXPORT void shutdown()
Shutdown character set/collation library.
Definition: collations.cc:105
stdx::expected< size_t, std::error_code > poll(poll_fd *fds, size_t num_fds, std::chrono::milliseconds timeout)
Definition: poll.h:53
stdx::expected< void, error_type > getpeername(native_handle_type native_handle, struct sockaddr *addr, size_t *addr_len)
Definition: socket.h:423
static int to_errno(int err)
Definition: result.h:38
static int from_errno(int err)
Definition: result.h:42
struct sockaddr sockaddr
Definition: sock_probe_win32.h:63
case opt name
Definition: sslopt-case.h:29
int val
Definition: result.h:31
int funerr
Definition: result.h:32
void remove_and_wakeup(int fd)
Definition: task.cc:880
#define CLOSESOCKET(x)
Definition: task_os.h:101
static result xcom_shut_close_socket(int *sock)
Definition: task_os.h:175
#define SET_OS_ERR(x)
Definition: task_os.h:100
static int is_socket_error(int x)
Definition: task_os.h:116
#define SOCK_SHUT_RDWR
Definition: task_os.h:102
static int hard_select_err(int err)
Definition: task_os.h:110
struct pollfd pollfd
Definition: task_os.h:114
static int xcom_getpeername(int s, struct sockaddr *name, socklen_t *namelen)
Definition: task_os.h:155
#define SOCK_EWOULDBLOCK
Definition: task_os.h:92
static int hard_connect_err(int err)
Definition: task_os.h:106
static void shutdown_socket(int *sock)
Definition: task_os.h:151
#define GET_OS_ERR
Definition: task_os.h:99
static result xcom_close_socket(int *sock)
Definition: task_os.h:162
#define SOCK_EINTR
Definition: task_os.h:90