summaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@ev0ke.net>2015-07-30 14:43:15 -0400
committerDavid Goulet <dgoulet@ev0ke.net>2015-07-30 15:21:12 -0400
commit8c83e8cec0e8d4c29577ae7c7b27637e5b91c99e (patch)
treeb5d30b2201c2a4f5610bf20e5935129610ddc53c /src/common/compat.h
parentaa22b9672cd7faa4ea856e54e41cd0d73039ae1a (diff)
downloadtor-8c83e8cec0e8d4c29577ae7c7b27637e5b91c99e.tar.gz
tor-8c83e8cec0e8d4c29577ae7c7b27637e5b91c99e.zip
Add get_max_sockets() and remove dead code
The control port was using set_max_file_descriptors() with a limit set to 0 to query the number of maximum socket Tor can use. With the recent changes to that function, a check was introduced to make sure a user can not set a value below the amount we reserved for non socket. This commit adds get_max_sockets() that returns the value of max_sockets so we can stop using that "setter" function to get the current value. Finally, the dead code is removed that is the code that checked for limit equal to 0. From now on, set_max_file_descriptors() should never be used with a limit set to 0 for a valid use case. Fixes #16697 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/common/compat.h')
-rw-r--r--src/common/compat.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 68985d8554..3247a59878 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -617,6 +617,7 @@ set_uint8(void *cp, uint8_t v)
#if !defined(HAVE_RLIM_T)
typedef unsigned long rlim_t;
#endif
+int get_max_sockets(void);
int set_max_file_descriptors(rlim_t limit, int *max);
int tor_disable_debugger_attach(void);
int switch_id(const char *user);