[PATCH] ntdll: Show one-time ERR if NOFILE limit is reached (resend)
Octavian Voicu
octavian.voicu at gmail.com
Fri Jun 11 04:13:17 CDT 2010
Fixes bug 19861 (nominated for 1.2).
---
dlls/ntdll/file.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index b5d1c14..5275c64 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -72,6 +72,9 @@
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
#endif
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
@@ -203,6 +206,31 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
break;
}
}
+ else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
+ {
+ static int once = 0;
+ if (!once++)
+ {
+#define MSG_INCR_NOFILE "Too many open files, please set nofile to " \
+ "a larger value in /etc/security/limits.conf"
+#ifdef HAVE_SETRLIMIT
+ struct rlimit rlimit;
+ if (!getrlimit(RLIMIT_NOFILE, &rlimit))
+ {
+ ERR(MSG_INCR_NOFILE " (cur: %lu, max: %lu)\n",
+ (unsigned long) rlimit.rlim_cur,
+ (unsigned long) rlimit.rlim_max);
+ }
+ else
+ {
+ ERR(MSG_INCR_NOFILE "\n");
+ }
+#else
+ ERR(MSG_INCR_NOFILE "\n");
+#endif
+#undef MSG_INCR_NOFILE
+ }
+ }
return io->u.Status;
}
--
1.7.0.4
More information about the wine-patches
mailing list