aboutsummaryrefslogtreecommitdiffstats
path: root/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'sock.h')
-rw-r--r--sock.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sock.h b/sock.h
index 3e74bf96..9a9cc223 100644
--- a/sock.h
+++ b/sock.h
@@ -5,6 +5,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK)
+#define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0)
#define sockerr_again() (errno == EINPROGRESS || errno == EINTR)
#define closesocket(a) close(a)
#else
@@ -21,6 +22,7 @@
# define umask _umask
# define mode_t int
# define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); }
+# define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); }
# define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK)
# define ETIMEDOUT WSAETIMEDOUT
# define sleep(a) Sleep(a*1000)