Rev | Line | |
---|
[8a9afe4] | 1 | #include <errno.h> |
---|
| 2 | #include <fcntl.h> |
---|
| 3 | |
---|
[b7d3cc34] | 4 | #ifndef _WIN32 |
---|
| 5 | #include <unistd.h> |
---|
| 6 | #include <sys/socket.h> |
---|
| 7 | #include <netinet/in.h> |
---|
| 8 | #include <arpa/inet.h> |
---|
| 9 | #include <netdb.h> |
---|
| 10 | #define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK) |
---|
[701acdd4] | 11 | #define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0) |
---|
[b7d3cc34] | 12 | #define sockerr_again() (errno == EINPROGRESS || errno == EINTR) |
---|
| 13 | #define closesocket(a) close(a) |
---|
| 14 | #else |
---|
| 15 | # include <winsock2.h> |
---|
| 16 | # ifndef _MSC_VER |
---|
| 17 | # include <ws2tcpip.h> |
---|
| 18 | # endif |
---|
| 19 | # if !defined(BITLBEE_CORE) && defined(_MSC_VER) |
---|
| 20 | # pragma comment(lib,"bitlbee.lib") |
---|
| 21 | # endif |
---|
| 22 | # include <io.h> |
---|
| 23 | # define read(a,b,c) recv(a,b,c,0) |
---|
| 24 | # define write(a,b,c) send(a,b,c,0) |
---|
| 25 | # define umask _umask |
---|
| 26 | # define mode_t int |
---|
| 27 | # define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); } |
---|
[701acdd4] | 28 | # define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); } |
---|
[b7d3cc34] | 29 | # define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK) |
---|
| 30 | # define ETIMEDOUT WSAETIMEDOUT |
---|
| 31 | # define sleep(a) Sleep(a*1000) |
---|
| 32 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.