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>
61 #include <asm/uaccess.h>
62 #include <asm/processor.h>
66 #include <asm/stacktrace.h>
69 #ifdef CONFIG_BSD_PROCESS_ACCT
70 #include <linux/acct.h>
72 #ifdef CONFIG_RT_MUTEXES
73 #include <linux/rtmutex.h>
75 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
76 #include <linux/lockdep.h>
78 #ifdef CONFIG_CHR_DEV_SG
82 #ifdef CONFIG_LOCKUP_DETECTOR
83 #include <linux/nmi.h>
87 #if defined(CONFIG_SYSCTL)
89 /* External variables not in a header file. */
90 extern int sysctl_overcommit_memory;
91 extern int sysctl_overcommit_ratio;
92 extern int max_threads;
93 extern int core_uses_pid;
94 extern int suid_dumpable;
95 extern char core_pattern[];
96 extern unsigned int core_pipe_limit;
98 extern int min_free_kbytes;
99 extern int pid_max_min, pid_max_max;
100 extern int sysctl_drop_caches;
101 extern int percpu_pagelist_fraction;
102 extern int compat_log;
103 extern int latencytop_enabled;
104 extern int sysctl_nr_open_min, sysctl_nr_open_max;
106 extern int sysctl_nr_trim_pages;
109 extern int blk_iopoll_enabled;
112 /* Constants used for minimum and maximum */
113 #ifdef CONFIG_LOCKUP_DETECTOR
114 static int sixty = 60;
115 static int neg_one = -1;
119 static int __maybe_unused one = 1;
120 static int __maybe_unused two = 2;
121 static int __maybe_unused three = 3;
122 static unsigned long one_ul = 1;
123 static int one_hundred = 100;
125 static int ten_thousand = 10000;
128 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
129 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
131 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
132 static int maxolduid = 65535;
133 static int minolduid;
134 static int min_percpu_pagelist_fract = 8;
136 static int ngroups_max = NGROUPS_MAX;
138 #ifdef CONFIG_INOTIFY_USER
139 #include <linux/inotify.h>
142 #include <asm/system.h>
145 #ifdef CONFIG_SPARC64
146 extern int sysctl_tsb_ratio;
150 extern int pwrsw_enabled;
151 extern int unaligned_enabled;
155 extern int no_unaligned_warning;
156 extern int unaligned_dump_stack;
159 #ifdef CONFIG_PROC_SYSCTL
160 static int proc_do_cad_pid(struct ctl_table *table, int write,
161 void __user *buffer, size_t *lenp, loff_t *ppos);
162 static int proc_taint(struct ctl_table *table, int write,
163 void __user *buffer, size_t *lenp, loff_t *ppos);
167 static int proc_dmesg_restrict(struct ctl_table *table, int write,
168 void __user *buffer, size_t *lenp, loff_t *ppos);
171 #ifdef CONFIG_MAGIC_SYSRQ
172 /* Note: sysrq code uses it's own private copy */
173 static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
175 static int sysrq_sysctl_handler(ctl_table *table, int write,
176 void __user *buffer, size_t *lenp,
181 error = proc_dointvec(table, write, buffer, lenp, ppos);
186 sysrq_toggle_support(__sysrq_enabled);
193 static struct ctl_table root_table[];
194 static struct ctl_table_root sysctl_table_root;
195 static struct ctl_table_header root_table_header = {
197 .ctl_table = root_table,
198 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
199 .root = &sysctl_table_root,
200 .set = &sysctl_table_root.default_set,
202 static struct ctl_table_root sysctl_table_root = {
203 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
204 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
207 static struct ctl_table kern_table[];
208 static struct ctl_table vm_table[];
209 static struct ctl_table fs_table[];
210 static struct ctl_table debug_table[];
211 static struct ctl_table dev_table[];
212 extern struct ctl_table random_table[];
214 extern struct ctl_table epoll_table[];
217 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
218 int sysctl_legacy_va_layout;
221 /* The default sysctl tables: */
223 static struct ctl_table root_table[] = {
225 .procname = "kernel",
242 .child = debug_table,
252 #ifdef CONFIG_SCHED_DEBUG
253 static int min_sched_granularity_ns = 100000; /* 100 usecs */
254 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
255 static int min_wakeup_granularity_ns; /* 0 usecs */
256 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
257 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
258 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
261 #ifdef CONFIG_COMPACTION
262 static int min_extfrag_threshold;
263 static int max_extfrag_threshold = 1000;
266 static struct ctl_table kern_table[] = {
268 .procname = "sched_child_runs_first",
269 .data = &sysctl_sched_child_runs_first,
270 .maxlen = sizeof(unsigned int),
272 .proc_handler = proc_dointvec,
274 #ifdef CONFIG_SCHED_DEBUG
276 .procname = "sched_min_granularity_ns",
277 .data = &sysctl_sched_min_granularity,
278 .maxlen = sizeof(unsigned int),
280 .proc_handler = sched_proc_update_handler,
281 .extra1 = &min_sched_granularity_ns,
282 .extra2 = &max_sched_granularity_ns,
285 .procname = "sched_latency_ns",
286 .data = &sysctl_sched_latency,
287 .maxlen = sizeof(unsigned int),
289 .proc_handler = sched_proc_update_handler,
290 .extra1 = &min_sched_granularity_ns,
291 .extra2 = &max_sched_granularity_ns,
294 .procname = "sched_wakeup_granularity_ns",
295 .data = &sysctl_sched_wakeup_granularity,
296 .maxlen = sizeof(unsigned int),
298 .proc_handler = sched_proc_update_handler,
299 .extra1 = &min_wakeup_granularity_ns,
300 .extra2 = &max_wakeup_granularity_ns,
303 .procname = "sched_tunable_scaling",
304 .data = &sysctl_sched_tunable_scaling,
305 .maxlen = sizeof(enum sched_tunable_scaling),
307 .proc_handler = sched_proc_update_handler,
308 .extra1 = &min_sched_tunable_scaling,
309 .extra2 = &max_sched_tunable_scaling,
312 .procname = "sched_migration_cost",
313 .data = &sysctl_sched_migration_cost,
314 .maxlen = sizeof(unsigned int),
316 .proc_handler = proc_dointvec,
319 .procname = "sched_nr_migrate",
320 .data = &sysctl_sched_nr_migrate,
321 .maxlen = sizeof(unsigned int),
323 .proc_handler = proc_dointvec,
326 .procname = "sched_time_avg",
327 .data = &sysctl_sched_time_avg,
328 .maxlen = sizeof(unsigned int),
330 .proc_handler = proc_dointvec,
333 .procname = "sched_shares_window",
334 .data = &sysctl_sched_shares_window,
335 .maxlen = sizeof(unsigned int),
337 .proc_handler = proc_dointvec,
340 .procname = "timer_migration",
341 .data = &sysctl_timer_migration,
342 .maxlen = sizeof(unsigned int),
344 .proc_handler = proc_dointvec_minmax,
350 .procname = "sched_rt_period_us",
351 .data = &sysctl_sched_rt_period,
352 .maxlen = sizeof(unsigned int),
354 .proc_handler = sched_rt_handler,
357 .procname = "sched_rt_runtime_us",
358 .data = &sysctl_sched_rt_runtime,
359 .maxlen = sizeof(int),
361 .proc_handler = sched_rt_handler,
363 #ifdef CONFIG_SCHED_AUTOGROUP
365 .procname = "sched_autogroup_enabled",
366 .data = &sysctl_sched_autogroup_enabled,
367 .maxlen = sizeof(unsigned int),
369 .proc_handler = proc_dointvec_minmax,
374 #ifdef CONFIG_CFS_BANDWIDTH
376 .procname = "sched_cfs_bandwidth_slice_us",
377 .data = &sysctl_sched_cfs_bandwidth_slice,
378 .maxlen = sizeof(unsigned int),
380 .proc_handler = proc_dointvec_minmax,
384 #ifdef CONFIG_PROVE_LOCKING
386 .procname = "prove_locking",
387 .data = &prove_locking,
388 .maxlen = sizeof(int),
390 .proc_handler = proc_dointvec,
393 #ifdef CONFIG_LOCK_STAT
395 .procname = "lock_stat",
397 .maxlen = sizeof(int),
399 .proc_handler = proc_dointvec,
404 .data = &panic_timeout,
405 .maxlen = sizeof(int),
407 .proc_handler = proc_dointvec,
410 .procname = "core_uses_pid",
411 .data = &core_uses_pid,
412 .maxlen = sizeof(int),
414 .proc_handler = proc_dointvec,
417 .procname = "core_pattern",
418 .data = core_pattern,
419 .maxlen = CORENAME_MAX_SIZE,
421 .proc_handler = proc_dostring,
424 .procname = "core_pipe_limit",
425 .data = &core_pipe_limit,
426 .maxlen = sizeof(unsigned int),
428 .proc_handler = proc_dointvec,
430 #ifdef CONFIG_PROC_SYSCTL
432 .procname = "tainted",
433 .maxlen = sizeof(long),
435 .proc_handler = proc_taint,
438 #ifdef CONFIG_LATENCYTOP
440 .procname = "latencytop",
441 .data = &latencytop_enabled,
442 .maxlen = sizeof(int),
444 .proc_handler = proc_dointvec,
447 #ifdef CONFIG_BLK_DEV_INITRD
449 .procname = "real-root-dev",
450 .data = &real_root_dev,
451 .maxlen = sizeof(int),
453 .proc_handler = proc_dointvec,
457 .procname = "print-fatal-signals",
458 .data = &print_fatal_signals,
459 .maxlen = sizeof(int),
461 .proc_handler = proc_dointvec,
465 .procname = "reboot-cmd",
466 .data = reboot_command,
469 .proc_handler = proc_dostring,
472 .procname = "stop-a",
473 .data = &stop_a_enabled,
474 .maxlen = sizeof (int),
476 .proc_handler = proc_dointvec,
479 .procname = "scons-poweroff",
480 .data = &scons_pwroff,
481 .maxlen = sizeof (int),
483 .proc_handler = proc_dointvec,
486 #ifdef CONFIG_SPARC64
488 .procname = "tsb-ratio",
489 .data = &sysctl_tsb_ratio,
490 .maxlen = sizeof (int),
492 .proc_handler = proc_dointvec,
497 .procname = "soft-power",
498 .data = &pwrsw_enabled,
499 .maxlen = sizeof (int),
501 .proc_handler = proc_dointvec,
504 .procname = "unaligned-trap",
505 .data = &unaligned_enabled,
506 .maxlen = sizeof (int),
508 .proc_handler = proc_dointvec,
512 .procname = "ctrl-alt-del",
514 .maxlen = sizeof(int),
516 .proc_handler = proc_dointvec,
518 #ifdef CONFIG_FUNCTION_TRACER
520 .procname = "ftrace_enabled",
521 .data = &ftrace_enabled,
522 .maxlen = sizeof(int),
524 .proc_handler = ftrace_enable_sysctl,
527 #ifdef CONFIG_STACK_TRACER
529 .procname = "stack_tracer_enabled",
530 .data = &stack_tracer_enabled,
531 .maxlen = sizeof(int),
533 .proc_handler = stack_trace_sysctl,
536 #ifdef CONFIG_TRACING
538 .procname = "ftrace_dump_on_oops",
539 .data = &ftrace_dump_on_oops,
540 .maxlen = sizeof(int),
542 .proc_handler = proc_dointvec,
545 #ifdef CONFIG_MODULES
547 .procname = "modprobe",
548 .data = &modprobe_path,
549 .maxlen = KMOD_PATH_LEN,
551 .proc_handler = proc_dostring,
554 .procname = "modules_disabled",
555 .data = &modules_disabled,
556 .maxlen = sizeof(int),
558 /* only handle a transition from default "0" to "1" */
559 .proc_handler = proc_dointvec_minmax,
564 #ifdef CONFIG_HOTPLUG
566 .procname = "hotplug",
567 .data = &uevent_helper,
568 .maxlen = UEVENT_HELPER_PATH_LEN,
570 .proc_handler = proc_dostring,
573 #ifdef CONFIG_CHR_DEV_SG
575 .procname = "sg-big-buff",
576 .data = &sg_big_buff,
577 .maxlen = sizeof (int),
579 .proc_handler = proc_dointvec,
582 #ifdef CONFIG_BSD_PROCESS_ACCT
586 .maxlen = 3*sizeof(int),
588 .proc_handler = proc_dointvec,
591 #ifdef CONFIG_MAGIC_SYSRQ
594 .data = &__sysrq_enabled,
595 .maxlen = sizeof (int),
597 .proc_handler = sysrq_sysctl_handler,
600 #ifdef CONFIG_PROC_SYSCTL
602 .procname = "cad_pid",
604 .maxlen = sizeof (int),
606 .proc_handler = proc_do_cad_pid,
610 .procname = "threads-max",
611 .data = &max_threads,
612 .maxlen = sizeof(int),
614 .proc_handler = proc_dointvec,
617 .procname = "random",
619 .child = random_table,
622 .procname = "usermodehelper",
624 .child = usermodehelper_table,
627 .procname = "overflowuid",
628 .data = &overflowuid,
629 .maxlen = sizeof(int),
631 .proc_handler = proc_dointvec_minmax,
632 .extra1 = &minolduid,
633 .extra2 = &maxolduid,
636 .procname = "overflowgid",
637 .data = &overflowgid,
638 .maxlen = sizeof(int),
640 .proc_handler = proc_dointvec_minmax,
641 .extra1 = &minolduid,
642 .extra2 = &maxolduid,
645 #ifdef CONFIG_MATHEMU
647 .procname = "ieee_emulation_warnings",
648 .data = &sysctl_ieee_emulation_warnings,
649 .maxlen = sizeof(int),
651 .proc_handler = proc_dointvec,
655 .procname = "userprocess_debug",
656 .data = &show_unhandled_signals,
657 .maxlen = sizeof(int),
659 .proc_handler = proc_dointvec,
663 .procname = "pid_max",
665 .maxlen = sizeof (int),
667 .proc_handler = proc_dointvec_minmax,
668 .extra1 = &pid_max_min,
669 .extra2 = &pid_max_max,
672 .procname = "panic_on_oops",
673 .data = &panic_on_oops,
674 .maxlen = sizeof(int),
676 .proc_handler = proc_dointvec,
678 #if defined CONFIG_PRINTK
680 .procname = "printk",
681 .data = &console_loglevel,
682 .maxlen = 4*sizeof(int),
684 .proc_handler = proc_dointvec,
687 .procname = "printk_ratelimit",
688 .data = &printk_ratelimit_state.interval,
689 .maxlen = sizeof(int),
691 .proc_handler = proc_dointvec_jiffies,
694 .procname = "printk_ratelimit_burst",
695 .data = &printk_ratelimit_state.burst,
696 .maxlen = sizeof(int),
698 .proc_handler = proc_dointvec,
701 .procname = "printk_delay",
702 .data = &printk_delay_msec,
703 .maxlen = sizeof(int),
705 .proc_handler = proc_dointvec_minmax,
707 .extra2 = &ten_thousand,
710 .procname = "dmesg_restrict",
711 .data = &dmesg_restrict,
712 .maxlen = sizeof(int),
714 .proc_handler = proc_dointvec_minmax,
719 .procname = "kptr_restrict",
720 .data = &kptr_restrict,
721 .maxlen = sizeof(int),
723 .proc_handler = proc_dmesg_restrict,
729 .procname = "ngroups_max",
730 .data = &ngroups_max,
731 .maxlen = sizeof (int),
733 .proc_handler = proc_dointvec,
735 #if defined(CONFIG_LOCKUP_DETECTOR)
737 .procname = "watchdog",
738 .data = &watchdog_enabled,
739 .maxlen = sizeof (int),
741 .proc_handler = proc_dowatchdog,
746 .procname = "watchdog_thresh",
747 .data = &watchdog_thresh,
748 .maxlen = sizeof(int),
750 .proc_handler = proc_dowatchdog,
755 .procname = "softlockup_panic",
756 .data = &softlockup_panic,
757 .maxlen = sizeof(int),
759 .proc_handler = proc_dointvec_minmax,
764 .procname = "nmi_watchdog",
765 .data = &watchdog_enabled,
766 .maxlen = sizeof (int),
768 .proc_handler = proc_dowatchdog,
773 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
775 .procname = "unknown_nmi_panic",
776 .data = &unknown_nmi_panic,
777 .maxlen = sizeof (int),
779 .proc_handler = proc_dointvec,
782 #if defined(CONFIG_X86)
784 .procname = "panic_on_unrecovered_nmi",
785 .data = &panic_on_unrecovered_nmi,
786 .maxlen = sizeof(int),
788 .proc_handler = proc_dointvec,
791 .procname = "panic_on_io_nmi",
792 .data = &panic_on_io_nmi,
793 .maxlen = sizeof(int),
795 .proc_handler = proc_dointvec,
798 .procname = "bootloader_type",
799 .data = &bootloader_type,
800 .maxlen = sizeof (int),
802 .proc_handler = proc_dointvec,
805 .procname = "bootloader_version",
806 .data = &bootloader_version,
807 .maxlen = sizeof (int),
809 .proc_handler = proc_dointvec,
812 .procname = "kstack_depth_to_print",
813 .data = &kstack_depth_to_print,
814 .maxlen = sizeof(int),
816 .proc_handler = proc_dointvec,
819 .procname = "io_delay_type",
820 .data = &io_delay_type,
821 .maxlen = sizeof(int),
823 .proc_handler = proc_dointvec,
826 #if defined(CONFIG_MMU)
828 .procname = "randomize_va_space",
829 .data = &randomize_va_space,
830 .maxlen = sizeof(int),
832 .proc_handler = proc_dointvec,
835 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
837 .procname = "spin_retry",
839 .maxlen = sizeof (int),
841 .proc_handler = proc_dointvec,
844 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
846 .procname = "acpi_video_flags",
847 .data = &acpi_realmode_flags,
848 .maxlen = sizeof (unsigned long),
850 .proc_handler = proc_doulongvec_minmax,
855 .procname = "ignore-unaligned-usertrap",
856 .data = &no_unaligned_warning,
857 .maxlen = sizeof (int),
859 .proc_handler = proc_dointvec,
862 .procname = "unaligned-dump-stack",
863 .data = &unaligned_dump_stack,
864 .maxlen = sizeof (int),
866 .proc_handler = proc_dointvec,
869 #ifdef CONFIG_DETECT_HUNG_TASK
871 .procname = "hung_task_panic",
872 .data = &sysctl_hung_task_panic,
873 .maxlen = sizeof(int),
875 .proc_handler = proc_dointvec_minmax,
880 .procname = "hung_task_check_count",
881 .data = &sysctl_hung_task_check_count,
882 .maxlen = sizeof(unsigned long),
884 .proc_handler = proc_doulongvec_minmax,
887 .procname = "hung_task_timeout_secs",
888 .data = &sysctl_hung_task_timeout_secs,
889 .maxlen = sizeof(unsigned long),
891 .proc_handler = proc_dohung_task_timeout_secs,
894 .procname = "hung_task_warnings",
895 .data = &sysctl_hung_task_warnings,
896 .maxlen = sizeof(unsigned long),
898 .proc_handler = proc_doulongvec_minmax,
903 .procname = "compat-log",
905 .maxlen = sizeof (int),
907 .proc_handler = proc_dointvec,
910 #ifdef CONFIG_RT_MUTEXES
912 .procname = "max_lock_depth",
913 .data = &max_lock_depth,
914 .maxlen = sizeof(int),
916 .proc_handler = proc_dointvec,
920 .procname = "poweroff_cmd",
921 .data = &poweroff_cmd,
922 .maxlen = POWEROFF_CMD_PATH_LEN,
924 .proc_handler = proc_dostring,
930 .child = key_sysctls,
933 #ifdef CONFIG_RCU_TORTURE_TEST
935 .procname = "rcutorture_runnable",
936 .data = &rcutorture_runnable,
937 .maxlen = sizeof(int),
939 .proc_handler = proc_dointvec,
942 #ifdef CONFIG_PERF_EVENTS
944 * User-space scripts rely on the existence of this file
945 * as a feature check for perf_events being enabled.
947 * So it's an ABI, do not remove!
950 .procname = "perf_event_paranoid",
951 .data = &sysctl_perf_event_paranoid,
952 .maxlen = sizeof(sysctl_perf_event_paranoid),
954 .proc_handler = proc_dointvec,
957 .procname = "perf_event_mlock_kb",
958 .data = &sysctl_perf_event_mlock,
959 .maxlen = sizeof(sysctl_perf_event_mlock),
961 .proc_handler = proc_dointvec,
964 .procname = "perf_event_max_sample_rate",
965 .data = &sysctl_perf_event_sample_rate,
966 .maxlen = sizeof(sysctl_perf_event_sample_rate),
968 .proc_handler = perf_proc_update_handler,
971 #ifdef CONFIG_KMEMCHECK
973 .procname = "kmemcheck",
974 .data = &kmemcheck_enabled,
975 .maxlen = sizeof(int),
977 .proc_handler = proc_dointvec,
982 .procname = "blk_iopoll",
983 .data = &blk_iopoll_enabled,
984 .maxlen = sizeof(int),
986 .proc_handler = proc_dointvec,
992 static struct ctl_table vm_table[] = {
994 .procname = "overcommit_memory",
995 .data = &sysctl_overcommit_memory,
996 .maxlen = sizeof(sysctl_overcommit_memory),
998 .proc_handler = proc_dointvec_minmax,
1003 .procname = "panic_on_oom",
1004 .data = &sysctl_panic_on_oom,
1005 .maxlen = sizeof(sysctl_panic_on_oom),
1007 .proc_handler = proc_dointvec_minmax,
1012 .procname = "oom_kill_allocating_task",
1013 .data = &sysctl_oom_kill_allocating_task,
1014 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1016 .proc_handler = proc_dointvec,
1019 .procname = "oom_dump_tasks",
1020 .data = &sysctl_oom_dump_tasks,
1021 .maxlen = sizeof(sysctl_oom_dump_tasks),
1023 .proc_handler = proc_dointvec,
1026 .procname = "overcommit_ratio",
1027 .data = &sysctl_overcommit_ratio,
1028 .maxlen = sizeof(sysctl_overcommit_ratio),
1030 .proc_handler = proc_dointvec,
1033 .procname = "page-cluster",
1034 .data = &page_cluster,
1035 .maxlen = sizeof(int),
1037 .proc_handler = proc_dointvec_minmax,
1041 .procname = "dirty_background_ratio",
1042 .data = &dirty_background_ratio,
1043 .maxlen = sizeof(dirty_background_ratio),
1045 .proc_handler = dirty_background_ratio_handler,
1047 .extra2 = &one_hundred,
1050 .procname = "dirty_background_bytes",
1051 .data = &dirty_background_bytes,
1052 .maxlen = sizeof(dirty_background_bytes),
1054 .proc_handler = dirty_background_bytes_handler,
1058 .procname = "dirty_ratio",
1059 .data = &vm_dirty_ratio,
1060 .maxlen = sizeof(vm_dirty_ratio),
1062 .proc_handler = dirty_ratio_handler,
1064 .extra2 = &one_hundred,
1067 .procname = "dirty_bytes",
1068 .data = &vm_dirty_bytes,
1069 .maxlen = sizeof(vm_dirty_bytes),
1071 .proc_handler = dirty_bytes_handler,
1072 .extra1 = &dirty_bytes_min,
1075 .procname = "dirty_writeback_centisecs",
1076 .data = &dirty_writeback_interval,
1077 .maxlen = sizeof(dirty_writeback_interval),
1079 .proc_handler = dirty_writeback_centisecs_handler,
1082 .procname = "dirty_expire_centisecs",
1083 .data = &dirty_expire_interval,
1084 .maxlen = sizeof(dirty_expire_interval),
1086 .proc_handler = proc_dointvec_minmax,
1090 .procname = "nr_pdflush_threads",
1091 .data = &nr_pdflush_threads,
1092 .maxlen = sizeof nr_pdflush_threads,
1093 .mode = 0444 /* read-only*/,
1094 .proc_handler = proc_dointvec,
1097 .procname = "swappiness",
1098 .data = &vm_swappiness,
1099 .maxlen = sizeof(vm_swappiness),
1101 .proc_handler = proc_dointvec_minmax,
1103 .extra2 = &one_hundred,
1105 #ifdef CONFIG_HUGETLB_PAGE
1107 .procname = "nr_hugepages",
1109 .maxlen = sizeof(unsigned long),
1111 .proc_handler = hugetlb_sysctl_handler,
1112 .extra1 = (void *)&hugetlb_zero,
1113 .extra2 = (void *)&hugetlb_infinity,
1117 .procname = "nr_hugepages_mempolicy",
1119 .maxlen = sizeof(unsigned long),
1121 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1122 .extra1 = (void *)&hugetlb_zero,
1123 .extra2 = (void *)&hugetlb_infinity,
1127 .procname = "hugetlb_shm_group",
1128 .data = &sysctl_hugetlb_shm_group,
1129 .maxlen = sizeof(gid_t),
1131 .proc_handler = proc_dointvec,
1134 .procname = "hugepages_treat_as_movable",
1135 .data = &hugepages_treat_as_movable,
1136 .maxlen = sizeof(int),
1138 .proc_handler = hugetlb_treat_movable_handler,
1141 .procname = "nr_overcommit_hugepages",
1143 .maxlen = sizeof(unsigned long),
1145 .proc_handler = hugetlb_overcommit_handler,
1146 .extra1 = (void *)&hugetlb_zero,
1147 .extra2 = (void *)&hugetlb_infinity,
1151 .procname = "lowmem_reserve_ratio",
1152 .data = &sysctl_lowmem_reserve_ratio,
1153 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1155 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1158 .procname = "drop_caches",
1159 .data = &sysctl_drop_caches,
1160 .maxlen = sizeof(int),
1162 .proc_handler = drop_caches_sysctl_handler,
1166 #ifdef CONFIG_COMPACTION
1168 .procname = "compact_memory",
1169 .data = &sysctl_compact_memory,
1170 .maxlen = sizeof(int),
1172 .proc_handler = sysctl_compaction_handler,
1175 .procname = "extfrag_threshold",
1176 .data = &sysctl_extfrag_threshold,
1177 .maxlen = sizeof(int),
1179 .proc_handler = sysctl_extfrag_handler,
1180 .extra1 = &min_extfrag_threshold,
1181 .extra2 = &max_extfrag_threshold,
1184 #endif /* CONFIG_COMPACTION */
1186 .procname = "min_free_kbytes",
1187 .data = &min_free_kbytes,
1188 .maxlen = sizeof(min_free_kbytes),
1190 .proc_handler = min_free_kbytes_sysctl_handler,
1194 .procname = "percpu_pagelist_fraction",
1195 .data = &percpu_pagelist_fraction,
1196 .maxlen = sizeof(percpu_pagelist_fraction),
1198 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1199 .extra1 = &min_percpu_pagelist_fract,
1203 .procname = "max_map_count",
1204 .data = &sysctl_max_map_count,
1205 .maxlen = sizeof(sysctl_max_map_count),
1207 .proc_handler = proc_dointvec_minmax,
1212 .procname = "nr_trim_pages",
1213 .data = &sysctl_nr_trim_pages,
1214 .maxlen = sizeof(sysctl_nr_trim_pages),
1216 .proc_handler = proc_dointvec_minmax,
1221 .procname = "laptop_mode",
1222 .data = &laptop_mode,
1223 .maxlen = sizeof(laptop_mode),
1225 .proc_handler = proc_dointvec_jiffies,
1228 .procname = "block_dump",
1229 .data = &block_dump,
1230 .maxlen = sizeof(block_dump),
1232 .proc_handler = proc_dointvec,
1236 .procname = "vfs_cache_pressure",
1237 .data = &sysctl_vfs_cache_pressure,
1238 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1240 .proc_handler = proc_dointvec,
1243 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1245 .procname = "legacy_va_layout",
1246 .data = &sysctl_legacy_va_layout,
1247 .maxlen = sizeof(sysctl_legacy_va_layout),
1249 .proc_handler = proc_dointvec,
1255 .procname = "zone_reclaim_mode",
1256 .data = &zone_reclaim_mode,
1257 .maxlen = sizeof(zone_reclaim_mode),
1259 .proc_handler = proc_dointvec,
1263 .procname = "min_unmapped_ratio",
1264 .data = &sysctl_min_unmapped_ratio,
1265 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1267 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1269 .extra2 = &one_hundred,
1272 .procname = "min_slab_ratio",
1273 .data = &sysctl_min_slab_ratio,
1274 .maxlen = sizeof(sysctl_min_slab_ratio),
1276 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1278 .extra2 = &one_hundred,
1283 .procname = "stat_interval",
1284 .data = &sysctl_stat_interval,
1285 .maxlen = sizeof(sysctl_stat_interval),
1287 .proc_handler = proc_dointvec_jiffies,
1292 .procname = "mmap_min_addr",
1293 .data = &dac_mmap_min_addr,
1294 .maxlen = sizeof(unsigned long),
1296 .proc_handler = mmap_min_addr_handler,
1301 .procname = "numa_zonelist_order",
1302 .data = &numa_zonelist_order,
1303 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1305 .proc_handler = numa_zonelist_order_handler,
1308 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1309 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1311 .procname = "vdso_enabled",
1312 .data = &vdso_enabled,
1313 .maxlen = sizeof(vdso_enabled),
1315 .proc_handler = proc_dointvec,
1319 #ifdef CONFIG_HIGHMEM
1321 .procname = "highmem_is_dirtyable",
1322 .data = &vm_highmem_is_dirtyable,
1323 .maxlen = sizeof(vm_highmem_is_dirtyable),
1325 .proc_handler = proc_dointvec_minmax,
1331 .procname = "scan_unevictable_pages",
1332 .data = &scan_unevictable_pages,
1333 .maxlen = sizeof(scan_unevictable_pages),
1335 .proc_handler = scan_unevictable_handler,
1337 #ifdef CONFIG_MEMORY_FAILURE
1339 .procname = "memory_failure_early_kill",
1340 .data = &sysctl_memory_failure_early_kill,
1341 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1343 .proc_handler = proc_dointvec_minmax,
1348 .procname = "memory_failure_recovery",
1349 .data = &sysctl_memory_failure_recovery,
1350 .maxlen = sizeof(sysctl_memory_failure_recovery),
1352 .proc_handler = proc_dointvec_minmax,
1360 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1361 static struct ctl_table binfmt_misc_table[] = {
1366 static struct ctl_table fs_table[] = {
1368 .procname = "inode-nr",
1369 .data = &inodes_stat,
1370 .maxlen = 2*sizeof(int),
1372 .proc_handler = proc_nr_inodes,
1375 .procname = "inode-state",
1376 .data = &inodes_stat,
1377 .maxlen = 7*sizeof(int),
1379 .proc_handler = proc_nr_inodes,
1382 .procname = "file-nr",
1383 .data = &files_stat,
1384 .maxlen = sizeof(files_stat),
1386 .proc_handler = proc_nr_files,
1389 .procname = "file-max",
1390 .data = &files_stat.max_files,
1391 .maxlen = sizeof(files_stat.max_files),
1393 .proc_handler = proc_doulongvec_minmax,
1396 .procname = "nr_open",
1397 .data = &sysctl_nr_open,
1398 .maxlen = sizeof(int),
1400 .proc_handler = proc_dointvec_minmax,
1401 .extra1 = &sysctl_nr_open_min,
1402 .extra2 = &sysctl_nr_open_max,
1405 .procname = "dentry-state",
1406 .data = &dentry_stat,
1407 .maxlen = 6*sizeof(int),
1409 .proc_handler = proc_nr_dentry,
1412 .procname = "overflowuid",
1413 .data = &fs_overflowuid,
1414 .maxlen = sizeof(int),
1416 .proc_handler = proc_dointvec_minmax,
1417 .extra1 = &minolduid,
1418 .extra2 = &maxolduid,
1421 .procname = "overflowgid",
1422 .data = &fs_overflowgid,
1423 .maxlen = sizeof(int),
1425 .proc_handler = proc_dointvec_minmax,
1426 .extra1 = &minolduid,
1427 .extra2 = &maxolduid,
1429 #ifdef CONFIG_FILE_LOCKING
1431 .procname = "leases-enable",
1432 .data = &leases_enable,
1433 .maxlen = sizeof(int),
1435 .proc_handler = proc_dointvec,
1438 #ifdef CONFIG_DNOTIFY
1440 .procname = "dir-notify-enable",
1441 .data = &dir_notify_enable,
1442 .maxlen = sizeof(int),
1444 .proc_handler = proc_dointvec,
1448 #ifdef CONFIG_FILE_LOCKING
1450 .procname = "lease-break-time",
1451 .data = &lease_break_time,
1452 .maxlen = sizeof(int),
1454 .proc_handler = proc_dointvec,
1459 .procname = "aio-nr",
1461 .maxlen = sizeof(aio_nr),
1463 .proc_handler = proc_doulongvec_minmax,
1466 .procname = "aio-max-nr",
1467 .data = &aio_max_nr,
1468 .maxlen = sizeof(aio_max_nr),
1470 .proc_handler = proc_doulongvec_minmax,
1472 #endif /* CONFIG_AIO */
1473 #ifdef CONFIG_INOTIFY_USER
1475 .procname = "inotify",
1477 .child = inotify_table,
1482 .procname = "epoll",
1484 .child = epoll_table,
1489 .procname = "suid_dumpable",
1490 .data = &suid_dumpable,
1491 .maxlen = sizeof(int),
1493 .proc_handler = proc_dointvec_minmax,
1497 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1499 .procname = "binfmt_misc",
1501 .child = binfmt_misc_table,
1505 .procname = "pipe-max-size",
1506 .data = &pipe_max_size,
1507 .maxlen = sizeof(int),
1509 .proc_handler = &pipe_proc_fn,
1510 .extra1 = &pipe_min_size,
1515 static struct ctl_table debug_table[] = {
1516 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
1517 defined(CONFIG_S390) || defined(CONFIG_TILE)
1519 .procname = "exception-trace",
1520 .data = &show_unhandled_signals,
1521 .maxlen = sizeof(int),
1523 .proc_handler = proc_dointvec
1526 #if defined(CONFIG_OPTPROBES)
1528 .procname = "kprobes-optimization",
1529 .data = &sysctl_kprobes_optimization,
1530 .maxlen = sizeof(int),
1532 .proc_handler = proc_kprobes_optimization_handler,
1540 static struct ctl_table dev_table[] = {
1544 static DEFINE_SPINLOCK(sysctl_lock);
1546 /* called under sysctl_lock */
1547 static int use_table(struct ctl_table_header *p)
1549 if (unlikely(p->unregistering))
1555 /* called under sysctl_lock */
1556 static void unuse_table(struct ctl_table_header *p)
1559 if (unlikely(p->unregistering))
1560 complete(p->unregistering);
1563 /* called under sysctl_lock, will reacquire if has to wait */
1564 static void start_unregistering(struct ctl_table_header *p)
1567 * if p->used is 0, nobody will ever touch that entry again;
1568 * we'll eliminate all paths to it before dropping sysctl_lock
1570 if (unlikely(p->used)) {
1571 struct completion wait;
1572 init_completion(&wait);
1573 p->unregistering = &wait;
1574 spin_unlock(&sysctl_lock);
1575 wait_for_completion(&wait);
1576 spin_lock(&sysctl_lock);
1578 /* anything non-NULL; we'll never dereference it */
1579 p->unregistering = ERR_PTR(-EINVAL);
1582 * do not remove from the list until nobody holds it; walking the
1583 * list in do_sysctl() relies on that.
1585 list_del_init(&p->ctl_entry);
1588 void sysctl_head_get(struct ctl_table_header *head)
1590 spin_lock(&sysctl_lock);
1592 spin_unlock(&sysctl_lock);
1595 void sysctl_head_put(struct ctl_table_header *head)
1597 spin_lock(&sysctl_lock);
1599 kfree_rcu(head, rcu);
1600 spin_unlock(&sysctl_lock);
1603 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1607 spin_lock(&sysctl_lock);
1608 if (!use_table(head))
1609 head = ERR_PTR(-ENOENT);
1610 spin_unlock(&sysctl_lock);
1614 void sysctl_head_finish(struct ctl_table_header *head)
1618 spin_lock(&sysctl_lock);
1620 spin_unlock(&sysctl_lock);
1623 static struct ctl_table_set *
1624 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1626 struct ctl_table_set *set = &root->default_set;
1628 set = root->lookup(root, namespaces);
1632 static struct list_head *
1633 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1635 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1639 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1640 struct ctl_table_header *prev)
1642 struct ctl_table_root *root;
1643 struct list_head *header_list;
1644 struct ctl_table_header *head;
1645 struct list_head *tmp;
1647 spin_lock(&sysctl_lock);
1650 tmp = &prev->ctl_entry;
1654 tmp = &root_table_header.ctl_entry;
1656 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1658 if (!use_table(head))
1660 spin_unlock(&sysctl_lock);
1665 header_list = lookup_header_list(root, namespaces);
1666 if (tmp != header_list)
1670 root = list_entry(root->root_list.next,
1671 struct ctl_table_root, root_list);
1672 if (root == &sysctl_table_root)
1674 header_list = lookup_header_list(root, namespaces);
1675 } while (list_empty(header_list));
1676 tmp = header_list->next;
1679 spin_unlock(&sysctl_lock);
1683 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1685 return __sysctl_head_next(current->nsproxy, prev);
1688 void register_sysctl_root(struct ctl_table_root *root)
1690 spin_lock(&sysctl_lock);
1691 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1692 spin_unlock(&sysctl_lock);
1696 * sysctl_perm does NOT grant the superuser all rights automatically, because
1697 * some sysctl variables are readonly even to root.
1700 static int test_perm(int mode, int op)
1702 if (!current_euid())
1704 else if (in_egroup_p(0))
1706 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1711 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1715 if (root->permissions)
1716 mode = root->permissions(root, current->nsproxy, table);
1720 return test_perm(mode, op);
1723 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1725 for (; table->procname; table++) {
1726 table->parent = parent;
1728 sysctl_set_parent(table, table->child);
1732 static __init int sysctl_init(void)
1734 sysctl_set_parent(NULL, root_table);
1735 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1736 sysctl_check_table(current->nsproxy, root_table);
1741 core_initcall(sysctl_init);
1743 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1744 struct ctl_table *table)
1746 struct ctl_table *p;
1747 const char *s = branch->procname;
1749 /* branch should have named subdirectory as its first element */
1750 if (!s || !branch->child)
1753 /* ... and nothing else */
1754 if (branch[1].procname)
1757 /* table should contain subdirectory with the same name */
1758 for (p = table; p->procname; p++) {
1761 if (p->procname && strcmp(p->procname, s) == 0)
1767 /* see if attaching q to p would be an improvement */
1768 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1770 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1771 struct ctl_table *next;
1773 int not_in_parent = !p->attached_by;
1775 while ((next = is_branch_in(by, to)) != NULL) {
1776 if (by == q->attached_by)
1778 if (to == p->attached_by)
1784 if (is_better && not_in_parent) {
1785 q->attached_by = by;
1786 q->attached_to = to;
1792 * __register_sysctl_paths - register a sysctl hierarchy
1793 * @root: List of sysctl headers to register on
1794 * @namespaces: Data to compute which lists of sysctl entries are visible
1795 * @path: The path to the directory the sysctl table is in.
1796 * @table: the top-level table structure
1798 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1799 * array. A completely 0 filled entry terminates the table.
1801 * The members of the &struct ctl_table structure are used as follows:
1803 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1804 * enter a sysctl file
1806 * data - a pointer to data for use by proc_handler
1808 * maxlen - the maximum size in bytes of the data
1810 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1812 * child - a pointer to the child sysctl table if this entry is a directory, or
1815 * proc_handler - the text handler routine (described below)
1817 * de - for internal use by the sysctl routines
1819 * extra1, extra2 - extra pointers usable by the proc handler routines
1821 * Leaf nodes in the sysctl tree will be represented by a single file
1822 * under /proc; non-leaf nodes will be represented by directories.
1824 * sysctl(2) can automatically manage read and write requests through
1825 * the sysctl table. The data and maxlen fields of the ctl_table
1826 * struct enable minimal validation of the values being written to be
1827 * performed, and the mode field allows minimal authentication.
1829 * There must be a proc_handler routine for any terminal nodes
1830 * mirrored under /proc/sys (non-terminals are handled by a built-in
1831 * directory handler). Several default handlers are available to
1832 * cover common cases -
1834 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1835 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1836 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1838 * It is the handler's job to read the input buffer from user memory
1839 * and process it. The handler should return 0 on success.
1841 * This routine returns %NULL on a failure to register, and a pointer
1842 * to the table header on success.
1844 struct ctl_table_header *__register_sysctl_paths(
1845 struct ctl_table_root *root,
1846 struct nsproxy *namespaces,
1847 const struct ctl_path *path, struct ctl_table *table)
1849 struct ctl_table_header *header;
1850 struct ctl_table *new, **prevp;
1851 unsigned int n, npath;
1852 struct ctl_table_set *set;
1854 /* Count the path components */
1855 for (npath = 0; path[npath].procname; ++npath)
1859 * For each path component, allocate a 2-element ctl_table array.
1860 * The first array element will be filled with the sysctl entry
1861 * for this, the second will be the sentinel (procname == 0).
1863 * We allocate everything in one go so that we don't have to
1864 * worry about freeing additional memory in unregister_sysctl_table.
1866 header = kzalloc(sizeof(struct ctl_table_header) +
1867 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1871 new = (struct ctl_table *) (header + 1);
1873 /* Now connect the dots */
1874 prevp = &header->ctl_table;
1875 for (n = 0; n < npath; ++n, ++path) {
1876 /* Copy the procname */
1877 new->procname = path->procname;
1881 prevp = &new->child;
1886 header->ctl_table_arg = table;
1888 INIT_LIST_HEAD(&header->ctl_entry);
1890 header->unregistering = NULL;
1891 header->root = root;
1892 sysctl_set_parent(NULL, header->ctl_table);
1894 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1895 if (sysctl_check_table(namespaces, header->ctl_table)) {
1900 spin_lock(&sysctl_lock);
1901 header->set = lookup_header_set(root, namespaces);
1902 header->attached_by = header->ctl_table;
1903 header->attached_to = root_table;
1904 header->parent = &root_table_header;
1905 for (set = header->set; set; set = set->parent) {
1906 struct ctl_table_header *p;
1907 list_for_each_entry(p, &set->list, ctl_entry) {
1908 if (p->unregistering)
1910 try_attach(p, header);
1913 header->parent->count++;
1914 list_add_tail(&header->ctl_entry, &header->set->list);
1915 spin_unlock(&sysctl_lock);
1921 * register_sysctl_table_path - register a sysctl table hierarchy
1922 * @path: The path to the directory the sysctl table is in.
1923 * @table: the top-level table structure
1925 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1926 * array. A completely 0 filled entry terminates the table.
1928 * See __register_sysctl_paths for more details.
1930 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1931 struct ctl_table *table)
1933 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1938 * register_sysctl_table - register a sysctl table hierarchy
1939 * @table: the top-level table structure
1941 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1942 * array. A completely 0 filled entry terminates the table.
1944 * See register_sysctl_paths for more details.
1946 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1948 static const struct ctl_path null_path[] = { {} };
1950 return register_sysctl_paths(null_path, table);
1954 * unregister_sysctl_table - unregister a sysctl table hierarchy
1955 * @header: the header returned from register_sysctl_table
1957 * Unregisters the sysctl table and all children. proc entries may not
1958 * actually be removed until they are no longer used by anyone.
1960 void unregister_sysctl_table(struct ctl_table_header * header)
1967 spin_lock(&sysctl_lock);
1968 start_unregistering(header);
1969 if (!--header->parent->count) {
1971 kfree_rcu(header->parent, rcu);
1973 if (!--header->count)
1974 kfree_rcu(header, rcu);
1975 spin_unlock(&sysctl_lock);
1978 int sysctl_is_seen(struct ctl_table_header *p)
1980 struct ctl_table_set *set = p->set;
1982 spin_lock(&sysctl_lock);
1983 if (p->unregistering)
1985 else if (!set->is_seen)
1988 res = set->is_seen(set);
1989 spin_unlock(&sysctl_lock);
1993 void setup_sysctl_set(struct ctl_table_set *p,
1994 struct ctl_table_set *parent,
1995 int (*is_seen)(struct ctl_table_set *))
1997 INIT_LIST_HEAD(&p->list);
1998 p->parent = parent ? parent : &sysctl_table_root.default_set;
1999 p->is_seen = is_seen;
2002 #else /* !CONFIG_SYSCTL */
2003 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2008 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2009 struct ctl_table *table)
2014 void unregister_sysctl_table(struct ctl_table_header * table)
2018 void setup_sysctl_set(struct ctl_table_set *p,
2019 struct ctl_table_set *parent,
2020 int (*is_seen)(struct ctl_table_set *))
2024 void sysctl_head_put(struct ctl_table_header *head)
2028 #endif /* CONFIG_SYSCTL */
2034 #ifdef CONFIG_PROC_SYSCTL
2036 static int _proc_do_string(void* data, int maxlen, int write,
2037 void __user *buffer,
2038 size_t *lenp, loff_t *ppos)
2044 if (!data || !maxlen || !*lenp) {
2052 while (len < *lenp) {
2053 if (get_user(c, p++))
2055 if (c == 0 || c == '\n')
2061 if(copy_from_user(data, buffer, len))
2063 ((char *) data)[len] = 0;
2081 if(copy_to_user(buffer, data, len))
2084 if(put_user('\n', ((char __user *) buffer) + len))
2095 * proc_dostring - read a string sysctl
2096 * @table: the sysctl table
2097 * @write: %TRUE if this is a write to the sysctl file
2098 * @buffer: the user buffer
2099 * @lenp: the size of the user buffer
2100 * @ppos: file position
2102 * Reads/writes a string from/to the user buffer. If the kernel
2103 * buffer provided is not large enough to hold the string, the
2104 * string is truncated. The copied string is %NULL-terminated.
2105 * If the string is being read by the user process, it is copied
2106 * and a newline '\n' is added. It is truncated if the buffer is
2109 * Returns 0 on success.
2111 int proc_dostring(struct ctl_table *table, int write,
2112 void __user *buffer, size_t *lenp, loff_t *ppos)
2114 return _proc_do_string(table->data, table->maxlen, write,
2115 buffer, lenp, ppos);
2118 static size_t proc_skip_spaces(char **buf)
2121 char *tmp = skip_spaces(*buf);
2127 static void proc_skip_char(char **buf, size_t *size, const char v)
2137 #define TMPBUFLEN 22
2139 * proc_get_long - reads an ASCII formatted integer from a user buffer
2141 * @buf: a kernel buffer
2142 * @size: size of the kernel buffer
2143 * @val: this is where the number will be stored
2144 * @neg: set to %TRUE if number is negative
2145 * @perm_tr: a vector which contains the allowed trailers
2146 * @perm_tr_len: size of the perm_tr vector
2147 * @tr: pointer to store the trailer character
2149 * In case of success %0 is returned and @buf and @size are updated with
2150 * the amount of bytes read. If @tr is non-NULL and a trailing
2151 * character exists (size is non-zero after returning from this
2152 * function), @tr is updated with the trailing character.
2154 static int proc_get_long(char **buf, size_t *size,
2155 unsigned long *val, bool *neg,
2156 const char *perm_tr, unsigned perm_tr_len, char *tr)
2159 char *p, tmp[TMPBUFLEN];
2165 if (len > TMPBUFLEN - 1)
2166 len = TMPBUFLEN - 1;
2168 memcpy(tmp, *buf, len);
2172 if (*p == '-' && *size > 1) {
2180 *val = simple_strtoul(p, &p, 0);
2184 /* We don't know if the next char is whitespace thus we may accept
2185 * invalid integers (e.g. 1234...a) or two integers instead of one
2186 * (e.g. 123...1). So lets not allow such large numbers. */
2187 if (len == TMPBUFLEN - 1)
2190 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2193 if (tr && (len < *size))
2203 * proc_put_long - converts an integer to a decimal ASCII formatted string
2205 * @buf: the user buffer
2206 * @size: the size of the user buffer
2207 * @val: the integer to be converted
2208 * @neg: sign of the number, %TRUE for negative
2210 * In case of success %0 is returned and @buf and @size are updated with
2211 * the amount of bytes written.
2213 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2217 char tmp[TMPBUFLEN], *p = tmp;
2219 sprintf(p, "%s%lu", neg ? "-" : "", val);
2223 if (copy_to_user(*buf, tmp, len))
2231 static int proc_put_char(void __user **buf, size_t *size, char c)
2234 char __user **buffer = (char __user **)buf;
2235 if (put_user(c, *buffer))
2237 (*size)--, (*buffer)++;
2243 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2245 int write, void *data)
2248 *valp = *negp ? -*lvalp : *lvalp;
2253 *lvalp = (unsigned long)-val;
2256 *lvalp = (unsigned long)val;
2262 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2264 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2265 int write, void __user *buffer,
2266 size_t *lenp, loff_t *ppos,
2267 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2268 int write, void *data),
2271 int *i, vleft, first = 1, err = 0;
2272 unsigned long page = 0;
2276 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2281 i = (int *) tbl_data;
2282 vleft = table->maxlen / sizeof(*i);
2286 conv = do_proc_dointvec_conv;
2289 if (left > PAGE_SIZE - 1)
2290 left = PAGE_SIZE - 1;
2291 page = __get_free_page(GFP_TEMPORARY);
2292 kbuf = (char *) page;
2295 if (copy_from_user(kbuf, buffer, left)) {
2302 for (; left && vleft--; i++, first=0) {
2307 left -= proc_skip_spaces(&kbuf);
2311 err = proc_get_long(&kbuf, &left, &lval, &neg,
2313 sizeof(proc_wspace_sep), NULL);
2316 if (conv(&neg, &lval, i, 1, data)) {
2321 if (conv(&neg, &lval, i, 0, data)) {
2326 err = proc_put_char(&buffer, &left, '\t');
2329 err = proc_put_long(&buffer, &left, lval, neg);
2335 if (!write && !first && left && !err)
2336 err = proc_put_char(&buffer, &left, '\n');
2337 if (write && !err && left)
2338 left -= proc_skip_spaces(&kbuf);
2343 return err ? : -EINVAL;
2350 static int do_proc_dointvec(struct ctl_table *table, int write,
2351 void __user *buffer, size_t *lenp, loff_t *ppos,
2352 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2353 int write, void *data),
2356 return __do_proc_dointvec(table->data, table, write,
2357 buffer, lenp, ppos, conv, data);
2361 * proc_dointvec - read a vector of integers
2362 * @table: the sysctl table
2363 * @write: %TRUE if this is a write to the sysctl file
2364 * @buffer: the user buffer
2365 * @lenp: the size of the user buffer
2366 * @ppos: file position
2368 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2369 * values from/to the user buffer, treated as an ASCII string.
2371 * Returns 0 on success.
2373 int proc_dointvec(struct ctl_table *table, int write,
2374 void __user *buffer, size_t *lenp, loff_t *ppos)
2376 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2381 * Taint values can only be increased
2382 * This means we can safely use a temporary.
2384 static int proc_taint(struct ctl_table *table, int write,
2385 void __user *buffer, size_t *lenp, loff_t *ppos)
2388 unsigned long tmptaint = get_taint();
2391 if (write && !capable(CAP_SYS_ADMIN))
2396 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2402 * Poor man's atomic or. Not worth adding a primitive
2403 * to everyone's atomic.h for this
2406 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2407 if ((tmptaint >> i) & 1)
2415 #ifdef CONFIG_PRINTK
2416 static int proc_dmesg_restrict(struct ctl_table *table, int write,
2417 void __user *buffer, size_t *lenp, loff_t *ppos)
2419 if (write && !capable(CAP_SYS_ADMIN))
2422 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2426 struct do_proc_dointvec_minmax_conv_param {
2431 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2433 int write, void *data)
2435 struct do_proc_dointvec_minmax_conv_param *param = data;
2437 int val = *negp ? -*lvalp : *lvalp;
2438 if ((param->min && *param->min > val) ||
2439 (param->max && *param->max < val))
2446 *lvalp = (unsigned long)-val;
2449 *lvalp = (unsigned long)val;
2456 * proc_dointvec_minmax - read a vector of integers with min/max values
2457 * @table: the sysctl table
2458 * @write: %TRUE if this is a write to the sysctl file
2459 * @buffer: the user buffer
2460 * @lenp: the size of the user buffer
2461 * @ppos: file position
2463 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2464 * values from/to the user buffer, treated as an ASCII string.
2466 * This routine will ensure the values are within the range specified by
2467 * table->extra1 (min) and table->extra2 (max).
2469 * Returns 0 on success.
2471 int proc_dointvec_minmax(struct ctl_table *table, int write,
2472 void __user *buffer, size_t *lenp, loff_t *ppos)
2474 struct do_proc_dointvec_minmax_conv_param param = {
2475 .min = (int *) table->extra1,
2476 .max = (int *) table->extra2,
2478 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2479 do_proc_dointvec_minmax_conv, ¶m);
2482 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2483 void __user *buffer,
2484 size_t *lenp, loff_t *ppos,
2485 unsigned long convmul,
2486 unsigned long convdiv)
2488 unsigned long *i, *min, *max;
2489 int vleft, first = 1, err = 0;
2490 unsigned long page = 0;
2494 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2499 i = (unsigned long *) data;
2500 min = (unsigned long *) table->extra1;
2501 max = (unsigned long *) table->extra2;
2502 vleft = table->maxlen / sizeof(unsigned long);
2506 if (left > PAGE_SIZE - 1)
2507 left = PAGE_SIZE - 1;
2508 page = __get_free_page(GFP_TEMPORARY);
2509 kbuf = (char *) page;
2512 if (copy_from_user(kbuf, buffer, left)) {
2519 for (; left && vleft--; i++, first = 0) {
2525 left -= proc_skip_spaces(&kbuf);
2527 err = proc_get_long(&kbuf, &left, &val, &neg,
2529 sizeof(proc_wspace_sep), NULL);
2534 if ((min && val < *min) || (max && val > *max))
2538 val = convdiv * (*i) / convmul;
2540 err = proc_put_char(&buffer, &left, '\t');
2541 err = proc_put_long(&buffer, &left, val, false);
2547 if (!write && !first && left && !err)
2548 err = proc_put_char(&buffer, &left, '\n');
2550 left -= proc_skip_spaces(&kbuf);
2555 return err ? : -EINVAL;
2562 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2563 void __user *buffer,
2564 size_t *lenp, loff_t *ppos,
2565 unsigned long convmul,
2566 unsigned long convdiv)
2568 return __do_proc_doulongvec_minmax(table->data, table, write,
2569 buffer, lenp, ppos, convmul, convdiv);
2573 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2574 * @table: the sysctl table
2575 * @write: %TRUE if this is a write to the sysctl file
2576 * @buffer: the user buffer
2577 * @lenp: the size of the user buffer
2578 * @ppos: file position
2580 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2581 * values from/to the user buffer, treated as an ASCII string.
2583 * This routine will ensure the values are within the range specified by
2584 * table->extra1 (min) and table->extra2 (max).
2586 * Returns 0 on success.
2588 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2589 void __user *buffer, size_t *lenp, loff_t *ppos)
2591 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2595 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2596 * @table: the sysctl table
2597 * @write: %TRUE if this is a write to the sysctl file
2598 * @buffer: the user buffer
2599 * @lenp: the size of the user buffer
2600 * @ppos: file position
2602 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2603 * values from/to the user buffer, treated as an ASCII string. The values
2604 * are treated as milliseconds, and converted to jiffies when they are stored.
2606 * This routine will ensure the values are within the range specified by
2607 * table->extra1 (min) and table->extra2 (max).
2609 * Returns 0 on success.
2611 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2612 void __user *buffer,
2613 size_t *lenp, loff_t *ppos)
2615 return do_proc_doulongvec_minmax(table, write, buffer,
2616 lenp, ppos, HZ, 1000l);
2620 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2622 int write, void *data)
2625 if (*lvalp > LONG_MAX / HZ)
2627 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2633 lval = (unsigned long)-val;
2636 lval = (unsigned long)val;
2643 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2645 int write, void *data)
2648 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2650 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2656 lval = (unsigned long)-val;
2659 lval = (unsigned long)val;
2661 *lvalp = jiffies_to_clock_t(lval);
2666 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2668 int write, void *data)
2671 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2677 lval = (unsigned long)-val;
2680 lval = (unsigned long)val;
2682 *lvalp = jiffies_to_msecs(lval);
2688 * proc_dointvec_jiffies - read a vector of integers as seconds
2689 * @table: the sysctl table
2690 * @write: %TRUE if this is a write to the sysctl file
2691 * @buffer: the user buffer
2692 * @lenp: the size of the user buffer
2693 * @ppos: file position
2695 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2696 * values from/to the user buffer, treated as an ASCII string.
2697 * The values read are assumed to be in seconds, and are converted into
2700 * Returns 0 on success.
2702 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2703 void __user *buffer, size_t *lenp, loff_t *ppos)
2705 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2706 do_proc_dointvec_jiffies_conv,NULL);
2710 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2711 * @table: the sysctl table
2712 * @write: %TRUE if this is a write to the sysctl file
2713 * @buffer: the user buffer
2714 * @lenp: the size of the user buffer
2715 * @ppos: pointer to the file position
2717 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2718 * values from/to the user buffer, treated as an ASCII string.
2719 * The values read are assumed to be in 1/USER_HZ seconds, and
2720 * are converted into jiffies.
2722 * Returns 0 on success.
2724 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2725 void __user *buffer, size_t *lenp, loff_t *ppos)
2727 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2728 do_proc_dointvec_userhz_jiffies_conv,NULL);
2732 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2733 * @table: the sysctl table
2734 * @write: %TRUE if this is a write to the sysctl file
2735 * @buffer: the user buffer
2736 * @lenp: the size of the user buffer
2737 * @ppos: file position
2738 * @ppos: the current position in the file
2740 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2741 * values from/to the user buffer, treated as an ASCII string.
2742 * The values read are assumed to be in 1/1000 seconds, and
2743 * are converted into jiffies.
2745 * Returns 0 on success.
2747 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2748 void __user *buffer, size_t *lenp, loff_t *ppos)
2750 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2751 do_proc_dointvec_ms_jiffies_conv, NULL);
2754 static int proc_do_cad_pid(struct ctl_table *table, int write,
2755 void __user *buffer, size_t *lenp, loff_t *ppos)
2757 struct pid *new_pid;
2761 tmp = pid_vnr(cad_pid);
2763 r = __do_proc_dointvec(&tmp, table, write, buffer,
2764 lenp, ppos, NULL, NULL);
2768 new_pid = find_get_pid(tmp);
2772 put_pid(xchg(&cad_pid, new_pid));
2777 * proc_do_large_bitmap - read/write from/to a large bitmap
2778 * @table: the sysctl table
2779 * @write: %TRUE if this is a write to the sysctl file
2780 * @buffer: the user buffer
2781 * @lenp: the size of the user buffer
2782 * @ppos: file position
2784 * The bitmap is stored at table->data and the bitmap length (in bits)
2787 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2788 * large bitmaps may be represented in a compact manner. Writing into
2789 * the file will clear the bitmap then update it with the given input.
2791 * Returns 0 on success.
2793 int proc_do_large_bitmap(struct ctl_table *table, int write,
2794 void __user *buffer, size_t *lenp, loff_t *ppos)
2798 size_t left = *lenp;
2799 unsigned long bitmap_len = table->maxlen;
2800 unsigned long *bitmap = (unsigned long *) table->data;
2801 unsigned long *tmp_bitmap = NULL;
2802 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2804 if (!bitmap_len || !left || (*ppos && !write)) {
2810 unsigned long page = 0;
2813 if (left > PAGE_SIZE - 1)
2814 left = PAGE_SIZE - 1;
2816 page = __get_free_page(GFP_TEMPORARY);
2817 kbuf = (char *) page;
2820 if (copy_from_user(kbuf, buffer, left)) {
2826 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2832 proc_skip_char(&kbuf, &left, '\n');
2833 while (!err && left) {
2834 unsigned long val_a, val_b;
2837 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2841 if (val_a >= bitmap_len || neg) {
2853 err = proc_get_long(&kbuf, &left, &val_b,
2854 &neg, tr_b, sizeof(tr_b),
2858 if (val_b >= bitmap_len || neg ||
2869 while (val_a <= val_b)
2870 set_bit(val_a++, tmp_bitmap);
2873 proc_skip_char(&kbuf, &left, '\n');
2877 unsigned long bit_a, bit_b = 0;
2880 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2881 if (bit_a >= bitmap_len)
2883 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2887 err = proc_put_char(&buffer, &left, ',');
2891 err = proc_put_long(&buffer, &left, bit_a, false);
2894 if (bit_a != bit_b) {
2895 err = proc_put_char(&buffer, &left, '-');
2898 err = proc_put_long(&buffer, &left, bit_b, false);
2906 err = proc_put_char(&buffer, &left, '\n');
2912 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2914 memcpy(bitmap, tmp_bitmap,
2915 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
2927 #else /* CONFIG_PROC_SYSCTL */
2929 int proc_dostring(struct ctl_table *table, int write,
2930 void __user *buffer, size_t *lenp, loff_t *ppos)
2935 int proc_dointvec(struct ctl_table *table, int write,
2936 void __user *buffer, size_t *lenp, loff_t *ppos)
2941 int proc_dointvec_minmax(struct ctl_table *table, int write,
2942 void __user *buffer, size_t *lenp, loff_t *ppos)
2947 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2948 void __user *buffer, size_t *lenp, loff_t *ppos)
2953 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2954 void __user *buffer, size_t *lenp, loff_t *ppos)
2959 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2960 void __user *buffer, size_t *lenp, loff_t *ppos)
2965 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2966 void __user *buffer, size_t *lenp, loff_t *ppos)
2971 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2972 void __user *buffer,
2973 size_t *lenp, loff_t *ppos)
2979 #endif /* CONFIG_PROC_SYSCTL */
2982 * No sense putting this after each symbol definition, twice,
2983 * exception granted :-)
2985 EXPORT_SYMBOL(proc_dointvec);
2986 EXPORT_SYMBOL(proc_dointvec_jiffies);
2987 EXPORT_SYMBOL(proc_dointvec_minmax);
2988 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2989 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2990 EXPORT_SYMBOL(proc_dostring);
2991 EXPORT_SYMBOL(proc_doulongvec_minmax);
2992 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2993 EXPORT_SYMBOL(register_sysctl_table);
2994 EXPORT_SYMBOL(register_sysctl_paths);
2995 EXPORT_SYMBOL(unregister_sysctl_table);