Build fix for Solaris.

This commit is contained in:
Gunnar Beutner 2012-05-11 12:44:04 +02:00
parent 1ec7c223d4
commit ab6b46786b
2 changed files with 15 additions and 2 deletions

View File

@ -84,8 +84,19 @@ void Socket::SetFD(SOCKET fd)
{
unsigned long lTrue = 1;
if (fd != INVALID_SOCKET)
if (fd != INVALID_SOCKET) {
#ifdef F_GETFL
int flags;
flags = fcntl(fd, F_GETFL, 0);
if (flags < 0)
throw PosixException("fcntl failed", errno);
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
throw PosixException("fcntl failed", errno);
#else /* F_GETFL */
ioctlsocket(fd, FIONBIO, &lTrue);
#endif /* F_GETFL */
}
m_FD = fd;
}

View File

@ -41,7 +41,9 @@ void closesocket(SOCKET fd);
#define ioctlsocket ioctl
#define MAXPATHLEN PATH_MAX
#ifndef MAXPATHLEN
# define MAXPATHLEN PATH_MAX
#endif /* MAXPATHLEN */
/* default visibility takes care of exported symbols */
#define I2_EXPORT