Patch for max root reserved f

Tekno Soft Snc (teknosoft@mclink.it)
Wed, 5 Nov 97 17:36:57 CET


Hi All,

below there's a patch for linux 2.1.62 that move the
max reserved files for root from #define to /proc filesystem.
It's accessible on /proc/sys/kernel/max-root-free-file.
This is usefull for a certain root programs that will needed
to reserved more files for a particular operations.

Bye!

Roberto Fichera - email MC3641@mclink.it
email teknosoft@mclink.it
-------------------------------------------------------------
What ? Do you have problem with Windows95 ? You can try to
send problem > /dev/null, "he" listen every problem but take
a while for the reply! A satisfied Windows95 user
-------------------------------------------------------------

diff -ur linux-2.1.62/fs/file_table.c linux-2.1.62-patched/fs/file_table.c
--- linux-2.1.62/fs/file_table.c Thu Oct 16 10:27:06 1997
+++ linux-2.1.62-patched/fs/file_table.c Wed Nov 5 12:51:50 1997
@@ -21,6 +21,7 @@
int nr_files = 0; /* read only */
int nr_free_files = 0; /* read only */
int max_files = NR_FILE;/* tunable */
+int max_root_free_files = NR_RESERVED_FILES; /* tunable */

/* Free list management, if you are here you must have f_count == 0 */
static struct file * free_filps = NULL;
@@ -69,7 +70,7 @@
static int old_max = 0;
struct file * f;

- if (nr_free_files > NR_RESERVED_FILES) {
+ if (nr_free_files > max_root_free_files) {
used_one:
f = free_filps;
remove_filp(f);
diff -ur linux-2.1.62/include/linux/fs.h
linux-2.1.62-patched/include/linux/fs.h
--- linux-2.1.62/include/linux/fs.h Fri Oct 31 12:31:41 1997
+++ linux-2.1.62-patched/include/linux/fs.h Wed Nov 5 13:14:31 1997
@@ -43,6 +43,7 @@
/* And dynamically-tunable limits and defaults: */
extern int max_inodes;
extern int max_files, nr_files, nr_free_files;
+extern int max_root_free_files;
#define NR_INODE 4096 /* this should be bigger than NR_FILE */
#define NR_FILE 1024 /* this can well be larger on a larger system */
#define NR_RESERVED_FILES 10 /* reserved for root */
diff -ur linux-2.1.62/include/linux/sysctl.h
linux-2.1.62-patched/include/linux/sysctl.h
--- linux-2.1.62/include/linux/sysctl.h Fri Oct 31 12:31:42 1997
+++ linux-2.1.62-patched/include/linux/sysctl.h Wed Nov 5 13:17:44 1997
@@ -58,6 +58,7 @@
KERN_MAXINODE,
KERN_NRFILE,
KERN_MAXFILE,
+ KERN_MAXROOTFILE, /* int: max root free files */
KERN_SECURELVL, /* int: system security level */
KERN_PANIC, /* int: panic timeout */
KERN_REALROOTDEV, /* real root device to mount after initrd
*/
diff -ur linux-2.1.62/kernel/sysctl.c linux-2.1.62-patched/kernel/sysctl.c
--- linux-2.1.62/kernel/sysctl.c Fri Oct 31 12:31:42 1997
+++ linux-2.1.62-patched/kernel/sysctl.c Wed Nov 5 13:03:45 1997
@@ -150,6 +150,8 @@
0444, NULL, &proc_dointvec},
{KERN_MAXFILE, "file-max", &max_files, sizeof(int),
0644, NULL, &proc_dointvec},
+ {KERN_MAXROOTFILE, "max-root-free-file", &max_root_free_files,
sizeof(int),
+ 0644, NULL, &proc_dointvec},
{KERN_DENTRY, "dentry-state", &dentry_stat, 6*sizeof(int),
0444, NULL, &proc_dointvec},
{KERN_SECURELVL, "securelevel", &securelevel, sizeof(int),