utils: port set_nonblocking() to WIN32

The new WIN32 version of set_nonblocking() can only deal with sockets,
i.e. it will fail on main_notify.c.  On WIN32, we have to reimplement
main_notify.c anyway, so this is not a big deal.
This commit is contained in:
Max Kellermann 2008-12-30 19:17:20 +01:00
parent bb55ec6b4e
commit 6890183c50

View File

@ -192,6 +192,11 @@ char *parsePath(char *path)
int set_nonblocking(int fd)
{
#ifdef WIN32
u_long val = 0;
return ioctlsocket(fd, FIONBIO, &val) == 0 ? 0 : -1;
#else
int ret, flags;
assert(fd >= 0);
@ -203,6 +208,7 @@ int set_nonblocking(int fd)
flags |= O_NONBLOCK;
while ((ret = fcntl(fd, F_SETFL, flags)) < 0 && errno == EINTR) ;
return ret;
#endif
}
void init_async_pipe(int file_des[2])