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/signal.h>
27 #include <linux/printk.h>
28 #include <linux/proc_fs.h>
29 #include <linux/security.h>
30 #include <linux/ctype.h>
31 #include <linux/kmemcheck.h>
33 #include <linux/init.h>
34 #include <linux/kernel.h>
35 #include <linux/kobject.h>
36 #include <linux/net.h>
37 #include <linux/sysrq.h>
38 #include <linux/highuid.h>
39 #include <linux/writeback.h>
40 #include <linux/ratelimit.h>
41 #include <linux/compaction.h>
42 #include <linux/hugetlb.h>
43 #include <linux/initrd.h>
44 #include <linux/key.h>
45 #include <linux/times.h>
46 #include <linux/limits.h>
47 #include <linux/dcache.h>
48 #include <linux/dnotify.h>
49 #include <linux/syscalls.h>
50 #include <linux/vmstat.h>
51 #include <linux/nfs_fs.h>
52 #include <linux/acpi.h>
53 #include <linux/reboot.h>
54 #include <linux/ftrace.h>
55 #include <linux/perf_event.h>
56 #include <linux/kprobes.h>
57 #include <linux/pipe_fs_i.h>
58 #include <linux/oom.h>
59 #include <linux/kmod.h>
60 #include <linux/capability.h>
62 #include <asm/uaccess.h>
63 #include <asm/processor.h>
67 #include <asm/stacktrace.h>
70 #ifdef CONFIG_BSD_PROCESS_ACCT
71 #include <linux/acct.h>
73 #ifdef CONFIG_RT_MUTEXES
74 #include <linux/rtmutex.h>
76 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
77 #include <linux/lockdep.h>
79 #ifdef CONFIG_CHR_DEV_SG
83 #ifdef CONFIG_LOCKUP_DETECTOR
84 #include <linux/nmi.h>
88 #if defined(CONFIG_SYSCTL)
90 /* External variables not in a header file. */
91 extern int sysctl_overcommit_memory;
92 extern int sysctl_overcommit_ratio;
93 extern int max_threads;
94 extern int core_uses_pid;
95 extern int suid_dumpable;
96 extern char core_pattern[];
97 extern unsigned int core_pipe_limit;
99 extern int min_free_kbytes;
100 extern int pid_max_min, pid_max_max;
101 extern int sysctl_drop_caches;
102 extern int percpu_pagelist_fraction;
103 extern int compat_log;
104 extern int latencytop_enabled;
105 extern int sysctl_nr_open_min, sysctl_nr_open_max;
107 extern int sysctl_nr_trim_pages;
110 extern int blk_iopoll_enabled;
113 /* Constants used for minimum and maximum */
114 #ifdef CONFIG_LOCKUP_DETECTOR
115 static int sixty = 60;
116 static int neg_one = -1;
120 static int __maybe_unused one = 1;
121 static int __maybe_unused two = 2;
122 static int __maybe_unused three = 3;
123 static unsigned long one_ul = 1;
124 static int one_hundred = 100;
126 static int ten_thousand = 10000;
129 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
130 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
132 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
133 static int maxolduid = 65535;
134 static int minolduid;
135 static int min_percpu_pagelist_fract = 8;
137 static int ngroups_max = NGROUPS_MAX;
138 static const int cap_last_cap = CAP_LAST_CAP;
140 #ifdef CONFIG_INOTIFY_USER
141 #include <linux/inotify.h>
144 #include <asm/system.h>
147 #ifdef CONFIG_SPARC64
148 extern int sysctl_tsb_ratio;
152 extern int pwrsw_enabled;
153 extern int unaligned_enabled;
157 #ifdef CONFIG_MATHEMU
158 extern int sysctl_ieee_emulation_warnings;
160 extern int sysctl_userprocess_debug;
161 extern int spin_retry;
165 extern int no_unaligned_warning;
166 extern int unaligned_dump_stack;
169 #ifdef CONFIG_PROC_SYSCTL
170 static int proc_do_cad_pid(struct ctl_table *table, int write,
171 void __user *buffer, size_t *lenp, loff_t *ppos);
172 static int proc_taint(struct ctl_table *table, int write,
173 void __user *buffer, size_t *lenp, loff_t *ppos);
177 static int proc_dmesg_restrict(struct ctl_table *table, int write,
178 void __user *buffer, size_t *lenp, loff_t *ppos);
181 #ifdef CONFIG_MAGIC_SYSRQ
182 /* Note: sysrq code uses it's own private copy */
183 static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
185 static int sysrq_sysctl_handler(ctl_table *table, int write,
186 void __user *buffer, size_t *lenp,
191 error = proc_dointvec(table, write, buffer, lenp, ppos);
196 sysrq_toggle_support(__sysrq_enabled);
203 static struct ctl_table root_table[];
204 static struct ctl_table_root sysctl_table_root;
205 static struct ctl_table_header root_table_header = {
207 .ctl_table = root_table,
208 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
209 .root = &sysctl_table_root,
210 .set = &sysctl_table_root.default_set,
212 static struct ctl_table_root sysctl_table_root = {
213 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
214 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
217 static struct ctl_table kern_table[];
218 static struct ctl_table vm_table[];
219 static struct ctl_table fs_table[];
220 static struct ctl_table debug_table[];
221 static struct ctl_table dev_table[];
222 extern struct ctl_table random_table[];
224 extern struct ctl_table epoll_table[];
227 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
228 int sysctl_legacy_va_layout;
231 /* The default sysctl tables: */
233 static struct ctl_table root_table[] = {
235 .procname = "kernel",
252 .child = debug_table,
262 #ifdef CONFIG_SCHED_DEBUG
263 static int min_sched_granularity_ns = 100000; /* 100 usecs */
264 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
265 static int min_wakeup_granularity_ns; /* 0 usecs */
266 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
267 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
268 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
271 #ifdef CONFIG_COMPACTION
272 static int min_extfrag_threshold;
273 static int max_extfrag_threshold = 1000;
276 static struct ctl_table kern_table[] = {
278 .procname = "sched_child_runs_first",
279 .data = &sysctl_sched_child_runs_first,
280 .maxlen = sizeof(unsigned int),
282 .proc_handler = proc_dointvec,
284 #ifdef CONFIG_SCHED_DEBUG
286 .procname = "sched_min_granularity_ns",
287 .data = &sysctl_sched_min_granularity,
288 .maxlen = sizeof(unsigned int),
290 .proc_handler = sched_proc_update_handler,
291 .extra1 = &min_sched_granularity_ns,
292 .extra2 = &max_sched_granularity_ns,
295 .procname = "sched_latency_ns",
296 .data = &sysctl_sched_latency,
297 .maxlen = sizeof(unsigned int),
299 .proc_handler = sched_proc_update_handler,
300 .extra1 = &min_sched_granularity_ns,
301 .extra2 = &max_sched_granularity_ns,
304 .procname = "sched_wakeup_granularity_ns",
305 .data = &sysctl_sched_wakeup_granularity,
306 .maxlen = sizeof(unsigned int),
308 .proc_handler = sched_proc_update_handler,
309 .extra1 = &min_wakeup_granularity_ns,
310 .extra2 = &max_wakeup_granularity_ns,
313 .procname = "sched_tunable_scaling",
314 .data = &sysctl_sched_tunable_scaling,
315 .maxlen = sizeof(enum sched_tunable_scaling),
317 .proc_handler = sched_proc_update_handler,
318 .extra1 = &min_sched_tunable_scaling,
319 .extra2 = &max_sched_tunable_scaling,
322 .procname = "sched_migration_cost",
323 .data = &sysctl_sched_migration_cost,
324 .maxlen = sizeof(unsigned int),
326 .proc_handler = proc_dointvec,
329 .procname = "sched_nr_migrate",
330 .data = &sysctl_sched_nr_migrate,
331 .maxlen = sizeof(unsigned int),
333 .proc_handler = proc_dointvec,
336 .procname = "sched_time_avg",
337 .data = &sysctl_sched_time_avg,
338 .maxlen = sizeof(unsigned int),
340 .proc_handler = proc_dointvec,
343 .procname = "sched_shares_window",
344 .data = &sysctl_sched_shares_window,
345 .maxlen = sizeof(unsigned int),
347 .proc_handler = proc_dointvec,
350 .procname = "timer_migration",
351 .data = &sysctl_timer_migration,
352 .maxlen = sizeof(unsigned int),
354 .proc_handler = proc_dointvec_minmax,
360 .procname = "sched_rt_period_us",
361 .data = &sysctl_sched_rt_period,
362 .maxlen = sizeof(unsigned int),
364 .proc_handler = sched_rt_handler,
367 .procname = "sched_rt_runtime_us",
368 .data = &sysctl_sched_rt_runtime,
369 .maxlen = sizeof(int),
371 .proc_handler = sched_rt_handler,
373 #ifdef CONFIG_SCHED_AUTOGROUP
375 .procname = "sched_autogroup_enabled",
376 .data = &sysctl_sched_autogroup_enabled,
377 .maxlen = sizeof(unsigned int),
379 .proc_handler = proc_dointvec_minmax,
384 #ifdef CONFIG_CFS_BANDWIDTH
386 .procname = "sched_cfs_bandwidth_slice_us",
387 .data = &sysctl_sched_cfs_bandwidth_slice,
388 .maxlen = sizeof(unsigned int),
390 .proc_handler = proc_dointvec_minmax,
394 #ifdef CONFIG_PROVE_LOCKING
396 .procname = "prove_locking",
397 .data = &prove_locking,
398 .maxlen = sizeof(int),
400 .proc_handler = proc_dointvec,
403 #ifdef CONFIG_LOCK_STAT
405 .procname = "lock_stat",
407 .maxlen = sizeof(int),
409 .proc_handler = proc_dointvec,
414 .data = &panic_timeout,
415 .maxlen = sizeof(int),
417 .proc_handler = proc_dointvec,
420 .procname = "core_uses_pid",
421 .data = &core_uses_pid,
422 .maxlen = sizeof(int),
424 .proc_handler = proc_dointvec,
427 .procname = "core_pattern",
428 .data = core_pattern,
429 .maxlen = CORENAME_MAX_SIZE,
431 .proc_handler = proc_dostring,
434 .procname = "core_pipe_limit",
435 .data = &core_pipe_limit,
436 .maxlen = sizeof(unsigned int),
438 .proc_handler = proc_dointvec,
440 #ifdef CONFIG_PROC_SYSCTL
442 .procname = "tainted",
443 .maxlen = sizeof(long),
445 .proc_handler = proc_taint,
448 #ifdef CONFIG_LATENCYTOP
450 .procname = "latencytop",
451 .data = &latencytop_enabled,
452 .maxlen = sizeof(int),
454 .proc_handler = proc_dointvec,
457 #ifdef CONFIG_BLK_DEV_INITRD
459 .procname = "real-root-dev",
460 .data = &real_root_dev,
461 .maxlen = sizeof(int),
463 .proc_handler = proc_dointvec,
467 .procname = "print-fatal-signals",
468 .data = &print_fatal_signals,
469 .maxlen = sizeof(int),
471 .proc_handler = proc_dointvec,
475 .procname = "reboot-cmd",
476 .data = reboot_command,
479 .proc_handler = proc_dostring,
482 .procname = "stop-a",
483 .data = &stop_a_enabled,
484 .maxlen = sizeof (int),
486 .proc_handler = proc_dointvec,
489 .procname = "scons-poweroff",
490 .data = &scons_pwroff,
491 .maxlen = sizeof (int),
493 .proc_handler = proc_dointvec,
496 #ifdef CONFIG_SPARC64
498 .procname = "tsb-ratio",
499 .data = &sysctl_tsb_ratio,
500 .maxlen = sizeof (int),
502 .proc_handler = proc_dointvec,
507 .procname = "soft-power",
508 .data = &pwrsw_enabled,
509 .maxlen = sizeof (int),
511 .proc_handler = proc_dointvec,
514 .procname = "unaligned-trap",
515 .data = &unaligned_enabled,
516 .maxlen = sizeof (int),
518 .proc_handler = proc_dointvec,
522 .procname = "ctrl-alt-del",
524 .maxlen = sizeof(int),
526 .proc_handler = proc_dointvec,
528 #ifdef CONFIG_FUNCTION_TRACER
530 .procname = "ftrace_enabled",
531 .data = &ftrace_enabled,
532 .maxlen = sizeof(int),
534 .proc_handler = ftrace_enable_sysctl,
537 #ifdef CONFIG_STACK_TRACER
539 .procname = "stack_tracer_enabled",
540 .data = &stack_tracer_enabled,
541 .maxlen = sizeof(int),
543 .proc_handler = stack_trace_sysctl,
546 #ifdef CONFIG_TRACING
548 .procname = "ftrace_dump_on_oops",
549 .data = &ftrace_dump_on_oops,
550 .maxlen = sizeof(int),
552 .proc_handler = proc_dointvec,
555 #ifdef CONFIG_MODULES
557 .procname = "modprobe",
558 .data = &modprobe_path,
559 .maxlen = KMOD_PATH_LEN,
561 .proc_handler = proc_dostring,
564 .procname = "modules_disabled",
565 .data = &modules_disabled,
566 .maxlen = sizeof(int),
568 /* only handle a transition from default "0" to "1" */
569 .proc_handler = proc_dointvec_minmax,
574 #ifdef CONFIG_HOTPLUG
576 .procname = "hotplug",
577 .data = &uevent_helper,
578 .maxlen = UEVENT_HELPER_PATH_LEN,
580 .proc_handler = proc_dostring,
583 #ifdef CONFIG_CHR_DEV_SG
585 .procname = "sg-big-buff",
586 .data = &sg_big_buff,
587 .maxlen = sizeof (int),
589 .proc_handler = proc_dointvec,
592 #ifdef CONFIG_BSD_PROCESS_ACCT
596 .maxlen = 3*sizeof(int),
598 .proc_handler = proc_dointvec,
601 #ifdef CONFIG_MAGIC_SYSRQ
604 .data = &__sysrq_enabled,
605 .maxlen = sizeof (int),
607 .proc_handler = sysrq_sysctl_handler,
610 #ifdef CONFIG_PROC_SYSCTL
612 .procname = "cad_pid",
614 .maxlen = sizeof (int),
616 .proc_handler = proc_do_cad_pid,
620 .procname = "threads-max",
621 .data = &max_threads,
622 .maxlen = sizeof(int),
624 .proc_handler = proc_dointvec,
627 .procname = "random",
629 .child = random_table,
632 .procname = "usermodehelper",
634 .child = usermodehelper_table,
637 .procname = "overflowuid",
638 .data = &overflowuid,
639 .maxlen = sizeof(int),
641 .proc_handler = proc_dointvec_minmax,
642 .extra1 = &minolduid,
643 .extra2 = &maxolduid,
646 .procname = "overflowgid",
647 .data = &overflowgid,
648 .maxlen = sizeof(int),
650 .proc_handler = proc_dointvec_minmax,
651 .extra1 = &minolduid,
652 .extra2 = &maxolduid,
655 #ifdef CONFIG_MATHEMU
657 .procname = "ieee_emulation_warnings",
658 .data = &sysctl_ieee_emulation_warnings,
659 .maxlen = sizeof(int),
661 .proc_handler = proc_dointvec,
665 .procname = "userprocess_debug",
666 .data = &show_unhandled_signals,
667 .maxlen = sizeof(int),
669 .proc_handler = proc_dointvec,
673 .procname = "pid_max",
675 .maxlen = sizeof (int),
677 .proc_handler = proc_dointvec_minmax,
678 .extra1 = &pid_max_min,
679 .extra2 = &pid_max_max,
682 .procname = "panic_on_oops",
683 .data = &panic_on_oops,
684 .maxlen = sizeof(int),
686 .proc_handler = proc_dointvec,
688 #if defined CONFIG_PRINTK
690 .procname = "printk",
691 .data = &console_loglevel,
692 .maxlen = 4*sizeof(int),
694 .proc_handler = proc_dointvec,
697 .procname = "printk_ratelimit",
698 .data = &printk_ratelimit_state.interval,
699 .maxlen = sizeof(int),
701 .proc_handler = proc_dointvec_jiffies,
704 .procname = "printk_ratelimit_burst",
705 .data = &printk_ratelimit_state.burst,
706 .maxlen = sizeof(int),
708 .proc_handler = proc_dointvec,
711 .procname = "printk_delay",
712 .data = &printk_delay_msec,
713 .maxlen = sizeof(int),
715 .proc_handler = proc_dointvec_minmax,
717 .extra2 = &ten_thousand,
720 .procname = "dmesg_restrict",
721 .data = &dmesg_restrict,
722 .maxlen = sizeof(int),
724 .proc_handler = proc_dointvec_minmax,
729 .procname = "kptr_restrict",
730 .data = &kptr_restrict,
731 .maxlen = sizeof(int),
733 .proc_handler = proc_dmesg_restrict,
739 .procname = "ngroups_max",
740 .data = &ngroups_max,
741 .maxlen = sizeof (int),
743 .proc_handler = proc_dointvec,
746 .procname = "cap_last_cap",
747 .data = (void *)&cap_last_cap,
748 .maxlen = sizeof(int),
750 .proc_handler = proc_dointvec,
752 #if defined(CONFIG_LOCKUP_DETECTOR)
754 .procname = "watchdog",
755 .data = &watchdog_enabled,
756 .maxlen = sizeof (int),
758 .proc_handler = proc_dowatchdog,
763 .procname = "watchdog_thresh",
764 .data = &watchdog_thresh,
765 .maxlen = sizeof(int),
767 .proc_handler = proc_dowatchdog,
772 .procname = "softlockup_panic",
773 .data = &softlockup_panic,
774 .maxlen = sizeof(int),
776 .proc_handler = proc_dointvec_minmax,
781 .procname = "nmi_watchdog",
782 .data = &watchdog_enabled,
783 .maxlen = sizeof (int),
785 .proc_handler = proc_dowatchdog,
790 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
792 .procname = "unknown_nmi_panic",
793 .data = &unknown_nmi_panic,
794 .maxlen = sizeof (int),
796 .proc_handler = proc_dointvec,
799 #if defined(CONFIG_X86)
801 .procname = "panic_on_unrecovered_nmi",
802 .data = &panic_on_unrecovered_nmi,
803 .maxlen = sizeof(int),
805 .proc_handler = proc_dointvec,
808 .procname = "panic_on_io_nmi",
809 .data = &panic_on_io_nmi,
810 .maxlen = sizeof(int),
812 .proc_handler = proc_dointvec,
815 .procname = "bootloader_type",
816 .data = &bootloader_type,
817 .maxlen = sizeof (int),
819 .proc_handler = proc_dointvec,
822 .procname = "bootloader_version",
823 .data = &bootloader_version,
824 .maxlen = sizeof (int),
826 .proc_handler = proc_dointvec,
829 .procname = "kstack_depth_to_print",
830 .data = &kstack_depth_to_print,
831 .maxlen = sizeof(int),
833 .proc_handler = proc_dointvec,
836 .procname = "io_delay_type",
837 .data = &io_delay_type,
838 .maxlen = sizeof(int),
840 .proc_handler = proc_dointvec,
843 #if defined(CONFIG_MMU)
845 .procname = "randomize_va_space",
846 .data = &randomize_va_space,
847 .maxlen = sizeof(int),
849 .proc_handler = proc_dointvec,
852 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
854 .procname = "spin_retry",
856 .maxlen = sizeof (int),
858 .proc_handler = proc_dointvec,
861 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
863 .procname = "acpi_video_flags",
864 .data = &acpi_realmode_flags,
865 .maxlen = sizeof (unsigned long),
867 .proc_handler = proc_doulongvec_minmax,
872 .procname = "ignore-unaligned-usertrap",
873 .data = &no_unaligned_warning,
874 .maxlen = sizeof (int),
876 .proc_handler = proc_dointvec,
879 .procname = "unaligned-dump-stack",
880 .data = &unaligned_dump_stack,
881 .maxlen = sizeof (int),
883 .proc_handler = proc_dointvec,
886 #ifdef CONFIG_DETECT_HUNG_TASK
888 .procname = "hung_task_panic",
889 .data = &sysctl_hung_task_panic,
890 .maxlen = sizeof(int),
892 .proc_handler = proc_dointvec_minmax,
897 .procname = "hung_task_check_count",
898 .data = &sysctl_hung_task_check_count,
899 .maxlen = sizeof(unsigned long),
901 .proc_handler = proc_doulongvec_minmax,
904 .procname = "hung_task_timeout_secs",
905 .data = &sysctl_hung_task_timeout_secs,
906 .maxlen = sizeof(unsigned long),
908 .proc_handler = proc_dohung_task_timeout_secs,
911 .procname = "hung_task_warnings",
912 .data = &sysctl_hung_task_warnings,
913 .maxlen = sizeof(unsigned long),
915 .proc_handler = proc_doulongvec_minmax,
920 .procname = "compat-log",
922 .maxlen = sizeof (int),
924 .proc_handler = proc_dointvec,
927 #ifdef CONFIG_RT_MUTEXES
929 .procname = "max_lock_depth",
930 .data = &max_lock_depth,
931 .maxlen = sizeof(int),
933 .proc_handler = proc_dointvec,
937 .procname = "poweroff_cmd",
938 .data = &poweroff_cmd,
939 .maxlen = POWEROFF_CMD_PATH_LEN,
941 .proc_handler = proc_dostring,
947 .child = key_sysctls,
950 #ifdef CONFIG_RCU_TORTURE_TEST
952 .procname = "rcutorture_runnable",
953 .data = &rcutorture_runnable,
954 .maxlen = sizeof(int),
956 .proc_handler = proc_dointvec,
959 #ifdef CONFIG_PERF_EVENTS
961 * User-space scripts rely on the existence of this file
962 * as a feature check for perf_events being enabled.
964 * So it's an ABI, do not remove!
967 .procname = "perf_event_paranoid",
968 .data = &sysctl_perf_event_paranoid,
969 .maxlen = sizeof(sysctl_perf_event_paranoid),
971 .proc_handler = proc_dointvec,
974 .procname = "perf_event_mlock_kb",
975 .data = &sysctl_perf_event_mlock,
976 .maxlen = sizeof(sysctl_perf_event_mlock),
978 .proc_handler = proc_dointvec,
981 .procname = "perf_event_max_sample_rate",
982 .data = &sysctl_perf_event_sample_rate,
983 .maxlen = sizeof(sysctl_perf_event_sample_rate),
985 .proc_handler = perf_proc_update_handler,
988 #ifdef CONFIG_KMEMCHECK
990 .procname = "kmemcheck",
991 .data = &kmemcheck_enabled,
992 .maxlen = sizeof(int),
994 .proc_handler = proc_dointvec,
999 .procname = "blk_iopoll",
1000 .data = &blk_iopoll_enabled,
1001 .maxlen = sizeof(int),
1003 .proc_handler = proc_dointvec,
1009 static struct ctl_table vm_table[] = {
1011 .procname = "overcommit_memory",
1012 .data = &sysctl_overcommit_memory,
1013 .maxlen = sizeof(sysctl_overcommit_memory),
1015 .proc_handler = proc_dointvec_minmax,
1020 .procname = "panic_on_oom",
1021 .data = &sysctl_panic_on_oom,
1022 .maxlen = sizeof(sysctl_panic_on_oom),
1024 .proc_handler = proc_dointvec_minmax,
1029 .procname = "oom_kill_allocating_task",
1030 .data = &sysctl_oom_kill_allocating_task,
1031 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1033 .proc_handler = proc_dointvec,
1036 .procname = "oom_dump_tasks",
1037 .data = &sysctl_oom_dump_tasks,
1038 .maxlen = sizeof(sysctl_oom_dump_tasks),
1040 .proc_handler = proc_dointvec,
1043 .procname = "overcommit_ratio",
1044 .data = &sysctl_overcommit_ratio,
1045 .maxlen = sizeof(sysctl_overcommit_ratio),
1047 .proc_handler = proc_dointvec,
1050 .procname = "page-cluster",
1051 .data = &page_cluster,
1052 .maxlen = sizeof(int),
1054 .proc_handler = proc_dointvec_minmax,
1058 .procname = "dirty_background_ratio",
1059 .data = &dirty_background_ratio,
1060 .maxlen = sizeof(dirty_background_ratio),
1062 .proc_handler = dirty_background_ratio_handler,
1064 .extra2 = &one_hundred,
1067 .procname = "dirty_background_bytes",
1068 .data = &dirty_background_bytes,
1069 .maxlen = sizeof(dirty_background_bytes),
1071 .proc_handler = dirty_background_bytes_handler,
1075 .procname = "dirty_ratio",
1076 .data = &vm_dirty_ratio,
1077 .maxlen = sizeof(vm_dirty_ratio),
1079 .proc_handler = dirty_ratio_handler,
1081 .extra2 = &one_hundred,
1084 .procname = "dirty_bytes",
1085 .data = &vm_dirty_bytes,
1086 .maxlen = sizeof(vm_dirty_bytes),
1088 .proc_handler = dirty_bytes_handler,
1089 .extra1 = &dirty_bytes_min,
1092 .procname = "dirty_writeback_centisecs",
1093 .data = &dirty_writeback_interval,
1094 .maxlen = sizeof(dirty_writeback_interval),
1096 .proc_handler = dirty_writeback_centisecs_handler,
1099 .procname = "dirty_expire_centisecs",
1100 .data = &dirty_expire_interval,
1101 .maxlen = sizeof(dirty_expire_interval),
1103 .proc_handler = proc_dointvec_minmax,
1107 .procname = "nr_pdflush_threads",
1108 .data = &nr_pdflush_threads,
1109 .maxlen = sizeof nr_pdflush_threads,
1110 .mode = 0444 /* read-only*/,
1111 .proc_handler = proc_dointvec,
1114 .procname = "swappiness",
1115 .data = &vm_swappiness,
1116 .maxlen = sizeof(vm_swappiness),
1118 .proc_handler = proc_dointvec_minmax,
1120 .extra2 = &one_hundred,
1122 #ifdef CONFIG_HUGETLB_PAGE
1124 .procname = "nr_hugepages",
1126 .maxlen = sizeof(unsigned long),
1128 .proc_handler = hugetlb_sysctl_handler,
1129 .extra1 = (void *)&hugetlb_zero,
1130 .extra2 = (void *)&hugetlb_infinity,
1134 .procname = "nr_hugepages_mempolicy",
1136 .maxlen = sizeof(unsigned long),
1138 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1139 .extra1 = (void *)&hugetlb_zero,
1140 .extra2 = (void *)&hugetlb_infinity,
1144 .procname = "hugetlb_shm_group",
1145 .data = &sysctl_hugetlb_shm_group,
1146 .maxlen = sizeof(gid_t),
1148 .proc_handler = proc_dointvec,
1151 .procname = "hugepages_treat_as_movable",
1152 .data = &hugepages_treat_as_movable,
1153 .maxlen = sizeof(int),
1155 .proc_handler = hugetlb_treat_movable_handler,
1158 .procname = "nr_overcommit_hugepages",
1160 .maxlen = sizeof(unsigned long),
1162 .proc_handler = hugetlb_overcommit_handler,
1163 .extra1 = (void *)&hugetlb_zero,
1164 .extra2 = (void *)&hugetlb_infinity,
1168 .procname = "lowmem_reserve_ratio",
1169 .data = &sysctl_lowmem_reserve_ratio,
1170 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1172 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1175 .procname = "drop_caches",
1176 .data = &sysctl_drop_caches,
1177 .maxlen = sizeof(int),
1179 .proc_handler = drop_caches_sysctl_handler,
1183 #ifdef CONFIG_COMPACTION
1185 .procname = "compact_memory",
1186 .data = &sysctl_compact_memory,
1187 .maxlen = sizeof(int),
1189 .proc_handler = sysctl_compaction_handler,
1192 .procname = "extfrag_threshold",
1193 .data = &sysctl_extfrag_threshold,
1194 .maxlen = sizeof(int),
1196 .proc_handler = sysctl_extfrag_handler,
1197 .extra1 = &min_extfrag_threshold,
1198 .extra2 = &max_extfrag_threshold,
1201 #endif /* CONFIG_COMPACTION */
1203 .procname = "min_free_kbytes",
1204 .data = &min_free_kbytes,
1205 .maxlen = sizeof(min_free_kbytes),
1207 .proc_handler = min_free_kbytes_sysctl_handler,
1211 .procname = "percpu_pagelist_fraction",
1212 .data = &percpu_pagelist_fraction,
1213 .maxlen = sizeof(percpu_pagelist_fraction),
1215 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1216 .extra1 = &min_percpu_pagelist_fract,
1220 .procname = "max_map_count",
1221 .data = &sysctl_max_map_count,
1222 .maxlen = sizeof(sysctl_max_map_count),
1224 .proc_handler = proc_dointvec_minmax,
1229 .procname = "nr_trim_pages",
1230 .data = &sysctl_nr_trim_pages,
1231 .maxlen = sizeof(sysctl_nr_trim_pages),
1233 .proc_handler = proc_dointvec_minmax,
1238 .procname = "laptop_mode",
1239 .data = &laptop_mode,
1240 .maxlen = sizeof(laptop_mode),
1242 .proc_handler = proc_dointvec_jiffies,
1245 .procname = "block_dump",
1246 .data = &block_dump,
1247 .maxlen = sizeof(block_dump),
1249 .proc_handler = proc_dointvec,
1253 .procname = "vfs_cache_pressure",
1254 .data = &sysctl_vfs_cache_pressure,
1255 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1257 .proc_handler = proc_dointvec,
1260 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1262 .procname = "legacy_va_layout",
1263 .data = &sysctl_legacy_va_layout,
1264 .maxlen = sizeof(sysctl_legacy_va_layout),
1266 .proc_handler = proc_dointvec,
1272 .procname = "zone_reclaim_mode",
1273 .data = &zone_reclaim_mode,
1274 .maxlen = sizeof(zone_reclaim_mode),
1276 .proc_handler = proc_dointvec,
1280 .procname = "min_unmapped_ratio",
1281 .data = &sysctl_min_unmapped_ratio,
1282 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1284 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1286 .extra2 = &one_hundred,
1289 .procname = "min_slab_ratio",
1290 .data = &sysctl_min_slab_ratio,
1291 .maxlen = sizeof(sysctl_min_slab_ratio),
1293 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1295 .extra2 = &one_hundred,
1300 .procname = "stat_interval",
1301 .data = &sysctl_stat_interval,
1302 .maxlen = sizeof(sysctl_stat_interval),
1304 .proc_handler = proc_dointvec_jiffies,
1309 .procname = "mmap_min_addr",
1310 .data = &dac_mmap_min_addr,
1311 .maxlen = sizeof(unsigned long),
1313 .proc_handler = mmap_min_addr_handler,
1318 .procname = "numa_zonelist_order",
1319 .data = &numa_zonelist_order,
1320 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1322 .proc_handler = numa_zonelist_order_handler,
1325 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1326 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1328 .procname = "vdso_enabled",
1329 .data = &vdso_enabled,
1330 .maxlen = sizeof(vdso_enabled),
1332 .proc_handler = proc_dointvec,
1336 #ifdef CONFIG_HIGHMEM
1338 .procname = "highmem_is_dirtyable",
1339 .data = &vm_highmem_is_dirtyable,
1340 .maxlen = sizeof(vm_highmem_is_dirtyable),
1342 .proc_handler = proc_dointvec_minmax,
1348 .procname = "scan_unevictable_pages",
1349 .data = &scan_unevictable_pages,
1350 .maxlen = sizeof(scan_unevictable_pages),
1352 .proc_handler = scan_unevictable_handler,
1354 #ifdef CONFIG_MEMORY_FAILURE
1356 .procname = "memory_failure_early_kill",
1357 .data = &sysctl_memory_failure_early_kill,
1358 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1360 .proc_handler = proc_dointvec_minmax,
1365 .procname = "memory_failure_recovery",
1366 .data = &sysctl_memory_failure_recovery,
1367 .maxlen = sizeof(sysctl_memory_failure_recovery),
1369 .proc_handler = proc_dointvec_minmax,
1377 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1378 static struct ctl_table binfmt_misc_table[] = {
1383 static struct ctl_table fs_table[] = {
1385 .procname = "inode-nr",
1386 .data = &inodes_stat,
1387 .maxlen = 2*sizeof(int),
1389 .proc_handler = proc_nr_inodes,
1392 .procname = "inode-state",
1393 .data = &inodes_stat,
1394 .maxlen = 7*sizeof(int),
1396 .proc_handler = proc_nr_inodes,
1399 .procname = "file-nr",
1400 .data = &files_stat,
1401 .maxlen = sizeof(files_stat),
1403 .proc_handler = proc_nr_files,
1406 .procname = "file-max",
1407 .data = &files_stat.max_files,
1408 .maxlen = sizeof(files_stat.max_files),
1410 .proc_handler = proc_doulongvec_minmax,
1413 .procname = "nr_open",
1414 .data = &sysctl_nr_open,
1415 .maxlen = sizeof(int),
1417 .proc_handler = proc_dointvec_minmax,
1418 .extra1 = &sysctl_nr_open_min,
1419 .extra2 = &sysctl_nr_open_max,
1422 .procname = "dentry-state",
1423 .data = &dentry_stat,
1424 .maxlen = 6*sizeof(int),
1426 .proc_handler = proc_nr_dentry,
1429 .procname = "overflowuid",
1430 .data = &fs_overflowuid,
1431 .maxlen = sizeof(int),
1433 .proc_handler = proc_dointvec_minmax,
1434 .extra1 = &minolduid,
1435 .extra2 = &maxolduid,
1438 .procname = "overflowgid",
1439 .data = &fs_overflowgid,
1440 .maxlen = sizeof(int),
1442 .proc_handler = proc_dointvec_minmax,
1443 .extra1 = &minolduid,
1444 .extra2 = &maxolduid,
1446 #ifdef CONFIG_FILE_LOCKING
1448 .procname = "leases-enable",
1449 .data = &leases_enable,
1450 .maxlen = sizeof(int),
1452 .proc_handler = proc_dointvec,
1455 #ifdef CONFIG_DNOTIFY
1457 .procname = "dir-notify-enable",
1458 .data = &dir_notify_enable,
1459 .maxlen = sizeof(int),
1461 .proc_handler = proc_dointvec,
1465 #ifdef CONFIG_FILE_LOCKING
1467 .procname = "lease-break-time",
1468 .data = &lease_break_time,
1469 .maxlen = sizeof(int),
1471 .proc_handler = proc_dointvec,
1476 .procname = "aio-nr",
1478 .maxlen = sizeof(aio_nr),
1480 .proc_handler = proc_doulongvec_minmax,
1483 .procname = "aio-max-nr",
1484 .data = &aio_max_nr,
1485 .maxlen = sizeof(aio_max_nr),
1487 .proc_handler = proc_doulongvec_minmax,
1489 #endif /* CONFIG_AIO */
1490 #ifdef CONFIG_INOTIFY_USER
1492 .procname = "inotify",
1494 .child = inotify_table,
1499 .procname = "epoll",
1501 .child = epoll_table,
1506 .procname = "suid_dumpable",
1507 .data = &suid_dumpable,
1508 .maxlen = sizeof(int),
1510 .proc_handler = proc_dointvec_minmax,
1514 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1516 .procname = "binfmt_misc",
1518 .child = binfmt_misc_table,
1522 .procname = "pipe-max-size",
1523 .data = &pipe_max_size,
1524 .maxlen = sizeof(int),
1526 .proc_handler = &pipe_proc_fn,
1527 .extra1 = &pipe_min_size,
1532 static struct ctl_table debug_table[] = {
1533 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
1534 defined(CONFIG_S390) || defined(CONFIG_TILE)
1536 .procname = "exception-trace",
1537 .data = &show_unhandled_signals,
1538 .maxlen = sizeof(int),
1540 .proc_handler = proc_dointvec
1543 #if defined(CONFIG_OPTPROBES)
1545 .procname = "kprobes-optimization",
1546 .data = &sysctl_kprobes_optimization,
1547 .maxlen = sizeof(int),
1549 .proc_handler = proc_kprobes_optimization_handler,
1557 static struct ctl_table dev_table[] = {
1561 static DEFINE_SPINLOCK(sysctl_lock);
1563 /* called under sysctl_lock */
1564 static int use_table(struct ctl_table_header *p)
1566 if (unlikely(p->unregistering))
1572 /* called under sysctl_lock */
1573 static void unuse_table(struct ctl_table_header *p)
1576 if (unlikely(p->unregistering))
1577 complete(p->unregistering);
1580 /* called under sysctl_lock, will reacquire if has to wait */
1581 static void start_unregistering(struct ctl_table_header *p)
1584 * if p->used is 0, nobody will ever touch that entry again;
1585 * we'll eliminate all paths to it before dropping sysctl_lock
1587 if (unlikely(p->used)) {
1588 struct completion wait;
1589 init_completion(&wait);
1590 p->unregistering = &wait;
1591 spin_unlock(&sysctl_lock);
1592 wait_for_completion(&wait);
1593 spin_lock(&sysctl_lock);
1595 /* anything non-NULL; we'll never dereference it */
1596 p->unregistering = ERR_PTR(-EINVAL);
1599 * do not remove from the list until nobody holds it; walking the
1600 * list in do_sysctl() relies on that.
1602 list_del_init(&p->ctl_entry);
1605 void sysctl_head_get(struct ctl_table_header *head)
1607 spin_lock(&sysctl_lock);
1609 spin_unlock(&sysctl_lock);
1612 void sysctl_head_put(struct ctl_table_header *head)
1614 spin_lock(&sysctl_lock);
1616 kfree_rcu(head, rcu);
1617 spin_unlock(&sysctl_lock);
1620 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1624 spin_lock(&sysctl_lock);
1625 if (!use_table(head))
1626 head = ERR_PTR(-ENOENT);
1627 spin_unlock(&sysctl_lock);
1631 void sysctl_head_finish(struct ctl_table_header *head)
1635 spin_lock(&sysctl_lock);
1637 spin_unlock(&sysctl_lock);
1640 static struct ctl_table_set *
1641 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1643 struct ctl_table_set *set = &root->default_set;
1645 set = root->lookup(root, namespaces);
1649 static struct list_head *
1650 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1652 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1656 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1657 struct ctl_table_header *prev)
1659 struct ctl_table_root *root;
1660 struct list_head *header_list;
1661 struct ctl_table_header *head;
1662 struct list_head *tmp;
1664 spin_lock(&sysctl_lock);
1667 tmp = &prev->ctl_entry;
1671 tmp = &root_table_header.ctl_entry;
1673 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1675 if (!use_table(head))
1677 spin_unlock(&sysctl_lock);
1682 header_list = lookup_header_list(root, namespaces);
1683 if (tmp != header_list)
1687 root = list_entry(root->root_list.next,
1688 struct ctl_table_root, root_list);
1689 if (root == &sysctl_table_root)
1691 header_list = lookup_header_list(root, namespaces);
1692 } while (list_empty(header_list));
1693 tmp = header_list->next;
1696 spin_unlock(&sysctl_lock);
1700 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1702 return __sysctl_head_next(current->nsproxy, prev);
1705 void register_sysctl_root(struct ctl_table_root *root)
1707 spin_lock(&sysctl_lock);
1708 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1709 spin_unlock(&sysctl_lock);
1713 * sysctl_perm does NOT grant the superuser all rights automatically, because
1714 * some sysctl variables are readonly even to root.
1717 static int test_perm(int mode, int op)
1719 if (!current_euid())
1721 else if (in_egroup_p(0))
1723 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1728 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1732 if (root->permissions)
1733 mode = root->permissions(root, current->nsproxy, table);
1737 return test_perm(mode, op);
1740 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1742 for (; table->procname; table++) {
1743 table->parent = parent;
1745 sysctl_set_parent(table, table->child);
1749 static __init int sysctl_init(void)
1751 sysctl_set_parent(NULL, root_table);
1752 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1753 sysctl_check_table(current->nsproxy, root_table);
1758 core_initcall(sysctl_init);
1760 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1761 struct ctl_table *table)
1763 struct ctl_table *p;
1764 const char *s = branch->procname;
1766 /* branch should have named subdirectory as its first element */
1767 if (!s || !branch->child)
1770 /* ... and nothing else */
1771 if (branch[1].procname)
1774 /* table should contain subdirectory with the same name */
1775 for (p = table; p->procname; p++) {
1778 if (p->procname && strcmp(p->procname, s) == 0)
1784 /* see if attaching q to p would be an improvement */
1785 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1787 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1788 struct ctl_table *next;
1790 int not_in_parent = !p->attached_by;
1792 while ((next = is_branch_in(by, to)) != NULL) {
1793 if (by == q->attached_by)
1795 if (to == p->attached_by)
1801 if (is_better && not_in_parent) {
1802 q->attached_by = by;
1803 q->attached_to = to;
1809 * __register_sysctl_paths - register a sysctl hierarchy
1810 * @root: List of sysctl headers to register on
1811 * @namespaces: Data to compute which lists of sysctl entries are visible
1812 * @path: The path to the directory the sysctl table is in.
1813 * @table: the top-level table structure
1815 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1816 * array. A completely 0 filled entry terminates the table.
1818 * The members of the &struct ctl_table structure are used as follows:
1820 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1821 * enter a sysctl file
1823 * data - a pointer to data for use by proc_handler
1825 * maxlen - the maximum size in bytes of the data
1827 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1829 * child - a pointer to the child sysctl table if this entry is a directory, or
1832 * proc_handler - the text handler routine (described below)
1834 * de - for internal use by the sysctl routines
1836 * extra1, extra2 - extra pointers usable by the proc handler routines
1838 * Leaf nodes in the sysctl tree will be represented by a single file
1839 * under /proc; non-leaf nodes will be represented by directories.
1841 * sysctl(2) can automatically manage read and write requests through
1842 * the sysctl table. The data and maxlen fields of the ctl_table
1843 * struct enable minimal validation of the values being written to be
1844 * performed, and the mode field allows minimal authentication.
1846 * There must be a proc_handler routine for any terminal nodes
1847 * mirrored under /proc/sys (non-terminals are handled by a built-in
1848 * directory handler). Several default handlers are available to
1849 * cover common cases -
1851 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1852 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1853 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1855 * It is the handler's job to read the input buffer from user memory
1856 * and process it. The handler should return 0 on success.
1858 * This routine returns %NULL on a failure to register, and a pointer
1859 * to the table header on success.
1861 struct ctl_table_header *__register_sysctl_paths(
1862 struct ctl_table_root *root,
1863 struct nsproxy *namespaces,
1864 const struct ctl_path *path, struct ctl_table *table)
1866 struct ctl_table_header *header;
1867 struct ctl_table *new, **prevp;
1868 unsigned int n, npath;
1869 struct ctl_table_set *set;
1871 /* Count the path components */
1872 for (npath = 0; path[npath].procname; ++npath)
1876 * For each path component, allocate a 2-element ctl_table array.
1877 * The first array element will be filled with the sysctl entry
1878 * for this, the second will be the sentinel (procname == 0).
1880 * We allocate everything in one go so that we don't have to
1881 * worry about freeing additional memory in unregister_sysctl_table.
1883 header = kzalloc(sizeof(struct ctl_table_header) +
1884 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1888 new = (struct ctl_table *) (header + 1);
1890 /* Now connect the dots */
1891 prevp = &header->ctl_table;
1892 for (n = 0; n < npath; ++n, ++path) {
1893 /* Copy the procname */
1894 new->procname = path->procname;
1898 prevp = &new->child;
1903 header->ctl_table_arg = table;
1905 INIT_LIST_HEAD(&header->ctl_entry);
1907 header->unregistering = NULL;
1908 header->root = root;
1909 sysctl_set_parent(NULL, header->ctl_table);
1911 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1912 if (sysctl_check_table(namespaces, header->ctl_table)) {
1917 spin_lock(&sysctl_lock);
1918 header->set = lookup_header_set(root, namespaces);
1919 header->attached_by = header->ctl_table;
1920 header->attached_to = root_table;
1921 header->parent = &root_table_header;
1922 for (set = header->set; set; set = set->parent) {
1923 struct ctl_table_header *p;
1924 list_for_each_entry(p, &set->list, ctl_entry) {
1925 if (p->unregistering)
1927 try_attach(p, header);
1930 header->parent->count++;
1931 list_add_tail(&header->ctl_entry, &header->set->list);
1932 spin_unlock(&sysctl_lock);
1938 * register_sysctl_table_path - register a sysctl table hierarchy
1939 * @path: The path to the directory the sysctl table is in.
1940 * @table: the top-level table structure
1942 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1943 * array. A completely 0 filled entry terminates the table.
1945 * See __register_sysctl_paths for more details.
1947 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1948 struct ctl_table *table)
1950 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1955 * register_sysctl_table - register a sysctl table hierarchy
1956 * @table: the top-level table structure
1958 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1959 * array. A completely 0 filled entry terminates the table.
1961 * See register_sysctl_paths for more details.
1963 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1965 static const struct ctl_path null_path[] = { {} };
1967 return register_sysctl_paths(null_path, table);
1971 * unregister_sysctl_table - unregister a sysctl table hierarchy
1972 * @header: the header returned from register_sysctl_table
1974 * Unregisters the sysctl table and all children. proc entries may not
1975 * actually be removed until they are no longer used by anyone.
1977 void unregister_sysctl_table(struct ctl_table_header * header)
1984 spin_lock(&sysctl_lock);
1985 start_unregistering(header);
1986 if (!--header->parent->count) {
1988 kfree_rcu(header->parent, rcu);
1990 if (!--header->count)
1991 kfree_rcu(header, rcu);
1992 spin_unlock(&sysctl_lock);
1995 int sysctl_is_seen(struct ctl_table_header *p)
1997 struct ctl_table_set *set = p->set;
1999 spin_lock(&sysctl_lock);
2000 if (p->unregistering)
2002 else if (!set->is_seen)
2005 res = set->is_seen(set);
2006 spin_unlock(&sysctl_lock);
2010 void setup_sysctl_set(struct ctl_table_set *p,
2011 struct ctl_table_set *parent,
2012 int (*is_seen)(struct ctl_table_set *))
2014 INIT_LIST_HEAD(&p->list);
2015 p->parent = parent ? parent : &sysctl_table_root.default_set;
2016 p->is_seen = is_seen;
2019 #else /* !CONFIG_SYSCTL */
2020 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2025 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2026 struct ctl_table *table)
2031 void unregister_sysctl_table(struct ctl_table_header * table)
2035 void setup_sysctl_set(struct ctl_table_set *p,
2036 struct ctl_table_set *parent,
2037 int (*is_seen)(struct ctl_table_set *))
2041 void sysctl_head_put(struct ctl_table_header *head)
2045 #endif /* CONFIG_SYSCTL */
2051 #ifdef CONFIG_PROC_SYSCTL
2053 static int _proc_do_string(void* data, int maxlen, int write,
2054 void __user *buffer,
2055 size_t *lenp, loff_t *ppos)
2061 if (!data || !maxlen || !*lenp) {
2069 while (len < *lenp) {
2070 if (get_user(c, p++))
2072 if (c == 0 || c == '\n')
2078 if(copy_from_user(data, buffer, len))
2080 ((char *) data)[len] = 0;
2098 if(copy_to_user(buffer, data, len))
2101 if(put_user('\n', ((char __user *) buffer) + len))
2112 * proc_dostring - read a string sysctl
2113 * @table: the sysctl table
2114 * @write: %TRUE if this is a write to the sysctl file
2115 * @buffer: the user buffer
2116 * @lenp: the size of the user buffer
2117 * @ppos: file position
2119 * Reads/writes a string from/to the user buffer. If the kernel
2120 * buffer provided is not large enough to hold the string, the
2121 * string is truncated. The copied string is %NULL-terminated.
2122 * If the string is being read by the user process, it is copied
2123 * and a newline '\n' is added. It is truncated if the buffer is
2126 * Returns 0 on success.
2128 int proc_dostring(struct ctl_table *table, int write,
2129 void __user *buffer, size_t *lenp, loff_t *ppos)
2131 return _proc_do_string(table->data, table->maxlen, write,
2132 buffer, lenp, ppos);
2135 static size_t proc_skip_spaces(char **buf)
2138 char *tmp = skip_spaces(*buf);
2144 static void proc_skip_char(char **buf, size_t *size, const char v)
2154 #define TMPBUFLEN 22
2156 * proc_get_long - reads an ASCII formatted integer from a user buffer
2158 * @buf: a kernel buffer
2159 * @size: size of the kernel buffer
2160 * @val: this is where the number will be stored
2161 * @neg: set to %TRUE if number is negative
2162 * @perm_tr: a vector which contains the allowed trailers
2163 * @perm_tr_len: size of the perm_tr vector
2164 * @tr: pointer to store the trailer character
2166 * In case of success %0 is returned and @buf and @size are updated with
2167 * the amount of bytes read. If @tr is non-NULL and a trailing
2168 * character exists (size is non-zero after returning from this
2169 * function), @tr is updated with the trailing character.
2171 static int proc_get_long(char **buf, size_t *size,
2172 unsigned long *val, bool *neg,
2173 const char *perm_tr, unsigned perm_tr_len, char *tr)
2176 char *p, tmp[TMPBUFLEN];
2182 if (len > TMPBUFLEN - 1)
2183 len = TMPBUFLEN - 1;
2185 memcpy(tmp, *buf, len);
2189 if (*p == '-' && *size > 1) {
2197 *val = simple_strtoul(p, &p, 0);
2201 /* We don't know if the next char is whitespace thus we may accept
2202 * invalid integers (e.g. 1234...a) or two integers instead of one
2203 * (e.g. 123...1). So lets not allow such large numbers. */
2204 if (len == TMPBUFLEN - 1)
2207 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2210 if (tr && (len < *size))
2220 * proc_put_long - converts an integer to a decimal ASCII formatted string
2222 * @buf: the user buffer
2223 * @size: the size of the user buffer
2224 * @val: the integer to be converted
2225 * @neg: sign of the number, %TRUE for negative
2227 * In case of success %0 is returned and @buf and @size are updated with
2228 * the amount of bytes written.
2230 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2234 char tmp[TMPBUFLEN], *p = tmp;
2236 sprintf(p, "%s%lu", neg ? "-" : "", val);
2240 if (copy_to_user(*buf, tmp, len))
2248 static int proc_put_char(void __user **buf, size_t *size, char c)
2251 char __user **buffer = (char __user **)buf;
2252 if (put_user(c, *buffer))
2254 (*size)--, (*buffer)++;
2260 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2262 int write, void *data)
2265 *valp = *negp ? -*lvalp : *lvalp;
2270 *lvalp = (unsigned long)-val;
2273 *lvalp = (unsigned long)val;
2279 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2281 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2282 int write, void __user *buffer,
2283 size_t *lenp, loff_t *ppos,
2284 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2285 int write, void *data),
2288 int *i, vleft, first = 1, err = 0;
2289 unsigned long page = 0;
2293 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2298 i = (int *) tbl_data;
2299 vleft = table->maxlen / sizeof(*i);
2303 conv = do_proc_dointvec_conv;
2306 if (left > PAGE_SIZE - 1)
2307 left = PAGE_SIZE - 1;
2308 page = __get_free_page(GFP_TEMPORARY);
2309 kbuf = (char *) page;
2312 if (copy_from_user(kbuf, buffer, left)) {
2319 for (; left && vleft--; i++, first=0) {
2324 left -= proc_skip_spaces(&kbuf);
2328 err = proc_get_long(&kbuf, &left, &lval, &neg,
2330 sizeof(proc_wspace_sep), NULL);
2333 if (conv(&neg, &lval, i, 1, data)) {
2338 if (conv(&neg, &lval, i, 0, data)) {
2343 err = proc_put_char(&buffer, &left, '\t');
2346 err = proc_put_long(&buffer, &left, lval, neg);
2352 if (!write && !first && left && !err)
2353 err = proc_put_char(&buffer, &left, '\n');
2354 if (write && !err && left)
2355 left -= proc_skip_spaces(&kbuf);
2360 return err ? : -EINVAL;
2367 static int do_proc_dointvec(struct ctl_table *table, int write,
2368 void __user *buffer, size_t *lenp, loff_t *ppos,
2369 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2370 int write, void *data),
2373 return __do_proc_dointvec(table->data, table, write,
2374 buffer, lenp, ppos, conv, data);
2378 * proc_dointvec - read a vector of integers
2379 * @table: the sysctl table
2380 * @write: %TRUE if this is a write to the sysctl file
2381 * @buffer: the user buffer
2382 * @lenp: the size of the user buffer
2383 * @ppos: file position
2385 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2386 * values from/to the user buffer, treated as an ASCII string.
2388 * Returns 0 on success.
2390 int proc_dointvec(struct ctl_table *table, int write,
2391 void __user *buffer, size_t *lenp, loff_t *ppos)
2393 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2398 * Taint values can only be increased
2399 * This means we can safely use a temporary.
2401 static int proc_taint(struct ctl_table *table, int write,
2402 void __user *buffer, size_t *lenp, loff_t *ppos)
2405 unsigned long tmptaint = get_taint();
2408 if (write && !capable(CAP_SYS_ADMIN))
2413 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2419 * Poor man's atomic or. Not worth adding a primitive
2420 * to everyone's atomic.h for this
2423 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2424 if ((tmptaint >> i) & 1)
2432 #ifdef CONFIG_PRINTK
2433 static int proc_dmesg_restrict(struct ctl_table *table, int write,
2434 void __user *buffer, size_t *lenp, loff_t *ppos)
2436 if (write && !capable(CAP_SYS_ADMIN))
2439 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2443 struct do_proc_dointvec_minmax_conv_param {
2448 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2450 int write, void *data)
2452 struct do_proc_dointvec_minmax_conv_param *param = data;
2454 int val = *negp ? -*lvalp : *lvalp;
2455 if ((param->min && *param->min > val) ||
2456 (param->max && *param->max < val))
2463 *lvalp = (unsigned long)-val;
2466 *lvalp = (unsigned long)val;
2473 * proc_dointvec_minmax - read a vector of integers with min/max values
2474 * @table: the sysctl table
2475 * @write: %TRUE if this is a write to the sysctl file
2476 * @buffer: the user buffer
2477 * @lenp: the size of the user buffer
2478 * @ppos: file position
2480 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2481 * values from/to the user buffer, treated as an ASCII string.
2483 * This routine will ensure the values are within the range specified by
2484 * table->extra1 (min) and table->extra2 (max).
2486 * Returns 0 on success.
2488 int proc_dointvec_minmax(struct ctl_table *table, int write,
2489 void __user *buffer, size_t *lenp, loff_t *ppos)
2491 struct do_proc_dointvec_minmax_conv_param param = {
2492 .min = (int *) table->extra1,
2493 .max = (int *) table->extra2,
2495 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2496 do_proc_dointvec_minmax_conv, ¶m);
2499 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2500 void __user *buffer,
2501 size_t *lenp, loff_t *ppos,
2502 unsigned long convmul,
2503 unsigned long convdiv)
2505 unsigned long *i, *min, *max;
2506 int vleft, first = 1, err = 0;
2507 unsigned long page = 0;
2511 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2516 i = (unsigned long *) data;
2517 min = (unsigned long *) table->extra1;
2518 max = (unsigned long *) table->extra2;
2519 vleft = table->maxlen / sizeof(unsigned long);
2523 if (left > PAGE_SIZE - 1)
2524 left = PAGE_SIZE - 1;
2525 page = __get_free_page(GFP_TEMPORARY);
2526 kbuf = (char *) page;
2529 if (copy_from_user(kbuf, buffer, left)) {
2536 for (; left && vleft--; i++, first = 0) {
2542 left -= proc_skip_spaces(&kbuf);
2544 err = proc_get_long(&kbuf, &left, &val, &neg,
2546 sizeof(proc_wspace_sep), NULL);
2551 if ((min && val < *min) || (max && val > *max))
2555 val = convdiv * (*i) / convmul;
2557 err = proc_put_char(&buffer, &left, '\t');
2558 err = proc_put_long(&buffer, &left, val, false);
2564 if (!write && !first && left && !err)
2565 err = proc_put_char(&buffer, &left, '\n');
2567 left -= proc_skip_spaces(&kbuf);
2572 return err ? : -EINVAL;
2579 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2580 void __user *buffer,
2581 size_t *lenp, loff_t *ppos,
2582 unsigned long convmul,
2583 unsigned long convdiv)
2585 return __do_proc_doulongvec_minmax(table->data, table, write,
2586 buffer, lenp, ppos, convmul, convdiv);
2590 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2591 * @table: the sysctl table
2592 * @write: %TRUE if this is a write to the sysctl file
2593 * @buffer: the user buffer
2594 * @lenp: the size of the user buffer
2595 * @ppos: file position
2597 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2598 * values from/to the user buffer, treated as an ASCII string.
2600 * This routine will ensure the values are within the range specified by
2601 * table->extra1 (min) and table->extra2 (max).
2603 * Returns 0 on success.
2605 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2606 void __user *buffer, size_t *lenp, loff_t *ppos)
2608 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2612 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2613 * @table: the sysctl table
2614 * @write: %TRUE if this is a write to the sysctl file
2615 * @buffer: the user buffer
2616 * @lenp: the size of the user buffer
2617 * @ppos: file position
2619 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2620 * values from/to the user buffer, treated as an ASCII string. The values
2621 * are treated as milliseconds, and converted to jiffies when they are stored.
2623 * This routine will ensure the values are within the range specified by
2624 * table->extra1 (min) and table->extra2 (max).
2626 * Returns 0 on success.
2628 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2629 void __user *buffer,
2630 size_t *lenp, loff_t *ppos)
2632 return do_proc_doulongvec_minmax(table, write, buffer,
2633 lenp, ppos, HZ, 1000l);
2637 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2639 int write, void *data)
2642 if (*lvalp > LONG_MAX / HZ)
2644 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2650 lval = (unsigned long)-val;
2653 lval = (unsigned long)val;
2660 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2662 int write, void *data)
2665 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2667 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2673 lval = (unsigned long)-val;
2676 lval = (unsigned long)val;
2678 *lvalp = jiffies_to_clock_t(lval);
2683 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2685 int write, void *data)
2688 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2694 lval = (unsigned long)-val;
2697 lval = (unsigned long)val;
2699 *lvalp = jiffies_to_msecs(lval);
2705 * proc_dointvec_jiffies - read a vector of integers as seconds
2706 * @table: the sysctl table
2707 * @write: %TRUE if this is a write to the sysctl file
2708 * @buffer: the user buffer
2709 * @lenp: the size of the user buffer
2710 * @ppos: file position
2712 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2713 * values from/to the user buffer, treated as an ASCII string.
2714 * The values read are assumed to be in seconds, and are converted into
2717 * Returns 0 on success.
2719 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2720 void __user *buffer, size_t *lenp, loff_t *ppos)
2722 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2723 do_proc_dointvec_jiffies_conv,NULL);
2727 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2728 * @table: the sysctl table
2729 * @write: %TRUE if this is a write to the sysctl file
2730 * @buffer: the user buffer
2731 * @lenp: the size of the user buffer
2732 * @ppos: pointer to the file position
2734 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2735 * values from/to the user buffer, treated as an ASCII string.
2736 * The values read are assumed to be in 1/USER_HZ seconds, and
2737 * are converted into jiffies.
2739 * Returns 0 on success.
2741 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2742 void __user *buffer, size_t *lenp, loff_t *ppos)
2744 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2745 do_proc_dointvec_userhz_jiffies_conv,NULL);
2749 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2750 * @table: the sysctl table
2751 * @write: %TRUE if this is a write to the sysctl file
2752 * @buffer: the user buffer
2753 * @lenp: the size of the user buffer
2754 * @ppos: file position
2755 * @ppos: the current position in the file
2757 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2758 * values from/to the user buffer, treated as an ASCII string.
2759 * The values read are assumed to be in 1/1000 seconds, and
2760 * are converted into jiffies.
2762 * Returns 0 on success.
2764 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2765 void __user *buffer, size_t *lenp, loff_t *ppos)
2767 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2768 do_proc_dointvec_ms_jiffies_conv, NULL);
2771 static int proc_do_cad_pid(struct ctl_table *table, int write,
2772 void __user *buffer, size_t *lenp, loff_t *ppos)
2774 struct pid *new_pid;
2778 tmp = pid_vnr(cad_pid);
2780 r = __do_proc_dointvec(&tmp, table, write, buffer,
2781 lenp, ppos, NULL, NULL);
2785 new_pid = find_get_pid(tmp);
2789 put_pid(xchg(&cad_pid, new_pid));
2794 * proc_do_large_bitmap - read/write from/to a large bitmap
2795 * @table: the sysctl table
2796 * @write: %TRUE if this is a write to the sysctl file
2797 * @buffer: the user buffer
2798 * @lenp: the size of the user buffer
2799 * @ppos: file position
2801 * The bitmap is stored at table->data and the bitmap length (in bits)
2804 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2805 * large bitmaps may be represented in a compact manner. Writing into
2806 * the file will clear the bitmap then update it with the given input.
2808 * Returns 0 on success.
2810 int proc_do_large_bitmap(struct ctl_table *table, int write,
2811 void __user *buffer, size_t *lenp, loff_t *ppos)
2815 size_t left = *lenp;
2816 unsigned long bitmap_len = table->maxlen;
2817 unsigned long *bitmap = (unsigned long *) table->data;
2818 unsigned long *tmp_bitmap = NULL;
2819 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2821 if (!bitmap_len || !left || (*ppos && !write)) {
2827 unsigned long page = 0;
2830 if (left > PAGE_SIZE - 1)
2831 left = PAGE_SIZE - 1;
2833 page = __get_free_page(GFP_TEMPORARY);
2834 kbuf = (char *) page;
2837 if (copy_from_user(kbuf, buffer, left)) {
2843 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2849 proc_skip_char(&kbuf, &left, '\n');
2850 while (!err && left) {
2851 unsigned long val_a, val_b;
2854 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2858 if (val_a >= bitmap_len || neg) {
2870 err = proc_get_long(&kbuf, &left, &val_b,
2871 &neg, tr_b, sizeof(tr_b),
2875 if (val_b >= bitmap_len || neg ||
2886 while (val_a <= val_b)
2887 set_bit(val_a++, tmp_bitmap);
2890 proc_skip_char(&kbuf, &left, '\n');
2894 unsigned long bit_a, bit_b = 0;
2897 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2898 if (bit_a >= bitmap_len)
2900 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2904 err = proc_put_char(&buffer, &left, ',');
2908 err = proc_put_long(&buffer, &left, bit_a, false);
2911 if (bit_a != bit_b) {
2912 err = proc_put_char(&buffer, &left, '-');
2915 err = proc_put_long(&buffer, &left, bit_b, false);
2923 err = proc_put_char(&buffer, &left, '\n');
2929 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2931 memcpy(bitmap, tmp_bitmap,
2932 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
2944 #else /* CONFIG_PROC_SYSCTL */
2946 int proc_dostring(struct ctl_table *table, int write,
2947 void __user *buffer, size_t *lenp, loff_t *ppos)
2952 int proc_dointvec(struct ctl_table *table, int write,
2953 void __user *buffer, size_t *lenp, loff_t *ppos)
2958 int proc_dointvec_minmax(struct ctl_table *table, int write,
2959 void __user *buffer, size_t *lenp, loff_t *ppos)
2964 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2965 void __user *buffer, size_t *lenp, loff_t *ppos)
2970 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2971 void __user *buffer, size_t *lenp, loff_t *ppos)
2976 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2977 void __user *buffer, size_t *lenp, loff_t *ppos)
2982 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2983 void __user *buffer, size_t *lenp, loff_t *ppos)
2988 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2989 void __user *buffer,
2990 size_t *lenp, loff_t *ppos)
2996 #endif /* CONFIG_PROC_SYSCTL */
2999 * No sense putting this after each symbol definition, twice,
3000 * exception granted :-)
3002 EXPORT_SYMBOL(proc_dointvec);
3003 EXPORT_SYMBOL(proc_dointvec_jiffies);
3004 EXPORT_SYMBOL(proc_dointvec_minmax);
3005 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3006 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3007 EXPORT_SYMBOL(proc_dostring);
3008 EXPORT_SYMBOL(proc_doulongvec_minmax);
3009 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3010 EXPORT_SYMBOL(register_sysctl_table);
3011 EXPORT_SYMBOL(register_sysctl_paths);
3012 EXPORT_SYMBOL(unregister_sysctl_table);