summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-10-16 06:16:10 +0000
committerJeremy Allison <jra@samba.org>1998-10-16 06:16:10 +0000
commitf3793be1651c055da7cfa58afb817547df766de8 (patch)
tree092a69f5bb0f13bd63be48e1fb5c116ecf540977 /source3/lib
parentc9ab92ffe523a7061e97668becf08705db1d744f (diff)
downloadsamba-f3793be1651c055da7cfa58afb817547df766de8.tar.gz
samba-f3793be1651c055da7cfa58afb817547df766de8.tar.bz2
samba-f3793be1651c055da7cfa58afb817547df766de8.zip
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)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c12
1 files changed, 7 insertions, 5 deletions
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
}