2 * sysctl.c: General linux system control interface
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
21 #include <linux/config.h>
22 #include <linux/module.h>
24 #include <linux/swap.h>
25 #include <linux/slab.h>
26 #include <linux/sysctl.h>
27 #include <linux/proc_fs.h>
28 #include <linux/ctype.h>
29 #include <linux/utsname.h>
30 #include <linux/capability.h>
31 #include <linux/smp_lock.h>
32 #include <linux/init.h>
33 #include <linux/kernel.h>
34 #include <linux/sysrq.h>
35 #include <linux/highuid.h>
36 #include <linux/writeback.h>
37 #include <linux/hugetlb.h>
38 #include <linux/security.h>
39 #include <linux/initrd.h>
40 #include <linux/times.h>
41 #include <linux/limits.h>
42 #include <asm/uaccess.h>
44 #ifdef CONFIG_ROOT_NFS
45 #include <linux/nfs_fs.h>
48 #if defined(CONFIG_SYSCTL)
50 /* External variables not in a header file. */
51 extern int panic_timeout;
53 extern int sysctl_overcommit_memory;
54 extern int sysctl_overcommit_ratio;
55 extern int max_threads;
56 extern atomic_t nr_queued_signals;
57 extern int max_queued_signals;
58 extern int sysrq_enabled;
59 extern int core_uses_pid;
60 extern char core_pattern[];
63 extern int sysctl_lower_zone_protection;
64 extern int min_free_kbytes;
65 extern int printk_ratelimit_jiffies;
66 extern int printk_ratelimit_burst;
68 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
69 static int maxolduid = 65535;
72 static int ngroups_max = NGROUPS_MAX;
75 extern char modprobe_path[];
78 extern char hotplug_path[];
80 extern char vshelper_path[];
81 #ifdef CONFIG_CHR_DEV_SG
82 extern int sg_big_buff;
85 extern size_t shm_ctlmax;
86 extern size_t shm_ctlall;
87 extern int shm_ctlmni;
88 extern int msg_ctlmax;
89 extern int msg_ctlmnb;
90 extern int msg_ctlmni;
91 extern int sem_ctls[];
95 extern char reboot_command [];
96 extern int stop_a_enabled;
97 extern int scons_pwroff;
101 extern int pwrsw_enabled;
102 extern int unaligned_enabled;
105 #ifdef CONFIG_ARCH_S390
106 #ifdef CONFIG_MATHEMU
107 extern int sysctl_ieee_emulation_warnings;
109 extern int sysctl_userprocess_debug;
112 extern int sysctl_hz_timer;
114 #if defined(CONFIG_PPC32) && defined(CONFIG_6xx)
115 extern unsigned long powersave_nap;
116 int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
117 void *buffer, size_t *lenp);
120 #ifdef CONFIG_BSD_PROCESS_ACCT
121 extern int acct_parm[];
124 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
125 ctl_table *, void **);
126 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
127 void __user *buffer, size_t *lenp);
129 static ctl_table root_table[];
130 static struct ctl_table_header root_table_header =
131 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
133 static ctl_table kern_table[];
134 static ctl_table vm_table[];
136 extern ctl_table net_table[];
138 static ctl_table proc_table[];
139 static ctl_table fs_table[];
140 static ctl_table debug_table[];
141 static ctl_table dev_table[];
142 extern ctl_table random_table[];
143 #ifdef CONFIG_UNIX98_PTYS
144 extern ctl_table pty_table[];
147 /* /proc declarations: */
149 #ifdef CONFIG_PROC_FS
151 static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *);
152 static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
153 static int proc_opensys(struct inode *, struct file *);
155 struct file_operations proc_sys_file_operations = {
156 .open = proc_opensys,
157 .read = proc_readsys,
158 .write = proc_writesys,
161 extern struct proc_dir_entry *proc_sys_root;
163 static void register_proc_table(ctl_table *, struct proc_dir_entry *);
164 static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
167 /* The default sysctl tables: */
169 static ctl_table root_table[] = {
171 .ctl_name = CTL_KERN,
172 .procname = "kernel",
191 .ctl_name = CTL_PROC,
203 .ctl_name = CTL_DEBUG,
206 .child = debug_table,
217 static ctl_table kern_table[] = {
219 .ctl_name = KERN_OSTYPE,
220 .procname = "ostype",
221 .data = system_utsname.sysname,
224 .proc_handler = &proc_doutsstring,
225 .strategy = &sysctl_string,
228 .ctl_name = KERN_OSRELEASE,
229 .procname = "osrelease",
230 .data = system_utsname.release,
233 .proc_handler = &proc_doutsstring,
234 .strategy = &sysctl_string,
237 .ctl_name = KERN_VERSION,
238 .procname = "version",
239 .data = system_utsname.version,
242 .proc_handler = &proc_doutsstring,
243 .strategy = &sysctl_string,
246 .ctl_name = KERN_NODENAME,
247 .procname = "hostname",
248 .data = system_utsname.nodename,
251 .proc_handler = &proc_doutsstring,
252 .strategy = &sysctl_string,
255 .ctl_name = KERN_DOMAINNAME,
256 .procname = "domainname",
257 .data = system_utsname.domainname,
260 .proc_handler = &proc_doutsstring,
261 .strategy = &sysctl_string,
264 .ctl_name = KERN_PANIC,
266 .data = &panic_timeout,
267 .maxlen = sizeof(int),
269 .proc_handler = &proc_dointvec,
272 .ctl_name = KERN_CORE_USES_PID,
273 .procname = "core_uses_pid",
274 .data = &core_uses_pid,
275 .maxlen = sizeof(int),
277 .proc_handler = &proc_dointvec,
280 .ctl_name = KERN_CORE_PATTERN,
281 .procname = "core_pattern",
282 .data = core_pattern,
285 .proc_handler = &proc_dostring,
286 .strategy = &sysctl_string,
289 .ctl_name = KERN_TAINTED,
290 .procname = "tainted",
292 .maxlen = sizeof(int),
294 .proc_handler = &proc_dointvec,
297 .ctl_name = KERN_CAP_BSET,
298 .procname = "cap-bound",
300 .maxlen = sizeof(kernel_cap_t),
302 .proc_handler = &proc_dointvec_bset,
304 #ifdef CONFIG_BLK_DEV_INITRD
306 .ctl_name = KERN_REALROOTDEV,
307 .procname = "real-root-dev",
308 .data = &real_root_dev,
309 .maxlen = sizeof(int),
311 .proc_handler = &proc_dointvec,
316 .ctl_name = KERN_SPARC_REBOOT,
317 .procname = "reboot-cmd",
318 .data = reboot_command,
321 .proc_handler = &proc_dostring,
322 .strategy = &sysctl_string,
325 .ctl_name = KERN_SPARC_STOP_A,
326 .procname = "stop-a",
327 .data = &stop_a_enabled,
328 .maxlen = sizeof (int),
330 .proc_handler = &proc_dointvec,
333 .ctl_name = KERN_SPARC_SCONS_PWROFF,
334 .procname = "scons-poweroff",
335 .data = &scons_pwroff,
336 .maxlen = sizeof (int),
338 .proc_handler = &proc_dointvec,
343 .ctl_name = KERN_HPPA_PWRSW,
344 .procname = "soft-power",
345 .data = &pwrsw_enabled,
346 .maxlen = sizeof (int),
348 .proc_handler = &proc_dointvec,
351 .ctl_name = KERN_HPPA_UNALIGNED,
352 .procname = "unaligned-trap",
353 .data = &unaligned_enabled,
354 .maxlen = sizeof (int),
356 .proc_handler = &proc_dointvec,
359 #if defined(CONFIG_PPC32) && defined(CONFIG_6xx)
361 .ctl_name = KERN_PPC_POWERSAVE_NAP,
362 .procname = "powersave-nap",
363 .data = &powersave_nap,
364 .maxlen = sizeof(int),
366 .proc_handler = &proc_dointvec,
369 .ctl_name = KERN_PPC_L2CR,
372 .proc_handler = &proc_dol2crvec,
376 .ctl_name = KERN_CTLALTDEL,
377 .procname = "ctrl-alt-del",
379 .maxlen = sizeof(int),
381 .proc_handler = &proc_dointvec,
384 .ctl_name = KERN_PRINTK,
385 .procname = "printk",
386 .data = &console_loglevel,
387 .maxlen = 4*sizeof(int),
389 .proc_handler = &proc_dointvec,
393 .ctl_name = KERN_MODPROBE,
394 .procname = "modprobe",
395 .data = &modprobe_path,
398 .proc_handler = &proc_dostring,
399 .strategy = &sysctl_string,
402 #ifdef CONFIG_HOTPLUG
404 .ctl_name = KERN_HOTPLUG,
405 .procname = "hotplug",
406 .data = &hotplug_path,
409 .proc_handler = &proc_dostring,
410 .strategy = &sysctl_string,
414 .ctl_name = KERN_VSHELPER,
415 .procname = "vshelper",
416 .data = &vshelper_path,
419 .proc_handler = &proc_dostring,
420 .strategy = &sysctl_string,
422 #ifdef CONFIG_CHR_DEV_SG
424 .ctl_name = KERN_SG_BIG_BUFF,
425 .procname = "sg-big-buff",
426 .data = &sg_big_buff,
427 .maxlen = sizeof (int),
429 .proc_handler = &proc_dointvec,
432 #ifdef CONFIG_BSD_PROCESS_ACCT
434 .ctl_name = KERN_ACCT,
437 .maxlen = 3*sizeof(int),
439 .proc_handler = &proc_dointvec,
443 .ctl_name = KERN_RTSIGNR,
444 .procname = "rtsig-nr",
445 .data = &nr_queued_signals,
446 .maxlen = sizeof(int),
448 .proc_handler = &proc_dointvec,
451 .ctl_name = KERN_RTSIGMAX,
452 .procname = "rtsig-max",
453 .data = &max_queued_signals,
454 .maxlen = sizeof(int),
456 .proc_handler = &proc_dointvec,
458 #ifdef CONFIG_SYSVIPC
460 .ctl_name = KERN_SHMMAX,
461 .procname = "shmmax",
463 .maxlen = sizeof (size_t),
465 .proc_handler = &proc_doulongvec_minmax,
468 .ctl_name = KERN_SHMALL,
469 .procname = "shmall",
471 .maxlen = sizeof (size_t),
473 .proc_handler = &proc_doulongvec_minmax,
476 .ctl_name = KERN_SHMMNI,
477 .procname = "shmmni",
479 .maxlen = sizeof (int),
481 .proc_handler = &proc_dointvec,
484 .ctl_name = KERN_MSGMAX,
485 .procname = "msgmax",
487 .maxlen = sizeof (int),
489 .proc_handler = &proc_dointvec,
492 .ctl_name = KERN_MSGMNI,
493 .procname = "msgmni",
495 .maxlen = sizeof (int),
497 .proc_handler = &proc_dointvec,
500 .ctl_name = KERN_MSGMNB,
501 .procname = "msgmnb",
503 .maxlen = sizeof (int),
505 .proc_handler = &proc_dointvec,
508 .ctl_name = KERN_SEM,
511 .maxlen = 4*sizeof (int),
513 .proc_handler = &proc_dointvec,
516 #ifdef CONFIG_MAGIC_SYSRQ
518 .ctl_name = KERN_SYSRQ,
520 .data = &sysrq_enabled,
521 .maxlen = sizeof (int),
523 .proc_handler = &proc_dointvec,
527 .ctl_name = KERN_CADPID,
528 .procname = "cad_pid",
530 .maxlen = sizeof (int),
532 .proc_handler = &proc_dointvec,
535 .ctl_name = KERN_MAX_THREADS,
536 .procname = "threads-max",
537 .data = &max_threads,
538 .maxlen = sizeof(int),
540 .proc_handler = &proc_dointvec,
543 .ctl_name = KERN_RANDOM,
544 .procname = "random",
546 .child = random_table,
548 #ifdef CONFIG_UNIX98_PTYS
550 .ctl_name = KERN_PTY,
557 .ctl_name = KERN_OVERFLOWUID,
558 .procname = "overflowuid",
559 .data = &overflowuid,
560 .maxlen = sizeof(int),
562 .proc_handler = &proc_dointvec_minmax,
563 .strategy = &sysctl_intvec,
564 .extra1 = &minolduid,
565 .extra2 = &maxolduid,
568 .ctl_name = KERN_OVERFLOWGID,
569 .procname = "overflowgid",
570 .data = &overflowgid,
571 .maxlen = sizeof(int),
573 .proc_handler = &proc_dointvec_minmax,
574 .strategy = &sysctl_intvec,
575 .extra1 = &minolduid,
576 .extra2 = &maxolduid,
578 #ifdef CONFIG_ARCH_S390
579 #ifdef CONFIG_MATHEMU
581 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
582 .procname = "ieee_emulation_warnings",
583 .data = &sysctl_ieee_emulation_warnings,
584 .maxlen = sizeof(int),
586 .proc_handler = &proc_dointvec,
589 #ifdef CONFIG_NO_IDLE_HZ
591 .ctl_name = KERN_HZ_TIMER,
592 .procname = "hz_timer",
593 .data = &sysctl_hz_timer,
594 .maxlen = sizeof(int),
596 .proc_handler = &proc_dointvec,
600 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
601 .procname = "userprocess_debug",
602 .data = &sysctl_userprocess_debug,
603 .maxlen = sizeof(int),
605 .proc_handler = &proc_dointvec,
609 .ctl_name = KERN_PIDMAX,
610 .procname = "pid_max",
612 .maxlen = sizeof (int),
614 .proc_handler = &proc_dointvec,
617 .ctl_name = KERN_PANIC_ON_OOPS,
618 .procname = "panic_on_oops",
619 .data = &panic_on_oops,
620 .maxlen = sizeof(int),
622 .proc_handler = &proc_dointvec,
625 .ctl_name = KERN_PRINTK_RATELIMIT,
626 .procname = "printk_ratelimit",
627 .data = &printk_ratelimit_jiffies,
628 .maxlen = sizeof(int),
630 .proc_handler = &proc_dointvec_jiffies,
631 .strategy = &sysctl_jiffies,
634 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
635 .procname = "printk_ratelimit_burst",
636 .data = &printk_ratelimit_burst,
637 .maxlen = sizeof(int),
639 .proc_handler = &proc_dointvec,
642 .ctl_name = KERN_NGROUPS_MAX,
643 .procname = "ngroups_max",
644 .data = &ngroups_max,
645 .maxlen = sizeof (int),
647 .proc_handler = &proc_dointvec,
652 /* Constants for minimum and maximum testing in vm_table.
653 We use these as one-element integer vectors. */
655 static int one_hundred = 100;
658 static ctl_table vm_table[] = {
660 .ctl_name = VM_OVERCOMMIT_MEMORY,
661 .procname = "overcommit_memory",
662 .data = &sysctl_overcommit_memory,
663 .maxlen = sizeof(sysctl_overcommit_memory),
665 .proc_handler = &proc_dointvec,
668 .ctl_name = VM_OVERCOMMIT_RATIO,
669 .procname = "overcommit_ratio",
670 .data = &sysctl_overcommit_ratio,
671 .maxlen = sizeof(sysctl_overcommit_ratio),
673 .proc_handler = &proc_dointvec,
676 .ctl_name = VM_PAGE_CLUSTER,
677 .procname = "page-cluster",
678 .data = &page_cluster,
679 .maxlen = sizeof(int),
681 .proc_handler = &proc_dointvec,
684 .ctl_name = VM_DIRTY_BACKGROUND,
685 .procname = "dirty_background_ratio",
686 .data = &dirty_background_ratio,
687 .maxlen = sizeof(dirty_background_ratio),
689 .proc_handler = &proc_dointvec_minmax,
690 .strategy = &sysctl_intvec,
692 .extra2 = &one_hundred,
695 .ctl_name = VM_DIRTY_RATIO,
696 .procname = "dirty_ratio",
697 .data = &vm_dirty_ratio,
698 .maxlen = sizeof(vm_dirty_ratio),
700 .proc_handler = &proc_dointvec_minmax,
701 .strategy = &sysctl_intvec,
703 .extra2 = &one_hundred,
706 .ctl_name = VM_DIRTY_WB_CS,
707 .procname = "dirty_writeback_centisecs",
708 .data = &dirty_writeback_centisecs,
709 .maxlen = sizeof(dirty_writeback_centisecs),
711 .proc_handler = &dirty_writeback_centisecs_handler,
714 .ctl_name = VM_DIRTY_EXPIRE_CS,
715 .procname = "dirty_expire_centisecs",
716 .data = &dirty_expire_centisecs,
717 .maxlen = sizeof(dirty_expire_centisecs),
719 .proc_handler = &proc_dointvec,
722 .ctl_name = VM_NR_PDFLUSH_THREADS,
723 .procname = "nr_pdflush_threads",
724 .data = &nr_pdflush_threads,
725 .maxlen = sizeof nr_pdflush_threads,
726 .mode = 0444 /* read-only*/,
727 .proc_handler = &proc_dointvec,
730 .ctl_name = VM_SWAPPINESS,
731 .procname = "swappiness",
732 .data = &vm_swappiness,
733 .maxlen = sizeof(vm_swappiness),
735 .proc_handler = &proc_dointvec_minmax,
736 .strategy = &sysctl_intvec,
738 .extra2 = &one_hundred,
740 #ifdef CONFIG_HUGETLB_PAGE
742 .ctl_name = VM_HUGETLB_PAGES,
743 .procname = "nr_hugepages",
744 .data = &max_huge_pages,
745 .maxlen = sizeof(unsigned long),
747 .proc_handler = &hugetlb_sysctl_handler,
748 .extra1 = (void *)&hugetlb_zero,
749 .extra2 = (void *)&hugetlb_infinity,
753 .ctl_name = VM_LOWER_ZONE_PROTECTION,
754 .procname = "lower_zone_protection",
755 .data = &sysctl_lower_zone_protection,
756 .maxlen = sizeof(sysctl_lower_zone_protection),
758 .proc_handler = &lower_zone_protection_sysctl_handler,
759 .strategy = &sysctl_intvec,
763 .ctl_name = VM_MIN_FREE_KBYTES,
764 .procname = "min_free_kbytes",
765 .data = &min_free_kbytes,
766 .maxlen = sizeof(min_free_kbytes),
768 .proc_handler = &min_free_kbytes_sysctl_handler,
769 .strategy = &sysctl_intvec,
773 .ctl_name = VM_MAX_MAP_COUNT,
774 .procname = "max_map_count",
775 .data = &sysctl_max_map_count,
776 .maxlen = sizeof(sysctl_max_map_count),
778 .proc_handler = &proc_dointvec
781 .ctl_name = VM_LAPTOP_MODE,
782 .procname = "laptop_mode",
783 .data = &laptop_mode,
784 .maxlen = sizeof(laptop_mode),
786 .proc_handler = &proc_dointvec,
787 .strategy = &sysctl_intvec,
791 .ctl_name = VM_BLOCK_DUMP,
792 .procname = "block_dump",
794 .maxlen = sizeof(block_dump),
796 .proc_handler = &proc_dointvec,
797 .strategy = &sysctl_intvec,
803 static ctl_table proc_table[] = {
807 static ctl_table fs_table[] = {
809 .ctl_name = FS_NRINODE,
810 .procname = "inode-nr",
811 .data = &inodes_stat,
812 .maxlen = 2*sizeof(int),
814 .proc_handler = &proc_dointvec,
817 .ctl_name = FS_STATINODE,
818 .procname = "inode-state",
819 .data = &inodes_stat,
820 .maxlen = 7*sizeof(int),
822 .proc_handler = &proc_dointvec,
825 .ctl_name = FS_NRFILE,
826 .procname = "file-nr",
828 .maxlen = 3*sizeof(int),
830 .proc_handler = &proc_dointvec,
833 .ctl_name = FS_MAXFILE,
834 .procname = "file-max",
835 .data = &files_stat.max_files,
836 .maxlen = sizeof(int),
838 .proc_handler = &proc_dointvec,
841 .ctl_name = FS_DENTRY,
842 .procname = "dentry-state",
843 .data = &dentry_stat,
844 .maxlen = 6*sizeof(int),
846 .proc_handler = &proc_dointvec,
849 .ctl_name = FS_OVERFLOWUID,
850 .procname = "overflowuid",
851 .data = &fs_overflowuid,
852 .maxlen = sizeof(int),
854 .proc_handler = &proc_dointvec_minmax,
855 .strategy = &sysctl_intvec,
856 .extra1 = &minolduid,
857 .extra2 = &maxolduid,
860 .ctl_name = FS_OVERFLOWGID,
861 .procname = "overflowgid",
862 .data = &fs_overflowgid,
863 .maxlen = sizeof(int),
865 .proc_handler = &proc_dointvec_minmax,
866 .strategy = &sysctl_intvec,
867 .extra1 = &minolduid,
868 .extra2 = &maxolduid,
871 .ctl_name = FS_LEASES,
872 .procname = "leases-enable",
873 .data = &leases_enable,
874 .maxlen = sizeof(int),
876 .proc_handler = &proc_dointvec,
879 .ctl_name = FS_DIR_NOTIFY,
880 .procname = "dir-notify-enable",
881 .data = &dir_notify_enable,
882 .maxlen = sizeof(int),
884 .proc_handler = &proc_dointvec,
887 .ctl_name = FS_LEASE_TIME,
888 .procname = "lease-break-time",
889 .data = &lease_break_time,
890 .maxlen = sizeof(int),
892 .proc_handler = &proc_dointvec,
895 .ctl_name = FS_AIO_NR,
896 .procname = "aio-nr",
898 .maxlen = sizeof(aio_nr),
900 .proc_handler = &proc_dointvec,
903 .ctl_name = FS_AIO_MAX_NR,
904 .procname = "aio-max-nr",
906 .maxlen = sizeof(aio_max_nr),
908 .proc_handler = &proc_dointvec,
913 static ctl_table debug_table[] = {
917 static ctl_table dev_table[] = {
921 extern void init_irq_proc (void);
923 void __init sysctl_init(void)
925 #ifdef CONFIG_PROC_FS
926 register_proc_table(root_table, proc_sys_root);
931 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
932 void __user *newval, size_t newlen)
934 struct list_head *tmp;
936 if (nlen <= 0 || nlen >= CTL_MAXNAME)
940 if (!oldlenp || get_user(old_len, oldlenp))
943 tmp = &root_table_header.ctl_entry;
945 struct ctl_table_header *head =
946 list_entry(tmp, struct ctl_table_header, ctl_entry);
947 void *context = NULL;
948 int error = parse_table(name, nlen, oldval, oldlenp,
949 newval, newlen, head->ctl_table,
953 if (error != -ENOTDIR)
956 } while (tmp != &root_table_header.ctl_entry);
960 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
962 struct __sysctl_args tmp;
965 if (copy_from_user(&tmp, args, sizeof(tmp)))
969 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
970 tmp.newval, tmp.newlen);
976 * ctl_perm does NOT grant the superuser all rights automatically, because
977 * some sysctl variables are readonly even to root.
980 static int test_perm(int mode, int op)
984 else if (in_egroup_p(0))
986 if ((mode & op & 0007) == op)
991 static inline int ctl_perm(ctl_table *table, int op)
994 error = security_sysctl(table, op);
997 return test_perm(table->mode, op);
1000 static int parse_table(int __user *name, int nlen,
1001 void __user *oldval, size_t __user *oldlenp,
1002 void __user *newval, size_t newlen,
1003 ctl_table *table, void **context)
1009 if (get_user(n, name))
1011 for ( ; table->ctl_name; table++) {
1012 if (n == table->ctl_name || table->ctl_name == CTL_ANY) {
1015 if (ctl_perm(table, 001))
1017 if (table->strategy) {
1018 error = table->strategy(
1021 newval, newlen, context);
1027 table = table->child;
1030 error = do_sysctl_strategy(table, name, nlen,
1032 newval, newlen, context);
1039 /* Perform the actual read/write of a sysctl table entry. */
1040 int do_sysctl_strategy (ctl_table *table,
1041 int __user *name, int nlen,
1042 void __user *oldval, size_t __user *oldlenp,
1043 void __user *newval, size_t newlen, void **context)
1052 if (ctl_perm(table, op))
1055 if (table->strategy) {
1056 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1057 newval, newlen, context);
1064 /* If there is no strategy routine, or if the strategy returns
1065 * zero, proceed with automatic r/w */
1066 if (table->data && table->maxlen) {
1067 if (oldval && oldlenp) {
1068 if (get_user(len, oldlenp))
1071 if (len > table->maxlen)
1072 len = table->maxlen;
1073 if(copy_to_user(oldval, table->data, len))
1075 if(put_user(len, oldlenp))
1079 if (newval && newlen) {
1081 if (len > table->maxlen)
1082 len = table->maxlen;
1083 if(copy_from_user(table->data, newval, len))
1091 * register_sysctl_table - register a sysctl hierarchy
1092 * @table: the top-level table structure
1093 * @insert_at_head: whether the entry should be inserted in front or at the end
1095 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1096 * array. An entry with a ctl_name of 0 terminates the table.
1098 * The members of the &ctl_table structure are used as follows:
1100 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1101 * must be unique within that level of sysctl
1103 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1104 * enter a sysctl file
1106 * data - a pointer to data for use by proc_handler
1108 * maxlen - the maximum size in bytes of the data
1110 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1112 * child - a pointer to the child sysctl table if this entry is a directory, or
1115 * proc_handler - the text handler routine (described below)
1117 * strategy - the strategy routine (described below)
1119 * de - for internal use by the sysctl routines
1121 * extra1, extra2 - extra pointers usable by the proc handler routines
1123 * Leaf nodes in the sysctl tree will be represented by a single file
1124 * under /proc; non-leaf nodes will be represented by directories.
1126 * sysctl(2) can automatically manage read and write requests through
1127 * the sysctl table. The data and maxlen fields of the ctl_table
1128 * struct enable minimal validation of the values being written to be
1129 * performed, and the mode field allows minimal authentication.
1131 * More sophisticated management can be enabled by the provision of a
1132 * strategy routine with the table entry. This will be called before
1133 * any automatic read or write of the data is performed.
1135 * The strategy routine may return
1137 * < 0 - Error occurred (error is passed to user process)
1139 * 0 - OK - proceed with automatic read or write.
1141 * > 0 - OK - read or write has been done by the strategy routine, so
1142 * return immediately.
1144 * There must be a proc_handler routine for any terminal nodes
1145 * mirrored under /proc/sys (non-terminals are handled by a built-in
1146 * directory handler). Several default handlers are available to
1147 * cover common cases -
1149 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1150 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1151 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1153 * It is the handler's job to read the input buffer from user memory
1154 * and process it. The handler should return 0 on success.
1156 * This routine returns %NULL on a failure to register, and a pointer
1157 * to the table header on success.
1159 struct ctl_table_header *register_sysctl_table(ctl_table * table,
1162 struct ctl_table_header *tmp;
1163 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
1166 tmp->ctl_table = table;
1167 INIT_LIST_HEAD(&tmp->ctl_entry);
1169 list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
1171 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1172 #ifdef CONFIG_PROC_FS
1173 register_proc_table(table, proc_sys_root);
1179 * unregister_sysctl_table - unregister a sysctl table hierarchy
1180 * @header: the header returned from register_sysctl_table
1182 * Unregisters the sysctl table and all children. proc entries may not
1183 * actually be removed until they are no longer used by anyone.
1185 void unregister_sysctl_table(struct ctl_table_header * header)
1187 list_del(&header->ctl_entry);
1188 #ifdef CONFIG_PROC_FS
1189 unregister_proc_table(header->ctl_table, proc_sys_root);
1198 #ifdef CONFIG_PROC_FS
1200 /* Scan the sysctl entries in table and add them all into /proc */
1201 static void register_proc_table(ctl_table * table, struct proc_dir_entry *root)
1203 struct proc_dir_entry *de;
1207 for (; table->ctl_name; table++) {
1208 /* Can't do anything without a proc name. */
1209 if (!table->procname)
1211 /* Maybe we can't do anything with it... */
1212 if (!table->proc_handler && !table->child) {
1213 printk(KERN_WARNING "SYSCTL: Can't register %s\n",
1218 len = strlen(table->procname);
1222 if (table->proc_handler)
1226 for (de = root->subdir; de; de = de->next) {
1227 if (proc_match(len, table->procname, de))
1230 /* If the subdir exists already, de is non-NULL */
1234 de = create_proc_entry(table->procname, mode, root);
1237 de->data = (void *) table;
1238 if (table->proc_handler)
1239 de->proc_fops = &proc_sys_file_operations;
1242 if (de->mode & S_IFDIR)
1243 register_proc_table(table->child, de);
1248 * Unregister a /proc sysctl table and any subdirectories.
1250 static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root)
1252 struct proc_dir_entry *de;
1253 for (; table->ctl_name; table++) {
1254 if (!(de = table->de))
1256 if (de->mode & S_IFDIR) {
1257 if (!table->child) {
1258 printk (KERN_ALERT "Help - malformed sysctl tree on free\n");
1261 unregister_proc_table(table->child, de);
1263 /* Don't unregister directories which still have entries.. */
1268 /* Don't unregister proc entries that are still being used.. */
1269 if (atomic_read(&de->count))
1273 remove_proc_entry(table->procname, root);
1277 static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
1278 size_t count, loff_t *ppos)
1281 struct proc_dir_entry *de;
1282 struct ctl_table *table;
1286 de = PDE(file->f_dentry->d_inode);
1287 if (!de || !de->data)
1289 table = (struct ctl_table *) de->data;
1290 if (!table || !table->proc_handler)
1292 op = (write ? 002 : 004);
1293 if (ctl_perm(table, op))
1299 * FIXME: we need to pass on ppos to the handler.
1302 error = (*table->proc_handler) (table, write, file, buf, &res);
1308 static int proc_opensys(struct inode *inode, struct file *file)
1310 if (file->f_mode & FMODE_WRITE) {
1312 * sysctl entries that are not writable,
1313 * are _NOT_ writable, capabilities or not.
1315 if (!(inode->i_mode & S_IWUSR))
1322 static ssize_t proc_readsys(struct file * file, char __user * buf,
1323 size_t count, loff_t *ppos)
1325 return do_rw_proc(0, file, buf, count, ppos);
1328 static ssize_t proc_writesys(struct file * file, const char __user * buf,
1329 size_t count, loff_t *ppos)
1331 return do_rw_proc(1, file, (char __user *) buf, count, ppos);
1335 * proc_dostring - read a string sysctl
1336 * @table: the sysctl table
1337 * @write: %TRUE if this is a write to the sysctl file
1338 * @filp: the file structure
1339 * @buffer: the user buffer
1340 * @lenp: the size of the user buffer
1342 * Reads/writes a string from/to the user buffer. If the kernel
1343 * buffer provided is not large enough to hold the string, the
1344 * string is truncated. The copied string is %NULL-terminated.
1345 * If the string is being read by the user process, it is copied
1346 * and a newline '\n' is added. It is truncated if the buffer is
1349 * Returns 0 on success.
1351 int proc_dostring(ctl_table *table, int write, struct file *filp,
1352 void __user *buffer, size_t *lenp)
1358 if (!table->data || !table->maxlen || !*lenp ||
1359 (filp->f_pos && !write)) {
1367 while (len < *lenp) {
1368 if (get_user(c, p++))
1370 if (c == 0 || c == '\n')
1374 if (len >= table->maxlen)
1375 len = table->maxlen-1;
1376 if(copy_from_user(table->data, buffer, len))
1378 ((char *) table->data)[len] = 0;
1379 filp->f_pos += *lenp;
1381 len = strlen(table->data);
1382 if (len > table->maxlen)
1383 len = table->maxlen;
1387 if(copy_to_user(buffer, table->data, len))
1390 if(put_user('\n', ((char *) buffer) + len))
1401 * Special case of dostring for the UTS structure. This has locks
1402 * to observe. Should this be in kernel/sys.c ????
1405 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1406 void __user *buffer, size_t *lenp)
1411 down_read(&uts_sem);
1412 r=proc_dostring(table,0,filp,buffer,lenp);
1415 down_write(&uts_sem);
1416 r=proc_dostring(table,1,filp,buffer,lenp);
1422 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1424 int write, void *data)
1427 *valp = *negp ? -*lvalp : *lvalp;
1432 *lvalp = (unsigned long)-val;
1435 *lvalp = (unsigned long)val;
1441 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
1442 void __user *buffer, size_t *lenp,
1443 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1444 int write, void *data),
1447 #define TMPBUFLEN 20
1448 int *i, vleft, first=1, neg, val;
1452 char buf[TMPBUFLEN], *p;
1454 if (!table->data || !table->maxlen || !*lenp ||
1455 (filp->f_pos && !write)) {
1460 i = (int *) table->data;
1461 vleft = table->maxlen / sizeof(*i);
1465 conv = do_proc_dointvec_conv;
1467 for (; left && vleft--; i++, first=0) {
1471 if (get_user(c,(char __user *) buffer))
1482 if (len > sizeof(buf) - 1)
1483 len = sizeof(buf) - 1;
1484 if(copy_from_user(buf, buffer, len))
1488 if (*p == '-' && left > 1) {
1492 if (*p < '0' || *p > '9')
1495 lval = simple_strtoul(p, &p, 0);
1498 if ((len < left) && *p && !isspace(*p))
1505 if (conv(&neg, &lval, i, 1, data))
1512 if (conv(&neg, &lval, i, 0, data))
1515 sprintf(p, "%s%lu", neg ? "-" : "", lval);
1519 if(copy_to_user(buffer, buf, len))
1526 if (!write && !first && left) {
1527 if(put_user('\n', (char *) buffer))
1532 p = (char *) buffer;
1535 if (get_user(c, p++))
1545 filp->f_pos += *lenp;
1551 * proc_dointvec - read a vector of integers
1552 * @table: the sysctl table
1553 * @write: %TRUE if this is a write to the sysctl file
1554 * @filp: the file structure
1555 * @buffer: the user buffer
1556 * @lenp: the size of the user buffer
1558 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1559 * values from/to the user buffer, treated as an ASCII string.
1561 * Returns 0 on success.
1563 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1564 void __user *buffer, size_t *lenp)
1566 return do_proc_dointvec(table,write,filp,buffer,lenp,
1576 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1578 int write, void *data)
1580 int op = *(int *)data;
1582 int val = *negp ? -*lvalp : *lvalp;
1584 case OP_SET: *valp = val; break;
1585 case OP_AND: *valp &= val; break;
1586 case OP_OR: *valp |= val; break;
1587 case OP_MAX: if(*valp < val)
1590 case OP_MIN: if(*valp > val)
1598 *lvalp = (unsigned long)-val;
1601 *lvalp = (unsigned long)val;
1608 * init may raise the set.
1611 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1612 void __user *buffer, size_t *lenp)
1616 if (!capable(CAP_SYS_MODULE)) {
1620 op = (current->pid == 1) ? OP_SET : OP_AND;
1621 return do_proc_dointvec(table,write,filp,buffer,lenp,
1622 do_proc_dointvec_bset_conv,&op);
1625 struct do_proc_dointvec_minmax_conv_param {
1630 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1632 int write, void *data)
1634 struct do_proc_dointvec_minmax_conv_param *param = data;
1636 int val = *negp ? -*lvalp : *lvalp;
1637 if ((param->min && *param->min > val) ||
1638 (param->max && *param->max < val))
1645 *lvalp = (unsigned long)-val;
1648 *lvalp = (unsigned long)val;
1655 * proc_dointvec_minmax - read a vector of integers with min/max values
1656 * @table: the sysctl table
1657 * @write: %TRUE if this is a write to the sysctl file
1658 * @filp: the file structure
1659 * @buffer: the user buffer
1660 * @lenp: the size of the user buffer
1662 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1663 * values from/to the user buffer, treated as an ASCII string.
1665 * This routine will ensure the values are within the range specified by
1666 * table->extra1 (min) and table->extra2 (max).
1668 * Returns 0 on success.
1670 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1671 void __user *buffer, size_t *lenp)
1673 struct do_proc_dointvec_minmax_conv_param param = {
1674 .min = (int *) table->extra1,
1675 .max = (int *) table->extra2,
1677 return do_proc_dointvec(table, write, filp, buffer, lenp,
1678 do_proc_dointvec_minmax_conv, ¶m);
1681 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
1683 void __user *buffer, size_t *lenp,
1684 unsigned long convmul,
1685 unsigned long convdiv)
1687 #define TMPBUFLEN 20
1688 unsigned long *i, *min, *max, val;
1689 int vleft, first=1, neg;
1691 char buf[TMPBUFLEN], *p;
1693 if (!table->data || !table->maxlen || !*lenp ||
1694 (filp->f_pos && !write)) {
1699 i = (unsigned long *) table->data;
1700 min = (unsigned long *) table->extra1;
1701 max = (unsigned long *) table->extra2;
1702 vleft = table->maxlen / sizeof(unsigned long);
1705 for (; left && vleft--; i++, min++, max++, first=0) {
1709 if (get_user(c, (char __user *) buffer))
1720 if (len > TMPBUFLEN-1)
1722 if (copy_from_user(buf, buffer, len))
1726 if (*p == '-' && left > 1) {
1730 if (*p < '0' || *p > '9')
1732 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
1734 if ((len < left) && *p && !isspace(*p))
1743 if ((min && val < *min) || (max && val > *max))
1750 sprintf(p, "%lu", convdiv * (*i) / convmul);
1754 if(copy_to_user(buffer, buf, len))
1761 if (!write && !first && left) {
1762 if(put_user('\n', (char *) buffer))
1767 p = (char *) buffer;
1770 if (get_user(c, p++))
1780 filp->f_pos += *lenp;
1786 * proc_doulongvec_minmax - read a vector of long integers with min/max values
1787 * @table: the sysctl table
1788 * @write: %TRUE if this is a write to the sysctl file
1789 * @filp: the file structure
1790 * @buffer: the user buffer
1791 * @lenp: the size of the user buffer
1793 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1794 * values from/to the user buffer, treated as an ASCII string.
1796 * This routine will ensure the values are within the range specified by
1797 * table->extra1 (min) and table->extra2 (max).
1799 * Returns 0 on success.
1801 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1802 void __user *buffer, size_t *lenp)
1804 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, 1l, 1l);
1808 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
1809 * @table: the sysctl table
1810 * @write: %TRUE if this is a write to the sysctl file
1811 * @filp: the file structure
1812 * @buffer: the user buffer
1813 * @lenp: the size of the user buffer
1815 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1816 * values from/to the user buffer, treated as an ASCII string. The values
1817 * are treated as milliseconds, and converted to jiffies when they are stored.
1819 * This routine will ensure the values are within the range specified by
1820 * table->extra1 (min) and table->extra2 (max).
1822 * Returns 0 on success.
1824 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1826 void __user *buffer, size_t *lenp)
1828 return do_proc_doulongvec_minmax(table, write, filp, buffer,
1833 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
1835 int write, void *data)
1838 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
1844 lval = (unsigned long)-val;
1847 lval = (unsigned long)val;
1854 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
1856 int write, void *data)
1859 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
1865 lval = (unsigned long)-val;
1868 lval = (unsigned long)val;
1870 *lvalp = jiffies_to_clock_t(lval);
1876 * proc_dointvec_jiffies - read a vector of integers as seconds
1877 * @table: the sysctl table
1878 * @write: %TRUE if this is a write to the sysctl file
1879 * @filp: the file structure
1880 * @buffer: the user buffer
1881 * @lenp: the size of the user buffer
1883 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1884 * values from/to the user buffer, treated as an ASCII string.
1885 * The values read are assumed to be in seconds, and are converted into
1888 * Returns 0 on success.
1890 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
1891 void __user *buffer, size_t *lenp)
1893 return do_proc_dointvec(table,write,filp,buffer,lenp,
1894 do_proc_dointvec_jiffies_conv,NULL);
1898 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
1899 * @table: the sysctl table
1900 * @write: %TRUE if this is a write to the sysctl file
1901 * @filp: the file structure
1902 * @buffer: the user buffer
1903 * @lenp: the size of the user buffer
1905 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1906 * values from/to the user buffer, treated as an ASCII string.
1907 * The values read are assumed to be in 1/USER_HZ seconds, and
1908 * are converted into jiffies.
1910 * Returns 0 on success.
1912 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
1913 void __user *buffer, size_t *lenp)
1915 return do_proc_dointvec(table,write,filp,buffer,lenp,
1916 do_proc_dointvec_userhz_jiffies_conv,NULL);
1919 #else /* CONFIG_PROC_FS */
1921 int proc_dostring(ctl_table *table, int write, struct file *filp,
1922 void *buffer, size_t *lenp)
1927 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1928 void *buffer, size_t *lenp)
1933 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1934 void *buffer, size_t *lenp)
1939 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1940 void *buffer, size_t *lenp)
1945 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1946 void *buffer, size_t *lenp)
1951 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
1952 void *buffer, size_t *lenp)
1957 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
1958 void *buffer, size_t *lenp)
1963 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1964 void *buffer, size_t *lenp)
1969 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1971 void *buffer, size_t *lenp)
1977 #endif /* CONFIG_PROC_FS */
1981 * General sysctl support routines
1984 /* The generic string strategy routine: */
1985 int sysctl_string(ctl_table *table, int __user *name, int nlen,
1986 void __user *oldval, size_t __user *oldlenp,
1987 void __user *newval, size_t newlen, void **context)
1991 if (!table->data || !table->maxlen)
1994 if (oldval && oldlenp) {
1995 if (get_user(len, oldlenp))
1998 l = strlen(table->data);
1999 if (len > l) len = l;
2000 if (len >= table->maxlen)
2001 len = table->maxlen;
2002 if(copy_to_user(oldval, table->data, len))
2004 if(put_user(0, ((char *) oldval) + len))
2006 if(put_user(len, oldlenp))
2010 if (newval && newlen) {
2012 if (len > table->maxlen)
2013 len = table->maxlen;
2014 if(copy_from_user(table->data, newval, len))
2016 if (len == table->maxlen)
2018 ((char *) table->data)[len] = 0;
2024 * This function makes sure that all of the integers in the vector
2025 * are between the minimum and maximum values given in the arrays
2026 * table->extra1 and table->extra2, respectively.
2028 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2029 void __user *oldval, size_t __user *oldlenp,
2030 void __user *newval, size_t newlen, void **context)
2032 int i, *vec, *min, *max;
2035 if (newval && newlen) {
2036 if (newlen % sizeof(int) != 0)
2039 if (!table->extra1 && !table->extra2)
2042 if (newlen > table->maxlen)
2043 newlen = table->maxlen;
2044 length = newlen / sizeof(int);
2046 vec = (int *) newval;
2047 min = (int *) table->extra1;
2048 max = (int *) table->extra2;
2050 for (i = 0; i < length; i++) {
2052 if (get_user(value, vec + i))
2054 if (min && value < min[i])
2056 if (max && value > max[i])
2063 /* Strategy function to convert jiffies to seconds */
2064 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2065 void __user *oldval, size_t __user *oldlenp,
2066 void __user *newval, size_t newlen, void **context)
2071 if (get_user(olen, oldlenp))
2073 if (olen!=sizeof(int))
2076 if (put_user(*(int *)(table->data) / HZ, (int *)oldval) ||
2077 (oldlenp && put_user(sizeof(int),oldlenp)))
2080 if (newval && newlen) {
2082 if (newlen != sizeof(int))
2084 if (get_user(new, (int *)newval))
2086 *(int *)(table->data) = new*HZ;
2092 #else /* CONFIG_SYSCTL */
2095 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2100 int sysctl_string(ctl_table *table, int __user *name, int nlen,
2101 void __user *oldval, size_t __user *oldlenp,
2102 void __user *newval, size_t newlen, void **context)
2107 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2108 void __user *oldval, size_t __user *oldlenp,
2109 void __user *newval, size_t newlen, void **context)
2114 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2115 void __user *oldval, size_t __user *oldlenp,
2116 void __user *newval, size_t newlen, void **context)
2121 int proc_dostring(ctl_table *table, int write, struct file *filp,
2122 void __user *buffer, size_t *lenp)
2127 int proc_dointvec(ctl_table *table, int write, struct file *filp,
2128 void __user *buffer, size_t *lenp)
2133 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2134 void __user *buffer, size_t *lenp)
2139 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2140 void __user *buffer, size_t *lenp)
2145 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2146 void *buffer, size_t *lenp)
2151 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2152 void *buffer, size_t *lenp)
2157 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2158 void __user *buffer, size_t *lenp)
2163 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2165 void __user *buffer, size_t *lenp)
2170 struct ctl_table_header * register_sysctl_table(ctl_table * table,
2176 void unregister_sysctl_table(struct ctl_table_header * table)
2180 #endif /* CONFIG_SYSCTL */
2183 * No sense putting this after each symbol definition, twice,
2184 * exception granted :-)
2186 EXPORT_SYMBOL(proc_dointvec);
2187 EXPORT_SYMBOL(proc_dointvec_jiffies);
2188 EXPORT_SYMBOL(proc_dointvec_minmax);
2189 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2190 EXPORT_SYMBOL(proc_dostring);
2191 EXPORT_SYMBOL(proc_doulongvec_minmax);
2192 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2193 EXPORT_SYMBOL(register_sysctl_table);
2194 EXPORT_SYMBOL(sysctl_intvec);
2195 EXPORT_SYMBOL(sysctl_jiffies);
2196 EXPORT_SYMBOL(sysctl_string);
2197 EXPORT_SYMBOL(unregister_sysctl_table);