summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-02-09 02:59:37 +0000
committerRoger Dingledine <arma@torproject.org>2006-02-09 02:59:37 +0000
commit28f3765b5aa022da0efa0273ca924e7e5a470481 (patch)
tree1312624e10c42353cf9c4e5d862c226cb4b92448
parentdbea401305b7c6b5bcbcf53d59720e6a9eca7a05 (diff)
downloadtor-28f3765b5aa022da0efa0273ca924e7e5a470481.tar.gz
tor-28f3765b5aa022da0efa0273ca924e7e5a470481.zip
and maybe some function documentation will help too
svn:r5935
-rw-r--r--src/common/compat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 689c7eaed4..0d9de300a5 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -441,9 +441,15 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
#define ULIMIT_BUFFER 32 /* keep 32 extra fd's beyond _ConnLimit */
-/** Get the maximum allowed number of file descriptors. (Some systems
- * have a low soft limit.) Make sure we set it to at least
- * <b>limit</b>. Return a new limit if we can, or -1 if we fail. */
+/** Learn the maximum allowed number of file descriptors. (Some systems
+ * have a low soft limit.
+ *
+ * We compute this by finding the largest number between <b>limit</b>
+ * and <b>cap</b> that we can use. If we can't find a number greater
+ * than or equal to <b>limit</b>, then we fail: return -1.
+ *
+ * Otherwise, return the number minus some buffer to allow for other
+ * file descriptors we'll want available for ordinary use. */
int
set_max_file_descriptors(unsigned long limit, unsigned long cap)
{