2 * sysctl.c: General linux system control interface
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
21 #include <linux/module.h>
23 #include <linux/swap.h>
24 #include <linux/slab.h>
25 #include <linux/sysctl.h>
26 #include <linux/proc_fs.h>
27 #include <linux/security.h>
28 #include <linux/ctype.h>
29 #include <linux/utsname.h>
30 #include <linux/smp_lock.h>
32 #include <linux/init.h>
33 #include <linux/kernel.h>
34 #include <linux/kobject.h>
35 #include <linux/net.h>
36 #include <linux/sysrq.h>
37 #include <linux/highuid.h>
38 #include <linux/writeback.h>
39 #include <linux/hugetlb.h>
40 #include <linux/security.h>
41 #include <linux/initrd.h>
42 #include <linux/times.h>
43 #include <linux/limits.h>
44 #include <linux/dcache.h>
45 #include <linux/syscalls.h>
46 #include <linux/nfs_fs.h>
47 #include <linux/acpi.h>
48 #include <linux/reboot.h>
50 #include <asm/uaccess.h>
51 #include <asm/processor.h>
55 #include <asm/stacktrace.h>
59 static int deprecated_sysctl_warning(struct __sysctl_args *args);
61 #if defined(CONFIG_SYSCTL)
63 /* External variables not in a header file. */
65 extern int print_fatal_signals;
66 extern int sysctl_overcommit_memory;
67 extern int sysctl_overcommit_ratio;
68 extern int sysctl_panic_on_oom;
69 extern int sysctl_oom_kill_allocating_task;
70 extern int max_threads;
71 extern int core_uses_pid;
72 extern int suid_dumpable;
73 extern char core_pattern[];
75 extern int min_free_kbytes;
76 extern int printk_ratelimit_jiffies;
77 extern int printk_ratelimit_burst;
78 extern int pid_max_min, pid_max_max;
79 extern int sysctl_drop_caches;
80 extern int percpu_pagelist_fraction;
81 extern int compat_log;
82 extern int maps_protect;
83 extern int sysctl_stat_interval;
84 extern int latencytop_enabled;
86 /* Constants used for minimum and maximum */
87 #if defined(CONFIG_DETECT_SOFTLOCKUP) || defined(CONFIG_HIGHMEM)
91 #ifdef CONFIG_DETECT_SOFTLOCKUP
92 static int sixty = 60;
100 static int one_hundred = 100;
102 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
103 static int maxolduid = 65535;
104 static int minolduid;
105 static int min_percpu_pagelist_fract = 8;
107 static int ngroups_max = NGROUPS_MAX;
110 extern char modprobe_path[];
112 #ifdef CONFIG_CHR_DEV_SG
113 extern int sg_big_buff;
117 extern char reboot_command [];
118 extern int stop_a_enabled;
119 extern int scons_pwroff;
123 extern int pwrsw_enabled;
124 extern int unaligned_enabled;
128 #ifdef CONFIG_MATHEMU
129 extern int sysctl_ieee_emulation_warnings;
131 extern int sysctl_userprocess_debug;
132 extern int spin_retry;
135 extern int sysctl_hz_timer;
137 #ifdef CONFIG_BSD_PROCESS_ACCT
138 extern int acct_parm[];
142 extern int no_unaligned_warning;
145 #ifdef CONFIG_RT_MUTEXES
146 extern int max_lock_depth;
149 #ifdef CONFIG_SYSCTL_SYSCALL
150 static int parse_table(int __user *, int, void __user *, size_t __user *,
151 void __user *, size_t, struct ctl_table *);
155 #ifdef CONFIG_PROC_SYSCTL
156 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
157 void __user *buffer, size_t *lenp, loff_t *ppos);
158 static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp,
159 void __user *buffer, size_t *lenp, loff_t *ppos);
162 static struct ctl_table root_table[];
163 static struct ctl_table_root sysctl_table_root;
164 static struct ctl_table_header root_table_header = {
165 .ctl_table = root_table,
166 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.header_list),
167 .root = &sysctl_table_root,
169 static struct ctl_table_root sysctl_table_root = {
170 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
171 .header_list = LIST_HEAD_INIT(root_table_header.ctl_entry),
174 static struct ctl_table kern_table[];
175 static struct ctl_table vm_table[];
176 static struct ctl_table fs_table[];
177 static struct ctl_table debug_table[];
178 static struct ctl_table dev_table[];
179 extern struct ctl_table random_table[];
180 #ifdef CONFIG_INOTIFY_USER
181 extern struct ctl_table inotify_table[];
184 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
185 int sysctl_legacy_va_layout;
188 extern int prove_locking;
189 extern int lock_stat;
191 /* The default sysctl tables: */
193 static struct ctl_table root_table[] = {
195 .ctl_name = CTL_KERN,
196 .procname = "kernel",
213 .ctl_name = CTL_DEBUG,
216 .child = debug_table,
225 * NOTE: do not add new entries to this table unless you have read
226 * Documentation/sysctl/ctl_unnumbered.txt
231 #ifdef CONFIG_SCHED_DEBUG
232 static int min_sched_granularity_ns = 100000; /* 100 usecs */
233 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
234 static int min_wakeup_granularity_ns; /* 0 usecs */
235 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
238 static struct ctl_table kern_table[] = {
239 #ifdef CONFIG_SCHED_DEBUG
241 .ctl_name = CTL_UNNUMBERED,
242 .procname = "sched_min_granularity_ns",
243 .data = &sysctl_sched_min_granularity,
244 .maxlen = sizeof(unsigned int),
246 .proc_handler = &sched_nr_latency_handler,
247 .strategy = &sysctl_intvec,
248 .extra1 = &min_sched_granularity_ns,
249 .extra2 = &max_sched_granularity_ns,
252 .ctl_name = CTL_UNNUMBERED,
253 .procname = "sched_latency_ns",
254 .data = &sysctl_sched_latency,
255 .maxlen = sizeof(unsigned int),
257 .proc_handler = &sched_nr_latency_handler,
258 .strategy = &sysctl_intvec,
259 .extra1 = &min_sched_granularity_ns,
260 .extra2 = &max_sched_granularity_ns,
263 .ctl_name = CTL_UNNUMBERED,
264 .procname = "sched_wakeup_granularity_ns",
265 .data = &sysctl_sched_wakeup_granularity,
266 .maxlen = sizeof(unsigned int),
268 .proc_handler = &proc_dointvec_minmax,
269 .strategy = &sysctl_intvec,
270 .extra1 = &min_wakeup_granularity_ns,
271 .extra2 = &max_wakeup_granularity_ns,
274 .ctl_name = CTL_UNNUMBERED,
275 .procname = "sched_batch_wakeup_granularity_ns",
276 .data = &sysctl_sched_batch_wakeup_granularity,
277 .maxlen = sizeof(unsigned int),
279 .proc_handler = &proc_dointvec_minmax,
280 .strategy = &sysctl_intvec,
281 .extra1 = &min_wakeup_granularity_ns,
282 .extra2 = &max_wakeup_granularity_ns,
285 .ctl_name = CTL_UNNUMBERED,
286 .procname = "sched_child_runs_first",
287 .data = &sysctl_sched_child_runs_first,
288 .maxlen = sizeof(unsigned int),
290 .proc_handler = &proc_dointvec,
293 .ctl_name = CTL_UNNUMBERED,
294 .procname = "sched_features",
295 .data = &sysctl_sched_features,
296 .maxlen = sizeof(unsigned int),
298 .proc_handler = &proc_dointvec,
301 .ctl_name = CTL_UNNUMBERED,
302 .procname = "sched_migration_cost",
303 .data = &sysctl_sched_migration_cost,
304 .maxlen = sizeof(unsigned int),
306 .proc_handler = &proc_dointvec,
309 .ctl_name = CTL_UNNUMBERED,
310 .procname = "sched_nr_migrate",
311 .data = &sysctl_sched_nr_migrate,
312 .maxlen = sizeof(unsigned int),
314 .proc_handler = &proc_dointvec,
317 .ctl_name = CTL_UNNUMBERED,
318 .procname = "sched_rt_period_ms",
319 .data = &sysctl_sched_rt_period,
320 .maxlen = sizeof(unsigned int),
322 .proc_handler = &proc_dointvec,
325 .ctl_name = CTL_UNNUMBERED,
326 .procname = "sched_rt_ratio",
327 .data = &sysctl_sched_rt_ratio,
328 .maxlen = sizeof(unsigned int),
330 .proc_handler = &proc_dointvec,
332 #if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
334 .ctl_name = CTL_UNNUMBERED,
335 .procname = "sched_min_bal_int_shares",
336 .data = &sysctl_sched_min_bal_int_shares,
337 .maxlen = sizeof(unsigned int),
339 .proc_handler = &proc_dointvec,
342 .ctl_name = CTL_UNNUMBERED,
343 .procname = "sched_max_bal_int_shares",
344 .data = &sysctl_sched_max_bal_int_shares,
345 .maxlen = sizeof(unsigned int),
347 .proc_handler = &proc_dointvec,
352 .ctl_name = CTL_UNNUMBERED,
353 .procname = "sched_compat_yield",
354 .data = &sysctl_sched_compat_yield,
355 .maxlen = sizeof(unsigned int),
357 .proc_handler = &proc_dointvec,
359 #ifdef CONFIG_PROVE_LOCKING
361 .ctl_name = CTL_UNNUMBERED,
362 .procname = "prove_locking",
363 .data = &prove_locking,
364 .maxlen = sizeof(int),
366 .proc_handler = &proc_dointvec,
369 #ifdef CONFIG_LOCK_STAT
371 .ctl_name = CTL_UNNUMBERED,
372 .procname = "lock_stat",
374 .maxlen = sizeof(int),
376 .proc_handler = &proc_dointvec,
380 .ctl_name = KERN_PANIC,
382 .data = &panic_timeout,
383 .maxlen = sizeof(int),
385 .proc_handler = &proc_dointvec,
388 .ctl_name = KERN_CORE_USES_PID,
389 .procname = "core_uses_pid",
390 .data = &core_uses_pid,
391 .maxlen = sizeof(int),
393 .proc_handler = &proc_dointvec,
396 .ctl_name = KERN_CORE_PATTERN,
397 .procname = "core_pattern",
398 .data = core_pattern,
399 .maxlen = CORENAME_MAX_SIZE,
401 .proc_handler = &proc_dostring,
402 .strategy = &sysctl_string,
404 #ifdef CONFIG_PROC_SYSCTL
406 .procname = "tainted",
408 .maxlen = sizeof(int),
410 .proc_handler = &proc_dointvec_taint,
413 #ifdef CONFIG_LATENCYTOP
415 .procname = "latencytop",
416 .data = &latencytop_enabled,
417 .maxlen = sizeof(int),
419 .proc_handler = &proc_dointvec,
422 #ifdef CONFIG_BLK_DEV_INITRD
424 .ctl_name = KERN_REALROOTDEV,
425 .procname = "real-root-dev",
426 .data = &real_root_dev,
427 .maxlen = sizeof(int),
429 .proc_handler = &proc_dointvec,
433 .ctl_name = CTL_UNNUMBERED,
434 .procname = "print-fatal-signals",
435 .data = &print_fatal_signals,
436 .maxlen = sizeof(int),
438 .proc_handler = &proc_dointvec,
442 .ctl_name = KERN_SPARC_REBOOT,
443 .procname = "reboot-cmd",
444 .data = reboot_command,
447 .proc_handler = &proc_dostring,
448 .strategy = &sysctl_string,
451 .ctl_name = KERN_SPARC_STOP_A,
452 .procname = "stop-a",
453 .data = &stop_a_enabled,
454 .maxlen = sizeof (int),
456 .proc_handler = &proc_dointvec,
459 .ctl_name = KERN_SPARC_SCONS_PWROFF,
460 .procname = "scons-poweroff",
461 .data = &scons_pwroff,
462 .maxlen = sizeof (int),
464 .proc_handler = &proc_dointvec,
469 .ctl_name = KERN_HPPA_PWRSW,
470 .procname = "soft-power",
471 .data = &pwrsw_enabled,
472 .maxlen = sizeof (int),
474 .proc_handler = &proc_dointvec,
477 .ctl_name = KERN_HPPA_UNALIGNED,
478 .procname = "unaligned-trap",
479 .data = &unaligned_enabled,
480 .maxlen = sizeof (int),
482 .proc_handler = &proc_dointvec,
486 .ctl_name = KERN_CTLALTDEL,
487 .procname = "ctrl-alt-del",
489 .maxlen = sizeof(int),
491 .proc_handler = &proc_dointvec,
494 .ctl_name = KERN_PRINTK,
495 .procname = "printk",
496 .data = &console_loglevel,
497 .maxlen = 4*sizeof(int),
499 .proc_handler = &proc_dointvec,
503 .ctl_name = KERN_MODPROBE,
504 .procname = "modprobe",
505 .data = &modprobe_path,
506 .maxlen = KMOD_PATH_LEN,
508 .proc_handler = &proc_dostring,
509 .strategy = &sysctl_string,
512 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
514 .ctl_name = KERN_HOTPLUG,
515 .procname = "hotplug",
516 .data = &uevent_helper,
517 .maxlen = UEVENT_HELPER_PATH_LEN,
519 .proc_handler = &proc_dostring,
520 .strategy = &sysctl_string,
523 #ifdef CONFIG_CHR_DEV_SG
525 .ctl_name = KERN_SG_BIG_BUFF,
526 .procname = "sg-big-buff",
527 .data = &sg_big_buff,
528 .maxlen = sizeof (int),
530 .proc_handler = &proc_dointvec,
533 #ifdef CONFIG_BSD_PROCESS_ACCT
535 .ctl_name = KERN_ACCT,
538 .maxlen = 3*sizeof(int),
540 .proc_handler = &proc_dointvec,
543 #ifdef CONFIG_MAGIC_SYSRQ
545 .ctl_name = KERN_SYSRQ,
547 .data = &__sysrq_enabled,
548 .maxlen = sizeof (int),
550 .proc_handler = &proc_dointvec,
553 #ifdef CONFIG_PROC_SYSCTL
555 .procname = "cad_pid",
557 .maxlen = sizeof (int),
559 .proc_handler = &proc_do_cad_pid,
563 .ctl_name = KERN_MAX_THREADS,
564 .procname = "threads-max",
565 .data = &max_threads,
566 .maxlen = sizeof(int),
568 .proc_handler = &proc_dointvec,
571 .ctl_name = KERN_RANDOM,
572 .procname = "random",
574 .child = random_table,
577 .ctl_name = KERN_OVERFLOWUID,
578 .procname = "overflowuid",
579 .data = &overflowuid,
580 .maxlen = sizeof(int),
582 .proc_handler = &proc_dointvec_minmax,
583 .strategy = &sysctl_intvec,
584 .extra1 = &minolduid,
585 .extra2 = &maxolduid,
588 .ctl_name = KERN_OVERFLOWGID,
589 .procname = "overflowgid",
590 .data = &overflowgid,
591 .maxlen = sizeof(int),
593 .proc_handler = &proc_dointvec_minmax,
594 .strategy = &sysctl_intvec,
595 .extra1 = &minolduid,
596 .extra2 = &maxolduid,
599 #ifdef CONFIG_MATHEMU
601 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
602 .procname = "ieee_emulation_warnings",
603 .data = &sysctl_ieee_emulation_warnings,
604 .maxlen = sizeof(int),
606 .proc_handler = &proc_dointvec,
609 #ifdef CONFIG_NO_IDLE_HZ
611 .ctl_name = KERN_HZ_TIMER,
612 .procname = "hz_timer",
613 .data = &sysctl_hz_timer,
614 .maxlen = sizeof(int),
616 .proc_handler = &proc_dointvec,
620 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
621 .procname = "userprocess_debug",
622 .data = &sysctl_userprocess_debug,
623 .maxlen = sizeof(int),
625 .proc_handler = &proc_dointvec,
629 .ctl_name = KERN_PIDMAX,
630 .procname = "pid_max",
632 .maxlen = sizeof (int),
634 .proc_handler = &proc_dointvec_minmax,
635 .strategy = sysctl_intvec,
636 .extra1 = &pid_max_min,
637 .extra2 = &pid_max_max,
640 .ctl_name = KERN_PANIC_ON_OOPS,
641 .procname = "panic_on_oops",
642 .data = &panic_on_oops,
643 .maxlen = sizeof(int),
645 .proc_handler = &proc_dointvec,
648 .ctl_name = KERN_PRINTK_RATELIMIT,
649 .procname = "printk_ratelimit",
650 .data = &printk_ratelimit_jiffies,
651 .maxlen = sizeof(int),
653 .proc_handler = &proc_dointvec_jiffies,
654 .strategy = &sysctl_jiffies,
657 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
658 .procname = "printk_ratelimit_burst",
659 .data = &printk_ratelimit_burst,
660 .maxlen = sizeof(int),
662 .proc_handler = &proc_dointvec,
665 .ctl_name = KERN_NGROUPS_MAX,
666 .procname = "ngroups_max",
667 .data = &ngroups_max,
668 .maxlen = sizeof (int),
670 .proc_handler = &proc_dointvec,
672 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
674 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
675 .procname = "unknown_nmi_panic",
676 .data = &unknown_nmi_panic,
677 .maxlen = sizeof (int),
679 .proc_handler = &proc_dointvec,
682 .procname = "nmi_watchdog",
683 .data = &nmi_watchdog_enabled,
684 .maxlen = sizeof (int),
686 .proc_handler = &proc_nmi_enabled,
689 #if defined(CONFIG_X86)
691 .ctl_name = KERN_PANIC_ON_NMI,
692 .procname = "panic_on_unrecovered_nmi",
693 .data = &panic_on_unrecovered_nmi,
694 .maxlen = sizeof(int),
696 .proc_handler = &proc_dointvec,
699 .ctl_name = KERN_BOOTLOADER_TYPE,
700 .procname = "bootloader_type",
701 .data = &bootloader_type,
702 .maxlen = sizeof (int),
704 .proc_handler = &proc_dointvec,
707 .ctl_name = CTL_UNNUMBERED,
708 .procname = "kstack_depth_to_print",
709 .data = &kstack_depth_to_print,
710 .maxlen = sizeof(int),
712 .proc_handler = &proc_dointvec,
715 .ctl_name = CTL_UNNUMBERED,
716 .procname = "io_delay_type",
717 .data = &io_delay_type,
718 .maxlen = sizeof(int),
720 .proc_handler = &proc_dointvec,
723 #if defined(CONFIG_MMU)
725 .ctl_name = KERN_RANDOMIZE,
726 .procname = "randomize_va_space",
727 .data = &randomize_va_space,
728 .maxlen = sizeof(int),
730 .proc_handler = &proc_dointvec,
733 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
735 .ctl_name = KERN_SPIN_RETRY,
736 .procname = "spin_retry",
738 .maxlen = sizeof (int),
740 .proc_handler = &proc_dointvec,
743 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
745 .procname = "acpi_video_flags",
746 .data = &acpi_realmode_flags,
747 .maxlen = sizeof (unsigned long),
749 .proc_handler = &proc_doulongvec_minmax,
754 .ctl_name = KERN_IA64_UNALIGNED,
755 .procname = "ignore-unaligned-usertrap",
756 .data = &no_unaligned_warning,
757 .maxlen = sizeof (int),
759 .proc_handler = &proc_dointvec,
762 #ifdef CONFIG_DETECT_SOFTLOCKUP
764 .ctl_name = CTL_UNNUMBERED,
765 .procname = "softlockup_thresh",
766 .data = &softlockup_thresh,
767 .maxlen = sizeof(unsigned long),
769 .proc_handler = &proc_doulongvec_minmax,
770 .strategy = &sysctl_intvec,
775 .ctl_name = CTL_UNNUMBERED,
776 .procname = "hung_task_check_count",
777 .data = &sysctl_hung_task_check_count,
778 .maxlen = sizeof(unsigned long),
780 .proc_handler = &proc_doulongvec_minmax,
781 .strategy = &sysctl_intvec,
784 .ctl_name = CTL_UNNUMBERED,
785 .procname = "hung_task_timeout_secs",
786 .data = &sysctl_hung_task_timeout_secs,
787 .maxlen = sizeof(unsigned long),
789 .proc_handler = &proc_doulongvec_minmax,
790 .strategy = &sysctl_intvec,
793 .ctl_name = CTL_UNNUMBERED,
794 .procname = "hung_task_warnings",
795 .data = &sysctl_hung_task_warnings,
796 .maxlen = sizeof(unsigned long),
798 .proc_handler = &proc_doulongvec_minmax,
799 .strategy = &sysctl_intvec,
804 .ctl_name = KERN_COMPAT_LOG,
805 .procname = "compat-log",
807 .maxlen = sizeof (int),
809 .proc_handler = &proc_dointvec,
812 #ifdef CONFIG_RT_MUTEXES
814 .ctl_name = KERN_MAX_LOCK_DEPTH,
815 .procname = "max_lock_depth",
816 .data = &max_lock_depth,
817 .maxlen = sizeof(int),
819 .proc_handler = &proc_dointvec,
822 #ifdef CONFIG_PROC_FS
824 .ctl_name = CTL_UNNUMBERED,
825 .procname = "maps_protect",
826 .data = &maps_protect,
827 .maxlen = sizeof(int),
829 .proc_handler = &proc_dointvec,
833 .ctl_name = CTL_UNNUMBERED,
834 .procname = "poweroff_cmd",
835 .data = &poweroff_cmd,
836 .maxlen = POWEROFF_CMD_PATH_LEN,
838 .proc_handler = &proc_dostring,
839 .strategy = &sysctl_string,
842 * NOTE: do not add new entries to this table unless you have read
843 * Documentation/sysctl/ctl_unnumbered.txt
848 static struct ctl_table vm_table[] = {
850 .ctl_name = VM_OVERCOMMIT_MEMORY,
851 .procname = "overcommit_memory",
852 .data = &sysctl_overcommit_memory,
853 .maxlen = sizeof(sysctl_overcommit_memory),
855 .proc_handler = &proc_dointvec,
858 .ctl_name = VM_PANIC_ON_OOM,
859 .procname = "panic_on_oom",
860 .data = &sysctl_panic_on_oom,
861 .maxlen = sizeof(sysctl_panic_on_oom),
863 .proc_handler = &proc_dointvec,
866 .ctl_name = CTL_UNNUMBERED,
867 .procname = "oom_kill_allocating_task",
868 .data = &sysctl_oom_kill_allocating_task,
869 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
871 .proc_handler = &proc_dointvec,
874 .ctl_name = VM_OVERCOMMIT_RATIO,
875 .procname = "overcommit_ratio",
876 .data = &sysctl_overcommit_ratio,
877 .maxlen = sizeof(sysctl_overcommit_ratio),
879 .proc_handler = &proc_dointvec,
882 .ctl_name = VM_PAGE_CLUSTER,
883 .procname = "page-cluster",
884 .data = &page_cluster,
885 .maxlen = sizeof(int),
887 .proc_handler = &proc_dointvec,
890 .ctl_name = VM_DIRTY_BACKGROUND,
891 .procname = "dirty_background_ratio",
892 .data = &dirty_background_ratio,
893 .maxlen = sizeof(dirty_background_ratio),
895 .proc_handler = &proc_dointvec_minmax,
896 .strategy = &sysctl_intvec,
898 .extra2 = &one_hundred,
901 .ctl_name = VM_DIRTY_RATIO,
902 .procname = "dirty_ratio",
903 .data = &vm_dirty_ratio,
904 .maxlen = sizeof(vm_dirty_ratio),
906 .proc_handler = &dirty_ratio_handler,
907 .strategy = &sysctl_intvec,
909 .extra2 = &one_hundred,
912 .procname = "dirty_writeback_centisecs",
913 .data = &dirty_writeback_interval,
914 .maxlen = sizeof(dirty_writeback_interval),
916 .proc_handler = &dirty_writeback_centisecs_handler,
919 .procname = "dirty_expire_centisecs",
920 .data = &dirty_expire_interval,
921 .maxlen = sizeof(dirty_expire_interval),
923 .proc_handler = &proc_dointvec_userhz_jiffies,
926 .ctl_name = VM_NR_PDFLUSH_THREADS,
927 .procname = "nr_pdflush_threads",
928 .data = &nr_pdflush_threads,
929 .maxlen = sizeof nr_pdflush_threads,
930 .mode = 0444 /* read-only*/,
931 .proc_handler = &proc_dointvec,
934 .ctl_name = VM_SWAPPINESS,
935 .procname = "swappiness",
936 .data = &vm_swappiness,
937 .maxlen = sizeof(vm_swappiness),
939 .proc_handler = &proc_dointvec_minmax,
940 .strategy = &sysctl_intvec,
942 .extra2 = &one_hundred,
944 #ifdef CONFIG_HUGETLB_PAGE
946 .procname = "nr_hugepages",
947 .data = &max_huge_pages,
948 .maxlen = sizeof(unsigned long),
950 .proc_handler = &hugetlb_sysctl_handler,
951 .extra1 = (void *)&hugetlb_zero,
952 .extra2 = (void *)&hugetlb_infinity,
955 .ctl_name = VM_HUGETLB_GROUP,
956 .procname = "hugetlb_shm_group",
957 .data = &sysctl_hugetlb_shm_group,
958 .maxlen = sizeof(gid_t),
960 .proc_handler = &proc_dointvec,
963 .ctl_name = CTL_UNNUMBERED,
964 .procname = "hugepages_treat_as_movable",
965 .data = &hugepages_treat_as_movable,
966 .maxlen = sizeof(int),
968 .proc_handler = &hugetlb_treat_movable_handler,
971 .ctl_name = CTL_UNNUMBERED,
972 .procname = "nr_overcommit_hugepages",
973 .data = &nr_overcommit_huge_pages,
974 .maxlen = sizeof(nr_overcommit_huge_pages),
976 .proc_handler = &proc_doulongvec_minmax,
980 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
981 .procname = "lowmem_reserve_ratio",
982 .data = &sysctl_lowmem_reserve_ratio,
983 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
985 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
986 .strategy = &sysctl_intvec,
989 .ctl_name = VM_DROP_PAGECACHE,
990 .procname = "drop_caches",
991 .data = &sysctl_drop_caches,
992 .maxlen = sizeof(int),
994 .proc_handler = drop_caches_sysctl_handler,
995 .strategy = &sysctl_intvec,
998 .ctl_name = VM_MIN_FREE_KBYTES,
999 .procname = "min_free_kbytes",
1000 .data = &min_free_kbytes,
1001 .maxlen = sizeof(min_free_kbytes),
1003 .proc_handler = &min_free_kbytes_sysctl_handler,
1004 .strategy = &sysctl_intvec,
1008 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1009 .procname = "percpu_pagelist_fraction",
1010 .data = &percpu_pagelist_fraction,
1011 .maxlen = sizeof(percpu_pagelist_fraction),
1013 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
1014 .strategy = &sysctl_intvec,
1015 .extra1 = &min_percpu_pagelist_fract,
1019 .ctl_name = VM_MAX_MAP_COUNT,
1020 .procname = "max_map_count",
1021 .data = &sysctl_max_map_count,
1022 .maxlen = sizeof(sysctl_max_map_count),
1024 .proc_handler = &proc_dointvec
1028 .ctl_name = VM_LAPTOP_MODE,
1029 .procname = "laptop_mode",
1030 .data = &laptop_mode,
1031 .maxlen = sizeof(laptop_mode),
1033 .proc_handler = &proc_dointvec_jiffies,
1034 .strategy = &sysctl_jiffies,
1037 .ctl_name = VM_BLOCK_DUMP,
1038 .procname = "block_dump",
1039 .data = &block_dump,
1040 .maxlen = sizeof(block_dump),
1042 .proc_handler = &proc_dointvec,
1043 .strategy = &sysctl_intvec,
1047 .ctl_name = VM_VFS_CACHE_PRESSURE,
1048 .procname = "vfs_cache_pressure",
1049 .data = &sysctl_vfs_cache_pressure,
1050 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1052 .proc_handler = &proc_dointvec,
1053 .strategy = &sysctl_intvec,
1056 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1058 .ctl_name = VM_LEGACY_VA_LAYOUT,
1059 .procname = "legacy_va_layout",
1060 .data = &sysctl_legacy_va_layout,
1061 .maxlen = sizeof(sysctl_legacy_va_layout),
1063 .proc_handler = &proc_dointvec,
1064 .strategy = &sysctl_intvec,
1070 .ctl_name = VM_ZONE_RECLAIM_MODE,
1071 .procname = "zone_reclaim_mode",
1072 .data = &zone_reclaim_mode,
1073 .maxlen = sizeof(zone_reclaim_mode),
1075 .proc_handler = &proc_dointvec,
1076 .strategy = &sysctl_intvec,
1080 .ctl_name = VM_MIN_UNMAPPED,
1081 .procname = "min_unmapped_ratio",
1082 .data = &sysctl_min_unmapped_ratio,
1083 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1085 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
1086 .strategy = &sysctl_intvec,
1088 .extra2 = &one_hundred,
1091 .ctl_name = VM_MIN_SLAB,
1092 .procname = "min_slab_ratio",
1093 .data = &sysctl_min_slab_ratio,
1094 .maxlen = sizeof(sysctl_min_slab_ratio),
1096 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
1097 .strategy = &sysctl_intvec,
1099 .extra2 = &one_hundred,
1104 .ctl_name = CTL_UNNUMBERED,
1105 .procname = "stat_interval",
1106 .data = &sysctl_stat_interval,
1107 .maxlen = sizeof(sysctl_stat_interval),
1109 .proc_handler = &proc_dointvec_jiffies,
1110 .strategy = &sysctl_jiffies,
1113 #ifdef CONFIG_SECURITY
1115 .ctl_name = CTL_UNNUMBERED,
1116 .procname = "mmap_min_addr",
1117 .data = &mmap_min_addr,
1118 .maxlen = sizeof(unsigned long),
1120 .proc_handler = &proc_doulongvec_minmax,
1125 .ctl_name = CTL_UNNUMBERED,
1126 .procname = "numa_zonelist_order",
1127 .data = &numa_zonelist_order,
1128 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1130 .proc_handler = &numa_zonelist_order_handler,
1131 .strategy = &sysctl_string,
1134 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1135 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1137 .ctl_name = VM_VDSO_ENABLED,
1138 .procname = "vdso_enabled",
1139 .data = &vdso_enabled,
1140 .maxlen = sizeof(vdso_enabled),
1142 .proc_handler = &proc_dointvec,
1143 .strategy = &sysctl_intvec,
1147 #ifdef CONFIG_HIGHMEM
1149 .ctl_name = CTL_UNNUMBERED,
1150 .procname = "highmem_is_dirtyable",
1151 .data = &vm_highmem_is_dirtyable,
1152 .maxlen = sizeof(vm_highmem_is_dirtyable),
1154 .proc_handler = &proc_dointvec_minmax,
1155 .strategy = &sysctl_intvec,
1161 * NOTE: do not add new entries to this table unless you have read
1162 * Documentation/sysctl/ctl_unnumbered.txt
1167 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1168 static struct ctl_table binfmt_misc_table[] = {
1173 static struct ctl_table fs_table[] = {
1175 .ctl_name = FS_NRINODE,
1176 .procname = "inode-nr",
1177 .data = &inodes_stat,
1178 .maxlen = 2*sizeof(int),
1180 .proc_handler = &proc_dointvec,
1183 .ctl_name = FS_STATINODE,
1184 .procname = "inode-state",
1185 .data = &inodes_stat,
1186 .maxlen = 7*sizeof(int),
1188 .proc_handler = &proc_dointvec,
1191 .procname = "file-nr",
1192 .data = &files_stat,
1193 .maxlen = 3*sizeof(int),
1195 .proc_handler = &proc_nr_files,
1198 .ctl_name = FS_MAXFILE,
1199 .procname = "file-max",
1200 .data = &files_stat.max_files,
1201 .maxlen = sizeof(int),
1203 .proc_handler = &proc_dointvec,
1206 .ctl_name = FS_DENTRY,
1207 .procname = "dentry-state",
1208 .data = &dentry_stat,
1209 .maxlen = 6*sizeof(int),
1211 .proc_handler = &proc_dointvec,
1214 .ctl_name = FS_OVERFLOWUID,
1215 .procname = "overflowuid",
1216 .data = &fs_overflowuid,
1217 .maxlen = sizeof(int),
1219 .proc_handler = &proc_dointvec_minmax,
1220 .strategy = &sysctl_intvec,
1221 .extra1 = &minolduid,
1222 .extra2 = &maxolduid,
1225 .ctl_name = FS_OVERFLOWGID,
1226 .procname = "overflowgid",
1227 .data = &fs_overflowgid,
1228 .maxlen = sizeof(int),
1230 .proc_handler = &proc_dointvec_minmax,
1231 .strategy = &sysctl_intvec,
1232 .extra1 = &minolduid,
1233 .extra2 = &maxolduid,
1236 .ctl_name = FS_LEASES,
1237 .procname = "leases-enable",
1238 .data = &leases_enable,
1239 .maxlen = sizeof(int),
1241 .proc_handler = &proc_dointvec,
1243 #ifdef CONFIG_DNOTIFY
1245 .ctl_name = FS_DIR_NOTIFY,
1246 .procname = "dir-notify-enable",
1247 .data = &dir_notify_enable,
1248 .maxlen = sizeof(int),
1250 .proc_handler = &proc_dointvec,
1255 .ctl_name = FS_LEASE_TIME,
1256 .procname = "lease-break-time",
1257 .data = &lease_break_time,
1258 .maxlen = sizeof(int),
1260 .proc_handler = &proc_dointvec_minmax,
1261 .strategy = &sysctl_intvec,
1266 .procname = "aio-nr",
1268 .maxlen = sizeof(aio_nr),
1270 .proc_handler = &proc_doulongvec_minmax,
1273 .procname = "aio-max-nr",
1274 .data = &aio_max_nr,
1275 .maxlen = sizeof(aio_max_nr),
1277 .proc_handler = &proc_doulongvec_minmax,
1279 #ifdef CONFIG_INOTIFY_USER
1281 .ctl_name = FS_INOTIFY,
1282 .procname = "inotify",
1284 .child = inotify_table,
1289 .ctl_name = KERN_SETUID_DUMPABLE,
1290 .procname = "suid_dumpable",
1291 .data = &suid_dumpable,
1292 .maxlen = sizeof(int),
1294 .proc_handler = &proc_dointvec,
1296 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1298 .ctl_name = CTL_UNNUMBERED,
1299 .procname = "binfmt_misc",
1301 .child = binfmt_misc_table,
1305 * NOTE: do not add new entries to this table unless you have read
1306 * Documentation/sysctl/ctl_unnumbered.txt
1311 static struct ctl_table debug_table[] = {
1312 #if defined(CONFIG_X86) || defined(CONFIG_PPC)
1314 .ctl_name = CTL_UNNUMBERED,
1315 .procname = "exception-trace",
1316 .data = &show_unhandled_signals,
1317 .maxlen = sizeof(int),
1319 .proc_handler = proc_dointvec
1325 static struct ctl_table dev_table[] = {
1329 static DEFINE_SPINLOCK(sysctl_lock);
1331 /* called under sysctl_lock */
1332 static int use_table(struct ctl_table_header *p)
1334 if (unlikely(p->unregistering))
1340 /* called under sysctl_lock */
1341 static void unuse_table(struct ctl_table_header *p)
1344 if (unlikely(p->unregistering))
1345 complete(p->unregistering);
1348 /* called under sysctl_lock, will reacquire if has to wait */
1349 static void start_unregistering(struct ctl_table_header *p)
1352 * if p->used is 0, nobody will ever touch that entry again;
1353 * we'll eliminate all paths to it before dropping sysctl_lock
1355 if (unlikely(p->used)) {
1356 struct completion wait;
1357 init_completion(&wait);
1358 p->unregistering = &wait;
1359 spin_unlock(&sysctl_lock);
1360 wait_for_completion(&wait);
1361 spin_lock(&sysctl_lock);
1364 * do not remove from the list until nobody holds it; walking the
1365 * list in do_sysctl() relies on that.
1367 list_del_init(&p->ctl_entry);
1370 void sysctl_head_finish(struct ctl_table_header *head)
1374 spin_lock(&sysctl_lock);
1376 spin_unlock(&sysctl_lock);
1379 static struct list_head *
1380 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1382 struct list_head *header_list;
1383 header_list = &root->header_list;
1385 header_list = root->lookup(root, namespaces);
1389 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1390 struct ctl_table_header *prev)
1392 struct ctl_table_root *root;
1393 struct list_head *header_list;
1394 struct ctl_table_header *head;
1395 struct list_head *tmp;
1397 spin_lock(&sysctl_lock);
1400 tmp = &prev->ctl_entry;
1404 tmp = &root_table_header.ctl_entry;
1406 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1408 if (!use_table(head))
1410 spin_unlock(&sysctl_lock);
1415 header_list = lookup_header_list(root, namespaces);
1416 if (tmp != header_list)
1420 root = list_entry(root->root_list.next,
1421 struct ctl_table_root, root_list);
1422 if (root == &sysctl_table_root)
1424 header_list = lookup_header_list(root, namespaces);
1425 } while (list_empty(header_list));
1426 tmp = header_list->next;
1429 spin_unlock(&sysctl_lock);
1433 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1435 return __sysctl_head_next(current->nsproxy, prev);
1438 void register_sysctl_root(struct ctl_table_root *root)
1440 spin_lock(&sysctl_lock);
1441 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1442 spin_unlock(&sysctl_lock);
1445 #ifdef CONFIG_SYSCTL_SYSCALL
1446 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1447 void __user *newval, size_t newlen)
1449 struct ctl_table_header *head;
1450 int error = -ENOTDIR;
1452 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1456 if (!oldlenp || get_user(old_len, oldlenp))
1460 for (head = sysctl_head_next(NULL); head;
1461 head = sysctl_head_next(head)) {
1462 error = parse_table(name, nlen, oldval, oldlenp,
1463 newval, newlen, head->ctl_table);
1464 if (error != -ENOTDIR) {
1465 sysctl_head_finish(head);
1472 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1474 struct __sysctl_args tmp;
1477 if (copy_from_user(&tmp, args, sizeof(tmp)))
1480 error = deprecated_sysctl_warning(&tmp);
1485 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1486 tmp.newval, tmp.newlen);
1491 #endif /* CONFIG_SYSCTL_SYSCALL */
1494 * sysctl_perm does NOT grant the superuser all rights automatically, because
1495 * some sysctl variables are readonly even to root.
1498 static int test_perm(int mode, int op)
1502 else if (in_egroup_p(0))
1504 if ((mode & op & 0007) == op)
1509 int sysctl_perm(struct ctl_table *table, int op)
1512 error = security_sysctl(table, op);
1515 return test_perm(table->mode, op);
1518 #ifdef CONFIG_SYSCTL_SYSCALL
1519 static int parse_table(int __user *name, int nlen,
1520 void __user *oldval, size_t __user *oldlenp,
1521 void __user *newval, size_t newlen,
1522 struct ctl_table *table)
1528 if (get_user(n, name))
1530 for ( ; table->ctl_name || table->procname; table++) {
1531 if (!table->ctl_name)
1533 if (n == table->ctl_name) {
1536 if (sysctl_perm(table, 001))
1540 table = table->child;
1543 error = do_sysctl_strategy(table, name, nlen,
1552 /* Perform the actual read/write of a sysctl table entry. */
1553 int do_sysctl_strategy (struct ctl_table *table,
1554 int __user *name, int nlen,
1555 void __user *oldval, size_t __user *oldlenp,
1556 void __user *newval, size_t newlen)
1564 if (sysctl_perm(table, op))
1567 if (table->strategy) {
1568 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1576 /* If there is no strategy routine, or if the strategy returns
1577 * zero, proceed with automatic r/w */
1578 if (table->data && table->maxlen) {
1579 rc = sysctl_data(table, name, nlen, oldval, oldlenp,
1586 #endif /* CONFIG_SYSCTL_SYSCALL */
1588 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1590 for (; table->ctl_name || table->procname; table++) {
1591 table->parent = parent;
1593 sysctl_set_parent(table, table->child);
1597 static __init int sysctl_init(void)
1600 sysctl_set_parent(NULL, root_table);
1601 err = sysctl_check_table(current->nsproxy, root_table);
1605 core_initcall(sysctl_init);
1608 * __register_sysctl_paths - register a sysctl hierarchy
1609 * @root: List of sysctl headers to register on
1610 * @namespaces: Data to compute which lists of sysctl entries are visible
1611 * @path: The path to the directory the sysctl table is in.
1612 * @table: the top-level table structure
1614 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1615 * array. A completely 0 filled entry terminates the table.
1617 * The members of the &struct ctl_table structure are used as follows:
1619 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1620 * must be unique within that level of sysctl
1622 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1623 * enter a sysctl file
1625 * data - a pointer to data for use by proc_handler
1627 * maxlen - the maximum size in bytes of the data
1629 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1631 * child - a pointer to the child sysctl table if this entry is a directory, or
1634 * proc_handler - the text handler routine (described below)
1636 * strategy - the strategy routine (described below)
1638 * de - for internal use by the sysctl routines
1640 * extra1, extra2 - extra pointers usable by the proc handler routines
1642 * Leaf nodes in the sysctl tree will be represented by a single file
1643 * under /proc; non-leaf nodes will be represented by directories.
1645 * sysctl(2) can automatically manage read and write requests through
1646 * the sysctl table. The data and maxlen fields of the ctl_table
1647 * struct enable minimal validation of the values being written to be
1648 * performed, and the mode field allows minimal authentication.
1650 * More sophisticated management can be enabled by the provision of a
1651 * strategy routine with the table entry. This will be called before
1652 * any automatic read or write of the data is performed.
1654 * The strategy routine may return
1656 * < 0 - Error occurred (error is passed to user process)
1658 * 0 - OK - proceed with automatic read or write.
1660 * > 0 - OK - read or write has been done by the strategy routine, so
1661 * return immediately.
1663 * There must be a proc_handler routine for any terminal nodes
1664 * mirrored under /proc/sys (non-terminals are handled by a built-in
1665 * directory handler). Several default handlers are available to
1666 * cover common cases -
1668 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1669 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1670 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1672 * It is the handler's job to read the input buffer from user memory
1673 * and process it. The handler should return 0 on success.
1675 * This routine returns %NULL on a failure to register, and a pointer
1676 * to the table header on success.
1678 struct ctl_table_header *__register_sysctl_paths(
1679 struct ctl_table_root *root,
1680 struct nsproxy *namespaces,
1681 const struct ctl_path *path, struct ctl_table *table)
1683 struct list_head *header_list;
1684 struct ctl_table_header *header;
1685 struct ctl_table *new, **prevp;
1686 unsigned int n, npath;
1688 /* Count the path components */
1689 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
1693 * For each path component, allocate a 2-element ctl_table array.
1694 * The first array element will be filled with the sysctl entry
1695 * for this, the second will be the sentinel (ctl_name == 0).
1697 * We allocate everything in one go so that we don't have to
1698 * worry about freeing additional memory in unregister_sysctl_table.
1700 header = kzalloc(sizeof(struct ctl_table_header) +
1701 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1705 new = (struct ctl_table *) (header + 1);
1707 /* Now connect the dots */
1708 prevp = &header->ctl_table;
1709 for (n = 0; n < npath; ++n, ++path) {
1710 /* Copy the procname */
1711 new->procname = path->procname;
1712 new->ctl_name = path->ctl_name;
1716 prevp = &new->child;
1721 header->ctl_table_arg = table;
1723 INIT_LIST_HEAD(&header->ctl_entry);
1725 header->unregistering = NULL;
1726 header->root = root;
1727 sysctl_set_parent(NULL, header->ctl_table);
1728 if (sysctl_check_table(namespaces, header->ctl_table)) {
1732 spin_lock(&sysctl_lock);
1733 header_list = lookup_header_list(root, namespaces);
1734 list_add_tail(&header->ctl_entry, header_list);
1735 spin_unlock(&sysctl_lock);
1741 * register_sysctl_table_path - register a sysctl table hierarchy
1742 * @path: The path to the directory the sysctl table is in.
1743 * @table: the top-level table structure
1745 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1746 * array. A completely 0 filled entry terminates the table.
1748 * See __register_sysctl_paths for more details.
1750 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1751 struct ctl_table *table)
1753 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1758 * register_sysctl_table - register a sysctl table hierarchy
1759 * @table: the top-level table structure
1761 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1762 * array. A completely 0 filled entry terminates the table.
1764 * See register_sysctl_paths for more details.
1766 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1768 static const struct ctl_path null_path[] = { {} };
1770 return register_sysctl_paths(null_path, table);
1774 * unregister_sysctl_table - unregister a sysctl table hierarchy
1775 * @header: the header returned from register_sysctl_table
1777 * Unregisters the sysctl table and all children. proc entries may not
1778 * actually be removed until they are no longer used by anyone.
1780 void unregister_sysctl_table(struct ctl_table_header * header)
1787 spin_lock(&sysctl_lock);
1788 start_unregistering(header);
1789 spin_unlock(&sysctl_lock);
1793 #else /* !CONFIG_SYSCTL */
1794 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1799 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1800 struct ctl_table *table)
1805 void unregister_sysctl_table(struct ctl_table_header * table)
1809 #endif /* CONFIG_SYSCTL */
1815 #ifdef CONFIG_PROC_SYSCTL
1817 static int _proc_do_string(void* data, int maxlen, int write,
1818 struct file *filp, void __user *buffer,
1819 size_t *lenp, loff_t *ppos)
1825 if (!data || !maxlen || !*lenp) {
1833 while (len < *lenp) {
1834 if (get_user(c, p++))
1836 if (c == 0 || c == '\n')
1842 if(copy_from_user(data, buffer, len))
1844 ((char *) data)[len] = 0;
1862 if(copy_to_user(buffer, data, len))
1865 if(put_user('\n', ((char __user *) buffer) + len))
1876 * proc_dostring - read a string sysctl
1877 * @table: the sysctl table
1878 * @write: %TRUE if this is a write to the sysctl file
1879 * @filp: the file structure
1880 * @buffer: the user buffer
1881 * @lenp: the size of the user buffer
1882 * @ppos: file position
1884 * Reads/writes a string from/to the user buffer. If the kernel
1885 * buffer provided is not large enough to hold the string, the
1886 * string is truncated. The copied string is %NULL-terminated.
1887 * If the string is being read by the user process, it is copied
1888 * and a newline '\n' is added. It is truncated if the buffer is
1891 * Returns 0 on success.
1893 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
1894 void __user *buffer, size_t *lenp, loff_t *ppos)
1896 return _proc_do_string(table->data, table->maxlen, write, filp,
1897 buffer, lenp, ppos);
1901 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1903 int write, void *data)
1906 *valp = *negp ? -*lvalp : *lvalp;
1911 *lvalp = (unsigned long)-val;
1914 *lvalp = (unsigned long)val;
1920 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
1921 int write, struct file *filp, void __user *buffer,
1922 size_t *lenp, loff_t *ppos,
1923 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1924 int write, void *data),
1927 #define TMPBUFLEN 21
1928 int *i, vleft, first=1, neg, val;
1932 char buf[TMPBUFLEN], *p;
1933 char __user *s = buffer;
1935 if (!tbl_data || !table->maxlen || !*lenp ||
1936 (*ppos && !write)) {
1941 i = (int *) tbl_data;
1942 vleft = table->maxlen / sizeof(*i);
1946 conv = do_proc_dointvec_conv;
1948 for (; left && vleft--; i++, first=0) {
1963 if (len > sizeof(buf) - 1)
1964 len = sizeof(buf) - 1;
1965 if (copy_from_user(buf, s, len))
1969 if (*p == '-' && left > 1) {
1973 if (*p < '0' || *p > '9')
1976 lval = simple_strtoul(p, &p, 0);
1979 if ((len < left) && *p && !isspace(*p))
1986 if (conv(&neg, &lval, i, 1, data))
1993 if (conv(&neg, &lval, i, 0, data))
1996 sprintf(p, "%s%lu", neg ? "-" : "", lval);
2000 if(copy_to_user(s, buf, len))
2007 if (!write && !first && left) {
2008 if(put_user('\n', s))
2015 if (get_user(c, s++))
2030 static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2031 void __user *buffer, size_t *lenp, loff_t *ppos,
2032 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2033 int write, void *data),
2036 return __do_proc_dointvec(table->data, table, write, filp,
2037 buffer, lenp, ppos, conv, data);
2041 * proc_dointvec - read a vector of integers
2042 * @table: the sysctl table
2043 * @write: %TRUE if this is a write to the sysctl file
2044 * @filp: the file structure
2045 * @buffer: the user buffer
2046 * @lenp: the size of the user buffer
2047 * @ppos: file position
2049 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2050 * values from/to the user buffer, treated as an ASCII string.
2052 * Returns 0 on success.
2054 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2055 void __user *buffer, size_t *lenp, loff_t *ppos)
2057 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2065 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
2067 int write, void *data)
2069 int op = *(int *)data;
2071 int val = *negp ? -*lvalp : *lvalp;
2073 case OP_SET: *valp = val; break;
2074 case OP_AND: *valp &= val; break;
2075 case OP_OR: *valp |= val; break;
2081 *lvalp = (unsigned long)-val;
2084 *lvalp = (unsigned long)val;
2091 * Taint values can only be increased
2093 static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp,
2094 void __user *buffer, size_t *lenp, loff_t *ppos)
2098 if (write && !capable(CAP_SYS_ADMIN))
2102 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2103 do_proc_dointvec_bset_conv,&op);
2106 struct do_proc_dointvec_minmax_conv_param {
2111 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2113 int write, void *data)
2115 struct do_proc_dointvec_minmax_conv_param *param = data;
2117 int val = *negp ? -*lvalp : *lvalp;
2118 if ((param->min && *param->min > val) ||
2119 (param->max && *param->max < val))
2126 *lvalp = (unsigned long)-val;
2129 *lvalp = (unsigned long)val;
2136 * proc_dointvec_minmax - read a vector of integers with min/max values
2137 * @table: the sysctl table
2138 * @write: %TRUE if this is a write to the sysctl file
2139 * @filp: the file structure
2140 * @buffer: the user buffer
2141 * @lenp: the size of the user buffer
2142 * @ppos: file position
2144 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2145 * values from/to the user buffer, treated as an ASCII string.
2147 * This routine will ensure the values are within the range specified by
2148 * table->extra1 (min) and table->extra2 (max).
2150 * Returns 0 on success.
2152 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2153 void __user *buffer, size_t *lenp, loff_t *ppos)
2155 struct do_proc_dointvec_minmax_conv_param param = {
2156 .min = (int *) table->extra1,
2157 .max = (int *) table->extra2,
2159 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2160 do_proc_dointvec_minmax_conv, ¶m);
2163 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2165 void __user *buffer,
2166 size_t *lenp, loff_t *ppos,
2167 unsigned long convmul,
2168 unsigned long convdiv)
2170 #define TMPBUFLEN 21
2171 unsigned long *i, *min, *max, val;
2172 int vleft, first=1, neg;
2174 char buf[TMPBUFLEN], *p;
2175 char __user *s = buffer;
2177 if (!data || !table->maxlen || !*lenp ||
2178 (*ppos && !write)) {
2183 i = (unsigned long *) data;
2184 min = (unsigned long *) table->extra1;
2185 max = (unsigned long *) table->extra2;
2186 vleft = table->maxlen / sizeof(unsigned long);
2189 for (; left && vleft--; i++, min++, max++, first=0) {
2204 if (len > TMPBUFLEN-1)
2206 if (copy_from_user(buf, s, len))
2210 if (*p == '-' && left > 1) {
2214 if (*p < '0' || *p > '9')
2216 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
2218 if ((len < left) && *p && !isspace(*p))
2227 if ((min && val < *min) || (max && val > *max))
2234 sprintf(p, "%lu", convdiv * (*i) / convmul);
2238 if(copy_to_user(s, buf, len))
2245 if (!write && !first && left) {
2246 if(put_user('\n', s))
2253 if (get_user(c, s++))
2268 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2270 void __user *buffer,
2271 size_t *lenp, loff_t *ppos,
2272 unsigned long convmul,
2273 unsigned long convdiv)
2275 return __do_proc_doulongvec_minmax(table->data, table, write,
2276 filp, buffer, lenp, ppos, convmul, convdiv);
2280 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2281 * @table: the sysctl table
2282 * @write: %TRUE if this is a write to the sysctl file
2283 * @filp: the file structure
2284 * @buffer: the user buffer
2285 * @lenp: the size of the user buffer
2286 * @ppos: file position
2288 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2289 * values from/to the user buffer, treated as an ASCII string.
2291 * This routine will ensure the values are within the range specified by
2292 * table->extra1 (min) and table->extra2 (max).
2294 * Returns 0 on success.
2296 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2297 void __user *buffer, size_t *lenp, loff_t *ppos)
2299 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
2303 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2304 * @table: the sysctl table
2305 * @write: %TRUE if this is a write to the sysctl file
2306 * @filp: the file structure
2307 * @buffer: the user buffer
2308 * @lenp: the size of the user buffer
2309 * @ppos: file position
2311 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2312 * values from/to the user buffer, treated as an ASCII string. The values
2313 * are treated as milliseconds, and converted to jiffies when they are stored.
2315 * This routine will ensure the values are within the range specified by
2316 * table->extra1 (min) and table->extra2 (max).
2318 * Returns 0 on success.
2320 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2322 void __user *buffer,
2323 size_t *lenp, loff_t *ppos)
2325 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2326 lenp, ppos, HZ, 1000l);
2330 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2332 int write, void *data)
2335 if (*lvalp > LONG_MAX / HZ)
2337 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2343 lval = (unsigned long)-val;
2346 lval = (unsigned long)val;
2353 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2355 int write, void *data)
2358 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2360 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2366 lval = (unsigned long)-val;
2369 lval = (unsigned long)val;
2371 *lvalp = jiffies_to_clock_t(lval);
2376 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2378 int write, void *data)
2381 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2387 lval = (unsigned long)-val;
2390 lval = (unsigned long)val;
2392 *lvalp = jiffies_to_msecs(lval);
2398 * proc_dointvec_jiffies - read a vector of integers as seconds
2399 * @table: the sysctl table
2400 * @write: %TRUE if this is a write to the sysctl file
2401 * @filp: the file structure
2402 * @buffer: the user buffer
2403 * @lenp: the size of the user buffer
2404 * @ppos: file position
2406 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2407 * values from/to the user buffer, treated as an ASCII string.
2408 * The values read are assumed to be in seconds, and are converted into
2411 * Returns 0 on success.
2413 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2414 void __user *buffer, size_t *lenp, loff_t *ppos)
2416 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2417 do_proc_dointvec_jiffies_conv,NULL);
2421 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2422 * @table: the sysctl table
2423 * @write: %TRUE if this is a write to the sysctl file
2424 * @filp: the file structure
2425 * @buffer: the user buffer
2426 * @lenp: the size of the user buffer
2427 * @ppos: pointer to the file position
2429 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2430 * values from/to the user buffer, treated as an ASCII string.
2431 * The values read are assumed to be in 1/USER_HZ seconds, and
2432 * are converted into jiffies.
2434 * Returns 0 on success.
2436 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2437 void __user *buffer, size_t *lenp, loff_t *ppos)
2439 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2440 do_proc_dointvec_userhz_jiffies_conv,NULL);
2444 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2445 * @table: the sysctl table
2446 * @write: %TRUE if this is a write to the sysctl file
2447 * @filp: the file structure
2448 * @buffer: the user buffer
2449 * @lenp: the size of the user buffer
2450 * @ppos: file position
2451 * @ppos: the current position in the file
2453 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2454 * values from/to the user buffer, treated as an ASCII string.
2455 * The values read are assumed to be in 1/1000 seconds, and
2456 * are converted into jiffies.
2458 * Returns 0 on success.
2460 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2461 void __user *buffer, size_t *lenp, loff_t *ppos)
2463 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2464 do_proc_dointvec_ms_jiffies_conv, NULL);
2467 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2468 void __user *buffer, size_t *lenp, loff_t *ppos)
2470 struct pid *new_pid;
2474 tmp = pid_nr_ns(cad_pid, current->nsproxy->pid_ns);
2476 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2477 lenp, ppos, NULL, NULL);
2481 new_pid = find_get_pid(tmp);
2485 put_pid(xchg(&cad_pid, new_pid));
2489 #else /* CONFIG_PROC_FS */
2491 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2492 void __user *buffer, size_t *lenp, loff_t *ppos)
2497 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2498 void __user *buffer, size_t *lenp, loff_t *ppos)
2503 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2504 void __user *buffer, size_t *lenp, loff_t *ppos)
2509 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2510 void __user *buffer, size_t *lenp, loff_t *ppos)
2515 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2516 void __user *buffer, size_t *lenp, loff_t *ppos)
2521 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2522 void __user *buffer, size_t *lenp, loff_t *ppos)
2527 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2528 void __user *buffer, size_t *lenp, loff_t *ppos)
2533 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2535 void __user *buffer,
2536 size_t *lenp, loff_t *ppos)
2542 #endif /* CONFIG_PROC_FS */
2545 #ifdef CONFIG_SYSCTL_SYSCALL
2547 * General sysctl support routines
2550 /* The generic sysctl data routine (used if no strategy routine supplied) */
2551 int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2552 void __user *oldval, size_t __user *oldlenp,
2553 void __user *newval, size_t newlen)
2557 /* Get out of I don't have a variable */
2558 if (!table->data || !table->maxlen)
2561 if (oldval && oldlenp) {
2562 if (get_user(len, oldlenp))
2565 if (len > table->maxlen)
2566 len = table->maxlen;
2567 if (copy_to_user(oldval, table->data, len))
2569 if (put_user(len, oldlenp))
2574 if (newval && newlen) {
2575 if (newlen > table->maxlen)
2576 newlen = table->maxlen;
2578 if (copy_from_user(table->data, newval, newlen))
2584 /* The generic string strategy routine: */
2585 int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2586 void __user *oldval, size_t __user *oldlenp,
2587 void __user *newval, size_t newlen)
2589 if (!table->data || !table->maxlen)
2592 if (oldval && oldlenp) {
2594 if (get_user(bufsize, oldlenp))
2597 size_t len = strlen(table->data), copied;
2599 /* This shouldn't trigger for a well-formed sysctl */
2600 if (len > table->maxlen)
2601 len = table->maxlen;
2603 /* Copy up to a max of bufsize-1 bytes of the string */
2604 copied = (len >= bufsize) ? bufsize - 1 : len;
2606 if (copy_to_user(oldval, table->data, copied) ||
2607 put_user(0, (char __user *)(oldval + copied)))
2609 if (put_user(len, oldlenp))
2613 if (newval && newlen) {
2614 size_t len = newlen;
2615 if (len > table->maxlen)
2616 len = table->maxlen;
2617 if(copy_from_user(table->data, newval, len))
2619 if (len == table->maxlen)
2621 ((char *) table->data)[len] = 0;
2627 * This function makes sure that all of the integers in the vector
2628 * are between the minimum and maximum values given in the arrays
2629 * table->extra1 and table->extra2, respectively.
2631 int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2632 void __user *oldval, size_t __user *oldlenp,
2633 void __user *newval, size_t newlen)
2636 if (newval && newlen) {
2637 int __user *vec = (int __user *) newval;
2638 int *min = (int *) table->extra1;
2639 int *max = (int *) table->extra2;
2643 if (newlen % sizeof(int) != 0)
2646 if (!table->extra1 && !table->extra2)
2649 if (newlen > table->maxlen)
2650 newlen = table->maxlen;
2651 length = newlen / sizeof(int);
2653 for (i = 0; i < length; i++) {
2655 if (get_user(value, vec + i))
2657 if (min && value < min[i])
2659 if (max && value > max[i])
2666 /* Strategy function to convert jiffies to seconds */
2667 int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2668 void __user *oldval, size_t __user *oldlenp,
2669 void __user *newval, size_t newlen)
2671 if (oldval && oldlenp) {
2674 if (get_user(olen, oldlenp))
2679 if (olen < sizeof(int))
2682 val = *(int *)(table->data) / HZ;
2683 if (put_user(val, (int __user *)oldval))
2685 if (put_user(sizeof(int), oldlenp))
2689 if (newval && newlen) {
2691 if (newlen != sizeof(int))
2693 if (get_user(new, (int __user *)newval))
2695 *(int *)(table->data) = new*HZ;
2700 /* Strategy function to convert jiffies to seconds */
2701 int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2702 void __user *oldval, size_t __user *oldlenp,
2703 void __user *newval, size_t newlen)
2705 if (oldval && oldlenp) {
2708 if (get_user(olen, oldlenp))
2713 if (olen < sizeof(int))
2716 val = jiffies_to_msecs(*(int *)(table->data));
2717 if (put_user(val, (int __user *)oldval))
2719 if (put_user(sizeof(int), oldlenp))
2723 if (newval && newlen) {
2725 if (newlen != sizeof(int))
2727 if (get_user(new, (int __user *)newval))
2729 *(int *)(table->data) = msecs_to_jiffies(new);
2736 #else /* CONFIG_SYSCTL_SYSCALL */
2739 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2741 struct __sysctl_args tmp;
2744 if (copy_from_user(&tmp, args, sizeof(tmp)))
2747 error = deprecated_sysctl_warning(&tmp);
2749 /* If no error reading the parameters then just -ENOSYS ... */
2756 int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2757 void __user *oldval, size_t __user *oldlenp,
2758 void __user *newval, size_t newlen)
2763 int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2764 void __user *oldval, size_t __user *oldlenp,
2765 void __user *newval, size_t newlen)
2770 int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2771 void __user *oldval, size_t __user *oldlenp,
2772 void __user *newval, size_t newlen)
2777 int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2778 void __user *oldval, size_t __user *oldlenp,
2779 void __user *newval, size_t newlen)
2784 int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2785 void __user *oldval, size_t __user *oldlenp,
2786 void __user *newval, size_t newlen)
2791 #endif /* CONFIG_SYSCTL_SYSCALL */
2793 static int deprecated_sysctl_warning(struct __sysctl_args *args)
2795 static int msg_count;
2796 int name[CTL_MAXNAME];
2799 /* Check args->nlen. */
2800 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
2803 /* Read in the sysctl name for better debug message logging */
2804 for (i = 0; i < args->nlen; i++)
2805 if (get_user(name[i], args->name + i))
2808 /* Ignore accesses to kernel.version */
2809 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
2812 if (msg_count < 5) {
2815 "warning: process `%s' used the deprecated sysctl "
2816 "system call with ", current->comm);
2817 for (i = 0; i < args->nlen; i++)
2818 printk("%d.", name[i]);
2825 * No sense putting this after each symbol definition, twice,
2826 * exception granted :-)
2828 EXPORT_SYMBOL(proc_dointvec);
2829 EXPORT_SYMBOL(proc_dointvec_jiffies);
2830 EXPORT_SYMBOL(proc_dointvec_minmax);
2831 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2832 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2833 EXPORT_SYMBOL(proc_dostring);
2834 EXPORT_SYMBOL(proc_doulongvec_minmax);
2835 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2836 EXPORT_SYMBOL(register_sysctl_table);
2837 EXPORT_SYMBOL(register_sysctl_paths);
2838 EXPORT_SYMBOL(sysctl_intvec);
2839 EXPORT_SYMBOL(sysctl_jiffies);
2840 EXPORT_SYMBOL(sysctl_ms_jiffies);
2841 EXPORT_SYMBOL(sysctl_string);
2842 EXPORT_SYMBOL(sysctl_data);
2843 EXPORT_SYMBOL(unregister_sysctl_table);