summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_pipe_hnd.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-30 01:49:24 +0000
committerJeremy Allison <jra@samba.org>1998-09-30 01:49:24 +0000
commit5b4d94e20fdb5888da1b71a7b6a30ebede6cb06a (patch)
treeb4f9513c1c829ee874b53e7c4f45d9acadc079d7 /source3/rpc_server/srv_pipe_hnd.c
parent5a8458c377b6901b67a039eafbd5727ed1207cf3 (diff)
downloadsamba-5b4d94e20fdb5888da1b71a7b6a30ebede6cb06a.tar.gz
samba-5b4d94e20fdb5888da1b71a7b6a30ebede6cb06a.tar.bz2
samba-5b4d94e20fdb5888da1b71a7b6a30ebede6cb06a.zip
(Finally) implemented "max open files" as a global smb.conf parameter.
Sets up the files array correctly - limited by the smb.conf parameter and by the max fd's per process as found by getrlimit(). Jeremy. (This used to be commit eca24bd24352c688cdf48c1ef14adb8ac353468f)
Diffstat (limited to 'source3/rpc_server/srv_pipe_hnd.c')
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 301510730b..cb1ec963d9 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -28,9 +28,6 @@
#define PIPE "\\PIPE\\"
#define PIPELEN strlen(PIPE)
-/* this must be larger than the sum of the open files and directories */
-#define PIPE_HANDLE_OFFSET 0x7000
-
extern int DEBUGLEVEL;
static pipes_struct *chain_p;
static int pipes_open;
@@ -42,6 +39,21 @@ static int pipes_open;
static pipes_struct *Pipes;
static struct bitmap *bmap;
+/* this must be larger than the sum of the open files and directories */
+static int pipe_handle_offset;
+
+/****************************************************************************
+ Set the pipe_handle_offset. Called from smbd/files.c
+****************************************************************************/
+
+void set_pipe_handle_offset(int max_open_files)
+{
+ if(max_open_files < 0x7000)
+ pipe_handle_offset = 0x7000;
+ else
+ pipe_handle_offset = max_open_files + 10; /* For safety. :-) */
+}
+
/****************************************************************************
reset pipe chain handle number
****************************************************************************/
@@ -103,7 +115,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
DLIST_ADD(Pipes, p);
bitmap_set(bmap, i);
- i += PIPE_HANDLE_OFFSET;
+ i += pipe_handle_offset;
pipes_open++;
@@ -283,7 +295,7 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn)
mem_buf_free(&(p->rdata.data));
mem_buf_free(&(p->rhdr .data));
- bitmap_clear(bmap, p->pnum - PIPE_HANDLE_OFFSET);
+ bitmap_clear(bmap, p->pnum - pipe_handle_offset);
pipes_open--;