From f3793be1651c055da7cfa58afb817547df766de8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Oct 1998 06:16:10 +0000 Subject: Re-added code to tell the user how many open files they have. Needed for server diagnosis purposes... Jeremy. (This used to be commit 04d79a9ae515e7259277f9980552f1d61df239f1) --- source3/lib/util.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index c1307336cc..d0cb51f3ca 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -4849,9 +4849,9 @@ void zero_free(void *p, size_t size) /***************************************************************** -set our open file limit to the max and return the limit +set our open file limit to a requested max and return the limit *****************************************************************/ -int set_maxfiles(void) +int set_maxfiles(int requested_max) { #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)) struct rlimit rlp; @@ -4860,13 +4860,15 @@ int set_maxfiles(void) * account for the extra fd we need * as well as the log files and standard * handles etc. */ - rlp.rlim_cur = rlp.rlim_max; + rlp.rlim_cur = MIN(requested_max,rlp.rlim_max); setrlimit(RLIMIT_NOFILE, &rlp); getrlimit(RLIMIT_NOFILE, &rlp); return rlp.rlim_cur; #else - /* just guess ... */ - return 1024; + /* + * No way to know - just guess... + */ + return requested_max; #endif } -- cgit