Previously compiled programs might retrieve the maximum number of
files they can open from the kernel and then try to select on them. This
can cause segfaults as processes exceed the bounds of their fd_sets.
At minimum, I strongly advise the following additional patch
which forces processes to manually raise their set size. Processes that
use hundreds of file descriptors should be smart enough to change their
resource limits and make sure their file descriptor set size is large enough.
David Schwartz
--- resource.h 1996/07/28 07:06:17 1.1.1.1
+++ resource.h 1996/08/17 19:36:10
@@ -20,6 +20,12 @@
#ifdef __KERNEL__
+#if NR_OPEN > 256
+#define INIT_NR_OPEN 256
+#else
+#define INIT_NR_OPEN NR_OPEN
+#endif
+
#define INIT_RLIMITS \
{ \
{ LONG_MAX, LONG_MAX }, \
@@ -29,7 +35,7 @@
{ 0, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
{ MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \
- { NR_OPEN, NR_OPEN }, \
+ { INIT_NR_OPEN, NR_OPEN }, \
{ LONG_MAX, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
}
On Mon, 9 Dec 1996, Oskar Pearson wrote:
>
> Hi
>
> > Here is a patch of mine to do just what you want. I think it
> > is very important to put this patch into the kernel as most modern OS'es
> > (Solaris, OSF/1, etc..) have higher limits of at least 1024 per process.
> As far as I am aware this will not work at 1024 filedescriptors?
>
> I have put a page on the Web for this at http://www.linux.org.za/tweak.html
>
> This has been working on our cache server for weeks without problems (except
> for a power problem), and opens and closes in the region of 3/4 -> 1 million
> filedescriptors per day.
>
> Enjoy!
>
> > diff -ur linux-2.0.20-dist/include/linux/fs.h linux-2.0.20-mine/include/linux/fs.h
> > --- linux-2.0.20-dist/include/linux/fs.h Fri Sep 13 06:07:08 1996
> > +++ linux-2.0.20-mine/include/linux/fs.h Fri Sep 13 20:46:16 1996
> > @@ -29,7 +29,7 @@
> >
> > /* Fixed constants first: */
> > #undef NR_OPEN
> > -#define NR_OPEN 256
> > +#define NR_OPEN 1024
> >
> > #define NR_SUPER 64
> > #define BLOCK_SIZE 1024
> > diff -ur linux-2.0.20-dist/include/linux/limits.h linux-2.0.20-mine/include/linux/limits.h
> > --- linux-2.0.20-dist/include/linux/limits.h Wed Jul 17 08:10:03 1996
> > +++ linux-2.0.20-mine/include/linux/limits.h Fri Sep 13 20:43:31 1996
> > @@ -1,12 +1,12 @@
> > #ifndef _LINUX_LIMITS_H
> > #define _LINUX_LIMITS_H
> >
> > -#define NR_OPEN 256
> > +#define NR_OPEN 1024
> >
> > #define NGROUPS_MAX 32 /* supplemental group IDs are available */
> > #define ARG_MAX 131072 /* # bytes of args + environ for exec() */
> > #define CHILD_MAX 999 /* no limit :-) */
> > -#define OPEN_MAX 256 /* # open files a process may have */
> > +#define OPEN_MAX 1024 /* # open files a process may have */
> > #define LINK_MAX 127 /* # links a file may have */
> > #define MAX_CANON 255 /* size of the canonical input queue */
> > #define MAX_INPUT 255 /* size of the type-ahead buffer */
>
>