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>
61 #include <linux/binfmts.h>
63 #include <asm/uaccess.h>
64 #include <asm/processor.h>
68 #include <asm/stacktrace.h>
71 #ifdef CONFIG_BSD_PROCESS_ACCT
72 #include <linux/acct.h>
74 #ifdef CONFIG_RT_MUTEXES
75 #include <linux/rtmutex.h>
77 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
78 #include <linux/lockdep.h>
80 #ifdef CONFIG_CHR_DEV_SG
84 #ifdef CONFIG_LOCKUP_DETECTOR
85 #include <linux/nmi.h>
89 #if defined(CONFIG_SYSCTL)
91 /* External variables not in a header file. */
92 extern int sysctl_overcommit_memory;
93 extern int sysctl_overcommit_ratio;
94 extern int max_threads;
95 extern int core_uses_pid;
96 extern int suid_dumpable;
97 extern char core_pattern[];
98 extern unsigned int core_pipe_limit;
100 extern int min_free_kbytes;
101 extern int pid_max_min, pid_max_max;
102 extern int sysctl_drop_caches;
103 extern int percpu_pagelist_fraction;
104 extern int compat_log;
105 extern int latencytop_enabled;
106 extern int sysctl_nr_open_min, sysctl_nr_open_max;
108 extern int sysctl_nr_trim_pages;
111 extern int blk_iopoll_enabled;
114 /* Constants used for minimum and maximum */
115 #ifdef CONFIG_LOCKUP_DETECTOR
116 static int sixty = 60;
117 static int neg_one = -1;
121 static int __maybe_unused one = 1;
122 static int __maybe_unused two = 2;
123 static int __maybe_unused three = 3;
124 static unsigned long one_ul = 1;
125 static int one_hundred = 100;
127 static int ten_thousand = 10000;
130 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
131 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
133 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
134 static int maxolduid = 65535;
135 static int minolduid;
136 static int min_percpu_pagelist_fract = 8;
138 static int ngroups_max = NGROUPS_MAX;
139 static const int cap_last_cap = CAP_LAST_CAP;
141 #ifdef CONFIG_INOTIFY_USER
142 #include <linux/inotify.h>
145 #include <asm/system.h>
148 #ifdef CONFIG_SPARC64
149 extern int sysctl_tsb_ratio;
153 extern int pwrsw_enabled;
154 extern int unaligned_enabled;
158 extern int no_unaligned_warning;
159 extern int unaligned_dump_stack;
162 #ifdef CONFIG_PROC_SYSCTL
163 static int proc_do_cad_pid(struct ctl_table *table, int write,
164 void __user *buffer, size_t *lenp, loff_t *ppos);
165 static int proc_taint(struct ctl_table *table, int write,
166 void __user *buffer, size_t *lenp, loff_t *ppos);
170 static int proc_dmesg_restrict(struct ctl_table *table, int write,
171 void __user *buffer, size_t *lenp, loff_t *ppos);
174 #ifdef CONFIG_MAGIC_SYSRQ
175 /* Note: sysrq code uses it's own private copy */
176 static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
178 static int sysrq_sysctl_handler(ctl_table *table, int write,
179 void __user *buffer, size_t *lenp,
184 error = proc_dointvec(table, write, buffer, lenp, ppos);
189 sysrq_toggle_support(__sysrq_enabled);
196 static struct ctl_table root_table[];
197 static struct ctl_table_root sysctl_table_root;
198 static struct ctl_table_header root_table_header = {
200 .ctl_table = root_table,
201 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
202 .root = &sysctl_table_root,
203 .set = &sysctl_table_root.default_set,
205 static struct ctl_table_root sysctl_table_root = {
206 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
207 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
210 static struct ctl_table kern_table[];
211 static struct ctl_table vm_table[];
212 static struct ctl_table fs_table[];
213 static struct ctl_table debug_table[];
214 static struct ctl_table dev_table[];
215 extern struct ctl_table random_table[];
217 extern struct ctl_table epoll_table[];
220 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
221 int sysctl_legacy_va_layout;
224 /* The default sysctl tables: */
226 static struct ctl_table root_table[] = {
228 .procname = "kernel",
245 .child = debug_table,
255 #ifdef CONFIG_SCHED_DEBUG
256 static int min_sched_granularity_ns = 100000; /* 100 usecs */
257 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
258 static int min_wakeup_granularity_ns; /* 0 usecs */
259 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
260 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
261 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
264 #ifdef CONFIG_COMPACTION
265 static int min_extfrag_threshold;
266 static int max_extfrag_threshold = 1000;
269 static struct ctl_table kern_table[] = {
271 .procname = "sched_child_runs_first",
272 .data = &sysctl_sched_child_runs_first,
273 .maxlen = sizeof(unsigned int),
275 .proc_handler = proc_dointvec,
277 #ifdef CONFIG_SCHED_DEBUG
279 .procname = "sched_min_granularity_ns",
280 .data = &sysctl_sched_min_granularity,
281 .maxlen = sizeof(unsigned int),
283 .proc_handler = sched_proc_update_handler,
284 .extra1 = &min_sched_granularity_ns,
285 .extra2 = &max_sched_granularity_ns,
288 .procname = "sched_latency_ns",
289 .data = &sysctl_sched_latency,
290 .maxlen = sizeof(unsigned int),
292 .proc_handler = sched_proc_update_handler,
293 .extra1 = &min_sched_granularity_ns,
294 .extra2 = &max_sched_granularity_ns,
297 .procname = "sched_wakeup_granularity_ns",
298 .data = &sysctl_sched_wakeup_granularity,
299 .maxlen = sizeof(unsigned int),
301 .proc_handler = sched_proc_update_handler,
302 .extra1 = &min_wakeup_granularity_ns,
303 .extra2 = &max_wakeup_granularity_ns,
306 .procname = "sched_tunable_scaling",
307 .data = &sysctl_sched_tunable_scaling,
308 .maxlen = sizeof(enum sched_tunable_scaling),
310 .proc_handler = sched_proc_update_handler,
311 .extra1 = &min_sched_tunable_scaling,
312 .extra2 = &max_sched_tunable_scaling,
315 .procname = "sched_migration_cost",
316 .data = &sysctl_sched_migration_cost,
317 .maxlen = sizeof(unsigned int),
319 .proc_handler = proc_dointvec,
322 .procname = "sched_nr_migrate",
323 .data = &sysctl_sched_nr_migrate,
324 .maxlen = sizeof(unsigned int),
326 .proc_handler = proc_dointvec,
329 .procname = "sched_time_avg",
330 .data = &sysctl_sched_time_avg,
331 .maxlen = sizeof(unsigned int),
333 .proc_handler = proc_dointvec,
336 .procname = "sched_shares_window",
337 .data = &sysctl_sched_shares_window,
338 .maxlen = sizeof(unsigned int),
340 .proc_handler = proc_dointvec,
343 .procname = "timer_migration",
344 .data = &sysctl_timer_migration,
345 .maxlen = sizeof(unsigned int),
347 .proc_handler = proc_dointvec_minmax,
353 .procname = "sched_rt_period_us",
354 .data = &sysctl_sched_rt_period,
355 .maxlen = sizeof(unsigned int),
357 .proc_handler = sched_rt_handler,
360 .procname = "sched_rt_runtime_us",
361 .data = &sysctl_sched_rt_runtime,
362 .maxlen = sizeof(int),
364 .proc_handler = sched_rt_handler,
366 #ifdef CONFIG_SCHED_AUTOGROUP
368 .procname = "sched_autogroup_enabled",
369 .data = &sysctl_sched_autogroup_enabled,
370 .maxlen = sizeof(unsigned int),
372 .proc_handler = proc_dointvec_minmax,
377 #ifdef CONFIG_CFS_BANDWIDTH
379 .procname = "sched_cfs_bandwidth_slice_us",
380 .data = &sysctl_sched_cfs_bandwidth_slice,
381 .maxlen = sizeof(unsigned int),
383 .proc_handler = proc_dointvec_minmax,
387 #ifdef CONFIG_PROVE_LOCKING
389 .procname = "prove_locking",
390 .data = &prove_locking,
391 .maxlen = sizeof(int),
393 .proc_handler = proc_dointvec,
396 #ifdef CONFIG_LOCK_STAT
398 .procname = "lock_stat",
400 .maxlen = sizeof(int),
402 .proc_handler = proc_dointvec,
407 .data = &panic_timeout,
408 .maxlen = sizeof(int),
410 .proc_handler = proc_dointvec,
413 .procname = "core_uses_pid",
414 .data = &core_uses_pid,
415 .maxlen = sizeof(int),
417 .proc_handler = proc_dointvec,
420 .procname = "core_pattern",
421 .data = core_pattern,
422 .maxlen = CORENAME_MAX_SIZE,
424 .proc_handler = proc_dostring,
427 .procname = "core_pipe_limit",
428 .data = &core_pipe_limit,
429 .maxlen = sizeof(unsigned int),
431 .proc_handler = proc_dointvec,
433 #ifdef CONFIG_PROC_SYSCTL
435 .procname = "tainted",
436 .maxlen = sizeof(long),
438 .proc_handler = proc_taint,
441 #ifdef CONFIG_LATENCYTOP
443 .procname = "latencytop",
444 .data = &latencytop_enabled,
445 .maxlen = sizeof(int),
447 .proc_handler = proc_dointvec,
450 #ifdef CONFIG_BLK_DEV_INITRD
452 .procname = "real-root-dev",
453 .data = &real_root_dev,
454 .maxlen = sizeof(int),
456 .proc_handler = proc_dointvec,
460 .procname = "print-fatal-signals",
461 .data = &print_fatal_signals,
462 .maxlen = sizeof(int),
464 .proc_handler = proc_dointvec,
468 .procname = "reboot-cmd",
469 .data = reboot_command,
472 .proc_handler = proc_dostring,
475 .procname = "stop-a",
476 .data = &stop_a_enabled,
477 .maxlen = sizeof (int),
479 .proc_handler = proc_dointvec,
482 .procname = "scons-poweroff",
483 .data = &scons_pwroff,
484 .maxlen = sizeof (int),
486 .proc_handler = proc_dointvec,
489 #ifdef CONFIG_SPARC64
491 .procname = "tsb-ratio",
492 .data = &sysctl_tsb_ratio,
493 .maxlen = sizeof (int),
495 .proc_handler = proc_dointvec,
500 .procname = "soft-power",
501 .data = &pwrsw_enabled,
502 .maxlen = sizeof (int),
504 .proc_handler = proc_dointvec,
507 .procname = "unaligned-trap",
508 .data = &unaligned_enabled,
509 .maxlen = sizeof (int),
511 .proc_handler = proc_dointvec,
515 .procname = "ctrl-alt-del",
517 .maxlen = sizeof(int),
519 .proc_handler = proc_dointvec,
521 #ifdef CONFIG_FUNCTION_TRACER
523 .procname = "ftrace_enabled",
524 .data = &ftrace_enabled,
525 .maxlen = sizeof(int),
527 .proc_handler = ftrace_enable_sysctl,
530 #ifdef CONFIG_STACK_TRACER
532 .procname = "stack_tracer_enabled",
533 .data = &stack_tracer_enabled,
534 .maxlen = sizeof(int),
536 .proc_handler = stack_trace_sysctl,
539 #ifdef CONFIG_TRACING
541 .procname = "ftrace_dump_on_oops",
542 .data = &ftrace_dump_on_oops,
543 .maxlen = sizeof(int),
545 .proc_handler = proc_dointvec,
548 #ifdef CONFIG_MODULES
550 .procname = "modprobe",
551 .data = &modprobe_path,
552 .maxlen = KMOD_PATH_LEN,
554 .proc_handler = proc_dostring,
557 .procname = "modules_disabled",
558 .data = &modules_disabled,
559 .maxlen = sizeof(int),
561 /* only handle a transition from default "0" to "1" */
562 .proc_handler = proc_dointvec_minmax,
567 #ifdef CONFIG_HOTPLUG
569 .procname = "hotplug",
570 .data = &uevent_helper,
571 .maxlen = UEVENT_HELPER_PATH_LEN,
573 .proc_handler = proc_dostring,
576 #ifdef CONFIG_CHR_DEV_SG
578 .procname = "sg-big-buff",
579 .data = &sg_big_buff,
580 .maxlen = sizeof (int),
582 .proc_handler = proc_dointvec,
585 #ifdef CONFIG_BSD_PROCESS_ACCT
589 .maxlen = 3*sizeof(int),
591 .proc_handler = proc_dointvec,
594 #ifdef CONFIG_MAGIC_SYSRQ
597 .data = &__sysrq_enabled,
598 .maxlen = sizeof (int),
600 .proc_handler = sysrq_sysctl_handler,
603 #ifdef CONFIG_PROC_SYSCTL
605 .procname = "cad_pid",
607 .maxlen = sizeof (int),
609 .proc_handler = proc_do_cad_pid,
613 .procname = "threads-max",
614 .data = &max_threads,
615 .maxlen = sizeof(int),
617 .proc_handler = proc_dointvec,
620 .procname = "random",
622 .child = random_table,
625 .procname = "usermodehelper",
627 .child = usermodehelper_table,
630 .procname = "overflowuid",
631 .data = &overflowuid,
632 .maxlen = sizeof(int),
634 .proc_handler = proc_dointvec_minmax,
635 .extra1 = &minolduid,
636 .extra2 = &maxolduid,
639 .procname = "overflowgid",
640 .data = &overflowgid,
641 .maxlen = sizeof(int),
643 .proc_handler = proc_dointvec_minmax,
644 .extra1 = &minolduid,
645 .extra2 = &maxolduid,
648 #ifdef CONFIG_MATHEMU
650 .procname = "ieee_emulation_warnings",
651 .data = &sysctl_ieee_emulation_warnings,
652 .maxlen = sizeof(int),
654 .proc_handler = proc_dointvec,
658 .procname = "userprocess_debug",
659 .data = &show_unhandled_signals,
660 .maxlen = sizeof(int),
662 .proc_handler = proc_dointvec,
666 .procname = "pid_max",
668 .maxlen = sizeof (int),
670 .proc_handler = proc_dointvec_minmax,
671 .extra1 = &pid_max_min,
672 .extra2 = &pid_max_max,
675 .procname = "panic_on_oops",
676 .data = &panic_on_oops,
677 .maxlen = sizeof(int),
679 .proc_handler = proc_dointvec,
681 #if defined CONFIG_PRINTK
683 .procname = "printk",
684 .data = &console_loglevel,
685 .maxlen = 4*sizeof(int),
687 .proc_handler = proc_dointvec,
690 .procname = "printk_ratelimit",
691 .data = &printk_ratelimit_state.interval,
692 .maxlen = sizeof(int),
694 .proc_handler = proc_dointvec_jiffies,
697 .procname = "printk_ratelimit_burst",
698 .data = &printk_ratelimit_state.burst,
699 .maxlen = sizeof(int),
701 .proc_handler = proc_dointvec,
704 .procname = "printk_delay",
705 .data = &printk_delay_msec,
706 .maxlen = sizeof(int),
708 .proc_handler = proc_dointvec_minmax,
710 .extra2 = &ten_thousand,
713 .procname = "dmesg_restrict",
714 .data = &dmesg_restrict,
715 .maxlen = sizeof(int),
717 .proc_handler = proc_dointvec_minmax,
722 .procname = "kptr_restrict",
723 .data = &kptr_restrict,
724 .maxlen = sizeof(int),
726 .proc_handler = proc_dmesg_restrict,
732 .procname = "ngroups_max",
733 .data = &ngroups_max,
734 .maxlen = sizeof (int),
736 .proc_handler = proc_dointvec,
739 .procname = "cap_last_cap",
740 .data = (void *)&cap_last_cap,
741 .maxlen = sizeof(int),
743 .proc_handler = proc_dointvec,
745 #if defined(CONFIG_LOCKUP_DETECTOR)
747 .procname = "watchdog",
748 .data = &watchdog_enabled,
749 .maxlen = sizeof (int),
751 .proc_handler = proc_dowatchdog,
756 .procname = "watchdog_thresh",
757 .data = &watchdog_thresh,
758 .maxlen = sizeof(int),
760 .proc_handler = proc_dowatchdog,
765 .procname = "softlockup_panic",
766 .data = &softlockup_panic,
767 .maxlen = sizeof(int),
769 .proc_handler = proc_dointvec_minmax,
774 .procname = "nmi_watchdog",
775 .data = &watchdog_enabled,
776 .maxlen = sizeof (int),
778 .proc_handler = proc_dowatchdog,
783 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
785 .procname = "unknown_nmi_panic",
786 .data = &unknown_nmi_panic,
787 .maxlen = sizeof (int),
789 .proc_handler = proc_dointvec,
792 #if defined(CONFIG_X86)
794 .procname = "panic_on_unrecovered_nmi",
795 .data = &panic_on_unrecovered_nmi,
796 .maxlen = sizeof(int),
798 .proc_handler = proc_dointvec,
801 .procname = "panic_on_io_nmi",
802 .data = &panic_on_io_nmi,
803 .maxlen = sizeof(int),
805 .proc_handler = proc_dointvec,
807 #ifdef CONFIG_DEBUG_STACKOVERFLOW
809 .procname = "panic_on_stackoverflow",
810 .data = &sysctl_panic_on_stackoverflow,
811 .maxlen = sizeof(int),
813 .proc_handler = proc_dointvec,
817 .procname = "bootloader_type",
818 .data = &bootloader_type,
819 .maxlen = sizeof (int),
821 .proc_handler = proc_dointvec,
824 .procname = "bootloader_version",
825 .data = &bootloader_version,
826 .maxlen = sizeof (int),
828 .proc_handler = proc_dointvec,
831 .procname = "kstack_depth_to_print",
832 .data = &kstack_depth_to_print,
833 .maxlen = sizeof(int),
835 .proc_handler = proc_dointvec,
838 .procname = "io_delay_type",
839 .data = &io_delay_type,
840 .maxlen = sizeof(int),
842 .proc_handler = proc_dointvec,
845 #if defined(CONFIG_MMU)
847 .procname = "randomize_va_space",
848 .data = &randomize_va_space,
849 .maxlen = sizeof(int),
851 .proc_handler = proc_dointvec,
854 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
856 .procname = "spin_retry",
858 .maxlen = sizeof (int),
860 .proc_handler = proc_dointvec,
863 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
865 .procname = "acpi_video_flags",
866 .data = &acpi_realmode_flags,
867 .maxlen = sizeof (unsigned long),
869 .proc_handler = proc_doulongvec_minmax,
874 .procname = "ignore-unaligned-usertrap",
875 .data = &no_unaligned_warning,
876 .maxlen = sizeof (int),
878 .proc_handler = proc_dointvec,
881 .procname = "unaligned-dump-stack",
882 .data = &unaligned_dump_stack,
883 .maxlen = sizeof (int),
885 .proc_handler = proc_dointvec,
888 #ifdef CONFIG_DETECT_HUNG_TASK
890 .procname = "hung_task_panic",
891 .data = &sysctl_hung_task_panic,
892 .maxlen = sizeof(int),
894 .proc_handler = proc_dointvec_minmax,
899 .procname = "hung_task_check_count",
900 .data = &sysctl_hung_task_check_count,
901 .maxlen = sizeof(unsigned long),
903 .proc_handler = proc_doulongvec_minmax,
906 .procname = "hung_task_timeout_secs",
907 .data = &sysctl_hung_task_timeout_secs,
908 .maxlen = sizeof(unsigned long),
910 .proc_handler = proc_dohung_task_timeout_secs,
913 .procname = "hung_task_warnings",
914 .data = &sysctl_hung_task_warnings,
915 .maxlen = sizeof(unsigned long),
917 .proc_handler = proc_doulongvec_minmax,
922 .procname = "compat-log",
924 .maxlen = sizeof (int),
926 .proc_handler = proc_dointvec,
929 #ifdef CONFIG_RT_MUTEXES
931 .procname = "max_lock_depth",
932 .data = &max_lock_depth,
933 .maxlen = sizeof(int),
935 .proc_handler = proc_dointvec,
939 .procname = "poweroff_cmd",
940 .data = &poweroff_cmd,
941 .maxlen = POWEROFF_CMD_PATH_LEN,
943 .proc_handler = proc_dostring,
949 .child = key_sysctls,
952 #ifdef CONFIG_RCU_TORTURE_TEST
954 .procname = "rcutorture_runnable",
955 .data = &rcutorture_runnable,
956 .maxlen = sizeof(int),
958 .proc_handler = proc_dointvec,
961 #ifdef CONFIG_PERF_EVENTS
963 * User-space scripts rely on the existence of this file
964 * as a feature check for perf_events being enabled.
966 * So it's an ABI, do not remove!
969 .procname = "perf_event_paranoid",
970 .data = &sysctl_perf_event_paranoid,
971 .maxlen = sizeof(sysctl_perf_event_paranoid),
973 .proc_handler = proc_dointvec,
976 .procname = "perf_event_mlock_kb",
977 .data = &sysctl_perf_event_mlock,
978 .maxlen = sizeof(sysctl_perf_event_mlock),
980 .proc_handler = proc_dointvec,
983 .procname = "perf_event_max_sample_rate",
984 .data = &sysctl_perf_event_sample_rate,
985 .maxlen = sizeof(sysctl_perf_event_sample_rate),
987 .proc_handler = perf_proc_update_handler,
990 #ifdef CONFIG_KMEMCHECK
992 .procname = "kmemcheck",
993 .data = &kmemcheck_enabled,
994 .maxlen = sizeof(int),
996 .proc_handler = proc_dointvec,
1001 .procname = "blk_iopoll",
1002 .data = &blk_iopoll_enabled,
1003 .maxlen = sizeof(int),
1005 .proc_handler = proc_dointvec,
1011 static struct ctl_table vm_table[] = {
1013 .procname = "overcommit_memory",
1014 .data = &sysctl_overcommit_memory,
1015 .maxlen = sizeof(sysctl_overcommit_memory),
1017 .proc_handler = proc_dointvec_minmax,
1022 .procname = "panic_on_oom",
1023 .data = &sysctl_panic_on_oom,
1024 .maxlen = sizeof(sysctl_panic_on_oom),
1026 .proc_handler = proc_dointvec_minmax,
1031 .procname = "oom_kill_allocating_task",
1032 .data = &sysctl_oom_kill_allocating_task,
1033 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1035 .proc_handler = proc_dointvec,
1038 .procname = "oom_dump_tasks",
1039 .data = &sysctl_oom_dump_tasks,
1040 .maxlen = sizeof(sysctl_oom_dump_tasks),
1042 .proc_handler = proc_dointvec,
1045 .procname = "overcommit_ratio",
1046 .data = &sysctl_overcommit_ratio,
1047 .maxlen = sizeof(sysctl_overcommit_ratio),
1049 .proc_handler = proc_dointvec,
1052 .procname = "page-cluster",
1053 .data = &page_cluster,
1054 .maxlen = sizeof(int),
1056 .proc_handler = proc_dointvec_minmax,
1060 .procname = "dirty_background_ratio",
1061 .data = &dirty_background_ratio,
1062 .maxlen = sizeof(dirty_background_ratio),
1064 .proc_handler = dirty_background_ratio_handler,
1066 .extra2 = &one_hundred,
1069 .procname = "dirty_background_bytes",
1070 .data = &dirty_background_bytes,
1071 .maxlen = sizeof(dirty_background_bytes),
1073 .proc_handler = dirty_background_bytes_handler,
1077 .procname = "dirty_ratio",
1078 .data = &vm_dirty_ratio,
1079 .maxlen = sizeof(vm_dirty_ratio),
1081 .proc_handler = dirty_ratio_handler,
1083 .extra2 = &one_hundred,
1086 .procname = "dirty_bytes",
1087 .data = &vm_dirty_bytes,
1088 .maxlen = sizeof(vm_dirty_bytes),
1090 .proc_handler = dirty_bytes_handler,
1091 .extra1 = &dirty_bytes_min,
1094 .procname = "dirty_writeback_centisecs",
1095 .data = &dirty_writeback_interval,
1096 .maxlen = sizeof(dirty_writeback_interval),
1098 .proc_handler = dirty_writeback_centisecs_handler,
1101 .procname = "dirty_expire_centisecs",
1102 .data = &dirty_expire_interval,
1103 .maxlen = sizeof(dirty_expire_interval),
1105 .proc_handler = proc_dointvec_minmax,
1109 .procname = "nr_pdflush_threads",
1110 .data = &nr_pdflush_threads,
1111 .maxlen = sizeof nr_pdflush_threads,
1112 .mode = 0444 /* read-only*/,
1113 .proc_handler = proc_dointvec,
1116 .procname = "swappiness",
1117 .data = &vm_swappiness,
1118 .maxlen = sizeof(vm_swappiness),
1120 .proc_handler = proc_dointvec_minmax,
1122 .extra2 = &one_hundred,
1124 #ifdef CONFIG_HUGETLB_PAGE
1126 .procname = "nr_hugepages",
1128 .maxlen = sizeof(unsigned long),
1130 .proc_handler = hugetlb_sysctl_handler,
1131 .extra1 = (void *)&hugetlb_zero,
1132 .extra2 = (void *)&hugetlb_infinity,
1136 .procname = "nr_hugepages_mempolicy",
1138 .maxlen = sizeof(unsigned long),
1140 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1141 .extra1 = (void *)&hugetlb_zero,
1142 .extra2 = (void *)&hugetlb_infinity,
1146 .procname = "hugetlb_shm_group",
1147 .data = &sysctl_hugetlb_shm_group,
1148 .maxlen = sizeof(gid_t),
1150 .proc_handler = proc_dointvec,
1153 .procname = "hugepages_treat_as_movable",
1154 .data = &hugepages_treat_as_movable,
1155 .maxlen = sizeof(int),
1157 .proc_handler = hugetlb_treat_movable_handler,
1160 .procname = "nr_overcommit_hugepages",
1162 .maxlen = sizeof(unsigned long),
1164 .proc_handler = hugetlb_overcommit_handler,
1165 .extra1 = (void *)&hugetlb_zero,
1166 .extra2 = (void *)&hugetlb_infinity,
1170 .procname = "lowmem_reserve_ratio",
1171 .data = &sysctl_lowmem_reserve_ratio,
1172 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1174 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1177 .procname = "drop_caches",
1178 .data = &sysctl_drop_caches,
1179 .maxlen = sizeof(int),
1181 .proc_handler = drop_caches_sysctl_handler,
1185 #ifdef CONFIG_COMPACTION
1187 .procname = "compact_memory",
1188 .data = &sysctl_compact_memory,
1189 .maxlen = sizeof(int),
1191 .proc_handler = sysctl_compaction_handler,
1194 .procname = "extfrag_threshold",
1195 .data = &sysctl_extfrag_threshold,
1196 .maxlen = sizeof(int),
1198 .proc_handler = sysctl_extfrag_handler,
1199 .extra1 = &min_extfrag_threshold,
1200 .extra2 = &max_extfrag_threshold,
1203 #endif /* CONFIG_COMPACTION */
1205 .procname = "min_free_kbytes",
1206 .data = &min_free_kbytes,
1207 .maxlen = sizeof(min_free_kbytes),
1209 .proc_handler = min_free_kbytes_sysctl_handler,
1213 .procname = "percpu_pagelist_fraction",
1214 .data = &percpu_pagelist_fraction,
1215 .maxlen = sizeof(percpu_pagelist_fraction),
1217 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1218 .extra1 = &min_percpu_pagelist_fract,
1222 .procname = "max_map_count",
1223 .data = &sysctl_max_map_count,
1224 .maxlen = sizeof(sysctl_max_map_count),
1226 .proc_handler = proc_dointvec_minmax,
1231 .procname = "nr_trim_pages",
1232 .data = &sysctl_nr_trim_pages,
1233 .maxlen = sizeof(sysctl_nr_trim_pages),
1235 .proc_handler = proc_dointvec_minmax,
1240 .procname = "laptop_mode",
1241 .data = &laptop_mode,
1242 .maxlen = sizeof(laptop_mode),
1244 .proc_handler = proc_dointvec_jiffies,
1247 .procname = "block_dump",
1248 .data = &block_dump,
1249 .maxlen = sizeof(block_dump),
1251 .proc_handler = proc_dointvec,
1255 .procname = "vfs_cache_pressure",
1256 .data = &sysctl_vfs_cache_pressure,
1257 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1259 .proc_handler = proc_dointvec,
1262 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1264 .procname = "legacy_va_layout",
1265 .data = &sysctl_legacy_va_layout,
1266 .maxlen = sizeof(sysctl_legacy_va_layout),
1268 .proc_handler = proc_dointvec,
1274 .procname = "zone_reclaim_mode",
1275 .data = &zone_reclaim_mode,
1276 .maxlen = sizeof(zone_reclaim_mode),
1278 .proc_handler = proc_dointvec,
1282 .procname = "min_unmapped_ratio",
1283 .data = &sysctl_min_unmapped_ratio,
1284 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1286 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1288 .extra2 = &one_hundred,
1291 .procname = "min_slab_ratio",
1292 .data = &sysctl_min_slab_ratio,
1293 .maxlen = sizeof(sysctl_min_slab_ratio),
1295 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1297 .extra2 = &one_hundred,
1302 .procname = "stat_interval",
1303 .data = &sysctl_stat_interval,
1304 .maxlen = sizeof(sysctl_stat_interval),
1306 .proc_handler = proc_dointvec_jiffies,
1311 .procname = "mmap_min_addr",
1312 .data = &dac_mmap_min_addr,
1313 .maxlen = sizeof(unsigned long),
1315 .proc_handler = mmap_min_addr_handler,
1320 .procname = "numa_zonelist_order",
1321 .data = &numa_zonelist_order,
1322 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1324 .proc_handler = numa_zonelist_order_handler,
1327 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1328 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1330 .procname = "vdso_enabled",
1331 .data = &vdso_enabled,
1332 .maxlen = sizeof(vdso_enabled),
1334 .proc_handler = proc_dointvec,
1338 #ifdef CONFIG_HIGHMEM
1340 .procname = "highmem_is_dirtyable",
1341 .data = &vm_highmem_is_dirtyable,
1342 .maxlen = sizeof(vm_highmem_is_dirtyable),
1344 .proc_handler = proc_dointvec_minmax,
1350 .procname = "scan_unevictable_pages",
1351 .data = &scan_unevictable_pages,
1352 .maxlen = sizeof(scan_unevictable_pages),
1354 .proc_handler = scan_unevictable_handler,
1356 #ifdef CONFIG_MEMORY_FAILURE
1358 .procname = "memory_failure_early_kill",
1359 .data = &sysctl_memory_failure_early_kill,
1360 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1362 .proc_handler = proc_dointvec_minmax,
1367 .procname = "memory_failure_recovery",
1368 .data = &sysctl_memory_failure_recovery,
1369 .maxlen = sizeof(sysctl_memory_failure_recovery),
1371 .proc_handler = proc_dointvec_minmax,
1379 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1380 static struct ctl_table binfmt_misc_table[] = {
1385 static struct ctl_table fs_table[] = {
1387 .procname = "inode-nr",
1388 .data = &inodes_stat,
1389 .maxlen = 2*sizeof(int),
1391 .proc_handler = proc_nr_inodes,
1394 .procname = "inode-state",
1395 .data = &inodes_stat,
1396 .maxlen = 7*sizeof(int),
1398 .proc_handler = proc_nr_inodes,
1401 .procname = "file-nr",
1402 .data = &files_stat,
1403 .maxlen = sizeof(files_stat),
1405 .proc_handler = proc_nr_files,
1408 .procname = "file-max",
1409 .data = &files_stat.max_files,
1410 .maxlen = sizeof(files_stat.max_files),
1412 .proc_handler = proc_doulongvec_minmax,
1415 .procname = "nr_open",
1416 .data = &sysctl_nr_open,
1417 .maxlen = sizeof(int),
1419 .proc_handler = proc_dointvec_minmax,
1420 .extra1 = &sysctl_nr_open_min,
1421 .extra2 = &sysctl_nr_open_max,
1424 .procname = "dentry-state",
1425 .data = &dentry_stat,
1426 .maxlen = 6*sizeof(int),
1428 .proc_handler = proc_nr_dentry,
1431 .procname = "overflowuid",
1432 .data = &fs_overflowuid,
1433 .maxlen = sizeof(int),
1435 .proc_handler = proc_dointvec_minmax,
1436 .extra1 = &minolduid,
1437 .extra2 = &maxolduid,
1440 .procname = "overflowgid",
1441 .data = &fs_overflowgid,
1442 .maxlen = sizeof(int),
1444 .proc_handler = proc_dointvec_minmax,
1445 .extra1 = &minolduid,
1446 .extra2 = &maxolduid,
1448 #ifdef CONFIG_FILE_LOCKING
1450 .procname = "leases-enable",
1451 .data = &leases_enable,
1452 .maxlen = sizeof(int),
1454 .proc_handler = proc_dointvec,
1457 #ifdef CONFIG_DNOTIFY
1459 .procname = "dir-notify-enable",
1460 .data = &dir_notify_enable,
1461 .maxlen = sizeof(int),
1463 .proc_handler = proc_dointvec,
1467 #ifdef CONFIG_FILE_LOCKING
1469 .procname = "lease-break-time",
1470 .data = &lease_break_time,
1471 .maxlen = sizeof(int),
1473 .proc_handler = proc_dointvec,
1478 .procname = "aio-nr",
1480 .maxlen = sizeof(aio_nr),
1482 .proc_handler = proc_doulongvec_minmax,
1485 .procname = "aio-max-nr",
1486 .data = &aio_max_nr,
1487 .maxlen = sizeof(aio_max_nr),
1489 .proc_handler = proc_doulongvec_minmax,
1491 #endif /* CONFIG_AIO */
1492 #ifdef CONFIG_INOTIFY_USER
1494 .procname = "inotify",
1496 .child = inotify_table,
1501 .procname = "epoll",
1503 .child = epoll_table,
1508 .procname = "suid_dumpable",
1509 .data = &suid_dumpable,
1510 .maxlen = sizeof(int),
1512 .proc_handler = proc_dointvec_minmax,
1516 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1518 .procname = "binfmt_misc",
1520 .child = binfmt_misc_table,
1524 .procname = "pipe-max-size",
1525 .data = &pipe_max_size,
1526 .maxlen = sizeof(int),
1528 .proc_handler = &pipe_proc_fn,
1529 .extra1 = &pipe_min_size,
1534 static struct ctl_table debug_table[] = {
1535 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
1536 defined(CONFIG_S390) || defined(CONFIG_TILE)
1538 .procname = "exception-trace",
1539 .data = &show_unhandled_signals,
1540 .maxlen = sizeof(int),
1542 .proc_handler = proc_dointvec
1545 #if defined(CONFIG_OPTPROBES)
1547 .procname = "kprobes-optimization",
1548 .data = &sysctl_kprobes_optimization,
1549 .maxlen = sizeof(int),
1551 .proc_handler = proc_kprobes_optimization_handler,
1559 static struct ctl_table dev_table[] = {
1563 static DEFINE_SPINLOCK(sysctl_lock);
1565 /* called under sysctl_lock */
1566 static int use_table(struct ctl_table_header *p)
1568 if (unlikely(p->unregistering))
1574 /* called under sysctl_lock */
1575 static void unuse_table(struct ctl_table_header *p)
1578 if (unlikely(p->unregistering))
1579 complete(p->unregistering);
1582 /* called under sysctl_lock, will reacquire if has to wait */
1583 static void start_unregistering(struct ctl_table_header *p)
1586 * if p->used is 0, nobody will ever touch that entry again;
1587 * we'll eliminate all paths to it before dropping sysctl_lock
1589 if (unlikely(p->used)) {
1590 struct completion wait;
1591 init_completion(&wait);
1592 p->unregistering = &wait;
1593 spin_unlock(&sysctl_lock);
1594 wait_for_completion(&wait);
1595 spin_lock(&sysctl_lock);
1597 /* anything non-NULL; we'll never dereference it */
1598 p->unregistering = ERR_PTR(-EINVAL);
1601 * do not remove from the list until nobody holds it; walking the
1602 * list in do_sysctl() relies on that.
1604 list_del_init(&p->ctl_entry);
1607 void sysctl_head_get(struct ctl_table_header *head)
1609 spin_lock(&sysctl_lock);
1611 spin_unlock(&sysctl_lock);
1614 void sysctl_head_put(struct ctl_table_header *head)
1616 spin_lock(&sysctl_lock);
1618 kfree_rcu(head, rcu);
1619 spin_unlock(&sysctl_lock);
1622 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1626 spin_lock(&sysctl_lock);
1627 if (!use_table(head))
1628 head = ERR_PTR(-ENOENT);
1629 spin_unlock(&sysctl_lock);
1633 void sysctl_head_finish(struct ctl_table_header *head)
1637 spin_lock(&sysctl_lock);
1639 spin_unlock(&sysctl_lock);
1642 static struct ctl_table_set *
1643 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1645 struct ctl_table_set *set = &root->default_set;
1647 set = root->lookup(root, namespaces);
1651 static struct list_head *
1652 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1654 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1658 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1659 struct ctl_table_header *prev)
1661 struct ctl_table_root *root;
1662 struct list_head *header_list;
1663 struct ctl_table_header *head;
1664 struct list_head *tmp;
1666 spin_lock(&sysctl_lock);
1669 tmp = &prev->ctl_entry;
1673 tmp = &root_table_header.ctl_entry;
1675 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1677 if (!use_table(head))
1679 spin_unlock(&sysctl_lock);
1684 header_list = lookup_header_list(root, namespaces);
1685 if (tmp != header_list)
1689 root = list_entry(root->root_list.next,
1690 struct ctl_table_root, root_list);
1691 if (root == &sysctl_table_root)
1693 header_list = lookup_header_list(root, namespaces);
1694 } while (list_empty(header_list));
1695 tmp = header_list->next;
1698 spin_unlock(&sysctl_lock);
1702 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1704 return __sysctl_head_next(current->nsproxy, prev);
1707 void register_sysctl_root(struct ctl_table_root *root)
1709 spin_lock(&sysctl_lock);
1710 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1711 spin_unlock(&sysctl_lock);
1715 * sysctl_perm does NOT grant the superuser all rights automatically, because
1716 * some sysctl variables are readonly even to root.
1719 static int test_perm(int mode, int op)
1721 if (!current_euid())
1723 else if (in_egroup_p(0))
1725 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1730 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1734 if (root->permissions)
1735 mode = root->permissions(root, current->nsproxy, table);
1739 return test_perm(mode, op);
1742 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1744 for (; table->procname; table++) {
1745 table->parent = parent;
1747 sysctl_set_parent(table, table->child);
1751 static __init int sysctl_init(void)
1753 sysctl_set_parent(NULL, root_table);
1754 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1755 sysctl_check_table(current->nsproxy, root_table);
1760 core_initcall(sysctl_init);
1762 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1763 struct ctl_table *table)
1765 struct ctl_table *p;
1766 const char *s = branch->procname;
1768 /* branch should have named subdirectory as its first element */
1769 if (!s || !branch->child)
1772 /* ... and nothing else */
1773 if (branch[1].procname)
1776 /* table should contain subdirectory with the same name */
1777 for (p = table; p->procname; p++) {
1780 if (p->procname && strcmp(p->procname, s) == 0)
1786 /* see if attaching q to p would be an improvement */
1787 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1789 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1790 struct ctl_table *next;
1792 int not_in_parent = !p->attached_by;
1794 while ((next = is_branch_in(by, to)) != NULL) {
1795 if (by == q->attached_by)
1797 if (to == p->attached_by)
1803 if (is_better && not_in_parent) {
1804 q->attached_by = by;
1805 q->attached_to = to;
1811 * __register_sysctl_paths - register a sysctl hierarchy
1812 * @root: List of sysctl headers to register on
1813 * @namespaces: Data to compute which lists of sysctl entries are visible
1814 * @path: The path to the directory the sysctl table is in.
1815 * @table: the top-level table structure
1817 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1818 * array. A completely 0 filled entry terminates the table.
1820 * The members of the &struct ctl_table structure are used as follows:
1822 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1823 * enter a sysctl file
1825 * data - a pointer to data for use by proc_handler
1827 * maxlen - the maximum size in bytes of the data
1829 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1831 * child - a pointer to the child sysctl table if this entry is a directory, or
1834 * proc_handler - the text handler routine (described below)
1836 * de - for internal use by the sysctl routines
1838 * extra1, extra2 - extra pointers usable by the proc handler routines
1840 * Leaf nodes in the sysctl tree will be represented by a single file
1841 * under /proc; non-leaf nodes will be represented by directories.
1843 * sysctl(2) can automatically manage read and write requests through
1844 * the sysctl table. The data and maxlen fields of the ctl_table
1845 * struct enable minimal validation of the values being written to be
1846 * performed, and the mode field allows minimal authentication.
1848 * There must be a proc_handler routine for any terminal nodes
1849 * mirrored under /proc/sys (non-terminals are handled by a built-in
1850 * directory handler). Several default handlers are available to
1851 * cover common cases -
1853 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1854 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1855 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1857 * It is the handler's job to read the input buffer from user memory
1858 * and process it. The handler should return 0 on success.
1860 * This routine returns %NULL on a failure to register, and a pointer
1861 * to the table header on success.
1863 struct ctl_table_header *__register_sysctl_paths(
1864 struct ctl_table_root *root,
1865 struct nsproxy *namespaces,
1866 const struct ctl_path *path, struct ctl_table *table)
1868 struct ctl_table_header *header;
1869 struct ctl_table *new, **prevp;
1870 unsigned int n, npath;
1871 struct ctl_table_set *set;
1873 /* Count the path components */
1874 for (npath = 0; path[npath].procname; ++npath)
1878 * For each path component, allocate a 2-element ctl_table array.
1879 * The first array element will be filled with the sysctl entry
1880 * for this, the second will be the sentinel (procname == 0).
1882 * We allocate everything in one go so that we don't have to
1883 * worry about freeing additional memory in unregister_sysctl_table.
1885 header = kzalloc(sizeof(struct ctl_table_header) +
1886 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1890 new = (struct ctl_table *) (header + 1);
1892 /* Now connect the dots */
1893 prevp = &header->ctl_table;
1894 for (n = 0; n < npath; ++n, ++path) {
1895 /* Copy the procname */
1896 new->procname = path->procname;
1900 prevp = &new->child;
1905 header->ctl_table_arg = table;
1907 INIT_LIST_HEAD(&header->ctl_entry);
1909 header->unregistering = NULL;
1910 header->root = root;
1911 sysctl_set_parent(NULL, header->ctl_table);
1913 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1914 if (sysctl_check_table(namespaces, header->ctl_table)) {
1919 spin_lock(&sysctl_lock);
1920 header->set = lookup_header_set(root, namespaces);
1921 header->attached_by = header->ctl_table;
1922 header->attached_to = root_table;
1923 header->parent = &root_table_header;
1924 for (set = header->set; set; set = set->parent) {
1925 struct ctl_table_header *p;
1926 list_for_each_entry(p, &set->list, ctl_entry) {
1927 if (p->unregistering)
1929 try_attach(p, header);
1932 header->parent->count++;
1933 list_add_tail(&header->ctl_entry, &header->set->list);
1934 spin_unlock(&sysctl_lock);
1940 * register_sysctl_table_path - register a sysctl table hierarchy
1941 * @path: The path to the directory the sysctl table is in.
1942 * @table: the top-level table structure
1944 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1945 * array. A completely 0 filled entry terminates the table.
1947 * See __register_sysctl_paths for more details.
1949 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1950 struct ctl_table *table)
1952 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1957 * register_sysctl_table - register a sysctl table hierarchy
1958 * @table: the top-level table structure
1960 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1961 * array. A completely 0 filled entry terminates the table.
1963 * See register_sysctl_paths for more details.
1965 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1967 static const struct ctl_path null_path[] = { {} };
1969 return register_sysctl_paths(null_path, table);
1973 * unregister_sysctl_table - unregister a sysctl table hierarchy
1974 * @header: the header returned from register_sysctl_table
1976 * Unregisters the sysctl table and all children. proc entries may not
1977 * actually be removed until they are no longer used by anyone.
1979 void unregister_sysctl_table(struct ctl_table_header * header)
1986 spin_lock(&sysctl_lock);
1987 start_unregistering(header);
1988 if (!--header->parent->count) {
1990 kfree_rcu(header->parent, rcu);
1992 if (!--header->count)
1993 kfree_rcu(header, rcu);
1994 spin_unlock(&sysctl_lock);
1997 int sysctl_is_seen(struct ctl_table_header *p)
1999 struct ctl_table_set *set = p->set;
2001 spin_lock(&sysctl_lock);
2002 if (p->unregistering)
2004 else if (!set->is_seen)
2007 res = set->is_seen(set);
2008 spin_unlock(&sysctl_lock);
2012 void setup_sysctl_set(struct ctl_table_set *p,
2013 struct ctl_table_set *parent,
2014 int (*is_seen)(struct ctl_table_set *))
2016 INIT_LIST_HEAD(&p->list);
2017 p->parent = parent ? parent : &sysctl_table_root.default_set;
2018 p->is_seen = is_seen;
2021 #else /* !CONFIG_SYSCTL */
2022 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2027 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2028 struct ctl_table *table)
2033 void unregister_sysctl_table(struct ctl_table_header * table)
2037 void setup_sysctl_set(struct ctl_table_set *p,
2038 struct ctl_table_set *parent,
2039 int (*is_seen)(struct ctl_table_set *))
2043 void sysctl_head_put(struct ctl_table_header *head)
2047 #endif /* CONFIG_SYSCTL */
2053 #ifdef CONFIG_PROC_SYSCTL
2055 static int _proc_do_string(void* data, int maxlen, int write,
2056 void __user *buffer,
2057 size_t *lenp, loff_t *ppos)
2063 if (!data || !maxlen || !*lenp) {
2071 while (len < *lenp) {
2072 if (get_user(c, p++))
2074 if (c == 0 || c == '\n')
2080 if(copy_from_user(data, buffer, len))
2082 ((char *) data)[len] = 0;
2100 if(copy_to_user(buffer, data, len))
2103 if(put_user('\n', ((char __user *) buffer) + len))
2114 * proc_dostring - read a string sysctl
2115 * @table: the sysctl table
2116 * @write: %TRUE if this is a write to the sysctl file
2117 * @buffer: the user buffer
2118 * @lenp: the size of the user buffer
2119 * @ppos: file position
2121 * Reads/writes a string from/to the user buffer. If the kernel
2122 * buffer provided is not large enough to hold the string, the
2123 * string is truncated. The copied string is %NULL-terminated.
2124 * If the string is being read by the user process, it is copied
2125 * and a newline '\n' is added. It is truncated if the buffer is
2128 * Returns 0 on success.
2130 int proc_dostring(struct ctl_table *table, int write,
2131 void __user *buffer, size_t *lenp, loff_t *ppos)
2133 return _proc_do_string(table->data, table->maxlen, write,
2134 buffer, lenp, ppos);
2137 static size_t proc_skip_spaces(char **buf)
2140 char *tmp = skip_spaces(*buf);
2146 static void proc_skip_char(char **buf, size_t *size, const char v)
2156 #define TMPBUFLEN 22
2158 * proc_get_long - reads an ASCII formatted integer from a user buffer
2160 * @buf: a kernel buffer
2161 * @size: size of the kernel buffer
2162 * @val: this is where the number will be stored
2163 * @neg: set to %TRUE if number is negative
2164 * @perm_tr: a vector which contains the allowed trailers
2165 * @perm_tr_len: size of the perm_tr vector
2166 * @tr: pointer to store the trailer character
2168 * In case of success %0 is returned and @buf and @size are updated with
2169 * the amount of bytes read. If @tr is non-NULL and a trailing
2170 * character exists (size is non-zero after returning from this
2171 * function), @tr is updated with the trailing character.
2173 static int proc_get_long(char **buf, size_t *size,
2174 unsigned long *val, bool *neg,
2175 const char *perm_tr, unsigned perm_tr_len, char *tr)
2178 char *p, tmp[TMPBUFLEN];
2184 if (len > TMPBUFLEN - 1)
2185 len = TMPBUFLEN - 1;
2187 memcpy(tmp, *buf, len);
2191 if (*p == '-' && *size > 1) {
2199 *val = simple_strtoul(p, &p, 0);
2203 /* We don't know if the next char is whitespace thus we may accept
2204 * invalid integers (e.g. 1234...a) or two integers instead of one
2205 * (e.g. 123...1). So lets not allow such large numbers. */
2206 if (len == TMPBUFLEN - 1)
2209 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2212 if (tr && (len < *size))
2222 * proc_put_long - converts an integer to a decimal ASCII formatted string
2224 * @buf: the user buffer
2225 * @size: the size of the user buffer
2226 * @val: the integer to be converted
2227 * @neg: sign of the number, %TRUE for negative
2229 * In case of success %0 is returned and @buf and @size are updated with
2230 * the amount of bytes written.
2232 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2236 char tmp[TMPBUFLEN], *p = tmp;
2238 sprintf(p, "%s%lu", neg ? "-" : "", val);
2242 if (copy_to_user(*buf, tmp, len))
2250 static int proc_put_char(void __user **buf, size_t *size, char c)
2253 char __user **buffer = (char __user **)buf;
2254 if (put_user(c, *buffer))
2256 (*size)--, (*buffer)++;
2262 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2264 int write, void *data)
2267 *valp = *negp ? -*lvalp : *lvalp;
2272 *lvalp = (unsigned long)-val;
2275 *lvalp = (unsigned long)val;
2281 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2283 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2284 int write, void __user *buffer,
2285 size_t *lenp, loff_t *ppos,
2286 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2287 int write, void *data),
2290 int *i, vleft, first = 1, err = 0;
2291 unsigned long page = 0;
2295 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2300 i = (int *) tbl_data;
2301 vleft = table->maxlen / sizeof(*i);
2305 conv = do_proc_dointvec_conv;
2308 if (left > PAGE_SIZE - 1)
2309 left = PAGE_SIZE - 1;
2310 page = __get_free_page(GFP_TEMPORARY);
2311 kbuf = (char *) page;
2314 if (copy_from_user(kbuf, buffer, left)) {
2321 for (; left && vleft--; i++, first=0) {
2326 left -= proc_skip_spaces(&kbuf);
2330 err = proc_get_long(&kbuf, &left, &lval, &neg,
2332 sizeof(proc_wspace_sep), NULL);
2335 if (conv(&neg, &lval, i, 1, data)) {
2340 if (conv(&neg, &lval, i, 0, data)) {
2345 err = proc_put_char(&buffer, &left, '\t');
2348 err = proc_put_long(&buffer, &left, lval, neg);
2354 if (!write && !first && left && !err)
2355 err = proc_put_char(&buffer, &left, '\n');
2356 if (write && !err && left)
2357 left -= proc_skip_spaces(&kbuf);
2362 return err ? : -EINVAL;
2369 static int do_proc_dointvec(struct ctl_table *table, int write,
2370 void __user *buffer, size_t *lenp, loff_t *ppos,
2371 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2372 int write, void *data),
2375 return __do_proc_dointvec(table->data, table, write,
2376 buffer, lenp, ppos, conv, data);
2380 * proc_dointvec - read a vector of integers
2381 * @table: the sysctl table
2382 * @write: %TRUE if this is a write to the sysctl file
2383 * @buffer: the user buffer
2384 * @lenp: the size of the user buffer
2385 * @ppos: file position
2387 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2388 * values from/to the user buffer, treated as an ASCII string.
2390 * Returns 0 on success.
2392 int proc_dointvec(struct ctl_table *table, int write,
2393 void __user *buffer, size_t *lenp, loff_t *ppos)
2395 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2400 * Taint values can only be increased
2401 * This means we can safely use a temporary.
2403 static int proc_taint(struct ctl_table *table, int write,
2404 void __user *buffer, size_t *lenp, loff_t *ppos)
2407 unsigned long tmptaint = get_taint();
2410 if (write && !capable(CAP_SYS_ADMIN))
2415 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2421 * Poor man's atomic or. Not worth adding a primitive
2422 * to everyone's atomic.h for this
2425 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2426 if ((tmptaint >> i) & 1)
2434 #ifdef CONFIG_PRINTK
2435 static int proc_dmesg_restrict(struct ctl_table *table, int write,
2436 void __user *buffer, size_t *lenp, loff_t *ppos)
2438 if (write && !capable(CAP_SYS_ADMIN))
2441 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2445 struct do_proc_dointvec_minmax_conv_param {
2450 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2452 int write, void *data)
2454 struct do_proc_dointvec_minmax_conv_param *param = data;
2456 int val = *negp ? -*lvalp : *lvalp;
2457 if ((param->min && *param->min > val) ||
2458 (param->max && *param->max < val))
2465 *lvalp = (unsigned long)-val;
2468 *lvalp = (unsigned long)val;
2475 * proc_dointvec_minmax - read a vector of integers with min/max values
2476 * @table: the sysctl table
2477 * @write: %TRUE if this is a write to the sysctl file
2478 * @buffer: the user buffer
2479 * @lenp: the size of the user buffer
2480 * @ppos: file position
2482 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2483 * values from/to the user buffer, treated as an ASCII string.
2485 * This routine will ensure the values are within the range specified by
2486 * table->extra1 (min) and table->extra2 (max).
2488 * Returns 0 on success.
2490 int proc_dointvec_minmax(struct ctl_table *table, int write,
2491 void __user *buffer, size_t *lenp, loff_t *ppos)
2493 struct do_proc_dointvec_minmax_conv_param param = {
2494 .min = (int *) table->extra1,
2495 .max = (int *) table->extra2,
2497 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2498 do_proc_dointvec_minmax_conv, ¶m);
2501 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2502 void __user *buffer,
2503 size_t *lenp, loff_t *ppos,
2504 unsigned long convmul,
2505 unsigned long convdiv)
2507 unsigned long *i, *min, *max;
2508 int vleft, first = 1, err = 0;
2509 unsigned long page = 0;
2513 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2518 i = (unsigned long *) data;
2519 min = (unsigned long *) table->extra1;
2520 max = (unsigned long *) table->extra2;
2521 vleft = table->maxlen / sizeof(unsigned long);
2525 if (left > PAGE_SIZE - 1)
2526 left = PAGE_SIZE - 1;
2527 page = __get_free_page(GFP_TEMPORARY);
2528 kbuf = (char *) page;
2531 if (copy_from_user(kbuf, buffer, left)) {
2538 for (; left && vleft--; i++, first = 0) {
2544 left -= proc_skip_spaces(&kbuf);
2546 err = proc_get_long(&kbuf, &left, &val, &neg,
2548 sizeof(proc_wspace_sep), NULL);
2553 if ((min && val < *min) || (max && val > *max))
2557 val = convdiv * (*i) / convmul;
2559 err = proc_put_char(&buffer, &left, '\t');
2560 err = proc_put_long(&buffer, &left, val, false);
2566 if (!write && !first && left && !err)
2567 err = proc_put_char(&buffer, &left, '\n');
2569 left -= proc_skip_spaces(&kbuf);
2574 return err ? : -EINVAL;
2581 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2582 void __user *buffer,
2583 size_t *lenp, loff_t *ppos,
2584 unsigned long convmul,
2585 unsigned long convdiv)
2587 return __do_proc_doulongvec_minmax(table->data, table, write,
2588 buffer, lenp, ppos, convmul, convdiv);
2592 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2593 * @table: the sysctl table
2594 * @write: %TRUE if this is a write to the sysctl file
2595 * @buffer: the user buffer
2596 * @lenp: the size of the user buffer
2597 * @ppos: file position
2599 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2600 * values from/to the user buffer, treated as an ASCII string.
2602 * This routine will ensure the values are within the range specified by
2603 * table->extra1 (min) and table->extra2 (max).
2605 * Returns 0 on success.
2607 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2608 void __user *buffer, size_t *lenp, loff_t *ppos)
2610 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2614 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2615 * @table: the sysctl table
2616 * @write: %TRUE if this is a write to the sysctl file
2617 * @buffer: the user buffer
2618 * @lenp: the size of the user buffer
2619 * @ppos: file position
2621 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2622 * values from/to the user buffer, treated as an ASCII string. The values
2623 * are treated as milliseconds, and converted to jiffies when they are stored.
2625 * This routine will ensure the values are within the range specified by
2626 * table->extra1 (min) and table->extra2 (max).
2628 * Returns 0 on success.
2630 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2631 void __user *buffer,
2632 size_t *lenp, loff_t *ppos)
2634 return do_proc_doulongvec_minmax(table, write, buffer,
2635 lenp, ppos, HZ, 1000l);
2639 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2641 int write, void *data)
2644 if (*lvalp > LONG_MAX / HZ)
2646 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2652 lval = (unsigned long)-val;
2655 lval = (unsigned long)val;
2662 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2664 int write, void *data)
2667 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2669 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2675 lval = (unsigned long)-val;
2678 lval = (unsigned long)val;
2680 *lvalp = jiffies_to_clock_t(lval);
2685 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2687 int write, void *data)
2690 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2696 lval = (unsigned long)-val;
2699 lval = (unsigned long)val;
2701 *lvalp = jiffies_to_msecs(lval);
2707 * proc_dointvec_jiffies - read a vector of integers as seconds
2708 * @table: the sysctl table
2709 * @write: %TRUE if this is a write to the sysctl file
2710 * @buffer: the user buffer
2711 * @lenp: the size of the user buffer
2712 * @ppos: file position
2714 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2715 * values from/to the user buffer, treated as an ASCII string.
2716 * The values read are assumed to be in seconds, and are converted into
2719 * Returns 0 on success.
2721 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2722 void __user *buffer, size_t *lenp, loff_t *ppos)
2724 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2725 do_proc_dointvec_jiffies_conv,NULL);
2729 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2730 * @table: the sysctl table
2731 * @write: %TRUE if this is a write to the sysctl file
2732 * @buffer: the user buffer
2733 * @lenp: the size of the user buffer
2734 * @ppos: pointer to the file position
2736 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2737 * values from/to the user buffer, treated as an ASCII string.
2738 * The values read are assumed to be in 1/USER_HZ seconds, and
2739 * are converted into jiffies.
2741 * Returns 0 on success.
2743 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2744 void __user *buffer, size_t *lenp, loff_t *ppos)
2746 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2747 do_proc_dointvec_userhz_jiffies_conv,NULL);
2751 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2752 * @table: the sysctl table
2753 * @write: %TRUE if this is a write to the sysctl file
2754 * @buffer: the user buffer
2755 * @lenp: the size of the user buffer
2756 * @ppos: file position
2757 * @ppos: the current position in the file
2759 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2760 * values from/to the user buffer, treated as an ASCII string.
2761 * The values read are assumed to be in 1/1000 seconds, and
2762 * are converted into jiffies.
2764 * Returns 0 on success.
2766 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2767 void __user *buffer, size_t *lenp, loff_t *ppos)
2769 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2770 do_proc_dointvec_ms_jiffies_conv, NULL);
2773 static int proc_do_cad_pid(struct ctl_table *table, int write,
2774 void __user *buffer, size_t *lenp, loff_t *ppos)
2776 struct pid *new_pid;
2780 tmp = pid_vnr(cad_pid);
2782 r = __do_proc_dointvec(&tmp, table, write, buffer,
2783 lenp, ppos, NULL, NULL);
2787 new_pid = find_get_pid(tmp);
2791 put_pid(xchg(&cad_pid, new_pid));
2796 * proc_do_large_bitmap - read/write from/to a large bitmap
2797 * @table: the sysctl table
2798 * @write: %TRUE if this is a write to the sysctl file
2799 * @buffer: the user buffer
2800 * @lenp: the size of the user buffer
2801 * @ppos: file position
2803 * The bitmap is stored at table->data and the bitmap length (in bits)
2806 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2807 * large bitmaps may be represented in a compact manner. Writing into
2808 * the file will clear the bitmap then update it with the given input.
2810 * Returns 0 on success.
2812 int proc_do_large_bitmap(struct ctl_table *table, int write,
2813 void __user *buffer, size_t *lenp, loff_t *ppos)
2817 size_t left = *lenp;
2818 unsigned long bitmap_len = table->maxlen;
2819 unsigned long *bitmap = (unsigned long *) table->data;
2820 unsigned long *tmp_bitmap = NULL;
2821 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2823 if (!bitmap_len || !left || (*ppos && !write)) {
2829 unsigned long page = 0;
2832 if (left > PAGE_SIZE - 1)
2833 left = PAGE_SIZE - 1;
2835 page = __get_free_page(GFP_TEMPORARY);
2836 kbuf = (char *) page;
2839 if (copy_from_user(kbuf, buffer, left)) {
2845 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2851 proc_skip_char(&kbuf, &left, '\n');
2852 while (!err && left) {
2853 unsigned long val_a, val_b;
2856 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2860 if (val_a >= bitmap_len || neg) {
2872 err = proc_get_long(&kbuf, &left, &val_b,
2873 &neg, tr_b, sizeof(tr_b),
2877 if (val_b >= bitmap_len || neg ||
2888 while (val_a <= val_b)
2889 set_bit(val_a++, tmp_bitmap);
2892 proc_skip_char(&kbuf, &left, '\n');
2896 unsigned long bit_a, bit_b = 0;
2899 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2900 if (bit_a >= bitmap_len)
2902 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2906 err = proc_put_char(&buffer, &left, ',');
2910 err = proc_put_long(&buffer, &left, bit_a, false);
2913 if (bit_a != bit_b) {
2914 err = proc_put_char(&buffer, &left, '-');
2917 err = proc_put_long(&buffer, &left, bit_b, false);
2925 err = proc_put_char(&buffer, &left, '\n');
2931 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2933 memcpy(bitmap, tmp_bitmap,
2934 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
2946 #else /* CONFIG_PROC_SYSCTL */
2948 int proc_dostring(struct ctl_table *table, int write,
2949 void __user *buffer, size_t *lenp, loff_t *ppos)
2954 int proc_dointvec(struct ctl_table *table, int write,
2955 void __user *buffer, size_t *lenp, loff_t *ppos)
2960 int proc_dointvec_minmax(struct ctl_table *table, int write,
2961 void __user *buffer, size_t *lenp, loff_t *ppos)
2966 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2967 void __user *buffer, size_t *lenp, loff_t *ppos)
2972 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2973 void __user *buffer, size_t *lenp, loff_t *ppos)
2978 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2979 void __user *buffer, size_t *lenp, loff_t *ppos)
2984 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2985 void __user *buffer, size_t *lenp, loff_t *ppos)
2990 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2991 void __user *buffer,
2992 size_t *lenp, loff_t *ppos)
2998 #endif /* CONFIG_PROC_SYSCTL */
3001 * No sense putting this after each symbol definition, twice,
3002 * exception granted :-)
3004 EXPORT_SYMBOL(proc_dointvec);
3005 EXPORT_SYMBOL(proc_dointvec_jiffies);
3006 EXPORT_SYMBOL(proc_dointvec_minmax);
3007 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3008 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3009 EXPORT_SYMBOL(proc_dostring);
3010 EXPORT_SYMBOL(proc_doulongvec_minmax);
3011 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3012 EXPORT_SYMBOL(register_sysctl_table);
3013 EXPORT_SYMBOL(register_sysctl_paths);
3014 EXPORT_SYMBOL(unregister_sysctl_table);