summaryrefslogtreecommitdiffstats
path: root/source3/smbd/open.c
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-02-19 09:33:30 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-20 16:35:48 -0800
commitd9a842b26f306a6328e0fb4f226ed8292a8c221a (patch)
tree38dccdf56470b5ee4e0a97dcf20fc477a522fd4a /source3/smbd/open.c
parent193be432a224918bf0fbecfb6705146476c15c07 (diff)
downloadsamba-d9a842b26f306a6328e0fb4f226ed8292a8c221a.tar.gz
samba-d9a842b26f306a6328e0fb4f226ed8292a8c221a.tar.xz
samba-d9a842b26f306a6328e0fb4f226ed8292a8c221a.zip
S3: Detect max_open_files from system
- Attempt to use syscalls to determine max-open-files value. - Add in periodic logging when max file limit reached
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r--source3/smbd/open.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 239d4ff0c41..ac7c35c240c 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -132,6 +132,18 @@ static NTSTATUS fd_open(struct connection_struct *conn,
fsp->fh->fd = SMB_VFS_OPEN(conn,fname,fsp,flags,mode);
if (fsp->fh->fd == -1) {
status = map_nt_error_from_unix(errno);
+ if (errno == EMFILE) {
+ static time_t last_warned = 0L;
+
+ if (time((time_t *) NULL) > last_warned) {
+ DEBUG(0,("Too many open files, unable "
+ "to open more! smbd's max "
+ "open files = %d\n",
+ lp_max_open_files()));
+ last_warned = time((time_t *) NULL);
+ }
+ }
+
}
DEBUG(10,("fd_open: name %s, flags = 0%o mode = 0%o, fd = %d. %s\n",