Messages in this thread Patch in this message |  | | Date | Wed, 08 Jan 1997 23:22:51 -0500 | From | Christopher Horn <> | Subject | Minor sysctl patch for 2.1.20... |
| |
Attached is a minor sysctl patch against 2.1.20 to add the following :
kernel/ctrl-alt-del Disables/enables hard reset via ctrl-alt-del (0 disabled, 1 enabled)
kernel/def-message-level Default message level for printk calls when no level specified.
kernel/min-console-level Minimum level allowed for the console. If console level is equal to or lower than this console logging is disabled.
kernel/def-console-level The default level for the console.
kernel/console-level Level of messages sent to the console.
vm/swapout-interval Interval between pageout scans for kswapd
I was thinking about making the sysctl stuff optional at compile time. Has anyone else done so already, or have plans to?
Cheers, Chris --- linux-2.1.20-virgin/include/linux/sysctl.h Fri Dec 13 21:05:34 1996 +++ linux/include/linux/sysctl.h Wed Jan 8 20:48:37 1997 @@ -62,13 +62,19 @@ #define KERN_JAVA_INTERPRETER 19 /* path to Java(tm) interpreter */ #define KERN_JAVA_APPLETVIEWER 20 /* path to Java(tm) appletviewer */ #define KERN_SPARC_REBOOT 21 /* reboot command on Sparc */ +#define KERN_CONLOGLVL 22 /* int: console log level */ +#define KERN_MINCONLOG 23 /* int: minimum console log level */ +#define KERN_DEFCONLOG 24 /* int: default console log level */ +#define KERN_DEFMSGLOG 25 /* int: default message log level */ +#define KERN_CTLALTDEL 26 /* int: allow ctrl-alt-del to reboot */ /* CTL_VM names: */ #define VM_SWAPCTL 1 /* struct: Set vm swapping control */ #define VM_KSWAPD 2 /* struct: control background pageout */ #define VM_FREEPG 3 /* struct: Set free page thresholds */ #define VM_BDFLUSH 4 /* struct: Control buffer cache flushing */ -#define VM_MAXID 5 +#define VM_SWAPOUT 5 /* int: Pageout scan interval */ +#define VM_MAXID 6 /* CTL_NET names: */ #define NET_CORE 1 diff -uNr linux-2.1.20-virgin/kernel/printk.c linux/kernel/printk.c --- linux-2.1.20-virgin/kernel/printk.c Tue Dec 17 16:07:52 1996 +++ linux/kernel/printk.c Wed Jan 8 20:43:12 1997 @@ -9,6 +9,7 @@ * to the console. Added hook for sending the console messages * elsewhere, in preparation for a serial line console (someday). * Ted Ts'o, 2/11/93. + * Added sysctl support, 1/8/97, Chris Horn. */ #include <stdarg.h> @@ -41,6 +42,12 @@ struct wait_queue * log_wait = NULL; int console_loglevel = DEFAULT_CONSOLE_LOGLEVEL; +/* For sysctl support... */ +int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL; +int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL; +int default_console_loglevel = DEFAULT_CONSOLE_LOGLEVEL; + + static void (*console_print_proc)(const char *) = 0; static char log_buf[LOG_BUF_LEN]; static unsigned long log_start = 0; @@ -131,16 +138,16 @@ logged_chars = 0; return 0; case 6: /* Disable logging to console */ - console_loglevel = MINIMUM_CONSOLE_LOGLEVEL; + console_loglevel = minimum_console_loglevel; return 0; case 7: /* Enable logging to console */ - console_loglevel = DEFAULT_CONSOLE_LOGLEVEL; + console_loglevel = default_console_loglevel; return 0; case 8: if (len < 1 || len > 8) return -EINVAL; - if (len < MINIMUM_CONSOLE_LOGLEVEL) - len = MINIMUM_CONSOLE_LOGLEVEL; + if (len < minimum_console_loglevel) + len = minimum_console_loglevel; console_loglevel = len; return 0; } @@ -173,7 +180,7 @@ ) { p -= 3; p[0] = '<'; - p[1] = DEFAULT_MESSAGE_LOGLEVEL + '0'; + p[1] = default_message_loglevel + '0'; p[2] = '>'; } else msg += 3; diff -uNr linux-2.1.20-virgin/kernel/sysctl.c linux/kernel/sysctl.c --- linux-2.1.20-virgin/kernel/sysctl.c Fri Dec 13 21:05:35 1996 +++ linux/kernel/sysctl.c Wed Jan 8 20:59:26 1997 @@ -7,6 +7,7 @@ * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver. * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver. * Dynamic registration fixes, Stephen Tweedie. + * Added swapout-interval, ctrl-alt-del, printk logging stuff, 1/8/97, Chris Horn. */ #include <linux/config.h> @@ -26,6 +27,9 @@ /* External variables not in a header file. */ extern int panic_timeout; +extern int console_loglevel, default_message_loglevel; +extern int minimum_console_loglevel, default_console_loglevel; +extern int C_A_D, swapout_interval; #ifdef CONFIG_ROOT_NFS @@ -42,6 +46,8 @@ static ctl_table kern_table[]; static ctl_table vm_table[]; extern ctl_table net_table[]; +static ctl_table dev_table[]; + /* /proc declarations: */ @@ -111,6 +117,7 @@ {CTL_KERN, "kernel", NULL, 0, 0555, kern_table}, {CTL_VM, "vm", NULL, 0, 0555, vm_table}, {CTL_NET, "net", NULL, 0, 0555, net_table}, + {CTL_DEV, "dev", NULL, 0, 0555, dev_table}, {0} }; @@ -157,6 +164,16 @@ {KERN_SPARC_REBOOT, "reboot-cmd", reboot_command, 256, 0644, NULL, &proc_dostring, &sysctl_string }, #endif + {KERN_DEFMSGLOG, "def-message-level", &default_message_loglevel, sizeof(int), + 0644, NULL, &proc_dointvec}, + {KERN_MINCONLOG, "min-console-level", &minimum_console_loglevel, sizeof(int), + 0644, NULL, &proc_dointvec}, + {KERN_DEFCONLOG, "def-console-level", &default_console_loglevel, sizeof(int), + 0644, NULL, &proc_dointvec}, + {KERN_CONLOGLVL, "console-level", &console_loglevel, sizeof(int), + 0644, NULL, &proc_dointvec}, + {KERN_CTLALTDEL, "ctrl-alt-del", &C_A_D, sizeof(int), + 0644, NULL, &proc_dointvec}, {0} }; @@ -170,6 +187,12 @@ {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0600, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &bdflush_min, &bdflush_max}, + {VM_SWAPOUT, "swapout-interval", + &swapout_interval, sizeof(int), 0600, NULL, &proc_dointvec}, + {0} +}; + +static ctl_table dev_table[] = { {0} }; |  |