Messages in this thread Patch in this message | | | From | "Ulrich Windl" <> | Date | Tue, 9 Nov 1999 08:22:06 +0200 | Subject | Q: sysctl (2.2.12) |
| |
Hello,
I'm planning to add some sysctl functionality, and I have supplied a sample patch. Would anybody care to have a look and tell me if that is OK? Are there any hidden traps I should be aware of?
I also think that the current sysctl code silently asumes "int" == "long", because there are no functions dealing with longs.
In addition I realized that changing include/linux/sysctl.h causes the whole network subsystem to be rebuilt (core, ip, etc.). Is that intentional?
Ulrich
Here's the sample patch:
Index: Documentation/sysctl/kernel.txt =================================================================== RCS file: /root/21REP/linux21/Documentation/sysctl/kernel.txt,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 kernel.txt --- Documentation/sysctl/kernel.txt 1999/08/10 17:20:41 1.1.1.4 +++ Documentation/sysctl/kernel.txt 1999/11/08 20:30:42 @@ -37,6 +37,7 @@ - rtsig-max - sg-big-buff [ generic SCSI device (sg) ] - shmmax [ sysv ipc ] +- time - version - zero-paged [ PPC only ] Index: include/linux/sysctl.h =================================================================== RCS file: /root/21REP/linux21/include/linux/sysctl.h,v retrieving revision 1.1.1.6 diff -u -r1.1.1.6 sysctl.h --- include/linux/sysctl.h 1999/08/10 17:24:18 1.1.1.6 +++ include/linux/sysctl.h 1999/11/08 20:11:05 @@ -103,9 +103,15 @@ KERN_MSGMAX=35, /* int: Maximum size of a messege */ KERN_MSGMNB=36, /* int: Maximum message queue size */ KERN_MSGPOOL=37, /* int: Maximum system message pool size */ - KERN_SYSRQ=38 /* int: Sysreq enable */ + KERN_SYSRQ=38, /* int: Sysreq enable */ + KERN_TIME=39 /* directory: time */ }; +/* KERN_TIME names: */ +enum +{ + KERN_TIME_TEST=1, /* int: some variable */ +}; /* CTL_VM names: */ enum Index: kernel/sysctl.c =================================================================== RCS file: /root/21REP/linux21/kernel/sysctl.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 sysctl.c --- kernel/sysctl.c 1999/08/10 17:24:29 1.1.1.5 +++ kernel/sysctl.c 1999/11/08 20:33:48 @@ -75,6 +75,7 @@ {root_table, DNODE_SINGLE(&root_table_header)}; static ctl_table kern_table[]; +static ctl_table kern_time_table[]; static ctl_table vm_table[]; #ifdef CONFIG_NET extern ctl_table net_table[]; @@ -218,7 +219,17 @@ #ifdef CONFIG_MAGIC_SYSRQ {KERN_SYSRQ, "sysrq", &sysrq_enabled, sizeof (int), 0644, NULL, &proc_dointvec}, -#endif +#endif + {KERN_TIME, "time", NULL, 0, 0555, kern_time_table}, + {0} +}; + +#if 1 +extern long time_tick; /* just a hack for this demo! */ +#endif +static ctl_table kern_time_table[] = { + {KERN_TIME_TEST, "test", &time_tick, sizeof(time_tick), + 0444, NULL, &proc_dointvec}, {0} };
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |