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 #ifdef WINSOCK
u_long on = toggle ? 1 : 0; u_long on = toggle ? 1 : 0;
ret = ioctlsocket(fd, FIONBIO, &on); 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 #else
ret = ioctl(fd, FIONBIO, &toggle); ret = ioctl(fd, FIONBIO, &toggle);
#endif
#endif #endif
if (ret == -1) if (ret == -1)
{ {