diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-09-19 20:41:31 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-09-19 20:41:31 +0000 |
commit | 93beeac01d27c3150cc998331ab79354c311bd8f (patch) | |
tree | 9ff5d506c6e4f74a01b54e26225b0485ca30eb38 /src/common/compat.c | |
parent | 8648b1133b72f384fc588208c0439a1aff30ec03 (diff) | |
download | tor-93beeac01d27c3150cc998331ab79354c311bd8f.tar.gz tor-93beeac01d27c3150cc998331ab79354c311bd8f.zip |
Merge in some bsockets calls, all wrapped inside #if defined(USE_BSOCKETS)
svn:r8427
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 674baeca0a..c98748bcd2 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -92,6 +92,10 @@ const char compat_c_id[] = #include <sys/mman.h> #endif +#ifdef USE_BSOCKETS +#include <bsocket.h> +#endif + #include "log.h" #include "util.h" @@ -425,7 +429,7 @@ touch_file(const char *fname) void set_socket_nonblocking(int socket) { -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) unsigned long nonblocking = 1; ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking); #else @@ -458,6 +462,8 @@ tor_socketpair(int family, int type, int protocol, int fd[2]) int r; r = socketpair(family, type, protocol, fd); return r < 0 ? -errno : r; +#elif defined(USE_BSOCKETS) + return bsockepair(family, type, protocol, fd); #else /* This socketpair does not work when localhost is down. So * it's really not the same thing at all. But it's close enough @@ -1233,7 +1239,7 @@ struct tor_mutex_t { * should call tor_socket_errno <em>at most once</em> on the failing * socket to get the error. */ -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) int tor_socket_errno(int sock) { @@ -1249,7 +1255,7 @@ tor_socket_errno(int sock) } #endif -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && !defined(USE_BSOCKETS) #define E(code, s) { code, (s " [" #code " ]") } struct { int code; const char *msg; } windows_socket_errors[] = { E(WSAEINTR, "Interrupted function call"), |