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/module.h>
23 #include <linux/swap.h>
24 #include <linux/slab.h>
25 #include <linux/sysctl.h>
26 #include <linux/proc_fs.h>
27 #include <linux/security.h>
28 #include <linux/ctype.h>
29 #include <linux/utsname.h>
30 #include <linux/smp_lock.h>
32 #include <linux/init.h>
33 #include <linux/kernel.h>
34 #include <linux/kobject.h>
35 #include <linux/net.h>
36 #include <linux/sysrq.h>
37 #include <linux/highuid.h>
38 #include <linux/writeback.h>
39 #include <linux/hugetlb.h>
40 #include <linux/security.h>
41 #include <linux/initrd.h>
42 #include <linux/times.h>
43 #include <linux/limits.h>
44 #include <linux/dcache.h>
45 #include <linux/syscalls.h>
46 #include <linux/nfs_fs.h>
47 #include <linux/acpi.h>
48 #include <linux/reboot.h>
50 #include <asm/uaccess.h>
51 #include <asm/processor.h>
55 #include <asm/stacktrace.h>
59 static int deprecated_sysctl_warning(struct __sysctl_args *args);
61 #if defined(CONFIG_SYSCTL)
63 /* External variables not in a header file. */
65 extern int print_fatal_signals;
66 extern int sysctl_overcommit_memory;
67 extern int sysctl_overcommit_ratio;
68 extern int sysctl_panic_on_oom;
69 extern int sysctl_oom_kill_allocating_task;
70 extern int max_threads;
71 extern int core_uses_pid;
72 extern int suid_dumpable;
73 extern char core_pattern[];
75 extern int min_free_kbytes;
76 extern int printk_ratelimit_jiffies;
77 extern int printk_ratelimit_burst;
78 extern int pid_max_min, pid_max_max;
79 extern int sysctl_drop_caches;
80 extern int percpu_pagelist_fraction;
81 extern int compat_log;
82 extern int maps_protect;
83 extern int sysctl_stat_interval;
84 extern int audit_argv_kb;
85 extern int latencytop_enabled;
87 /* Constants used for minimum and maximum */
88 #ifdef CONFIG_DETECT_SOFTLOCKUP
90 static int sixty = 60;
98 static int one_hundred = 100;
100 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
101 static int maxolduid = 65535;
102 static int minolduid;
103 static int min_percpu_pagelist_fract = 8;
105 static int ngroups_max = NGROUPS_MAX;
108 extern char modprobe_path[];
110 #ifdef CONFIG_CHR_DEV_SG
111 extern int sg_big_buff;
115 extern char reboot_command [];
116 extern int stop_a_enabled;
117 extern int scons_pwroff;
121 extern int pwrsw_enabled;
122 extern int unaligned_enabled;
126 #ifdef CONFIG_MATHEMU
127 extern int sysctl_ieee_emulation_warnings;
129 extern int sysctl_userprocess_debug;
130 extern int spin_retry;
133 extern int sysctl_hz_timer;
135 #ifdef CONFIG_BSD_PROCESS_ACCT
136 extern int acct_parm[];
140 extern int no_unaligned_warning;
143 #ifdef CONFIG_RT_MUTEXES
144 extern int max_lock_depth;
147 #ifdef CONFIG_SYSCTL_SYSCALL
148 static int parse_table(int __user *, int, void __user *, size_t __user *,
149 void __user *, size_t, struct ctl_table *);
153 #ifdef CONFIG_PROC_SYSCTL
154 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
155 void __user *buffer, size_t *lenp, loff_t *ppos);
156 static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp,
157 void __user *buffer, size_t *lenp, loff_t *ppos);
160 static struct ctl_table root_table[];
161 static struct ctl_table_root sysctl_table_root;
162 static struct ctl_table_header root_table_header = {
163 .ctl_table = root_table,
164 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.header_list),
165 .root = &sysctl_table_root,
167 static struct ctl_table_root sysctl_table_root = {
168 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
169 .header_list = LIST_HEAD_INIT(root_table_header.ctl_entry),
172 static struct ctl_table kern_table[];
173 static struct ctl_table vm_table[];
174 static struct ctl_table fs_table[];
175 static struct ctl_table debug_table[];
176 static struct ctl_table dev_table[];
177 extern struct ctl_table random_table[];
178 #ifdef CONFIG_INOTIFY_USER
179 extern struct ctl_table inotify_table[];
182 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
183 int sysctl_legacy_va_layout;
186 extern int prove_locking;
187 extern int lock_stat;
189 /* The default sysctl tables: */
191 static struct ctl_table root_table[] = {
193 .ctl_name = CTL_KERN,
194 .procname = "kernel",
211 .ctl_name = CTL_DEBUG,
214 .child = debug_table,
223 * NOTE: do not add new entries to this table unless you have read
224 * Documentation/sysctl/ctl_unnumbered.txt
229 #ifdef CONFIG_SCHED_DEBUG
230 static int min_sched_granularity_ns = 100000; /* 100 usecs */
231 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
232 static int min_wakeup_granularity_ns; /* 0 usecs */
233 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
236 static struct ctl_table kern_table[] = {
237 #ifdef CONFIG_SCHED_DEBUG
239 .ctl_name = CTL_UNNUMBERED,
240 .procname = "sched_min_granularity_ns",
241 .data = &sysctl_sched_min_granularity,
242 .maxlen = sizeof(unsigned int),
244 .proc_handler = &sched_nr_latency_handler,
245 .strategy = &sysctl_intvec,
246 .extra1 = &min_sched_granularity_ns,
247 .extra2 = &max_sched_granularity_ns,
250 .ctl_name = CTL_UNNUMBERED,
251 .procname = "sched_latency_ns",
252 .data = &sysctl_sched_latency,
253 .maxlen = sizeof(unsigned int),
255 .proc_handler = &sched_nr_latency_handler,
256 .strategy = &sysctl_intvec,
257 .extra1 = &min_sched_granularity_ns,
258 .extra2 = &max_sched_granularity_ns,
261 .ctl_name = CTL_UNNUMBERED,
262 .procname = "sched_wakeup_granularity_ns",
263 .data = &sysctl_sched_wakeup_granularity,
264 .maxlen = sizeof(unsigned int),
266 .proc_handler = &proc_dointvec_minmax,
267 .strategy = &sysctl_intvec,
268 .extra1 = &min_wakeup_granularity_ns,
269 .extra2 = &max_wakeup_granularity_ns,
272 .ctl_name = CTL_UNNUMBERED,
273 .procname = "sched_batch_wakeup_granularity_ns",
274 .data = &sysctl_sched_batch_wakeup_granularity,
275 .maxlen = sizeof(unsigned int),
277 .proc_handler = &proc_dointvec_minmax,
278 .strategy = &sysctl_intvec,
279 .extra1 = &min_wakeup_granularity_ns,
280 .extra2 = &max_wakeup_granularity_ns,
283 .ctl_name = CTL_UNNUMBERED,
284 .procname = "sched_child_runs_first",
285 .data = &sysctl_sched_child_runs_first,
286 .maxlen = sizeof(unsigned int),
288 .proc_handler = &proc_dointvec,
291 .ctl_name = CTL_UNNUMBERED,
292 .procname = "sched_features",
293 .data = &sysctl_sched_features,
294 .maxlen = sizeof(unsigned int),
296 .proc_handler = &proc_dointvec,
299 .ctl_name = CTL_UNNUMBERED,
300 .procname = "sched_migration_cost",
301 .data = &sysctl_sched_migration_cost,
302 .maxlen = sizeof(unsigned int),
304 .proc_handler = &proc_dointvec,
307 .ctl_name = CTL_UNNUMBERED,
308 .procname = "sched_nr_migrate",
309 .data = &sysctl_sched_nr_migrate,
310 .maxlen = sizeof(unsigned int),
312 .proc_handler = &proc_dointvec,
315 .ctl_name = CTL_UNNUMBERED,
316 .procname = "sched_rt_period_ms",
317 .data = &sysctl_sched_rt_period,
318 .maxlen = sizeof(unsigned int),
320 .proc_handler = &proc_dointvec,
323 .ctl_name = CTL_UNNUMBERED,
324 .procname = "sched_rt_ratio",
325 .data = &sysctl_sched_rt_ratio,
326 .maxlen = sizeof(unsigned int),
328 .proc_handler = &proc_dointvec,
330 #if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
332 .ctl_name = CTL_UNNUMBERED,
333 .procname = "sched_min_bal_int_shares",
334 .data = &sysctl_sched_min_bal_int_shares,
335 .maxlen = sizeof(unsigned int),
337 .proc_handler = &proc_dointvec,
340 .ctl_name = CTL_UNNUMBERED,
341 .procname = "sched_max_bal_int_shares",
342 .data = &sysctl_sched_max_bal_int_shares,
343 .maxlen = sizeof(unsigned int),
345 .proc_handler = &proc_dointvec,
350 .ctl_name = CTL_UNNUMBERED,
351 .procname = "sched_compat_yield",
352 .data = &sysctl_sched_compat_yield,
353 .maxlen = sizeof(unsigned int),
355 .proc_handler = &proc_dointvec,
357 #ifdef CONFIG_PROVE_LOCKING
359 .ctl_name = CTL_UNNUMBERED,
360 .procname = "prove_locking",
361 .data = &prove_locking,
362 .maxlen = sizeof(int),
364 .proc_handler = &proc_dointvec,
367 #ifdef CONFIG_LOCK_STAT
369 .ctl_name = CTL_UNNUMBERED,
370 .procname = "lock_stat",
372 .maxlen = sizeof(int),
374 .proc_handler = &proc_dointvec,
378 .ctl_name = KERN_PANIC,
380 .data = &panic_timeout,
381 .maxlen = sizeof(int),
383 .proc_handler = &proc_dointvec,
386 .ctl_name = KERN_CORE_USES_PID,
387 .procname = "core_uses_pid",
388 .data = &core_uses_pid,
389 .maxlen = sizeof(int),
391 .proc_handler = &proc_dointvec,
393 #ifdef CONFIG_AUDITSYSCALL
395 .ctl_name = CTL_UNNUMBERED,
396 .procname = "audit_argv_kb",
397 .data = &audit_argv_kb,
398 .maxlen = sizeof(int),
400 .proc_handler = &proc_dointvec,
404 .ctl_name = KERN_CORE_PATTERN,
405 .procname = "core_pattern",
406 .data = core_pattern,
407 .maxlen = CORENAME_MAX_SIZE,
409 .proc_handler = &proc_dostring,
410 .strategy = &sysctl_string,
412 #ifdef CONFIG_PROC_SYSCTL
414 .procname = "tainted",
416 .maxlen = sizeof(int),
418 .proc_handler = &proc_dointvec_taint,
421 #ifdef CONFIG_LATENCYTOP
423 .procname = "latencytop",
424 .data = &latencytop_enabled,
425 .maxlen = sizeof(int),
427 .proc_handler = &proc_dointvec,
430 #ifdef CONFIG_SECURITY_CAPABILITIES
432 .procname = "cap-bound",
434 .maxlen = sizeof(kernel_cap_t),
436 .proc_handler = &proc_dointvec_bset,
438 #endif /* def CONFIG_SECURITY_CAPABILITIES */
439 #ifdef CONFIG_BLK_DEV_INITRD
441 .ctl_name = KERN_REALROOTDEV,
442 .procname = "real-root-dev",
443 .data = &real_root_dev,
444 .maxlen = sizeof(int),
446 .proc_handler = &proc_dointvec,
450 .ctl_name = CTL_UNNUMBERED,
451 .procname = "print-fatal-signals",
452 .data = &print_fatal_signals,
453 .maxlen = sizeof(int),
455 .proc_handler = &proc_dointvec,
459 .ctl_name = KERN_SPARC_REBOOT,
460 .procname = "reboot-cmd",
461 .data = reboot_command,
464 .proc_handler = &proc_dostring,
465 .strategy = &sysctl_string,
468 .ctl_name = KERN_SPARC_STOP_A,
469 .procname = "stop-a",
470 .data = &stop_a_enabled,
471 .maxlen = sizeof (int),
473 .proc_handler = &proc_dointvec,
476 .ctl_name = KERN_SPARC_SCONS_PWROFF,
477 .procname = "scons-poweroff",
478 .data = &scons_pwroff,
479 .maxlen = sizeof (int),
481 .proc_handler = &proc_dointvec,
486 .ctl_name = KERN_HPPA_PWRSW,
487 .procname = "soft-power",
488 .data = &pwrsw_enabled,
489 .maxlen = sizeof (int),
491 .proc_handler = &proc_dointvec,
494 .ctl_name = KERN_HPPA_UNALIGNED,
495 .procname = "unaligned-trap",
496 .data = &unaligned_enabled,
497 .maxlen = sizeof (int),
499 .proc_handler = &proc_dointvec,
503 .ctl_name = KERN_CTLALTDEL,
504 .procname = "ctrl-alt-del",
506 .maxlen = sizeof(int),
508 .proc_handler = &proc_dointvec,
511 .ctl_name = KERN_PRINTK,
512 .procname = "printk",
513 .data = &console_loglevel,
514 .maxlen = 4*sizeof(int),
516 .proc_handler = &proc_dointvec,
520 .ctl_name = KERN_MODPROBE,
521 .procname = "modprobe",
522 .data = &modprobe_path,
523 .maxlen = KMOD_PATH_LEN,
525 .proc_handler = &proc_dostring,
526 .strategy = &sysctl_string,
529 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
531 .ctl_name = KERN_HOTPLUG,
532 .procname = "hotplug",
533 .data = &uevent_helper,
534 .maxlen = UEVENT_HELPER_PATH_LEN,
536 .proc_handler = &proc_dostring,
537 .strategy = &sysctl_string,
540 #ifdef CONFIG_CHR_DEV_SG
542 .ctl_name = KERN_SG_BIG_BUFF,
543 .procname = "sg-big-buff",
544 .data = &sg_big_buff,
545 .maxlen = sizeof (int),
547 .proc_handler = &proc_dointvec,
550 #ifdef CONFIG_BSD_PROCESS_ACCT
552 .ctl_name = KERN_ACCT,
555 .maxlen = 3*sizeof(int),
557 .proc_handler = &proc_dointvec,
560 #ifdef CONFIG_MAGIC_SYSRQ
562 .ctl_name = KERN_SYSRQ,
564 .data = &__sysrq_enabled,
565 .maxlen = sizeof (int),
567 .proc_handler = &proc_dointvec,
570 #ifdef CONFIG_PROC_SYSCTL
572 .procname = "cad_pid",
574 .maxlen = sizeof (int),
576 .proc_handler = &proc_do_cad_pid,
580 .ctl_name = KERN_MAX_THREADS,
581 .procname = "threads-max",
582 .data = &max_threads,
583 .maxlen = sizeof(int),
585 .proc_handler = &proc_dointvec,
588 .ctl_name = KERN_RANDOM,
589 .procname = "random",
591 .child = random_table,
594 .ctl_name = KERN_OVERFLOWUID,
595 .procname = "overflowuid",
596 .data = &overflowuid,
597 .maxlen = sizeof(int),
599 .proc_handler = &proc_dointvec_minmax,
600 .strategy = &sysctl_intvec,
601 .extra1 = &minolduid,
602 .extra2 = &maxolduid,
605 .ctl_name = KERN_OVERFLOWGID,
606 .procname = "overflowgid",
607 .data = &overflowgid,
608 .maxlen = sizeof(int),
610 .proc_handler = &proc_dointvec_minmax,
611 .strategy = &sysctl_intvec,
612 .extra1 = &minolduid,
613 .extra2 = &maxolduid,
616 #ifdef CONFIG_MATHEMU
618 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
619 .procname = "ieee_emulation_warnings",
620 .data = &sysctl_ieee_emulation_warnings,
621 .maxlen = sizeof(int),
623 .proc_handler = &proc_dointvec,
626 #ifdef CONFIG_NO_IDLE_HZ
628 .ctl_name = KERN_HZ_TIMER,
629 .procname = "hz_timer",
630 .data = &sysctl_hz_timer,
631 .maxlen = sizeof(int),
633 .proc_handler = &proc_dointvec,
637 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
638 .procname = "userprocess_debug",
639 .data = &sysctl_userprocess_debug,
640 .maxlen = sizeof(int),
642 .proc_handler = &proc_dointvec,
646 .ctl_name = KERN_PIDMAX,
647 .procname = "pid_max",
649 .maxlen = sizeof (int),
651 .proc_handler = &proc_dointvec_minmax,
652 .strategy = sysctl_intvec,
653 .extra1 = &pid_max_min,
654 .extra2 = &pid_max_max,
657 .ctl_name = KERN_PANIC_ON_OOPS,
658 .procname = "panic_on_oops",
659 .data = &panic_on_oops,
660 .maxlen = sizeof(int),
662 .proc_handler = &proc_dointvec,
665 .ctl_name = KERN_PRINTK_RATELIMIT,
666 .procname = "printk_ratelimit",
667 .data = &printk_ratelimit_jiffies,
668 .maxlen = sizeof(int),
670 .proc_handler = &proc_dointvec_jiffies,
671 .strategy = &sysctl_jiffies,
674 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
675 .procname = "printk_ratelimit_burst",
676 .data = &printk_ratelimit_burst,
677 .maxlen = sizeof(int),
679 .proc_handler = &proc_dointvec,
682 .ctl_name = KERN_NGROUPS_MAX,
683 .procname = "ngroups_max",
684 .data = &ngroups_max,
685 .maxlen = sizeof (int),
687 .proc_handler = &proc_dointvec,
689 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
691 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
692 .procname = "unknown_nmi_panic",
693 .data = &unknown_nmi_panic,
694 .maxlen = sizeof (int),
696 .proc_handler = &proc_dointvec,
699 .procname = "nmi_watchdog",
700 .data = &nmi_watchdog_enabled,
701 .maxlen = sizeof (int),
703 .proc_handler = &proc_nmi_enabled,
706 #if defined(CONFIG_X86)
708 .ctl_name = KERN_PANIC_ON_NMI,
709 .procname = "panic_on_unrecovered_nmi",
710 .data = &panic_on_unrecovered_nmi,
711 .maxlen = sizeof(int),
713 .proc_handler = &proc_dointvec,
716 .ctl_name = KERN_BOOTLOADER_TYPE,
717 .procname = "bootloader_type",
718 .data = &bootloader_type,
719 .maxlen = sizeof (int),
721 .proc_handler = &proc_dointvec,
724 .ctl_name = CTL_UNNUMBERED,
725 .procname = "kstack_depth_to_print",
726 .data = &kstack_depth_to_print,
727 .maxlen = sizeof(int),
729 .proc_handler = &proc_dointvec,
732 .ctl_name = CTL_UNNUMBERED,
733 .procname = "io_delay_type",
734 .data = &io_delay_type,
735 .maxlen = sizeof(int),
737 .proc_handler = &proc_dointvec,
740 #if defined(CONFIG_MMU)
742 .ctl_name = KERN_RANDOMIZE,
743 .procname = "randomize_va_space",
744 .data = &randomize_va_space,
745 .maxlen = sizeof(int),
747 .proc_handler = &proc_dointvec,
750 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
752 .ctl_name = KERN_SPIN_RETRY,
753 .procname = "spin_retry",
755 .maxlen = sizeof (int),
757 .proc_handler = &proc_dointvec,
760 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
762 .procname = "acpi_video_flags",
763 .data = &acpi_realmode_flags,
764 .maxlen = sizeof (unsigned long),
766 .proc_handler = &proc_doulongvec_minmax,
771 .ctl_name = KERN_IA64_UNALIGNED,
772 .procname = "ignore-unaligned-usertrap",
773 .data = &no_unaligned_warning,
774 .maxlen = sizeof (int),
776 .proc_handler = &proc_dointvec,
779 #ifdef CONFIG_DETECT_SOFTLOCKUP
781 .ctl_name = CTL_UNNUMBERED,
782 .procname = "softlockup_thresh",
783 .data = &softlockup_thresh,
784 .maxlen = sizeof(unsigned long),
786 .proc_handler = &proc_doulongvec_minmax,
787 .strategy = &sysctl_intvec,
792 .ctl_name = CTL_UNNUMBERED,
793 .procname = "hung_task_check_count",
794 .data = &sysctl_hung_task_check_count,
795 .maxlen = sizeof(unsigned long),
797 .proc_handler = &proc_doulongvec_minmax,
798 .strategy = &sysctl_intvec,
801 .ctl_name = CTL_UNNUMBERED,
802 .procname = "hung_task_timeout_secs",
803 .data = &sysctl_hung_task_timeout_secs,
804 .maxlen = sizeof(unsigned long),
806 .proc_handler = &proc_doulongvec_minmax,
807 .strategy = &sysctl_intvec,
810 .ctl_name = CTL_UNNUMBERED,
811 .procname = "hung_task_warnings",
812 .data = &sysctl_hung_task_warnings,
813 .maxlen = sizeof(unsigned long),
815 .proc_handler = &proc_doulongvec_minmax,
816 .strategy = &sysctl_intvec,
821 .ctl_name = KERN_COMPAT_LOG,
822 .procname = "compat-log",
824 .maxlen = sizeof (int),
826 .proc_handler = &proc_dointvec,
829 #ifdef CONFIG_RT_MUTEXES
831 .ctl_name = KERN_MAX_LOCK_DEPTH,
832 .procname = "max_lock_depth",
833 .data = &max_lock_depth,
834 .maxlen = sizeof(int),
836 .proc_handler = &proc_dointvec,
839 #ifdef CONFIG_PROC_FS
841 .ctl_name = CTL_UNNUMBERED,
842 .procname = "maps_protect",
843 .data = &maps_protect,
844 .maxlen = sizeof(int),
846 .proc_handler = &proc_dointvec,
850 .ctl_name = CTL_UNNUMBERED,
851 .procname = "poweroff_cmd",
852 .data = &poweroff_cmd,
853 .maxlen = POWEROFF_CMD_PATH_LEN,
855 .proc_handler = &proc_dostring,
856 .strategy = &sysctl_string,
859 * NOTE: do not add new entries to this table unless you have read
860 * Documentation/sysctl/ctl_unnumbered.txt
865 static struct ctl_table vm_table[] = {
867 .ctl_name = VM_OVERCOMMIT_MEMORY,
868 .procname = "overcommit_memory",
869 .data = &sysctl_overcommit_memory,
870 .maxlen = sizeof(sysctl_overcommit_memory),
872 .proc_handler = &proc_dointvec,
875 .ctl_name = VM_PANIC_ON_OOM,
876 .procname = "panic_on_oom",
877 .data = &sysctl_panic_on_oom,
878 .maxlen = sizeof(sysctl_panic_on_oom),
880 .proc_handler = &proc_dointvec,
883 .ctl_name = CTL_UNNUMBERED,
884 .procname = "oom_kill_allocating_task",
885 .data = &sysctl_oom_kill_allocating_task,
886 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
888 .proc_handler = &proc_dointvec,
891 .ctl_name = VM_OVERCOMMIT_RATIO,
892 .procname = "overcommit_ratio",
893 .data = &sysctl_overcommit_ratio,
894 .maxlen = sizeof(sysctl_overcommit_ratio),
896 .proc_handler = &proc_dointvec,
899 .ctl_name = VM_PAGE_CLUSTER,
900 .procname = "page-cluster",
901 .data = &page_cluster,
902 .maxlen = sizeof(int),
904 .proc_handler = &proc_dointvec,
907 .ctl_name = VM_DIRTY_BACKGROUND,
908 .procname = "dirty_background_ratio",
909 .data = &dirty_background_ratio,
910 .maxlen = sizeof(dirty_background_ratio),
912 .proc_handler = &proc_dointvec_minmax,
913 .strategy = &sysctl_intvec,
915 .extra2 = &one_hundred,
918 .ctl_name = VM_DIRTY_RATIO,
919 .procname = "dirty_ratio",
920 .data = &vm_dirty_ratio,
921 .maxlen = sizeof(vm_dirty_ratio),
923 .proc_handler = &dirty_ratio_handler,
924 .strategy = &sysctl_intvec,
926 .extra2 = &one_hundred,
929 .procname = "dirty_writeback_centisecs",
930 .data = &dirty_writeback_interval,
931 .maxlen = sizeof(dirty_writeback_interval),
933 .proc_handler = &dirty_writeback_centisecs_handler,
936 .procname = "dirty_expire_centisecs",
937 .data = &dirty_expire_interval,
938 .maxlen = sizeof(dirty_expire_interval),
940 .proc_handler = &proc_dointvec_userhz_jiffies,
943 .ctl_name = VM_NR_PDFLUSH_THREADS,
944 .procname = "nr_pdflush_threads",
945 .data = &nr_pdflush_threads,
946 .maxlen = sizeof nr_pdflush_threads,
947 .mode = 0444 /* read-only*/,
948 .proc_handler = &proc_dointvec,
951 .ctl_name = VM_SWAPPINESS,
952 .procname = "swappiness",
953 .data = &vm_swappiness,
954 .maxlen = sizeof(vm_swappiness),
956 .proc_handler = &proc_dointvec_minmax,
957 .strategy = &sysctl_intvec,
959 .extra2 = &one_hundred,
961 #ifdef CONFIG_HUGETLB_PAGE
963 .procname = "nr_hugepages",
964 .data = &max_huge_pages,
965 .maxlen = sizeof(unsigned long),
967 .proc_handler = &hugetlb_sysctl_handler,
968 .extra1 = (void *)&hugetlb_zero,
969 .extra2 = (void *)&hugetlb_infinity,
972 .ctl_name = VM_HUGETLB_GROUP,
973 .procname = "hugetlb_shm_group",
974 .data = &sysctl_hugetlb_shm_group,
975 .maxlen = sizeof(gid_t),
977 .proc_handler = &proc_dointvec,
980 .ctl_name = CTL_UNNUMBERED,
981 .procname = "hugepages_treat_as_movable",
982 .data = &hugepages_treat_as_movable,
983 .maxlen = sizeof(int),
985 .proc_handler = &hugetlb_treat_movable_handler,
988 .ctl_name = CTL_UNNUMBERED,
989 .procname = "nr_overcommit_hugepages",
990 .data = &nr_overcommit_huge_pages,
991 .maxlen = sizeof(nr_overcommit_huge_pages),
993 .proc_handler = &proc_doulongvec_minmax,
997 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
998 .procname = "lowmem_reserve_ratio",
999 .data = &sysctl_lowmem_reserve_ratio,
1000 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1002 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
1003 .strategy = &sysctl_intvec,
1006 .ctl_name = VM_DROP_PAGECACHE,
1007 .procname = "drop_caches",
1008 .data = &sysctl_drop_caches,
1009 .maxlen = sizeof(int),
1011 .proc_handler = drop_caches_sysctl_handler,
1012 .strategy = &sysctl_intvec,
1015 .ctl_name = VM_MIN_FREE_KBYTES,
1016 .procname = "min_free_kbytes",
1017 .data = &min_free_kbytes,
1018 .maxlen = sizeof(min_free_kbytes),
1020 .proc_handler = &min_free_kbytes_sysctl_handler,
1021 .strategy = &sysctl_intvec,
1025 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1026 .procname = "percpu_pagelist_fraction",
1027 .data = &percpu_pagelist_fraction,
1028 .maxlen = sizeof(percpu_pagelist_fraction),
1030 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
1031 .strategy = &sysctl_intvec,
1032 .extra1 = &min_percpu_pagelist_fract,
1036 .ctl_name = VM_MAX_MAP_COUNT,
1037 .procname = "max_map_count",
1038 .data = &sysctl_max_map_count,
1039 .maxlen = sizeof(sysctl_max_map_count),
1041 .proc_handler = &proc_dointvec
1045 .ctl_name = VM_LAPTOP_MODE,
1046 .procname = "laptop_mode",
1047 .data = &laptop_mode,
1048 .maxlen = sizeof(laptop_mode),
1050 .proc_handler = &proc_dointvec_jiffies,
1051 .strategy = &sysctl_jiffies,
1054 .ctl_name = VM_BLOCK_DUMP,
1055 .procname = "block_dump",
1056 .data = &block_dump,
1057 .maxlen = sizeof(block_dump),
1059 .proc_handler = &proc_dointvec,
1060 .strategy = &sysctl_intvec,
1064 .ctl_name = VM_VFS_CACHE_PRESSURE,
1065 .procname = "vfs_cache_pressure",
1066 .data = &sysctl_vfs_cache_pressure,
1067 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1069 .proc_handler = &proc_dointvec,
1070 .strategy = &sysctl_intvec,
1073 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1075 .ctl_name = VM_LEGACY_VA_LAYOUT,
1076 .procname = "legacy_va_layout",
1077 .data = &sysctl_legacy_va_layout,
1078 .maxlen = sizeof(sysctl_legacy_va_layout),
1080 .proc_handler = &proc_dointvec,
1081 .strategy = &sysctl_intvec,
1087 .ctl_name = VM_ZONE_RECLAIM_MODE,
1088 .procname = "zone_reclaim_mode",
1089 .data = &zone_reclaim_mode,
1090 .maxlen = sizeof(zone_reclaim_mode),
1092 .proc_handler = &proc_dointvec,
1093 .strategy = &sysctl_intvec,
1097 .ctl_name = VM_MIN_UNMAPPED,
1098 .procname = "min_unmapped_ratio",
1099 .data = &sysctl_min_unmapped_ratio,
1100 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1102 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
1103 .strategy = &sysctl_intvec,
1105 .extra2 = &one_hundred,
1108 .ctl_name = VM_MIN_SLAB,
1109 .procname = "min_slab_ratio",
1110 .data = &sysctl_min_slab_ratio,
1111 .maxlen = sizeof(sysctl_min_slab_ratio),
1113 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
1114 .strategy = &sysctl_intvec,
1116 .extra2 = &one_hundred,
1121 .ctl_name = CTL_UNNUMBERED,
1122 .procname = "stat_interval",
1123 .data = &sysctl_stat_interval,
1124 .maxlen = sizeof(sysctl_stat_interval),
1126 .proc_handler = &proc_dointvec_jiffies,
1127 .strategy = &sysctl_jiffies,
1130 #ifdef CONFIG_SECURITY
1132 .ctl_name = CTL_UNNUMBERED,
1133 .procname = "mmap_min_addr",
1134 .data = &mmap_min_addr,
1135 .maxlen = sizeof(unsigned long),
1137 .proc_handler = &proc_doulongvec_minmax,
1142 .ctl_name = CTL_UNNUMBERED,
1143 .procname = "numa_zonelist_order",
1144 .data = &numa_zonelist_order,
1145 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1147 .proc_handler = &numa_zonelist_order_handler,
1148 .strategy = &sysctl_string,
1151 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1152 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1154 .ctl_name = VM_VDSO_ENABLED,
1155 .procname = "vdso_enabled",
1156 .data = &vdso_enabled,
1157 .maxlen = sizeof(vdso_enabled),
1159 .proc_handler = &proc_dointvec,
1160 .strategy = &sysctl_intvec,
1165 * NOTE: do not add new entries to this table unless you have read
1166 * Documentation/sysctl/ctl_unnumbered.txt
1171 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1172 static struct ctl_table binfmt_misc_table[] = {
1177 static struct ctl_table fs_table[] = {
1179 .ctl_name = FS_NRINODE,
1180 .procname = "inode-nr",
1181 .data = &inodes_stat,
1182 .maxlen = 2*sizeof(int),
1184 .proc_handler = &proc_dointvec,
1187 .ctl_name = FS_STATINODE,
1188 .procname = "inode-state",
1189 .data = &inodes_stat,
1190 .maxlen = 7*sizeof(int),
1192 .proc_handler = &proc_dointvec,
1195 .procname = "file-nr",
1196 .data = &files_stat,
1197 .maxlen = 3*sizeof(int),
1199 .proc_handler = &proc_nr_files,
1202 .ctl_name = FS_MAXFILE,
1203 .procname = "file-max",
1204 .data = &files_stat.max_files,
1205 .maxlen = sizeof(int),
1207 .proc_handler = &proc_dointvec,
1210 .ctl_name = FS_DENTRY,
1211 .procname = "dentry-state",
1212 .data = &dentry_stat,
1213 .maxlen = 6*sizeof(int),
1215 .proc_handler = &proc_dointvec,
1218 .ctl_name = FS_OVERFLOWUID,
1219 .procname = "overflowuid",
1220 .data = &fs_overflowuid,
1221 .maxlen = sizeof(int),
1223 .proc_handler = &proc_dointvec_minmax,
1224 .strategy = &sysctl_intvec,
1225 .extra1 = &minolduid,
1226 .extra2 = &maxolduid,
1229 .ctl_name = FS_OVERFLOWGID,
1230 .procname = "overflowgid",
1231 .data = &fs_overflowgid,
1232 .maxlen = sizeof(int),
1234 .proc_handler = &proc_dointvec_minmax,
1235 .strategy = &sysctl_intvec,
1236 .extra1 = &minolduid,
1237 .extra2 = &maxolduid,
1240 .ctl_name = FS_LEASES,
1241 .procname = "leases-enable",
1242 .data = &leases_enable,
1243 .maxlen = sizeof(int),
1245 .proc_handler = &proc_dointvec,
1247 #ifdef CONFIG_DNOTIFY
1249 .ctl_name = FS_DIR_NOTIFY,
1250 .procname = "dir-notify-enable",
1251 .data = &dir_notify_enable,
1252 .maxlen = sizeof(int),
1254 .proc_handler = &proc_dointvec,
1259 .ctl_name = FS_LEASE_TIME,
1260 .procname = "lease-break-time",
1261 .data = &lease_break_time,
1262 .maxlen = sizeof(int),
1264 .proc_handler = &proc_dointvec_minmax,
1265 .strategy = &sysctl_intvec,
1270 .procname = "aio-nr",
1272 .maxlen = sizeof(aio_nr),
1274 .proc_handler = &proc_doulongvec_minmax,
1277 .procname = "aio-max-nr",
1278 .data = &aio_max_nr,
1279 .maxlen = sizeof(aio_max_nr),
1281 .proc_handler = &proc_doulongvec_minmax,
1283 #ifdef CONFIG_INOTIFY_USER
1285 .ctl_name = FS_INOTIFY,
1286 .procname = "inotify",
1288 .child = inotify_table,
1293 .ctl_name = KERN_SETUID_DUMPABLE,
1294 .procname = "suid_dumpable",
1295 .data = &suid_dumpable,
1296 .maxlen = sizeof(int),
1298 .proc_handler = &proc_dointvec,
1300 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1302 .ctl_name = CTL_UNNUMBERED,
1303 .procname = "binfmt_misc",
1305 .child = binfmt_misc_table,
1309 * NOTE: do not add new entries to this table unless you have read
1310 * Documentation/sysctl/ctl_unnumbered.txt
1315 static struct ctl_table debug_table[] = {
1316 #if defined(CONFIG_X86) || defined(CONFIG_PPC)
1318 .ctl_name = CTL_UNNUMBERED,
1319 .procname = "exception-trace",
1320 .data = &show_unhandled_signals,
1321 .maxlen = sizeof(int),
1323 .proc_handler = proc_dointvec
1329 static struct ctl_table dev_table[] = {
1333 static DEFINE_SPINLOCK(sysctl_lock);
1335 /* called under sysctl_lock */
1336 static int use_table(struct ctl_table_header *p)
1338 if (unlikely(p->unregistering))
1344 /* called under sysctl_lock */
1345 static void unuse_table(struct ctl_table_header *p)
1348 if (unlikely(p->unregistering))
1349 complete(p->unregistering);
1352 /* called under sysctl_lock, will reacquire if has to wait */
1353 static void start_unregistering(struct ctl_table_header *p)
1356 * if p->used is 0, nobody will ever touch that entry again;
1357 * we'll eliminate all paths to it before dropping sysctl_lock
1359 if (unlikely(p->used)) {
1360 struct completion wait;
1361 init_completion(&wait);
1362 p->unregistering = &wait;
1363 spin_unlock(&sysctl_lock);
1364 wait_for_completion(&wait);
1365 spin_lock(&sysctl_lock);
1368 * do not remove from the list until nobody holds it; walking the
1369 * list in do_sysctl() relies on that.
1371 list_del_init(&p->ctl_entry);
1374 void sysctl_head_finish(struct ctl_table_header *head)
1378 spin_lock(&sysctl_lock);
1380 spin_unlock(&sysctl_lock);
1383 static struct list_head *
1384 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1386 struct list_head *header_list;
1387 header_list = &root->header_list;
1389 header_list = root->lookup(root, namespaces);
1393 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1394 struct ctl_table_header *prev)
1396 struct ctl_table_root *root;
1397 struct list_head *header_list;
1398 struct ctl_table_header *head;
1399 struct list_head *tmp;
1401 spin_lock(&sysctl_lock);
1404 tmp = &prev->ctl_entry;
1408 tmp = &root_table_header.ctl_entry;
1410 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1412 if (!use_table(head))
1414 spin_unlock(&sysctl_lock);
1419 header_list = lookup_header_list(root, namespaces);
1420 if (tmp != header_list)
1424 root = list_entry(root->root_list.next,
1425 struct ctl_table_root, root_list);
1426 if (root == &sysctl_table_root)
1428 header_list = lookup_header_list(root, namespaces);
1429 } while (list_empty(header_list));
1430 tmp = header_list->next;
1433 spin_unlock(&sysctl_lock);
1437 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1439 return __sysctl_head_next(current->nsproxy, prev);
1442 void register_sysctl_root(struct ctl_table_root *root)
1444 spin_lock(&sysctl_lock);
1445 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1446 spin_unlock(&sysctl_lock);
1449 #ifdef CONFIG_SYSCTL_SYSCALL
1450 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1451 void __user *newval, size_t newlen)
1453 struct ctl_table_header *head;
1454 int error = -ENOTDIR;
1456 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1460 if (!oldlenp || get_user(old_len, oldlenp))
1464 for (head = sysctl_head_next(NULL); head;
1465 head = sysctl_head_next(head)) {
1466 error = parse_table(name, nlen, oldval, oldlenp,
1467 newval, newlen, head->ctl_table);
1468 if (error != -ENOTDIR) {
1469 sysctl_head_finish(head);
1476 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1478 struct __sysctl_args tmp;
1481 if (copy_from_user(&tmp, args, sizeof(tmp)))
1484 error = deprecated_sysctl_warning(&tmp);
1489 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1490 tmp.newval, tmp.newlen);
1495 #endif /* CONFIG_SYSCTL_SYSCALL */
1498 * sysctl_perm does NOT grant the superuser all rights automatically, because
1499 * some sysctl variables are readonly even to root.
1502 static int test_perm(int mode, int op)
1506 else if (in_egroup_p(0))
1508 if ((mode & op & 0007) == op)
1513 int sysctl_perm(struct ctl_table *table, int op)
1516 error = security_sysctl(table, op);
1519 return test_perm(table->mode, op);
1522 #ifdef CONFIG_SYSCTL_SYSCALL
1523 static int parse_table(int __user *name, int nlen,
1524 void __user *oldval, size_t __user *oldlenp,
1525 void __user *newval, size_t newlen,
1526 struct ctl_table *table)
1532 if (get_user(n, name))
1534 for ( ; table->ctl_name || table->procname; table++) {
1535 if (!table->ctl_name)
1537 if (n == table->ctl_name) {
1540 if (sysctl_perm(table, 001))
1544 table = table->child;
1547 error = do_sysctl_strategy(table, name, nlen,
1556 /* Perform the actual read/write of a sysctl table entry. */
1557 int do_sysctl_strategy (struct ctl_table *table,
1558 int __user *name, int nlen,
1559 void __user *oldval, size_t __user *oldlenp,
1560 void __user *newval, size_t newlen)
1568 if (sysctl_perm(table, op))
1571 if (table->strategy) {
1572 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1580 /* If there is no strategy routine, or if the strategy returns
1581 * zero, proceed with automatic r/w */
1582 if (table->data && table->maxlen) {
1583 rc = sysctl_data(table, name, nlen, oldval, oldlenp,
1590 #endif /* CONFIG_SYSCTL_SYSCALL */
1592 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1594 for (; table->ctl_name || table->procname; table++) {
1595 table->parent = parent;
1597 sysctl_set_parent(table, table->child);
1601 static __init int sysctl_init(void)
1604 sysctl_set_parent(NULL, root_table);
1605 err = sysctl_check_table(current->nsproxy, root_table);
1609 core_initcall(sysctl_init);
1612 * __register_sysctl_paths - register a sysctl hierarchy
1613 * @root: List of sysctl headers to register on
1614 * @namespaces: Data to compute which lists of sysctl entries are visible
1615 * @path: The path to the directory the sysctl table is in.
1616 * @table: the top-level table structure
1618 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1619 * array. A completely 0 filled entry terminates the table.
1621 * The members of the &struct ctl_table structure are used as follows:
1623 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1624 * must be unique within that level of sysctl
1626 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1627 * enter a sysctl file
1629 * data - a pointer to data for use by proc_handler
1631 * maxlen - the maximum size in bytes of the data
1633 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1635 * child - a pointer to the child sysctl table if this entry is a directory, or
1638 * proc_handler - the text handler routine (described below)
1640 * strategy - the strategy routine (described below)
1642 * de - for internal use by the sysctl routines
1644 * extra1, extra2 - extra pointers usable by the proc handler routines
1646 * Leaf nodes in the sysctl tree will be represented by a single file
1647 * under /proc; non-leaf nodes will be represented by directories.
1649 * sysctl(2) can automatically manage read and write requests through
1650 * the sysctl table. The data and maxlen fields of the ctl_table
1651 * struct enable minimal validation of the values being written to be
1652 * performed, and the mode field allows minimal authentication.
1654 * More sophisticated management can be enabled by the provision of a
1655 * strategy routine with the table entry. This will be called before
1656 * any automatic read or write of the data is performed.
1658 * The strategy routine may return
1660 * < 0 - Error occurred (error is passed to user process)
1662 * 0 - OK - proceed with automatic read or write.
1664 * > 0 - OK - read or write has been done by the strategy routine, so
1665 * return immediately.
1667 * There must be a proc_handler routine for any terminal nodes
1668 * mirrored under /proc/sys (non-terminals are handled by a built-in
1669 * directory handler). Several default handlers are available to
1670 * cover common cases -
1672 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1673 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1674 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1676 * It is the handler's job to read the input buffer from user memory
1677 * and process it. The handler should return 0 on success.
1679 * This routine returns %NULL on a failure to register, and a pointer
1680 * to the table header on success.
1682 struct ctl_table_header *__register_sysctl_paths(
1683 struct ctl_table_root *root,
1684 struct nsproxy *namespaces,
1685 const struct ctl_path *path, struct ctl_table *table)
1687 struct list_head *header_list;
1688 struct ctl_table_header *header;
1689 struct ctl_table *new, **prevp;
1690 unsigned int n, npath;
1692 /* Count the path components */
1693 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
1697 * For each path component, allocate a 2-element ctl_table array.
1698 * The first array element will be filled with the sysctl entry
1699 * for this, the second will be the sentinel (ctl_name == 0).
1701 * We allocate everything in one go so that we don't have to
1702 * worry about freeing additional memory in unregister_sysctl_table.
1704 header = kzalloc(sizeof(struct ctl_table_header) +
1705 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1709 new = (struct ctl_table *) (header + 1);
1711 /* Now connect the dots */
1712 prevp = &header->ctl_table;
1713 for (n = 0; n < npath; ++n, ++path) {
1714 /* Copy the procname */
1715 new->procname = path->procname;
1716 new->ctl_name = path->ctl_name;
1720 prevp = &new->child;
1725 header->ctl_table_arg = table;
1727 INIT_LIST_HEAD(&header->ctl_entry);
1729 header->unregistering = NULL;
1730 header->root = root;
1731 sysctl_set_parent(NULL, header->ctl_table);
1732 if (sysctl_check_table(namespaces, header->ctl_table)) {
1736 spin_lock(&sysctl_lock);
1737 header_list = lookup_header_list(root, namespaces);
1738 list_add_tail(&header->ctl_entry, header_list);
1739 spin_unlock(&sysctl_lock);
1745 * register_sysctl_table_path - register a sysctl table hierarchy
1746 * @path: The path to the directory the sysctl table is in.
1747 * @table: the top-level table structure
1749 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1750 * array. A completely 0 filled entry terminates the table.
1752 * See __register_sysctl_paths for more details.
1754 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1755 struct ctl_table *table)
1757 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1762 * register_sysctl_table - register a sysctl table hierarchy
1763 * @table: the top-level table structure
1765 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1766 * array. A completely 0 filled entry terminates the table.
1768 * See register_sysctl_paths for more details.
1770 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1772 static const struct ctl_path null_path[] = { {} };
1774 return register_sysctl_paths(null_path, table);
1778 * unregister_sysctl_table - unregister a sysctl table hierarchy
1779 * @header: the header returned from register_sysctl_table
1781 * Unregisters the sysctl table and all children. proc entries may not
1782 * actually be removed until they are no longer used by anyone.
1784 void unregister_sysctl_table(struct ctl_table_header * header)
1791 spin_lock(&sysctl_lock);
1792 start_unregistering(header);
1793 spin_unlock(&sysctl_lock);
1797 #else /* !CONFIG_SYSCTL */
1798 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1803 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1804 struct ctl_table *table)
1809 void unregister_sysctl_table(struct ctl_table_header * table)
1813 #endif /* CONFIG_SYSCTL */
1819 #ifdef CONFIG_PROC_SYSCTL
1821 static int _proc_do_string(void* data, int maxlen, int write,
1822 struct file *filp, void __user *buffer,
1823 size_t *lenp, loff_t *ppos)
1829 if (!data || !maxlen || !*lenp) {
1837 while (len < *lenp) {
1838 if (get_user(c, p++))
1840 if (c == 0 || c == '\n')
1846 if(copy_from_user(data, buffer, len))
1848 ((char *) data)[len] = 0;
1866 if(copy_to_user(buffer, data, len))
1869 if(put_user('\n', ((char __user *) buffer) + len))
1880 * proc_dostring - read a string sysctl
1881 * @table: the sysctl table
1882 * @write: %TRUE if this is a write to the sysctl file
1883 * @filp: the file structure
1884 * @buffer: the user buffer
1885 * @lenp: the size of the user buffer
1886 * @ppos: file position
1888 * Reads/writes a string from/to the user buffer. If the kernel
1889 * buffer provided is not large enough to hold the string, the
1890 * string is truncated. The copied string is %NULL-terminated.
1891 * If the string is being read by the user process, it is copied
1892 * and a newline '\n' is added. It is truncated if the buffer is
1895 * Returns 0 on success.
1897 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
1898 void __user *buffer, size_t *lenp, loff_t *ppos)
1900 return _proc_do_string(table->data, table->maxlen, write, filp,
1901 buffer, lenp, ppos);
1905 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1907 int write, void *data)
1910 *valp = *negp ? -*lvalp : *lvalp;
1915 *lvalp = (unsigned long)-val;
1918 *lvalp = (unsigned long)val;
1924 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
1925 int write, struct file *filp, void __user *buffer,
1926 size_t *lenp, loff_t *ppos,
1927 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1928 int write, void *data),
1931 #define TMPBUFLEN 21
1932 int *i, vleft, first=1, neg, val;
1936 char buf[TMPBUFLEN], *p;
1937 char __user *s = buffer;
1939 if (!tbl_data || !table->maxlen || !*lenp ||
1940 (*ppos && !write)) {
1945 i = (int *) tbl_data;
1946 vleft = table->maxlen / sizeof(*i);
1950 conv = do_proc_dointvec_conv;
1952 for (; left && vleft--; i++, first=0) {
1967 if (len > sizeof(buf) - 1)
1968 len = sizeof(buf) - 1;
1969 if (copy_from_user(buf, s, len))
1973 if (*p == '-' && left > 1) {
1977 if (*p < '0' || *p > '9')
1980 lval = simple_strtoul(p, &p, 0);
1983 if ((len < left) && *p && !isspace(*p))
1990 if (conv(&neg, &lval, i, 1, data))
1997 if (conv(&neg, &lval, i, 0, data))
2000 sprintf(p, "%s%lu", neg ? "-" : "", lval);
2004 if(copy_to_user(s, buf, len))
2011 if (!write && !first && left) {
2012 if(put_user('\n', s))
2019 if (get_user(c, s++))
2034 static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2035 void __user *buffer, size_t *lenp, loff_t *ppos,
2036 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2037 int write, void *data),
2040 return __do_proc_dointvec(table->data, table, write, filp,
2041 buffer, lenp, ppos, conv, data);
2045 * proc_dointvec - read a vector of integers
2046 * @table: the sysctl table
2047 * @write: %TRUE if this is a write to the sysctl file
2048 * @filp: the file structure
2049 * @buffer: the user buffer
2050 * @lenp: the size of the user buffer
2051 * @ppos: file position
2053 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2054 * values from/to the user buffer, treated as an ASCII string.
2056 * Returns 0 on success.
2058 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2059 void __user *buffer, size_t *lenp, loff_t *ppos)
2061 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2069 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
2071 int write, void *data)
2073 int op = *(int *)data;
2075 int val = *negp ? -*lvalp : *lvalp;
2077 case OP_SET: *valp = val; break;
2078 case OP_AND: *valp &= val; break;
2079 case OP_OR: *valp |= val; break;
2085 *lvalp = (unsigned long)-val;
2088 *lvalp = (unsigned long)val;
2094 #ifdef CONFIG_SECURITY_CAPABILITIES
2096 * init may raise the set.
2099 int proc_dointvec_bset(struct ctl_table *table, int write, struct file *filp,
2100 void __user *buffer, size_t *lenp, loff_t *ppos)
2104 if (write && !capable(CAP_SYS_MODULE)) {
2108 op = is_global_init(current) ? OP_SET : OP_AND;
2109 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2110 do_proc_dointvec_bset_conv,&op);
2112 #endif /* def CONFIG_SECURITY_CAPABILITIES */
2115 * Taint values can only be increased
2117 static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp,
2118 void __user *buffer, size_t *lenp, loff_t *ppos)
2122 if (write && !capable(CAP_SYS_ADMIN))
2126 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2127 do_proc_dointvec_bset_conv,&op);
2130 struct do_proc_dointvec_minmax_conv_param {
2135 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2137 int write, void *data)
2139 struct do_proc_dointvec_minmax_conv_param *param = data;
2141 int val = *negp ? -*lvalp : *lvalp;
2142 if ((param->min && *param->min > val) ||
2143 (param->max && *param->max < val))
2150 *lvalp = (unsigned long)-val;
2153 *lvalp = (unsigned long)val;
2160 * proc_dointvec_minmax - read a vector of integers with min/max values
2161 * @table: the sysctl table
2162 * @write: %TRUE if this is a write to the sysctl file
2163 * @filp: the file structure
2164 * @buffer: the user buffer
2165 * @lenp: the size of the user buffer
2166 * @ppos: file position
2168 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2169 * values from/to the user buffer, treated as an ASCII string.
2171 * This routine will ensure the values are within the range specified by
2172 * table->extra1 (min) and table->extra2 (max).
2174 * Returns 0 on success.
2176 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2177 void __user *buffer, size_t *lenp, loff_t *ppos)
2179 struct do_proc_dointvec_minmax_conv_param param = {
2180 .min = (int *) table->extra1,
2181 .max = (int *) table->extra2,
2183 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2184 do_proc_dointvec_minmax_conv, ¶m);
2187 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2189 void __user *buffer,
2190 size_t *lenp, loff_t *ppos,
2191 unsigned long convmul,
2192 unsigned long convdiv)
2194 #define TMPBUFLEN 21
2195 unsigned long *i, *min, *max, val;
2196 int vleft, first=1, neg;
2198 char buf[TMPBUFLEN], *p;
2199 char __user *s = buffer;
2201 if (!data || !table->maxlen || !*lenp ||
2202 (*ppos && !write)) {
2207 i = (unsigned long *) data;
2208 min = (unsigned long *) table->extra1;
2209 max = (unsigned long *) table->extra2;
2210 vleft = table->maxlen / sizeof(unsigned long);
2213 for (; left && vleft--; i++, min++, max++, first=0) {
2228 if (len > TMPBUFLEN-1)
2230 if (copy_from_user(buf, s, len))
2234 if (*p == '-' && left > 1) {
2238 if (*p < '0' || *p > '9')
2240 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
2242 if ((len < left) && *p && !isspace(*p))
2251 if ((min && val < *min) || (max && val > *max))
2258 sprintf(p, "%lu", convdiv * (*i) / convmul);
2262 if(copy_to_user(s, buf, len))
2269 if (!write && !first && left) {
2270 if(put_user('\n', s))
2277 if (get_user(c, s++))
2292 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2294 void __user *buffer,
2295 size_t *lenp, loff_t *ppos,
2296 unsigned long convmul,
2297 unsigned long convdiv)
2299 return __do_proc_doulongvec_minmax(table->data, table, write,
2300 filp, buffer, lenp, ppos, convmul, convdiv);
2304 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2305 * @table: the sysctl table
2306 * @write: %TRUE if this is a write to the sysctl file
2307 * @filp: the file structure
2308 * @buffer: the user buffer
2309 * @lenp: the size of the user buffer
2310 * @ppos: file position
2312 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2313 * values from/to the user buffer, treated as an ASCII string.
2315 * This routine will ensure the values are within the range specified by
2316 * table->extra1 (min) and table->extra2 (max).
2318 * Returns 0 on success.
2320 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2321 void __user *buffer, size_t *lenp, loff_t *ppos)
2323 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
2327 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2328 * @table: the sysctl table
2329 * @write: %TRUE if this is a write to the sysctl file
2330 * @filp: the file structure
2331 * @buffer: the user buffer
2332 * @lenp: the size of the user buffer
2333 * @ppos: file position
2335 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2336 * values from/to the user buffer, treated as an ASCII string. The values
2337 * are treated as milliseconds, and converted to jiffies when they are stored.
2339 * This routine will ensure the values are within the range specified by
2340 * table->extra1 (min) and table->extra2 (max).
2342 * Returns 0 on success.
2344 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2346 void __user *buffer,
2347 size_t *lenp, loff_t *ppos)
2349 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2350 lenp, ppos, HZ, 1000l);
2354 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2356 int write, void *data)
2359 if (*lvalp > LONG_MAX / HZ)
2361 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2367 lval = (unsigned long)-val;
2370 lval = (unsigned long)val;
2377 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2379 int write, void *data)
2382 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2384 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2390 lval = (unsigned long)-val;
2393 lval = (unsigned long)val;
2395 *lvalp = jiffies_to_clock_t(lval);
2400 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2402 int write, void *data)
2405 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2411 lval = (unsigned long)-val;
2414 lval = (unsigned long)val;
2416 *lvalp = jiffies_to_msecs(lval);
2422 * proc_dointvec_jiffies - read a vector of integers as seconds
2423 * @table: the sysctl table
2424 * @write: %TRUE if this is a write to the sysctl file
2425 * @filp: the file structure
2426 * @buffer: the user buffer
2427 * @lenp: the size of the user buffer
2428 * @ppos: file position
2430 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2431 * values from/to the user buffer, treated as an ASCII string.
2432 * The values read are assumed to be in seconds, and are converted into
2435 * Returns 0 on success.
2437 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2438 void __user *buffer, size_t *lenp, loff_t *ppos)
2440 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2441 do_proc_dointvec_jiffies_conv,NULL);
2445 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2446 * @table: the sysctl table
2447 * @write: %TRUE if this is a write to the sysctl file
2448 * @filp: the file structure
2449 * @buffer: the user buffer
2450 * @lenp: the size of the user buffer
2451 * @ppos: pointer to the file position
2453 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2454 * values from/to the user buffer, treated as an ASCII string.
2455 * The values read are assumed to be in 1/USER_HZ seconds, and
2456 * are converted into jiffies.
2458 * Returns 0 on success.
2460 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2461 void __user *buffer, size_t *lenp, loff_t *ppos)
2463 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2464 do_proc_dointvec_userhz_jiffies_conv,NULL);
2468 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2469 * @table: the sysctl table
2470 * @write: %TRUE if this is a write to the sysctl file
2471 * @filp: the file structure
2472 * @buffer: the user buffer
2473 * @lenp: the size of the user buffer
2474 * @ppos: file position
2475 * @ppos: the current position in the file
2477 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2478 * values from/to the user buffer, treated as an ASCII string.
2479 * The values read are assumed to be in 1/1000 seconds, and
2480 * are converted into jiffies.
2482 * Returns 0 on success.
2484 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2485 void __user *buffer, size_t *lenp, loff_t *ppos)
2487 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2488 do_proc_dointvec_ms_jiffies_conv, NULL);
2491 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2492 void __user *buffer, size_t *lenp, loff_t *ppos)
2494 struct pid *new_pid;
2498 tmp = pid_nr_ns(cad_pid, current->nsproxy->pid_ns);
2500 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2501 lenp, ppos, NULL, NULL);
2505 new_pid = find_get_pid(tmp);
2509 put_pid(xchg(&cad_pid, new_pid));
2513 #else /* CONFIG_PROC_FS */
2515 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2516 void __user *buffer, size_t *lenp, loff_t *ppos)
2521 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2522 void __user *buffer, size_t *lenp, loff_t *ppos)
2527 int proc_dointvec_bset(struct ctl_table *table, int write, struct file *filp,
2528 void __user *buffer, size_t *lenp, loff_t *ppos)
2533 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2534 void __user *buffer, size_t *lenp, loff_t *ppos)
2539 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2540 void __user *buffer, size_t *lenp, loff_t *ppos)
2545 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2546 void __user *buffer, size_t *lenp, loff_t *ppos)
2551 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2552 void __user *buffer, size_t *lenp, loff_t *ppos)
2557 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2558 void __user *buffer, size_t *lenp, loff_t *ppos)
2563 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2565 void __user *buffer,
2566 size_t *lenp, loff_t *ppos)
2572 #endif /* CONFIG_PROC_FS */
2575 #ifdef CONFIG_SYSCTL_SYSCALL
2577 * General sysctl support routines
2580 /* The generic sysctl data routine (used if no strategy routine supplied) */
2581 int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2582 void __user *oldval, size_t __user *oldlenp,
2583 void __user *newval, size_t newlen)
2587 /* Get out of I don't have a variable */
2588 if (!table->data || !table->maxlen)
2591 if (oldval && oldlenp) {
2592 if (get_user(len, oldlenp))
2595 if (len > table->maxlen)
2596 len = table->maxlen;
2597 if (copy_to_user(oldval, table->data, len))
2599 if (put_user(len, oldlenp))
2604 if (newval && newlen) {
2605 if (newlen > table->maxlen)
2606 newlen = table->maxlen;
2608 if (copy_from_user(table->data, newval, newlen))
2614 /* The generic string strategy routine: */
2615 int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2616 void __user *oldval, size_t __user *oldlenp,
2617 void __user *newval, size_t newlen)
2619 if (!table->data || !table->maxlen)
2622 if (oldval && oldlenp) {
2624 if (get_user(bufsize, oldlenp))
2627 size_t len = strlen(table->data), copied;
2629 /* This shouldn't trigger for a well-formed sysctl */
2630 if (len > table->maxlen)
2631 len = table->maxlen;
2633 /* Copy up to a max of bufsize-1 bytes of the string */
2634 copied = (len >= bufsize) ? bufsize - 1 : len;
2636 if (copy_to_user(oldval, table->data, copied) ||
2637 put_user(0, (char __user *)(oldval + copied)))
2639 if (put_user(len, oldlenp))
2643 if (newval && newlen) {
2644 size_t len = newlen;
2645 if (len > table->maxlen)
2646 len = table->maxlen;
2647 if(copy_from_user(table->data, newval, len))
2649 if (len == table->maxlen)
2651 ((char *) table->data)[len] = 0;
2657 * This function makes sure that all of the integers in the vector
2658 * are between the minimum and maximum values given in the arrays
2659 * table->extra1 and table->extra2, respectively.
2661 int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2662 void __user *oldval, size_t __user *oldlenp,
2663 void __user *newval, size_t newlen)
2666 if (newval && newlen) {
2667 int __user *vec = (int __user *) newval;
2668 int *min = (int *) table->extra1;
2669 int *max = (int *) table->extra2;
2673 if (newlen % sizeof(int) != 0)
2676 if (!table->extra1 && !table->extra2)
2679 if (newlen > table->maxlen)
2680 newlen = table->maxlen;
2681 length = newlen / sizeof(int);
2683 for (i = 0; i < length; i++) {
2685 if (get_user(value, vec + i))
2687 if (min && value < min[i])
2689 if (max && value > max[i])
2696 /* Strategy function to convert jiffies to seconds */
2697 int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2698 void __user *oldval, size_t __user *oldlenp,
2699 void __user *newval, size_t newlen)
2701 if (oldval && oldlenp) {
2704 if (get_user(olen, oldlenp))
2709 if (olen < sizeof(int))
2712 val = *(int *)(table->data) / HZ;
2713 if (put_user(val, (int __user *)oldval))
2715 if (put_user(sizeof(int), oldlenp))
2719 if (newval && newlen) {
2721 if (newlen != sizeof(int))
2723 if (get_user(new, (int __user *)newval))
2725 *(int *)(table->data) = new*HZ;
2730 /* Strategy function to convert jiffies to seconds */
2731 int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2732 void __user *oldval, size_t __user *oldlenp,
2733 void __user *newval, size_t newlen)
2735 if (oldval && oldlenp) {
2738 if (get_user(olen, oldlenp))
2743 if (olen < sizeof(int))
2746 val = jiffies_to_msecs(*(int *)(table->data));
2747 if (put_user(val, (int __user *)oldval))
2749 if (put_user(sizeof(int), oldlenp))
2753 if (newval && newlen) {
2755 if (newlen != sizeof(int))
2757 if (get_user(new, (int __user *)newval))
2759 *(int *)(table->data) = msecs_to_jiffies(new);
2766 #else /* CONFIG_SYSCTL_SYSCALL */
2769 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2771 struct __sysctl_args tmp;
2774 if (copy_from_user(&tmp, args, sizeof(tmp)))
2777 error = deprecated_sysctl_warning(&tmp);
2779 /* If no error reading the parameters then just -ENOSYS ... */
2786 int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2787 void __user *oldval, size_t __user *oldlenp,
2788 void __user *newval, size_t newlen)
2793 int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2794 void __user *oldval, size_t __user *oldlenp,
2795 void __user *newval, size_t newlen)
2800 int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2801 void __user *oldval, size_t __user *oldlenp,
2802 void __user *newval, size_t newlen)
2807 int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2808 void __user *oldval, size_t __user *oldlenp,
2809 void __user *newval, size_t newlen)
2814 int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2815 void __user *oldval, size_t __user *oldlenp,
2816 void __user *newval, size_t newlen)
2821 #endif /* CONFIG_SYSCTL_SYSCALL */
2823 static int deprecated_sysctl_warning(struct __sysctl_args *args)
2825 static int msg_count;
2826 int name[CTL_MAXNAME];
2829 /* Check args->nlen. */
2830 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
2833 /* Read in the sysctl name for better debug message logging */
2834 for (i = 0; i < args->nlen; i++)
2835 if (get_user(name[i], args->name + i))
2838 /* Ignore accesses to kernel.version */
2839 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
2842 if (msg_count < 5) {
2845 "warning: process `%s' used the deprecated sysctl "
2846 "system call with ", current->comm);
2847 for (i = 0; i < args->nlen; i++)
2848 printk("%d.", name[i]);
2855 * No sense putting this after each symbol definition, twice,
2856 * exception granted :-)
2858 EXPORT_SYMBOL(proc_dointvec);
2859 EXPORT_SYMBOL(proc_dointvec_jiffies);
2860 EXPORT_SYMBOL(proc_dointvec_minmax);
2861 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2862 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2863 EXPORT_SYMBOL(proc_dostring);
2864 EXPORT_SYMBOL(proc_doulongvec_minmax);
2865 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2866 EXPORT_SYMBOL(register_sysctl_table);
2867 EXPORT_SYMBOL(register_sysctl_paths);
2868 EXPORT_SYMBOL(sysctl_intvec);
2869 EXPORT_SYMBOL(sysctl_jiffies);
2870 EXPORT_SYMBOL(sysctl_ms_jiffies);
2871 EXPORT_SYMBOL(sysctl_string);
2872 EXPORT_SYMBOL(sysctl_data);
2873 EXPORT_SYMBOL(unregister_sysctl_table);