|
@@ -1589,6 +1589,13 @@ tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+
|
|
|
+int
|
|
|
+get_max_sockets(void)
|
|
|
+{
|
|
|
+ return max_sockets;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
* tell Tor it's allowed to use. */
|
|
|
#define ULIMIT_BUFFER 32
|
|
@@ -1601,8 +1608,6 @@ tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
|
|
|
* If we can't find a number greater than or equal to <b>limit</b>,
|
|
|
* then we fail: return -1.
|
|
|
*
|
|
|
- * If <b>limit</b> is 0, then do not adjust the current maximum.
|
|
|
- *
|
|
|
* Otherwise, return 0 and store the maximum we found inside <b>max_out</b>.*/
|
|
|
int
|
|
|
set_max_file_descriptors(rlim_t limit, int *max_out)
|
|
@@ -1647,17 +1652,6 @@ set_max_file_descriptors(rlim_t limit, int *max_out)
|
|
|
strerror(errno));
|
|
|
return -1;
|
|
|
}
|
|
|
- if (limit == 0) {
|
|
|
-
|
|
|
- * function increases limit if it started out less than ULIMIT_BUFFER */
|
|
|
-
|
|
|
-
|
|
|
- limit = rlim.rlim_max;
|
|
|
- if (limit > INT_MAX)
|
|
|
- limit = INT_MAX;
|
|
|
- *max_out = max_sockets = (int)limit - ULIMIT_BUFFER;
|
|
|
- return 0;
|
|
|
- }
|
|
|
if (rlim.rlim_max < limit) {
|
|
|
log_warn(LD_CONFIG,"We need %lu file descriptors available, and we're "
|
|
|
"limited to %lu. Please change your ulimit -n.",
|