Skip to contentSkip to conversation

printk: add features when CONFIG_PRINTK_TIME=y

PATCH New Stanislaw W. Gruszka 1 participant 1 message Jul 9, 2005 Proc sysctl

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk: add features when CONFIG_PRINTK_TIME=y

Add 2 values which control time printing when CONFIG_PRINTK_TIME=y. Values can
be changed on boot option printk_time=n,m or by /proc/sys/kernel/printk_time.
First one tell about what is printing: 0 - no additional time info, 1 - current time, 2 - difference between to consecutive printk calls. Second tell about resolution of printing time.

 include/linux/sysctl.h |    1 
 kernel/printk.c        |  119 ++++++++++++++++++++++++++++++++++++++-----------
 kernel/sysctl.c        |   14 +++++
 3 files changed, 109 insertions(+), 25 deletions(-)
include/linux/sysctl.h +1 -0
diff -uprN -X dontdiff linux-2.6.13-rc2.orig/include/linux/sysctl.h linux-2.6.13-rc2/include/linux/sysctl.h
@@ -137,6 +137,7 @@ enum
 	KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
 	KERN_RANDOMIZE=68, /* int: randomize virtual address space */
 	KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
+	KERN_PRINTK_TIME=70, /* int: behaviour of printk time */
 };
 
 
kernel/printk.c +94 -25

152 lines not on this page · raw message

kernel/sysctl.c +14 -0
diff -uprN -X dontdiff linux-2.6.13-rc2.orig/kernel/sysctl.c linux-2.6.13-rc2/kernel/sysctl.c
@@ -122,6 +122,10 @@ extern int sysctl_hz_timer;
 extern int acct_parm[];
 #endif
 
+#ifdef CONFIG_PRINTK_TIME
+extern int printk_time_parm[];
+#endif
+
 int randomize_va_space = 1;
 
 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
@@ -379,6 +383,16 @@ static ctl_table kern_table[] = {
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+#ifdef CONFIG_PRINTK_TIME
+	{
+		.ctl_name	= KERN_PRINTK_TIME,
+		.procname	= "printk_time",
+		.data		= printk_time_parm,
+		.maxlen		= 2*sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+#endif
 #ifdef CONFIG_KMOD
 	{
 		.ctl_name	= KERN_MODPROBE,