Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: net/base/net_util.cc

Issue 6577: Porting of listen_socket, telnet_server to linux (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698