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/export.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 #ifdef CONFIG_MATHEMU
156 extern int sysctl_ieee_emulation_warnings;
158 extern int sysctl_userprocess_debug;
159 extern int spin_retry;
163 extern int no_unaligned_warning;
164 extern int unaligned_dump_stack;
167 #ifdef CONFIG_PROC_SYSCTL
168 static int proc_do_cad_pid(struct ctl_table *table, int write,
169 void __user *buffer, size_t *lenp, loff_t *ppos);
170 static int proc_taint(struct ctl_table *table, int write,
171 void __user *buffer, size_t *lenp, loff_t *ppos);
175 static int proc_dmesg_restrict(struct ctl_table *table, int write,
176 void __user *buffer, size_t *lenp, loff_t *ppos);
179 #ifdef CONFIG_MAGIC_SYSRQ
180 /* Note: sysrq code uses it's own private copy */
181 static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
183 static int sysrq_sysctl_handler(ctl_table *table, int write,
184 void __user *buffer, size_t *lenp,
189 error = proc_dointvec(table, write, buffer, lenp, ppos);
194 sysrq_toggle_support(__sysrq_enabled);
201 static struct ctl_table root_table[];
202 static struct ctl_table_root sysctl_table_root;
203 static struct ctl_table_header root_table_header = {
205 .ctl_table = root_table,
206 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}},
207 .root = &sysctl_table_root,
208 .set = &sysctl_table_root.default_set,
210 static struct ctl_table_root sysctl_table_root = {
211 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
212 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
215 static struct ctl_table kern_table[];
216 static struct ctl_table vm_table[];
217 static struct ctl_table fs_table[];
218 static struct ctl_table debug_table[];
219 static struct ctl_table dev_table[];
220 extern struct ctl_table random_table[];
222 extern struct ctl_table epoll_table[];
225 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
226 int sysctl_legacy_va_layout;
229 /* The default sysctl tables: */
231 static struct ctl_table root_table[] = {
233 .procname = "kernel",
250 .child = debug_table,
260 #ifdef CONFIG_SCHED_DEBUG
261 static int min_sched_granularity_ns = 100000; /* 100 usecs */
262 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
263 static int min_wakeup_granularity_ns; /* 0 usecs */
264 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
265 static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
266 static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
269 #ifdef CONFIG_COMPACTION
270 static int min_extfrag_threshold;
271 static int max_extfrag_threshold = 1000;
274 static struct ctl_table kern_table[] = {
276 .procname = "sched_child_runs_first",
277 .data = &sysctl_sched_child_runs_first,
278 .maxlen = sizeof(unsigned int),
280 .proc_handler = proc_dointvec,
282 #ifdef CONFIG_SCHED_DEBUG
284 .procname = "sched_min_granularity_ns",
285 .data = &sysctl_sched_min_granularity,
286 .maxlen = sizeof(unsigned int),
288 .proc_handler = sched_proc_update_handler,
289 .extra1 = &min_sched_granularity_ns,
290 .extra2 = &max_sched_granularity_ns,
293 .procname = "sched_latency_ns",
294 .data = &sysctl_sched_latency,
295 .maxlen = sizeof(unsigned int),
297 .proc_handler = sched_proc_update_handler,
298 .extra1 = &min_sched_granularity_ns,
299 .extra2 = &max_sched_granularity_ns,
302 .procname = "sched_wakeup_granularity_ns",
303 .data = &sysctl_sched_wakeup_granularity,
304 .maxlen = sizeof(unsigned int),
306 .proc_handler = sched_proc_update_handler,
307 .extra1 = &min_wakeup_granularity_ns,
308 .extra2 = &max_wakeup_granularity_ns,
311 .procname = "sched_tunable_scaling",
312 .data = &sysctl_sched_tunable_scaling,
313 .maxlen = sizeof(enum sched_tunable_scaling),
315 .proc_handler = sched_proc_update_handler,
316 .extra1 = &min_sched_tunable_scaling,
317 .extra2 = &max_sched_tunable_scaling,
320 .procname = "sched_migration_cost",
321 .data = &sysctl_sched_migration_cost,
322 .maxlen = sizeof(unsigned int),
324 .proc_handler = proc_dointvec,
327 .procname = "sched_nr_migrate",
328 .data = &sysctl_sched_nr_migrate,
329 .maxlen = sizeof(unsigned int),
331 .proc_handler = proc_dointvec,
334 .procname = "sched_time_avg",
335 .data = &sysctl_sched_time_avg,
336 .maxlen = sizeof(unsigned int),
338 .proc_handler = proc_dointvec,
341 .procname = "sched_shares_window",
342 .data = &sysctl_sched_shares_window,
343 .maxlen = sizeof(unsigned int),
345 .proc_handler = proc_dointvec,
348 .procname = "timer_migration",
349 .data = &sysctl_timer_migration,
350 .maxlen = sizeof(unsigned int),
352 .proc_handler = proc_dointvec_bool,
356 .procname = "sched_rt_period_us",
357 .data = &sysctl_sched_rt_period,
358 .maxlen = sizeof(unsigned int),
360 .proc_handler = sched_rt_handler,
363 .procname = "sched_rt_runtime_us",
364 .data = &sysctl_sched_rt_runtime,
365 .maxlen = sizeof(int),
367 .proc_handler = sched_rt_handler,
369 #ifdef CONFIG_SCHED_AUTOGROUP
371 .procname = "sched_autogroup_enabled",
372 .data = &sysctl_sched_autogroup_enabled,
373 .maxlen = sizeof(unsigned int),
375 .proc_handler = proc_dointvec_minmax,
380 #ifdef CONFIG_PROVE_LOCKING
382 .procname = "prove_locking",
383 .data = &prove_locking,
384 .maxlen = sizeof(int),
386 .proc_handler = proc_dointvec,
389 #ifdef CONFIG_LOCK_STAT
391 .procname = "lock_stat",
393 .maxlen = sizeof(int),
395 .proc_handler = proc_dointvec,
400 .data = &panic_timeout,
401 .maxlen = sizeof(int),
403 .proc_handler = proc_dointvec,
406 .procname = "core_uses_pid",
407 .data = &core_uses_pid,
408 .maxlen = sizeof(int),
410 .proc_handler = proc_dointvec,
413 .procname = "core_pattern",
414 .data = core_pattern,
415 .maxlen = CORENAME_MAX_SIZE,
417 .proc_handler = proc_dostring,
420 .procname = "core_pipe_limit",
421 .data = &core_pipe_limit,
422 .maxlen = sizeof(unsigned int),
424 .proc_handler = proc_dointvec,
426 #ifdef CONFIG_PROC_SYSCTL
428 .procname = "tainted",
429 .maxlen = sizeof(long),
431 .proc_handler = proc_taint,
434 #ifdef CONFIG_LATENCYTOP
436 .procname = "latencytop",
437 .data = &latencytop_enabled,
438 .maxlen = sizeof(int),
440 .proc_handler = proc_dointvec,
443 #ifdef CONFIG_BLK_DEV_INITRD
445 .procname = "real-root-dev",
446 .data = &real_root_dev,
447 .maxlen = sizeof(int),
449 .proc_handler = proc_dointvec,
453 .procname = "print-fatal-signals",
454 .data = &print_fatal_signals,
455 .maxlen = sizeof(int),
457 .proc_handler = proc_dointvec,
461 .procname = "reboot-cmd",
462 .data = reboot_command,
465 .proc_handler = proc_dostring,
468 .procname = "stop-a",
469 .data = &stop_a_enabled,
470 .maxlen = sizeof (int),
472 .proc_handler = proc_dointvec,
475 .procname = "scons-poweroff",
476 .data = &scons_pwroff,
477 .maxlen = sizeof (int),
479 .proc_handler = proc_dointvec,
482 #ifdef CONFIG_SPARC64
484 .procname = "tsb-ratio",
485 .data = &sysctl_tsb_ratio,
486 .maxlen = sizeof (int),
488 .proc_handler = proc_dointvec,
493 .procname = "soft-power",
494 .data = &pwrsw_enabled,
495 .maxlen = sizeof (int),
497 .proc_handler = proc_dointvec,
500 .procname = "unaligned-trap",
501 .data = &unaligned_enabled,
502 .maxlen = sizeof (int),
504 .proc_handler = proc_dointvec,
508 .procname = "ctrl-alt-del",
510 .maxlen = sizeof(int),
512 .proc_handler = proc_dointvec,
514 #ifdef CONFIG_FUNCTION_TRACER
516 .procname = "ftrace_enabled",
517 .data = &ftrace_enabled,
518 .maxlen = sizeof(int),
520 .proc_handler = ftrace_enable_sysctl,
523 #ifdef CONFIG_STACK_TRACER
525 .procname = "stack_tracer_enabled",
526 .data = &stack_tracer_enabled,
527 .maxlen = sizeof(int),
529 .proc_handler = stack_trace_sysctl,
532 #ifdef CONFIG_TRACING
534 .procname = "ftrace_dump_on_oops",
535 .data = &ftrace_dump_on_oops,
536 .maxlen = sizeof(int),
538 .proc_handler = proc_dointvec,
541 #ifdef CONFIG_MODULES
543 .procname = "modprobe",
544 .data = &modprobe_path,
545 .maxlen = KMOD_PATH_LEN,
547 .proc_handler = proc_dostring,
550 .procname = "modules_disabled",
551 .data = &modules_disabled,
552 .maxlen = sizeof(int),
554 /* only handle a transition from default "0" to "1" */
555 .proc_handler = proc_dointvec_minmax,
560 #ifdef CONFIG_HOTPLUG
562 .procname = "hotplug",
563 .data = &uevent_helper,
564 .maxlen = UEVENT_HELPER_PATH_LEN,
566 .proc_handler = proc_dostring,
569 #ifdef CONFIG_CHR_DEV_SG
571 .procname = "sg-big-buff",
572 .data = &sg_big_buff,
573 .maxlen = sizeof (int),
575 .proc_handler = proc_dointvec,
578 #ifdef CONFIG_BSD_PROCESS_ACCT
582 .maxlen = 3*sizeof(int),
584 .proc_handler = proc_dointvec,
587 #ifdef CONFIG_MAGIC_SYSRQ
590 .data = &__sysrq_enabled,
591 .maxlen = sizeof (int),
593 .proc_handler = sysrq_sysctl_handler,
596 #ifdef CONFIG_PROC_SYSCTL
598 .procname = "cad_pid",
600 .maxlen = sizeof (int),
602 .proc_handler = proc_do_cad_pid,
606 .procname = "threads-max",
607 .data = &max_threads,
608 .maxlen = sizeof(int),
610 .proc_handler = proc_dointvec,
613 .procname = "random",
615 .child = random_table,
618 .procname = "usermodehelper",
620 .child = usermodehelper_table,
623 .procname = "overflowuid",
624 .data = &overflowuid,
625 .maxlen = sizeof(int),
627 .proc_handler = proc_dointvec_minmax,
628 .extra1 = &minolduid,
629 .extra2 = &maxolduid,
632 .procname = "overflowgid",
633 .data = &overflowgid,
634 .maxlen = sizeof(int),
636 .proc_handler = proc_dointvec_minmax,
637 .extra1 = &minolduid,
638 .extra2 = &maxolduid,
641 #ifdef CONFIG_MATHEMU
643 .procname = "ieee_emulation_warnings",
644 .data = &sysctl_ieee_emulation_warnings,
645 .maxlen = sizeof(int),
647 .proc_handler = proc_dointvec,
651 .procname = "userprocess_debug",
652 .data = &show_unhandled_signals,
653 .maxlen = sizeof(int),
655 .proc_handler = proc_dointvec,
659 .procname = "pid_max",
661 .maxlen = sizeof (int),
663 .proc_handler = proc_dointvec_minmax,
664 .extra1 = &pid_max_min,
665 .extra2 = &pid_max_max,
668 .procname = "panic_on_oops",
669 .data = &panic_on_oops,
670 .maxlen = sizeof(int),
672 .proc_handler = proc_dointvec,
674 #if defined CONFIG_PRINTK
676 .procname = "printk",
677 .data = &console_loglevel,
678 .maxlen = 4*sizeof(int),
680 .proc_handler = proc_dointvec,
683 .procname = "printk_ratelimit",
684 .data = &printk_ratelimit_state.interval,
685 .maxlen = sizeof(int),
687 .proc_handler = proc_dointvec_jiffies,
690 .procname = "printk_ratelimit_burst",
691 .data = &printk_ratelimit_state.burst,
692 .maxlen = sizeof(int),
694 .proc_handler = proc_dointvec,
697 .procname = "printk_delay",
698 .data = &printk_delay_msec,
699 .maxlen = sizeof(int),
701 .proc_handler = proc_dointvec_minmax,
703 .extra2 = &ten_thousand,
706 .procname = "dmesg_restrict",
707 .data = &dmesg_restrict,
708 .maxlen = sizeof(int),
710 .proc_handler = proc_dointvec_bool,
713 .procname = "kptr_restrict",
714 .data = &kptr_restrict,
715 .maxlen = sizeof(int),
717 .proc_handler = proc_dmesg_restrict,
723 .procname = "ngroups_max",
724 .data = &ngroups_max,
725 .maxlen = sizeof (int),
727 .proc_handler = proc_dointvec,
729 #if defined(CONFIG_LOCKUP_DETECTOR)
731 .procname = "watchdog",
732 .data = &watchdog_enabled,
733 .maxlen = sizeof (int),
735 .proc_handler = proc_dowatchdog,
740 .procname = "watchdog_thresh",
741 .data = &watchdog_thresh,
742 .maxlen = sizeof(int),
744 .proc_handler = proc_dowatchdog,
749 .procname = "softlockup_panic",
750 .data = &softlockup_panic,
751 .maxlen = sizeof(int),
753 .proc_handler = proc_dointvec_bool,
756 .procname = "nmi_watchdog",
757 .data = &watchdog_enabled,
758 .maxlen = sizeof (int),
760 .proc_handler = proc_dowatchdog,
765 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
767 .procname = "unknown_nmi_panic",
768 .data = &unknown_nmi_panic,
769 .maxlen = sizeof (int),
771 .proc_handler = proc_dointvec,
774 #if defined(CONFIG_X86)
776 .procname = "panic_on_unrecovered_nmi",
777 .data = &panic_on_unrecovered_nmi,
778 .maxlen = sizeof(int),
780 .proc_handler = proc_dointvec,
783 .procname = "panic_on_io_nmi",
784 .data = &panic_on_io_nmi,
785 .maxlen = sizeof(int),
787 .proc_handler = proc_dointvec,
790 .procname = "bootloader_type",
791 .data = &bootloader_type,
792 .maxlen = sizeof (int),
794 .proc_handler = proc_dointvec,
797 .procname = "bootloader_version",
798 .data = &bootloader_version,
799 .maxlen = sizeof (int),
801 .proc_handler = proc_dointvec,
804 .procname = "kstack_depth_to_print",
805 .data = &kstack_depth_to_print,
806 .maxlen = sizeof(int),
808 .proc_handler = proc_dointvec,
811 .procname = "io_delay_type",
812 .data = &io_delay_type,
813 .maxlen = sizeof(int),
815 .proc_handler = proc_dointvec,
818 #if defined(CONFIG_MMU)
820 .procname = "randomize_va_space",
821 .data = &randomize_va_space,
822 .maxlen = sizeof(int),
824 .proc_handler = proc_dointvec,
827 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
829 .procname = "spin_retry",
831 .maxlen = sizeof (int),
833 .proc_handler = proc_dointvec,
836 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
838 .procname = "acpi_video_flags",
839 .data = &acpi_realmode_flags,
840 .maxlen = sizeof (unsigned long),
842 .proc_handler = proc_doulongvec_minmax,
847 .procname = "ignore-unaligned-usertrap",
848 .data = &no_unaligned_warning,
849 .maxlen = sizeof (int),
851 .proc_handler = proc_dointvec,
854 .procname = "unaligned-dump-stack",
855 .data = &unaligned_dump_stack,
856 .maxlen = sizeof (int),
858 .proc_handler = proc_dointvec,
861 #ifdef CONFIG_DETECT_HUNG_TASK
863 .procname = "hung_task_panic",
864 .data = &sysctl_hung_task_panic,
865 .maxlen = sizeof(int),
867 .proc_handler = proc_dointvec_bool,
870 .procname = "hung_task_check_count",
871 .data = &sysctl_hung_task_check_count,
872 .maxlen = sizeof(unsigned long),
874 .proc_handler = proc_doulongvec_minmax,
877 .procname = "hung_task_timeout_secs",
878 .data = &sysctl_hung_task_timeout_secs,
879 .maxlen = sizeof(unsigned long),
881 .proc_handler = proc_dohung_task_timeout_secs,
884 .procname = "hung_task_warnings",
885 .data = &sysctl_hung_task_warnings,
886 .maxlen = sizeof(unsigned long),
888 .proc_handler = proc_doulongvec_minmax,
893 .procname = "compat-log",
895 .maxlen = sizeof (int),
897 .proc_handler = proc_dointvec,
900 #ifdef CONFIG_RT_MUTEXES
902 .procname = "max_lock_depth",
903 .data = &max_lock_depth,
904 .maxlen = sizeof(int),
906 .proc_handler = proc_dointvec,
910 .procname = "poweroff_cmd",
911 .data = &poweroff_cmd,
912 .maxlen = POWEROFF_CMD_PATH_LEN,
914 .proc_handler = proc_dostring,
920 .child = key_sysctls,
923 #ifdef CONFIG_RCU_TORTURE_TEST
925 .procname = "rcutorture_runnable",
926 .data = &rcutorture_runnable,
927 .maxlen = sizeof(int),
929 .proc_handler = proc_dointvec,
932 #ifdef CONFIG_PERF_EVENTS
934 * User-space scripts rely on the existence of this file
935 * as a feature check for perf_events being enabled.
937 * So it's an ABI, do not remove!
940 .procname = "perf_event_paranoid",
941 .data = &sysctl_perf_event_paranoid,
942 .maxlen = sizeof(sysctl_perf_event_paranoid),
944 .proc_handler = proc_dointvec,
947 .procname = "perf_event_mlock_kb",
948 .data = &sysctl_perf_event_mlock,
949 .maxlen = sizeof(sysctl_perf_event_mlock),
951 .proc_handler = proc_dointvec,
954 .procname = "perf_event_max_sample_rate",
955 .data = &sysctl_perf_event_sample_rate,
956 .maxlen = sizeof(sysctl_perf_event_sample_rate),
958 .proc_handler = perf_proc_update_handler,
961 #ifdef CONFIG_KMEMCHECK
963 .procname = "kmemcheck",
964 .data = &kmemcheck_enabled,
965 .maxlen = sizeof(int),
967 .proc_handler = proc_dointvec,
972 .procname = "blk_iopoll",
973 .data = &blk_iopoll_enabled,
974 .maxlen = sizeof(int),
976 .proc_handler = proc_dointvec,
982 static struct ctl_table vm_table[] = {
984 .procname = "overcommit_memory",
985 .data = &sysctl_overcommit_memory,
986 .maxlen = sizeof(sysctl_overcommit_memory),
988 .proc_handler = proc_dointvec_minmax,
993 .procname = "panic_on_oom",
994 .data = &sysctl_panic_on_oom,
995 .maxlen = sizeof(sysctl_panic_on_oom),
997 .proc_handler = proc_dointvec_minmax,
1002 .procname = "oom_kill_allocating_task",
1003 .data = &sysctl_oom_kill_allocating_task,
1004 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1006 .proc_handler = proc_dointvec,
1009 .procname = "oom_dump_tasks",
1010 .data = &sysctl_oom_dump_tasks,
1011 .maxlen = sizeof(sysctl_oom_dump_tasks),
1013 .proc_handler = proc_dointvec,
1016 .procname = "overcommit_ratio",
1017 .data = &sysctl_overcommit_ratio,
1018 .maxlen = sizeof(sysctl_overcommit_ratio),
1020 .proc_handler = proc_dointvec,
1023 .procname = "page-cluster",
1024 .data = &page_cluster,
1025 .maxlen = sizeof(int),
1027 .proc_handler = proc_dointvec_minmax,
1031 .procname = "dirty_background_ratio",
1032 .data = &dirty_background_ratio,
1033 .maxlen = sizeof(dirty_background_ratio),
1035 .proc_handler = dirty_background_ratio_handler,
1037 .extra2 = &one_hundred,
1040 .procname = "dirty_background_bytes",
1041 .data = &dirty_background_bytes,
1042 .maxlen = sizeof(dirty_background_bytes),
1044 .proc_handler = dirty_background_bytes_handler,
1048 .procname = "dirty_ratio",
1049 .data = &vm_dirty_ratio,
1050 .maxlen = sizeof(vm_dirty_ratio),
1052 .proc_handler = dirty_ratio_handler,
1054 .extra2 = &one_hundred,
1057 .procname = "dirty_bytes",
1058 .data = &vm_dirty_bytes,
1059 .maxlen = sizeof(vm_dirty_bytes),
1061 .proc_handler = dirty_bytes_handler,
1062 .extra1 = &dirty_bytes_min,
1065 .procname = "dirty_writeback_centisecs",
1066 .data = &dirty_writeback_interval,
1067 .maxlen = sizeof(dirty_writeback_interval),
1069 .proc_handler = dirty_writeback_centisecs_handler,
1072 .procname = "dirty_expire_centisecs",
1073 .data = &dirty_expire_interval,
1074 .maxlen = sizeof(dirty_expire_interval),
1076 .proc_handler = proc_dointvec_minmax,
1080 .procname = "nr_pdflush_threads",
1081 .data = &nr_pdflush_threads,
1082 .maxlen = sizeof nr_pdflush_threads,
1083 .mode = 0444 /* read-only*/,
1084 .proc_handler = proc_dointvec,
1087 .procname = "swappiness",
1088 .data = &vm_swappiness,
1089 .maxlen = sizeof(vm_swappiness),
1091 .proc_handler = proc_dointvec_minmax,
1093 .extra2 = &one_hundred,
1095 #ifdef CONFIG_HUGETLB_PAGE
1097 .procname = "nr_hugepages",
1099 .maxlen = sizeof(unsigned long),
1101 .proc_handler = hugetlb_sysctl_handler,
1102 .extra1 = (void *)&hugetlb_zero,
1103 .extra2 = (void *)&hugetlb_infinity,
1107 .procname = "nr_hugepages_mempolicy",
1109 .maxlen = sizeof(unsigned long),
1111 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1112 .extra1 = (void *)&hugetlb_zero,
1113 .extra2 = (void *)&hugetlb_infinity,
1117 .procname = "hugetlb_shm_group",
1118 .data = &sysctl_hugetlb_shm_group,
1119 .maxlen = sizeof(gid_t),
1121 .proc_handler = proc_dointvec,
1124 .procname = "hugepages_treat_as_movable",
1125 .data = &hugepages_treat_as_movable,
1126 .maxlen = sizeof(int),
1128 .proc_handler = hugetlb_treat_movable_handler,
1131 .procname = "nr_overcommit_hugepages",
1133 .maxlen = sizeof(unsigned long),
1135 .proc_handler = hugetlb_overcommit_handler,
1136 .extra1 = (void *)&hugetlb_zero,
1137 .extra2 = (void *)&hugetlb_infinity,
1141 .procname = "lowmem_reserve_ratio",
1142 .data = &sysctl_lowmem_reserve_ratio,
1143 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1145 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
1148 .procname = "drop_caches",
1149 .data = &sysctl_drop_caches,
1150 .maxlen = sizeof(int),
1152 .proc_handler = drop_caches_sysctl_handler,
1156 #ifdef CONFIG_COMPACTION
1158 .procname = "compact_memory",
1159 .data = &sysctl_compact_memory,
1160 .maxlen = sizeof(int),
1162 .proc_handler = sysctl_compaction_handler,
1165 .procname = "extfrag_threshold",
1166 .data = &sysctl_extfrag_threshold,
1167 .maxlen = sizeof(int),
1169 .proc_handler = sysctl_extfrag_handler,
1170 .extra1 = &min_extfrag_threshold,
1171 .extra2 = &max_extfrag_threshold,
1174 #endif /* CONFIG_COMPACTION */
1176 .procname = "min_free_kbytes",
1177 .data = &min_free_kbytes,
1178 .maxlen = sizeof(min_free_kbytes),
1180 .proc_handler = min_free_kbytes_sysctl_handler,
1184 .procname = "percpu_pagelist_fraction",
1185 .data = &percpu_pagelist_fraction,
1186 .maxlen = sizeof(percpu_pagelist_fraction),
1188 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
1189 .extra1 = &min_percpu_pagelist_fract,
1193 .procname = "max_map_count",
1194 .data = &sysctl_max_map_count,
1195 .maxlen = sizeof(sysctl_max_map_count),
1197 .proc_handler = proc_dointvec_minmax,
1202 .procname = "nr_trim_pages",
1203 .data = &sysctl_nr_trim_pages,
1204 .maxlen = sizeof(sysctl_nr_trim_pages),
1206 .proc_handler = proc_dointvec_minmax,
1211 .procname = "laptop_mode",
1212 .data = &laptop_mode,
1213 .maxlen = sizeof(laptop_mode),
1215 .proc_handler = proc_dointvec_jiffies,
1218 .procname = "block_dump",
1219 .data = &block_dump,
1220 .maxlen = sizeof(block_dump),
1222 .proc_handler = proc_dointvec,
1226 .procname = "vfs_cache_pressure",
1227 .data = &sysctl_vfs_cache_pressure,
1228 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1230 .proc_handler = proc_dointvec,
1233 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1235 .procname = "legacy_va_layout",
1236 .data = &sysctl_legacy_va_layout,
1237 .maxlen = sizeof(sysctl_legacy_va_layout),
1239 .proc_handler = proc_dointvec,
1245 .procname = "zone_reclaim_mode",
1246 .data = &zone_reclaim_mode,
1247 .maxlen = sizeof(zone_reclaim_mode),
1249 .proc_handler = proc_dointvec,
1253 .procname = "min_unmapped_ratio",
1254 .data = &sysctl_min_unmapped_ratio,
1255 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1257 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
1259 .extra2 = &one_hundred,
1262 .procname = "min_slab_ratio",
1263 .data = &sysctl_min_slab_ratio,
1264 .maxlen = sizeof(sysctl_min_slab_ratio),
1266 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
1268 .extra2 = &one_hundred,
1273 .procname = "stat_interval",
1274 .data = &sysctl_stat_interval,
1275 .maxlen = sizeof(sysctl_stat_interval),
1277 .proc_handler = proc_dointvec_jiffies,
1282 .procname = "mmap_min_addr",
1283 .data = &dac_mmap_min_addr,
1284 .maxlen = sizeof(unsigned long),
1286 .proc_handler = mmap_min_addr_handler,
1291 .procname = "numa_zonelist_order",
1292 .data = &numa_zonelist_order,
1293 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1295 .proc_handler = numa_zonelist_order_handler,
1298 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1299 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1301 .procname = "vdso_enabled",
1302 .data = &vdso_enabled,
1303 .maxlen = sizeof(vdso_enabled),
1305 .proc_handler = proc_dointvec,
1309 #ifdef CONFIG_HIGHMEM
1311 .procname = "highmem_is_dirtyable",
1312 .data = &vm_highmem_is_dirtyable,
1313 .maxlen = sizeof(vm_highmem_is_dirtyable),
1315 .proc_handler = proc_dointvec_bool,
1319 .procname = "scan_unevictable_pages",
1320 .data = &scan_unevictable_pages,
1321 .maxlen = sizeof(scan_unevictable_pages),
1323 .proc_handler = scan_unevictable_handler,
1325 #ifdef CONFIG_MEMORY_FAILURE
1327 .procname = "memory_failure_early_kill",
1328 .data = &sysctl_memory_failure_early_kill,
1329 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1331 .proc_handler = proc_dointvec_bool,
1334 .procname = "memory_failure_recovery",
1335 .data = &sysctl_memory_failure_recovery,
1336 .maxlen = sizeof(sysctl_memory_failure_recovery),
1338 .proc_handler = proc_dointvec_bool,
1344 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1345 static struct ctl_table binfmt_misc_table[] = {
1350 static struct ctl_table fs_table[] = {
1352 .procname = "inode-nr",
1353 .data = &inodes_stat,
1354 .maxlen = 2*sizeof(int),
1356 .proc_handler = proc_nr_inodes,
1359 .procname = "inode-state",
1360 .data = &inodes_stat,
1361 .maxlen = 7*sizeof(int),
1363 .proc_handler = proc_nr_inodes,
1366 .procname = "file-nr",
1367 .data = &files_stat,
1368 .maxlen = sizeof(files_stat),
1370 .proc_handler = proc_nr_files,
1373 .procname = "file-max",
1374 .data = &files_stat.max_files,
1375 .maxlen = sizeof(files_stat.max_files),
1377 .proc_handler = proc_doulongvec_minmax,
1380 .procname = "nr_open",
1381 .data = &sysctl_nr_open,
1382 .maxlen = sizeof(int),
1384 .proc_handler = proc_dointvec_minmax,
1385 .extra1 = &sysctl_nr_open_min,
1386 .extra2 = &sysctl_nr_open_max,
1389 .procname = "dentry-state",
1390 .data = &dentry_stat,
1391 .maxlen = 6*sizeof(int),
1393 .proc_handler = proc_nr_dentry,
1396 .procname = "overflowuid",
1397 .data = &fs_overflowuid,
1398 .maxlen = sizeof(int),
1400 .proc_handler = proc_dointvec_minmax,
1401 .extra1 = &minolduid,
1402 .extra2 = &maxolduid,
1405 .procname = "overflowgid",
1406 .data = &fs_overflowgid,
1407 .maxlen = sizeof(int),
1409 .proc_handler = proc_dointvec_minmax,
1410 .extra1 = &minolduid,
1411 .extra2 = &maxolduid,
1413 #ifdef CONFIG_FILE_LOCKING
1415 .procname = "leases-enable",
1416 .data = &leases_enable,
1417 .maxlen = sizeof(int),
1419 .proc_handler = proc_dointvec,
1422 #ifdef CONFIG_DNOTIFY
1424 .procname = "dir-notify-enable",
1425 .data = &dir_notify_enable,
1426 .maxlen = sizeof(int),
1428 .proc_handler = proc_dointvec,
1432 #ifdef CONFIG_FILE_LOCKING
1434 .procname = "lease-break-time",
1435 .data = &lease_break_time,
1436 .maxlen = sizeof(int),
1438 .proc_handler = proc_dointvec,
1443 .procname = "aio-nr",
1445 .maxlen = sizeof(aio_nr),
1447 .proc_handler = proc_doulongvec_minmax,
1450 .procname = "aio-max-nr",
1451 .data = &aio_max_nr,
1452 .maxlen = sizeof(aio_max_nr),
1454 .proc_handler = proc_doulongvec_minmax,
1456 #endif /* CONFIG_AIO */
1457 #ifdef CONFIG_INOTIFY_USER
1459 .procname = "inotify",
1461 .child = inotify_table,
1466 .procname = "epoll",
1468 .child = epoll_table,
1473 .procname = "suid_dumpable",
1474 .data = &suid_dumpable,
1475 .maxlen = sizeof(int),
1477 .proc_handler = proc_dointvec_minmax,
1481 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1483 .procname = "binfmt_misc",
1485 .child = binfmt_misc_table,
1489 .procname = "pipe-max-size",
1490 .data = &pipe_max_size,
1491 .maxlen = sizeof(int),
1493 .proc_handler = &pipe_proc_fn,
1494 .extra1 = &pipe_min_size,
1499 static struct ctl_table debug_table[] = {
1500 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
1501 defined(CONFIG_S390) || defined(CONFIG_TILE)
1503 .procname = "exception-trace",
1504 .data = &show_unhandled_signals,
1505 .maxlen = sizeof(int),
1507 .proc_handler = proc_dointvec
1510 #if defined(CONFIG_OPTPROBES)
1512 .procname = "kprobes-optimization",
1513 .data = &sysctl_kprobes_optimization,
1514 .maxlen = sizeof(int),
1516 .proc_handler = proc_kprobes_optimization_handler,
1524 static struct ctl_table dev_table[] = {
1528 static DEFINE_SPINLOCK(sysctl_lock);
1530 /* called under sysctl_lock */
1531 static int use_table(struct ctl_table_header *p)
1533 if (unlikely(p->unregistering))
1539 /* called under sysctl_lock */
1540 static void unuse_table(struct ctl_table_header *p)
1543 if (unlikely(p->unregistering))
1544 complete(p->unregistering);
1547 /* called under sysctl_lock, will reacquire if has to wait */
1548 static void start_unregistering(struct ctl_table_header *p)
1551 * if p->used is 0, nobody will ever touch that entry again;
1552 * we'll eliminate all paths to it before dropping sysctl_lock
1554 if (unlikely(p->used)) {
1555 struct completion wait;
1556 init_completion(&wait);
1557 p->unregistering = &wait;
1558 spin_unlock(&sysctl_lock);
1559 wait_for_completion(&wait);
1560 spin_lock(&sysctl_lock);
1562 /* anything non-NULL; we'll never dereference it */
1563 p->unregistering = ERR_PTR(-EINVAL);
1566 * do not remove from the list until nobody holds it; walking the
1567 * list in do_sysctl() relies on that.
1569 list_del_init(&p->ctl_entry);
1572 void sysctl_head_get(struct ctl_table_header *head)
1574 spin_lock(&sysctl_lock);
1576 spin_unlock(&sysctl_lock);
1579 void sysctl_head_put(struct ctl_table_header *head)
1581 spin_lock(&sysctl_lock);
1583 kfree_rcu(head, rcu);
1584 spin_unlock(&sysctl_lock);
1587 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1591 spin_lock(&sysctl_lock);
1592 if (!use_table(head))
1593 head = ERR_PTR(-ENOENT);
1594 spin_unlock(&sysctl_lock);
1598 void sysctl_head_finish(struct ctl_table_header *head)
1602 spin_lock(&sysctl_lock);
1604 spin_unlock(&sysctl_lock);
1607 static struct ctl_table_set *
1608 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1610 struct ctl_table_set *set = &root->default_set;
1612 set = root->lookup(root, namespaces);
1616 static struct list_head *
1617 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1619 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1623 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1624 struct ctl_table_header *prev)
1626 struct ctl_table_root *root;
1627 struct list_head *header_list;
1628 struct ctl_table_header *head;
1629 struct list_head *tmp;
1631 spin_lock(&sysctl_lock);
1634 tmp = &prev->ctl_entry;
1638 tmp = &root_table_header.ctl_entry;
1640 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1642 if (!use_table(head))
1644 spin_unlock(&sysctl_lock);
1649 header_list = lookup_header_list(root, namespaces);
1650 if (tmp != header_list)
1654 root = list_entry(root->root_list.next,
1655 struct ctl_table_root, root_list);
1656 if (root == &sysctl_table_root)
1658 header_list = lookup_header_list(root, namespaces);
1659 } while (list_empty(header_list));
1660 tmp = header_list->next;
1663 spin_unlock(&sysctl_lock);
1667 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1669 return __sysctl_head_next(current->nsproxy, prev);
1672 void register_sysctl_root(struct ctl_table_root *root)
1674 spin_lock(&sysctl_lock);
1675 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1676 spin_unlock(&sysctl_lock);
1680 * sysctl_perm does NOT grant the superuser all rights automatically, because
1681 * some sysctl variables are readonly even to root.
1684 static int test_perm(int mode, int op)
1686 if (!current_euid())
1688 else if (in_egroup_p(0))
1690 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1695 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1699 if (root->permissions)
1700 mode = root->permissions(root, current->nsproxy, table);
1704 return test_perm(mode, op);
1707 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1709 for (; table->procname; table++) {
1710 table->parent = parent;
1712 sysctl_set_parent(table, table->child);
1716 static __init int sysctl_init(void)
1718 sysctl_set_parent(NULL, root_table);
1719 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1720 sysctl_check_table(current->nsproxy, root_table);
1725 core_initcall(sysctl_init);
1727 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1728 struct ctl_table *table)
1730 struct ctl_table *p;
1731 const char *s = branch->procname;
1733 /* branch should have named subdirectory as its first element */
1734 if (!s || !branch->child)
1737 /* ... and nothing else */
1738 if (branch[1].procname)
1741 /* table should contain subdirectory with the same name */
1742 for (p = table; p->procname; p++) {
1745 if (p->procname && strcmp(p->procname, s) == 0)
1751 /* see if attaching q to p would be an improvement */
1752 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1754 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1755 struct ctl_table *next;
1757 int not_in_parent = !p->attached_by;
1759 while ((next = is_branch_in(by, to)) != NULL) {
1760 if (by == q->attached_by)
1762 if (to == p->attached_by)
1768 if (is_better && not_in_parent) {
1769 q->attached_by = by;
1770 q->attached_to = to;
1776 * __register_sysctl_paths - register a sysctl hierarchy
1777 * @root: List of sysctl headers to register on
1778 * @namespaces: Data to compute which lists of sysctl entries are visible
1779 * @path: The path to the directory the sysctl table is in.
1780 * @table: the top-level table structure
1782 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1783 * array. A completely 0 filled entry terminates the table.
1785 * The members of the &struct ctl_table structure are used as follows:
1787 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1788 * enter a sysctl file
1790 * data - a pointer to data for use by proc_handler
1792 * maxlen - the maximum size in bytes of the data
1794 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1796 * child - a pointer to the child sysctl table if this entry is a directory, or
1799 * proc_handler - the text handler routine (described below)
1801 * de - for internal use by the sysctl routines
1803 * extra1, extra2 - extra pointers usable by the proc handler routines
1805 * Leaf nodes in the sysctl tree will be represented by a single file
1806 * under /proc; non-leaf nodes will be represented by directories.
1808 * sysctl(2) can automatically manage read and write requests through
1809 * the sysctl table. The data and maxlen fields of the ctl_table
1810 * struct enable minimal validation of the values being written to be
1811 * performed, and the mode field allows minimal authentication.
1813 * There must be a proc_handler routine for any terminal nodes
1814 * mirrored under /proc/sys (non-terminals are handled by a built-in
1815 * directory handler). Several default handlers are available to
1816 * cover common cases -
1818 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1819 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1820 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1822 * It is the handler's job to read the input buffer from user memory
1823 * and process it. The handler should return 0 on success.
1825 * This routine returns %NULL on a failure to register, and a pointer
1826 * to the table header on success.
1828 struct ctl_table_header *__register_sysctl_paths(
1829 struct ctl_table_root *root,
1830 struct nsproxy *namespaces,
1831 const struct ctl_path *path, struct ctl_table *table)
1833 struct ctl_table_header *header;
1834 struct ctl_table *new, **prevp;
1835 unsigned int n, npath;
1836 struct ctl_table_set *set;
1838 /* Count the path components */
1839 for (npath = 0; path[npath].procname; ++npath)
1843 * For each path component, allocate a 2-element ctl_table array.
1844 * The first array element will be filled with the sysctl entry
1845 * for this, the second will be the sentinel (procname == 0).
1847 * We allocate everything in one go so that we don't have to
1848 * worry about freeing additional memory in unregister_sysctl_table.
1850 header = kzalloc(sizeof(struct ctl_table_header) +
1851 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1855 new = (struct ctl_table *) (header + 1);
1857 /* Now connect the dots */
1858 prevp = &header->ctl_table;
1859 for (n = 0; n < npath; ++n, ++path) {
1860 /* Copy the procname */
1861 new->procname = path->procname;
1865 prevp = &new->child;
1870 header->ctl_table_arg = table;
1872 INIT_LIST_HEAD(&header->ctl_entry);
1874 header->unregistering = NULL;
1875 header->root = root;
1876 sysctl_set_parent(NULL, header->ctl_table);
1878 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1879 if (sysctl_check_table(namespaces, header->ctl_table)) {
1884 spin_lock(&sysctl_lock);
1885 header->set = lookup_header_set(root, namespaces);
1886 header->attached_by = header->ctl_table;
1887 header->attached_to = root_table;
1888 header->parent = &root_table_header;
1889 for (set = header->set; set; set = set->parent) {
1890 struct ctl_table_header *p;
1891 list_for_each_entry(p, &set->list, ctl_entry) {
1892 if (p->unregistering)
1894 try_attach(p, header);
1897 header->parent->count++;
1898 list_add_tail(&header->ctl_entry, &header->set->list);
1899 spin_unlock(&sysctl_lock);
1905 * register_sysctl_table_path - register a sysctl table hierarchy
1906 * @path: The path to the directory the sysctl table is in.
1907 * @table: the top-level table structure
1909 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1910 * array. A completely 0 filled entry terminates the table.
1912 * See __register_sysctl_paths for more details.
1914 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1915 struct ctl_table *table)
1917 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1922 * register_sysctl_table - register a sysctl table hierarchy
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_table(struct ctl_table *table)
1932 static const struct ctl_path null_path[] = { {} };
1934 return register_sysctl_paths(null_path, table);
1938 * unregister_sysctl_table - unregister a sysctl table hierarchy
1939 * @header: the header returned from register_sysctl_table
1941 * Unregisters the sysctl table and all children. proc entries may not
1942 * actually be removed until they are no longer used by anyone.
1944 void unregister_sysctl_table(struct ctl_table_header * header)
1951 spin_lock(&sysctl_lock);
1952 start_unregistering(header);
1953 if (!--header->parent->count) {
1955 kfree_rcu(header->parent, rcu);
1957 if (!--header->count)
1958 kfree_rcu(header, rcu);
1959 spin_unlock(&sysctl_lock);
1962 int sysctl_is_seen(struct ctl_table_header *p)
1964 struct ctl_table_set *set = p->set;
1966 spin_lock(&sysctl_lock);
1967 if (p->unregistering)
1969 else if (!set->is_seen)
1972 res = set->is_seen(set);
1973 spin_unlock(&sysctl_lock);
1977 void setup_sysctl_set(struct ctl_table_set *p,
1978 struct ctl_table_set *parent,
1979 int (*is_seen)(struct ctl_table_set *))
1981 INIT_LIST_HEAD(&p->list);
1982 p->parent = parent ? parent : &sysctl_table_root.default_set;
1983 p->is_seen = is_seen;
1986 #else /* !CONFIG_SYSCTL */
1987 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1992 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1993 struct ctl_table *table)
1998 void unregister_sysctl_table(struct ctl_table_header * table)
2002 void setup_sysctl_set(struct ctl_table_set *p,
2003 struct ctl_table_set *parent,
2004 int (*is_seen)(struct ctl_table_set *))
2008 void sysctl_head_put(struct ctl_table_header *head)
2012 #endif /* CONFIG_SYSCTL */
2018 #ifdef CONFIG_PROC_SYSCTL
2020 static int _proc_do_string(void* data, int maxlen, int write,
2021 void __user *buffer,
2022 size_t *lenp, loff_t *ppos)
2028 if (!data || !maxlen || !*lenp) {
2036 while (len < *lenp) {
2037 if (get_user(c, p++))
2039 if (c == 0 || c == '\n')
2045 if(copy_from_user(data, buffer, len))
2047 ((char *) data)[len] = 0;
2065 if(copy_to_user(buffer, data, len))
2068 if(put_user('\n', ((char __user *) buffer) + len))
2079 * proc_dostring - read a string sysctl
2080 * @table: the sysctl table
2081 * @write: %TRUE if this is a write to the sysctl file
2082 * @buffer: the user buffer
2083 * @lenp: the size of the user buffer
2084 * @ppos: file position
2086 * Reads/writes a string from/to the user buffer. If the kernel
2087 * buffer provided is not large enough to hold the string, the
2088 * string is truncated. The copied string is %NULL-terminated.
2089 * If the string is being read by the user process, it is copied
2090 * and a newline '\n' is added. It is truncated if the buffer is
2093 * Returns 0 on success.
2095 int proc_dostring(struct ctl_table *table, int write,
2096 void __user *buffer, size_t *lenp, loff_t *ppos)
2098 return _proc_do_string(table->data, table->maxlen, write,
2099 buffer, lenp, ppos);
2102 static size_t proc_skip_spaces(char **buf)
2105 char *tmp = skip_spaces(*buf);
2111 static void proc_skip_char(char **buf, size_t *size, const char v)
2121 #define TMPBUFLEN 22
2123 * proc_get_long - reads an ASCII formatted integer from a user buffer
2125 * @buf: a kernel buffer
2126 * @size: size of the kernel buffer
2127 * @val: this is where the number will be stored
2128 * @neg: set to %TRUE if number is negative
2129 * @perm_tr: a vector which contains the allowed trailers
2130 * @perm_tr_len: size of the perm_tr vector
2131 * @tr: pointer to store the trailer character
2133 * In case of success %0 is returned and @buf and @size are updated with
2134 * the amount of bytes read. If @tr is non-NULL and a trailing
2135 * character exists (size is non-zero after returning from this
2136 * function), @tr is updated with the trailing character.
2138 static int proc_get_long(char **buf, size_t *size,
2139 unsigned long *val, bool *neg,
2140 const char *perm_tr, unsigned perm_tr_len, char *tr)
2143 char *p, tmp[TMPBUFLEN];
2149 if (len > TMPBUFLEN - 1)
2150 len = TMPBUFLEN - 1;
2152 memcpy(tmp, *buf, len);
2156 if (*p == '-' && *size > 1) {
2164 *val = simple_strtoul(p, &p, 0);
2168 /* We don't know if the next char is whitespace thus we may accept
2169 * invalid integers (e.g. 1234...a) or two integers instead of one
2170 * (e.g. 123...1). So lets not allow such large numbers. */
2171 if (len == TMPBUFLEN - 1)
2174 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
2177 if (tr && (len < *size))
2187 * proc_put_long - converts an integer to a decimal ASCII formatted string
2189 * @buf: the user buffer
2190 * @size: the size of the user buffer
2191 * @val: the integer to be converted
2192 * @neg: sign of the number, %TRUE for negative
2194 * In case of success %0 is returned and @buf and @size are updated with
2195 * the amount of bytes written.
2197 static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
2201 char tmp[TMPBUFLEN], *p = tmp;
2203 sprintf(p, "%s%lu", neg ? "-" : "", val);
2207 if (copy_to_user(*buf, tmp, len))
2215 static int proc_put_char(void __user **buf, size_t *size, char c)
2218 char __user **buffer = (char __user **)buf;
2219 if (put_user(c, *buffer))
2221 (*size)--, (*buffer)++;
2227 static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
2229 int write, void *data)
2232 *valp = *negp ? -*lvalp : *lvalp;
2237 *lvalp = (unsigned long)-val;
2240 *lvalp = (unsigned long)val;
2246 static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
2248 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2249 int write, void __user *buffer,
2250 size_t *lenp, loff_t *ppos,
2251 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2252 int write, void *data),
2255 int *i, vleft, first = 1, err = 0;
2256 unsigned long page = 0;
2260 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
2265 i = (int *) tbl_data;
2266 vleft = table->maxlen / sizeof(*i);
2270 conv = do_proc_dointvec_conv;
2273 if (left > PAGE_SIZE - 1)
2274 left = PAGE_SIZE - 1;
2275 page = __get_free_page(GFP_TEMPORARY);
2276 kbuf = (char *) page;
2279 if (copy_from_user(kbuf, buffer, left)) {
2286 for (; left && vleft--; i++, first=0) {
2291 left -= proc_skip_spaces(&kbuf);
2295 err = proc_get_long(&kbuf, &left, &lval, &neg,
2297 sizeof(proc_wspace_sep), NULL);
2300 if (conv(&neg, &lval, i, 1, data)) {
2305 if (conv(&neg, &lval, i, 0, data)) {
2310 err = proc_put_char(&buffer, &left, '\t');
2313 err = proc_put_long(&buffer, &left, lval, neg);
2319 if (!write && !first && left && !err)
2320 err = proc_put_char(&buffer, &left, '\n');
2321 if (write && !err && left)
2322 left -= proc_skip_spaces(&kbuf);
2327 return err ? : -EINVAL;
2334 static int do_proc_dointvec(struct ctl_table *table, int write,
2335 void __user *buffer, size_t *lenp, loff_t *ppos,
2336 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
2337 int write, void *data),
2340 return __do_proc_dointvec(table->data, table, write,
2341 buffer, lenp, ppos, conv, data);
2345 * proc_dointvec - read a vector of integers
2346 * @table: the sysctl table
2347 * @write: %TRUE if this is a write to the sysctl file
2348 * @buffer: the user buffer
2349 * @lenp: the size of the user buffer
2350 * @ppos: file position
2352 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2353 * values from/to the user buffer, treated as an ASCII string.
2355 * Returns 0 on success.
2357 int proc_dointvec(struct ctl_table *table, int write,
2358 void __user *buffer, size_t *lenp, loff_t *ppos)
2360 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2365 * Taint values can only be increased
2366 * This means we can safely use a temporary.
2368 static int proc_taint(struct ctl_table *table, int write,
2369 void __user *buffer, size_t *lenp, loff_t *ppos)
2372 unsigned long tmptaint = get_taint();
2375 if (write && !capable(CAP_SYS_ADMIN))
2380 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
2386 * Poor man's atomic or. Not worth adding a primitive
2387 * to everyone's atomic.h for this
2390 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2391 if ((tmptaint >> i) & 1)
2399 #ifdef CONFIG_PRINTK
2400 static int proc_dmesg_restrict(struct ctl_table *table, int write,
2401 void __user *buffer, size_t *lenp, loff_t *ppos)
2403 if (write && !capable(CAP_SYS_ADMIN))
2406 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2410 struct do_proc_dointvec_minmax_conv_param {
2415 static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2417 int write, void *data)
2419 struct do_proc_dointvec_minmax_conv_param *param = data;
2421 int val = *negp ? -*lvalp : *lvalp;
2422 if ((param->min && *param->min > val) ||
2423 (param->max && *param->max < val))
2430 *lvalp = (unsigned long)-val;
2433 *lvalp = (unsigned long)val;
2440 * proc_dointvec_minmax - read a vector of integers with min/max values
2441 * @table: the sysctl table
2442 * @write: %TRUE if this is a write to the sysctl file
2443 * @buffer: the user buffer
2444 * @lenp: the size of the user buffer
2445 * @ppos: file position
2447 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2448 * values from/to the user buffer, treated as an ASCII string.
2450 * This routine will ensure the values are within the range specified by
2451 * table->extra1 (min) and table->extra2 (max).
2453 * Returns 0 on success.
2455 int proc_dointvec_minmax(struct ctl_table *table, int write,
2456 void __user *buffer, size_t *lenp, loff_t *ppos)
2458 struct do_proc_dointvec_minmax_conv_param param = {
2459 .min = (int *) table->extra1,
2460 .max = (int *) table->extra2,
2462 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2463 do_proc_dointvec_minmax_conv, ¶m);
2467 * proc_dointvec_bool - read a vector of integers with 0/1 values
2468 * @table: the sysctl table
2469 * @write: %TRUE if this is a write to the sysctl file
2470 * @buffer: the user buffer
2471 * @lenp: the size of the user buffer
2472 * @ppos: file position
2474 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2475 * values from/to the user buffer, treated as an ASCII string.
2477 * This routine will ensure the values are either 0 or 1.
2479 * Returns 0 on success.
2481 int proc_dointvec_bool(struct ctl_table *table, int write,
2482 void __user *buffer, size_t *lenp, loff_t *ppos)
2484 struct do_proc_dointvec_minmax_conv_param param = {
2488 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2489 do_proc_dointvec_minmax_conv, ¶m);
2491 EXPORT_SYMBOL(proc_dointvec_bool);
2494 * proc_dointvec_unsigned - read a vector of integers with positive values
2495 * @table: the sysctl table
2496 * @write: %TRUE if this is a write to the sysctl file
2497 * @buffer: the user buffer
2498 * @lenp: the size of the user buffer
2499 * @ppos: file position
2501 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2502 * values from/to the user buffer, treated as an ASCII string.
2504 * This routine will ensure the values are positive.
2506 * Returns 0 on success.
2508 int proc_dointvec_unsigned(struct ctl_table *table, int write,
2509 void __user *buffer, size_t *lenp, loff_t *ppos)
2511 struct do_proc_dointvec_minmax_conv_param param = {
2514 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2515 do_proc_dointvec_minmax_conv, ¶m);
2517 EXPORT_SYMBOL(proc_dointvec_unsigned);
2519 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2520 void __user *buffer,
2521 size_t *lenp, loff_t *ppos,
2522 unsigned long convmul,
2523 unsigned long convdiv)
2525 unsigned long *i, *min, *max;
2526 int vleft, first = 1, err = 0;
2527 unsigned long page = 0;
2531 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
2536 i = (unsigned long *) data;
2537 min = (unsigned long *) table->extra1;
2538 max = (unsigned long *) table->extra2;
2539 vleft = table->maxlen / sizeof(unsigned long);
2543 if (left > PAGE_SIZE - 1)
2544 left = PAGE_SIZE - 1;
2545 page = __get_free_page(GFP_TEMPORARY);
2546 kbuf = (char *) page;
2549 if (copy_from_user(kbuf, buffer, left)) {
2556 for (; left && vleft--; i++, first = 0) {
2562 left -= proc_skip_spaces(&kbuf);
2564 err = proc_get_long(&kbuf, &left, &val, &neg,
2566 sizeof(proc_wspace_sep), NULL);
2571 if ((min && val < *min) || (max && val > *max))
2575 val = convdiv * (*i) / convmul;
2577 err = proc_put_char(&buffer, &left, '\t');
2578 err = proc_put_long(&buffer, &left, val, false);
2584 if (!write && !first && left && !err)
2585 err = proc_put_char(&buffer, &left, '\n');
2587 left -= proc_skip_spaces(&kbuf);
2592 return err ? : -EINVAL;
2599 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2600 void __user *buffer,
2601 size_t *lenp, loff_t *ppos,
2602 unsigned long convmul,
2603 unsigned long convdiv)
2605 return __do_proc_doulongvec_minmax(table->data, table, write,
2606 buffer, lenp, ppos, convmul, convdiv);
2610 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2611 * @table: the sysctl table
2612 * @write: %TRUE if this is a write to the sysctl file
2613 * @buffer: the user buffer
2614 * @lenp: the size of the user buffer
2615 * @ppos: file position
2617 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2618 * values from/to the user buffer, treated as an ASCII string.
2620 * This routine will ensure the values are within the range specified by
2621 * table->extra1 (min) and table->extra2 (max).
2623 * Returns 0 on success.
2625 int proc_doulongvec_minmax(struct ctl_table *table, int write,
2626 void __user *buffer, size_t *lenp, loff_t *ppos)
2628 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
2632 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2633 * @table: the sysctl table
2634 * @write: %TRUE if this is a write to the sysctl file
2635 * @buffer: the user buffer
2636 * @lenp: the size of the user buffer
2637 * @ppos: file position
2639 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2640 * values from/to the user buffer, treated as an ASCII string. The values
2641 * are treated as milliseconds, and converted to jiffies when they are stored.
2643 * This routine will ensure the values are within the range specified by
2644 * table->extra1 (min) and table->extra2 (max).
2646 * Returns 0 on success.
2648 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2649 void __user *buffer,
2650 size_t *lenp, loff_t *ppos)
2652 return do_proc_doulongvec_minmax(table, write, buffer,
2653 lenp, ppos, HZ, 1000l);
2657 static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
2659 int write, void *data)
2662 if (*lvalp > LONG_MAX / HZ)
2664 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2670 lval = (unsigned long)-val;
2673 lval = (unsigned long)val;
2680 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
2682 int write, void *data)
2685 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2687 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2693 lval = (unsigned long)-val;
2696 lval = (unsigned long)val;
2698 *lvalp = jiffies_to_clock_t(lval);
2703 static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
2705 int write, void *data)
2708 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2714 lval = (unsigned long)-val;
2717 lval = (unsigned long)val;
2719 *lvalp = jiffies_to_msecs(lval);
2725 * proc_dointvec_jiffies - read a vector of integers as seconds
2726 * @table: the sysctl table
2727 * @write: %TRUE if this is a write to the sysctl file
2728 * @buffer: the user buffer
2729 * @lenp: the size of the user buffer
2730 * @ppos: file position
2732 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2733 * values from/to the user buffer, treated as an ASCII string.
2734 * The values read are assumed to be in seconds, and are converted into
2737 * Returns 0 on success.
2739 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2740 void __user *buffer, size_t *lenp, loff_t *ppos)
2742 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2743 do_proc_dointvec_jiffies_conv,NULL);
2747 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2748 * @table: the sysctl table
2749 * @write: %TRUE if this is a write to the sysctl file
2750 * @buffer: the user buffer
2751 * @lenp: the size of the user buffer
2752 * @ppos: pointer to the file position
2754 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2755 * values from/to the user buffer, treated as an ASCII string.
2756 * The values read are assumed to be in 1/USER_HZ seconds, and
2757 * are converted into jiffies.
2759 * Returns 0 on success.
2761 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2762 void __user *buffer, size_t *lenp, loff_t *ppos)
2764 return do_proc_dointvec(table,write,buffer,lenp,ppos,
2765 do_proc_dointvec_userhz_jiffies_conv,NULL);
2769 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2770 * @table: the sysctl table
2771 * @write: %TRUE if this is a write to the sysctl file
2772 * @buffer: the user buffer
2773 * @lenp: the size of the user buffer
2774 * @ppos: file position
2775 * @ppos: the current position in the file
2777 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2778 * values from/to the user buffer, treated as an ASCII string.
2779 * The values read are assumed to be in 1/1000 seconds, and
2780 * are converted into jiffies.
2782 * Returns 0 on success.
2784 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2785 void __user *buffer, size_t *lenp, loff_t *ppos)
2787 return do_proc_dointvec(table, write, buffer, lenp, ppos,
2788 do_proc_dointvec_ms_jiffies_conv, NULL);
2791 static int proc_do_cad_pid(struct ctl_table *table, int write,
2792 void __user *buffer, size_t *lenp, loff_t *ppos)
2794 struct pid *new_pid;
2798 tmp = pid_vnr(cad_pid);
2800 r = __do_proc_dointvec(&tmp, table, write, buffer,
2801 lenp, ppos, NULL, NULL);
2805 new_pid = find_get_pid(tmp);
2809 put_pid(xchg(&cad_pid, new_pid));
2814 * proc_do_large_bitmap - read/write from/to a large bitmap
2815 * @table: the sysctl table
2816 * @write: %TRUE if this is a write to the sysctl file
2817 * @buffer: the user buffer
2818 * @lenp: the size of the user buffer
2819 * @ppos: file position
2821 * The bitmap is stored at table->data and the bitmap length (in bits)
2824 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2825 * large bitmaps may be represented in a compact manner. Writing into
2826 * the file will clear the bitmap then update it with the given input.
2828 * Returns 0 on success.
2830 int proc_do_large_bitmap(struct ctl_table *table, int write,
2831 void __user *buffer, size_t *lenp, loff_t *ppos)
2835 size_t left = *lenp;
2836 unsigned long bitmap_len = table->maxlen;
2837 unsigned long *bitmap = (unsigned long *) table->data;
2838 unsigned long *tmp_bitmap = NULL;
2839 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2841 if (!bitmap_len || !left || (*ppos && !write)) {
2847 unsigned long page = 0;
2850 if (left > PAGE_SIZE - 1)
2851 left = PAGE_SIZE - 1;
2853 page = __get_free_page(GFP_TEMPORARY);
2854 kbuf = (char *) page;
2857 if (copy_from_user(kbuf, buffer, left)) {
2863 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2869 proc_skip_char(&kbuf, &left, '\n');
2870 while (!err && left) {
2871 unsigned long val_a, val_b;
2874 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2878 if (val_a >= bitmap_len || neg) {
2890 err = proc_get_long(&kbuf, &left, &val_b,
2891 &neg, tr_b, sizeof(tr_b),
2895 if (val_b >= bitmap_len || neg ||
2906 while (val_a <= val_b)
2907 set_bit(val_a++, tmp_bitmap);
2910 proc_skip_char(&kbuf, &left, '\n');
2914 unsigned long bit_a, bit_b = 0;
2917 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2918 if (bit_a >= bitmap_len)
2920 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2924 err = proc_put_char(&buffer, &left, ',');
2928 err = proc_put_long(&buffer, &left, bit_a, false);
2931 if (bit_a != bit_b) {
2932 err = proc_put_char(&buffer, &left, '-');
2935 err = proc_put_long(&buffer, &left, bit_b, false);
2943 err = proc_put_char(&buffer, &left, '\n');
2949 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2951 memcpy(bitmap, tmp_bitmap,
2952 BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long));
2964 #else /* CONFIG_PROC_SYSCTL */
2966 int proc_dostring(struct ctl_table *table, int write,
2967 void __user *buffer, size_t *lenp, loff_t *ppos)
2972 int proc_dointvec(struct ctl_table *table, int write,
2973 void __user *buffer, size_t *lenp, loff_t *ppos)
2978 int proc_dointvec_minmax(struct ctl_table *table, int write,
2979 void __user *buffer, size_t *lenp, loff_t *ppos)
2984 int proc_dointvec_jiffies(struct ctl_table *table, int write,
2985 void __user *buffer, size_t *lenp, loff_t *ppos)
2990 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
2991 void __user *buffer, size_t *lenp, loff_t *ppos)
2996 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
2997 void __user *buffer, size_t *lenp, loff_t *ppos)
3002 int proc_doulongvec_minmax(struct ctl_table *table, int write,
3003 void __user *buffer, size_t *lenp, loff_t *ppos)
3008 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
3009 void __user *buffer,
3010 size_t *lenp, loff_t *ppos)
3016 #endif /* CONFIG_PROC_SYSCTL */
3019 * No sense putting this after each symbol definition, twice,
3020 * exception granted :-)
3022 EXPORT_SYMBOL(proc_dointvec);
3023 EXPORT_SYMBOL(proc_dointvec_jiffies);
3024 EXPORT_SYMBOL(proc_dointvec_minmax);
3025 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3026 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3027 EXPORT_SYMBOL(proc_dostring);
3028 EXPORT_SYMBOL(proc_doulongvec_minmax);
3029 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3030 EXPORT_SYMBOL(register_sysctl_table);
3031 EXPORT_SYMBOL(register_sysctl_paths);
3032 EXPORT_SYMBOL(unregister_sysctl_table);