summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-10-22 22:17:29 +0000
committerJeremy Allison <jra@samba.org>2002-10-22 22:17:29 +0000
commit83219da3028a0341a9c7b2db38738ca30288686b (patch)
tree7be5f6ff2559bf70011648f5312636aff84b69ff /source3/smbd
parent6ba55f9b279e235752d9cefd37a027c700172c7d (diff)
downloadsamba-83219da3028a0341a9c7b2db38738ca30288686b.tar.gz
samba-83219da3028a0341a9c7b2db38738ca30288686b.tar.bz2
samba-83219da3028a0341a9c7b2db38738ca30288686b.zip
Fix for systems that allow more than 65536 open files per process.
Jeremy. (This used to be commit 947a56ce00e552e8b8d2ed64435eabde6225f044)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/files.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index c055fb54eb..d926718c5d 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -112,6 +112,8 @@ files_struct *file_new(connection_struct *conn)
files_used++;
fsp->fnum = i + FILE_HANDLE_OFFSET;
+ SMB_ASSERT(fsp->fnum < 65536);
+
string_set(&fsp->fsp_name,"");
DLIST_ADD(Files, fsp);
@@ -144,7 +146,7 @@ void file_close_conn(connection_struct *conn)
Initialise file structures.
****************************************************************************/
-#define MAX_OPEN_FUDGEFACTOR 10
+#define MAX_OPEN_FUDGEFACTOR 20
void file_init(void)
{
@@ -160,11 +162,16 @@ void file_init(void)
real_max_open_files = real_lim - MAX_OPEN_FUDGEFACTOR;
+ if (real_max_open_files + FILE_HANDLE_OFFSET + MAX_OPEN_PIPES > 65536)
+ real_max_open_files = 65536 - FILE_HANDLE_OFFSET - MAX_OPEN_PIPES;
+
if(real_max_open_files != request_max_open_files) {
DEBUG(1,("file_init: Information only: requested %d \
open files, %d are available.\n", request_max_open_files, real_max_open_files));
}
+ SMB_ASSERT(real_max_open_files > 100);
+
file_bmap = bitmap_allocate(real_max_open_files);
if (!file_bmap) {