diff options
author | Jeremy Allison <jra@samba.org> | 1998-10-16 06:16:10 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-10-16 06:16:10 +0000 |
commit | 04d79a9ae515e7259277f9980552f1d61df239f1 (patch) | |
tree | 8d48ab9c72d2e6919192a757b56ac5d63708bfe1 /source/lib | |
parent | f69cf05ff56dffb313304964d5bf5e5aee2f40a7 (diff) | |
download | samba-04d79a9ae515e7259277f9980552f1d61df239f1.tar.gz samba-04d79a9ae515e7259277f9980552f1d61df239f1.tar.xz samba-04d79a9ae515e7259277f9980552f1d61df239f1.zip |
Re-added code to tell the user how many open files they
have. Needed for server diagnosis purposes...
Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/util.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index c1307336cc1..d0cb51f3caa 100644 --- a/source/lib/util.c +++ b/source/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 } |