Added net_set_nonblocking for Solaris.

This commit is contained in:
Jan Vidar Krey 2009-08-06 23:28:44 +02:00
parent cd389742e6
commit cfb450c3fc
1 changed files with 10 additions and 0 deletions

View File

@ -182,8 +182,18 @@ int net_set_nonblocking(int fd, int toggle)
#ifdef WINSOCK
u_long on = toggle ? 1 : 0;
ret = ioctlsocket(fd, FIONBIO, &on);
#else
#ifdef __sun__
int flags = fcntl(fd, F_GETFL, 0);
if (flags != -1)
{
if (toggle) flags |= O_NONBLOCK;
else flags &= ~O_NONBLOCK;
ret = fcntl(fd, F_SETFL, flags);
}
#else
ret = ioctl(fd, FIONBIO, &toggle);
#endif
#endif
if (ret == -1)
{