diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-06-15 10:16:00 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-15 15:07:53 -0400 |
commit | 1755f792ed265dcea70a199c19ffde47aae7544b (patch) | |
tree | cdc25880d039d1bc8138dc9e6cf9372e8f8407c2 /src/or/control.c | |
parent | 783f705ddc507c082ab53b556317680447f046f6 (diff) | |
download | tor-1755f792ed265dcea70a199c19ffde47aae7544b.tar.gz tor-1755f792ed265dcea70a199c19ffde47aae7544b.zip |
Refactor GETINFO process/descriptor-limit
Previously it duplicated some getrlimit code and content from compat.c;
now it doesn't.
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/or/control.c b/src/or/control.c index 9465f895a4..9fc28bb5c6 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1466,26 +1466,9 @@ getinfo_helper_misc(control_connection_t *conn, const char *question, } #endif } else if (!strcmp(question, "process/descriptor-limit")) { - /** platform specifc limits are from the set_max_file_descriptors function - * of src/common/compat.c */ - /* XXXX023 This is duplicated code from compat.c; it should turn into a - * function. */ - #ifdef HAVE_GETRLIMIT - struct rlimit descriptorLimit; - - if (getrlimit(RLIMIT_NOFILE, &descriptorLimit) == 0) { - tor_asprintf(answer, U64_FORMAT, - U64_PRINTF_ARG(descriptorLimit.rlim_max)); - } else { - *answer = tor_strdup("-1"); - } - #elif defined(CYGWIN) || defined(__CYGWIN__) - *answer = tor_strdup("3200"); - #elif defined(_WIN32) - *answer = tor_strdup("15000"); - #else - *answer = tor_strdup("15000"); - #endif + int max_fds=-1; + set_max_file_descriptors(0, &max_fds); + tor_asprintf(answer, "%d", max_fds); } else if (!strcmp(question, "dir-usage")) { *answer = directory_dump_request_log(); } else if (!strcmp(question, "fingerprint")) { |