[ovs-dev] [PATCH 03/14] socket-util: Maximum file descriptors for windows.

Gurucharan Shetty shettyg at nicira.com
Wed Feb 19 23:36:14 UTC 2014


Windows does not have a getrlimit() function. As such,
there is no limit to number of file descriptors that
can be opened. So, set an aritificial limit of 1024.
This may be increased in the future if the limit is too
low.

Co-authored-by: Linda Sun <lsun at vmware.com>
Signed-off-by: Linda Sun <lsun at vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 lib/socket-util.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/socket-util.c b/lib/socket-util.c
index bfa2ce8..cde4d71 100644
--- a/lib/socket-util.c
+++ b/lib/socket-util.c
@@ -122,6 +122,7 @@ set_dscp(int fd, uint8_t dscp)
     return 0;
 }
 
+#ifndef _WIN32
 static bool
 rlim_is_finite(rlim_t limit)
 {
@@ -143,11 +144,13 @@ rlim_is_finite(rlim_t limit)
 
     return true;
 }
+#endif
 
 /* Returns the maximum valid FD value, plus 1. */
 int
 get_max_fds(void)
 {
+#ifndef _WIN32
     static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
     static int max_fds;
 
@@ -163,6 +166,11 @@ get_max_fds(void)
     }
 
     return max_fds;
+#else
+    /* Windows does not have a limitation on the number of file descriptors.
+     * Set an artificial limit at 1024. */
+    return 1024;
+#endif
 }
 
 /* Translates 'host_name', which must be a string representation of an IP
-- 
1.7.9.5




More information about the dev mailing list