| Index: net/base/net_util.cc
|
| ===================================================================
|
| --- net/base/net_util.cc (revision 3911)
|
| +++ net/base/net_util.cc (working copy)
|
| @@ -10,8 +10,13 @@
|
| #include <unicode/uscript.h>
|
| #include <unicode/uset.h>
|
|
|
| -#ifdef OS_WIN
|
| +#include "build/build_config.h"
|
| +
|
| +#if defined(OS_WIN)
|
| #include <windows.h>
|
| +#elif defined(OS_POSIX)
|
| +#include <sys/socket.h>
|
| +#include <fcntl.h>
|
| #endif
|
|
|
| #include "net/base/net_util.h"
|
| @@ -913,4 +918,16 @@
|
| return IsPortAllowedByDefault(port);
|
| }
|
|
|
| +int SetNonBlocking(int fd) {
|
| +#if defined(OS_WIN)
|
| + unsigned long no_block = 1;
|
| + return ioctlsocket(fd, FIONBIO, &no_block);
|
| +#elif defined(OS_POSIX)
|
| + int flags = fcntl(fd, F_GETFL, 0);
|
| + if (-1 == flags)
|
| + flags = 0;
|
| + return fcntl(fd, F_SETFL, 0);
|
| +#endif
|
| +}
|
| +
|
| } // namespace net
|
|
|