PCI PM: Follow PCI_PM_CTRL_NO_SOFT_RESET during transitions from D3
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / sysctl.c
blob7755ae72c9fbc1249dafddf14ecef28bb1b54968
1 /*
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
12 * Horn.
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
16 * Wendling.
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>
22 #include <linux/mm.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>
31 #include <linux/fs.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/initrd.h>
41 #include <linux/key.h>
42 #include <linux/times.h>
43 #include <linux/limits.h>
44 #include <linux/dcache.h>
45 #include <linux/syscalls.h>
46 #include <linux/vmstat.h>
47 #include <linux/nfs_fs.h>
48 #include <linux/acpi.h>
49 #include <linux/reboot.h>
50 #include <linux/ftrace.h>
52 #include <asm/uaccess.h>
53 #include <asm/processor.h>
55 #ifdef CONFIG_X86
56 #include <asm/nmi.h>
57 #include <asm/stacktrace.h>
58 #include <asm/io.h>
59 #endif
61 static int deprecated_sysctl_warning(struct __sysctl_args *args);
63 #if defined(CONFIG_SYSCTL)
65 /* External variables not in a header file. */
66 extern int C_A_D;
67 extern int print_fatal_signals;
68 extern int sysctl_overcommit_memory;
69 extern int sysctl_overcommit_ratio;
70 extern int sysctl_panic_on_oom;
71 extern int sysctl_oom_kill_allocating_task;
72 extern int sysctl_oom_dump_tasks;
73 extern int max_threads;
74 extern int core_uses_pid;
75 extern int suid_dumpable;
76 extern char core_pattern[];
77 extern int pid_max;
78 extern int min_free_kbytes;
79 extern int pid_max_min, pid_max_max;
80 extern int sysctl_drop_caches;
81 extern int percpu_pagelist_fraction;
82 extern int compat_log;
83 extern int latencytop_enabled;
84 extern int sysctl_nr_open_min, sysctl_nr_open_max;
85 #ifndef CONFIG_MMU
86 extern int sysctl_nr_trim_pages;
87 #endif
88 #ifdef CONFIG_RCU_TORTURE_TEST
89 extern int rcutorture_runnable;
90 #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
92 /* Constants used for minimum and maximum */
93 #ifdef CONFIG_DETECT_SOFTLOCKUP
94 static int sixty = 60;
95 static int neg_one = -1;
96 #endif
98 static int zero;
99 static int one = 1;
100 static int two = 2;
101 static unsigned long one_ul = 1;
102 static int one_hundred = 100;
104 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
105 static int maxolduid = 65535;
106 static int minolduid;
107 static int min_percpu_pagelist_fract = 8;
109 static int ngroups_max = NGROUPS_MAX;
111 #ifdef CONFIG_MODULES
112 extern char modprobe_path[];
113 #endif
114 #ifdef CONFIG_CHR_DEV_SG
115 extern int sg_big_buff;
116 #endif
118 #ifdef CONFIG_SPARC
119 #include <asm/system.h>
120 #endif
122 #ifdef CONFIG_SPARC64
123 extern int sysctl_tsb_ratio;
124 #endif
126 #ifdef __hppa__
127 extern int pwrsw_enabled;
128 extern int unaligned_enabled;
129 #endif
131 #ifdef CONFIG_S390
132 #ifdef CONFIG_MATHEMU
133 extern int sysctl_ieee_emulation_warnings;
134 #endif
135 extern int sysctl_userprocess_debug;
136 extern int spin_retry;
137 #endif
139 #ifdef CONFIG_BSD_PROCESS_ACCT
140 extern int acct_parm[];
141 #endif
143 #ifdef CONFIG_IA64
144 extern int no_unaligned_warning;
145 extern int unaligned_dump_stack;
146 #endif
148 #ifdef CONFIG_RT_MUTEXES
149 extern int max_lock_depth;
150 #endif
152 #ifdef CONFIG_PROC_SYSCTL
153 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
154 void __user *buffer, size_t *lenp, loff_t *ppos);
155 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
156 void __user *buffer, size_t *lenp, loff_t *ppos);
157 #endif
159 static struct ctl_table root_table[];
160 static struct ctl_table_root sysctl_table_root;
161 static struct ctl_table_header root_table_header = {
162 .count = 1,
163 .ctl_table = root_table,
164 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
165 .root = &sysctl_table_root,
166 .set = &sysctl_table_root.default_set,
168 static struct ctl_table_root sysctl_table_root = {
169 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
170 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
173 static struct ctl_table kern_table[];
174 static struct ctl_table vm_table[];
175 static struct ctl_table fs_table[];
176 static struct ctl_table debug_table[];
177 static struct ctl_table dev_table[];
178 extern struct ctl_table random_table[];
179 #ifdef CONFIG_INOTIFY_USER
180 extern struct ctl_table inotify_table[];
181 #endif
182 #ifdef CONFIG_EPOLL
183 extern struct ctl_table epoll_table[];
184 #endif
186 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
187 int sysctl_legacy_va_layout;
188 #endif
190 extern int prove_locking;
191 extern int lock_stat;
193 /* The default sysctl tables: */
195 static struct ctl_table root_table[] = {
197 .ctl_name = CTL_KERN,
198 .procname = "kernel",
199 .mode = 0555,
200 .child = kern_table,
203 .ctl_name = CTL_VM,
204 .procname = "vm",
205 .mode = 0555,
206 .child = vm_table,
209 .ctl_name = CTL_FS,
210 .procname = "fs",
211 .mode = 0555,
212 .child = fs_table,
215 .ctl_name = CTL_DEBUG,
216 .procname = "debug",
217 .mode = 0555,
218 .child = debug_table,
221 .ctl_name = CTL_DEV,
222 .procname = "dev",
223 .mode = 0555,
224 .child = dev_table,
227 * NOTE: do not add new entries to this table unless you have read
228 * Documentation/sysctl/ctl_unnumbered.txt
230 { .ctl_name = 0 }
233 #ifdef CONFIG_SCHED_DEBUG
234 static int min_sched_granularity_ns = 100000; /* 100 usecs */
235 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
236 static int min_wakeup_granularity_ns; /* 0 usecs */
237 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
238 #endif
240 static struct ctl_table kern_table[] = {
241 #ifdef CONFIG_SCHED_DEBUG
243 .ctl_name = CTL_UNNUMBERED,
244 .procname = "sched_min_granularity_ns",
245 .data = &sysctl_sched_min_granularity,
246 .maxlen = sizeof(unsigned int),
247 .mode = 0644,
248 .proc_handler = &sched_nr_latency_handler,
249 .strategy = &sysctl_intvec,
250 .extra1 = &min_sched_granularity_ns,
251 .extra2 = &max_sched_granularity_ns,
254 .ctl_name = CTL_UNNUMBERED,
255 .procname = "sched_latency_ns",
256 .data = &sysctl_sched_latency,
257 .maxlen = sizeof(unsigned int),
258 .mode = 0644,
259 .proc_handler = &sched_nr_latency_handler,
260 .strategy = &sysctl_intvec,
261 .extra1 = &min_sched_granularity_ns,
262 .extra2 = &max_sched_granularity_ns,
265 .ctl_name = CTL_UNNUMBERED,
266 .procname = "sched_wakeup_granularity_ns",
267 .data = &sysctl_sched_wakeup_granularity,
268 .maxlen = sizeof(unsigned int),
269 .mode = 0644,
270 .proc_handler = &proc_dointvec_minmax,
271 .strategy = &sysctl_intvec,
272 .extra1 = &min_wakeup_granularity_ns,
273 .extra2 = &max_wakeup_granularity_ns,
276 .ctl_name = CTL_UNNUMBERED,
277 .procname = "sched_shares_ratelimit",
278 .data = &sysctl_sched_shares_ratelimit,
279 .maxlen = sizeof(unsigned int),
280 .mode = 0644,
281 .proc_handler = &proc_dointvec,
284 .ctl_name = CTL_UNNUMBERED,
285 .procname = "sched_shares_thresh",
286 .data = &sysctl_sched_shares_thresh,
287 .maxlen = sizeof(unsigned int),
288 .mode = 0644,
289 .proc_handler = &proc_dointvec_minmax,
290 .strategy = &sysctl_intvec,
291 .extra1 = &zero,
294 .ctl_name = CTL_UNNUMBERED,
295 .procname = "sched_child_runs_first",
296 .data = &sysctl_sched_child_runs_first,
297 .maxlen = sizeof(unsigned int),
298 .mode = 0644,
299 .proc_handler = &proc_dointvec,
302 .ctl_name = CTL_UNNUMBERED,
303 .procname = "sched_features",
304 .data = &sysctl_sched_features,
305 .maxlen = sizeof(unsigned int),
306 .mode = 0644,
307 .proc_handler = &proc_dointvec,
310 .ctl_name = CTL_UNNUMBERED,
311 .procname = "sched_migration_cost",
312 .data = &sysctl_sched_migration_cost,
313 .maxlen = sizeof(unsigned int),
314 .mode = 0644,
315 .proc_handler = &proc_dointvec,
318 .ctl_name = CTL_UNNUMBERED,
319 .procname = "sched_nr_migrate",
320 .data = &sysctl_sched_nr_migrate,
321 .maxlen = sizeof(unsigned int),
322 .mode = 0644,
323 .proc_handler = &proc_dointvec,
325 #endif
327 .ctl_name = CTL_UNNUMBERED,
328 .procname = "sched_rt_period_us",
329 .data = &sysctl_sched_rt_period,
330 .maxlen = sizeof(unsigned int),
331 .mode = 0644,
332 .proc_handler = &sched_rt_handler,
335 .ctl_name = CTL_UNNUMBERED,
336 .procname = "sched_rt_runtime_us",
337 .data = &sysctl_sched_rt_runtime,
338 .maxlen = sizeof(int),
339 .mode = 0644,
340 .proc_handler = &sched_rt_handler,
343 .ctl_name = CTL_UNNUMBERED,
344 .procname = "sched_compat_yield",
345 .data = &sysctl_sched_compat_yield,
346 .maxlen = sizeof(unsigned int),
347 .mode = 0644,
348 .proc_handler = &proc_dointvec,
350 #ifdef CONFIG_PROVE_LOCKING
352 .ctl_name = CTL_UNNUMBERED,
353 .procname = "prove_locking",
354 .data = &prove_locking,
355 .maxlen = sizeof(int),
356 .mode = 0644,
357 .proc_handler = &proc_dointvec,
359 #endif
360 #ifdef CONFIG_LOCK_STAT
362 .ctl_name = CTL_UNNUMBERED,
363 .procname = "lock_stat",
364 .data = &lock_stat,
365 .maxlen = sizeof(int),
366 .mode = 0644,
367 .proc_handler = &proc_dointvec,
369 #endif
371 .ctl_name = KERN_PANIC,
372 .procname = "panic",
373 .data = &panic_timeout,
374 .maxlen = sizeof(int),
375 .mode = 0644,
376 .proc_handler = &proc_dointvec,
379 .ctl_name = KERN_CORE_USES_PID,
380 .procname = "core_uses_pid",
381 .data = &core_uses_pid,
382 .maxlen = sizeof(int),
383 .mode = 0644,
384 .proc_handler = &proc_dointvec,
387 .ctl_name = KERN_CORE_PATTERN,
388 .procname = "core_pattern",
389 .data = core_pattern,
390 .maxlen = CORENAME_MAX_SIZE,
391 .mode = 0644,
392 .proc_handler = &proc_dostring,
393 .strategy = &sysctl_string,
395 #ifdef CONFIG_PROC_SYSCTL
397 .procname = "tainted",
398 .maxlen = sizeof(long),
399 .mode = 0644,
400 .proc_handler = &proc_taint,
402 #endif
403 #ifdef CONFIG_LATENCYTOP
405 .procname = "latencytop",
406 .data = &latencytop_enabled,
407 .maxlen = sizeof(int),
408 .mode = 0644,
409 .proc_handler = &proc_dointvec,
411 #endif
412 #ifdef CONFIG_BLK_DEV_INITRD
414 .ctl_name = KERN_REALROOTDEV,
415 .procname = "real-root-dev",
416 .data = &real_root_dev,
417 .maxlen = sizeof(int),
418 .mode = 0644,
419 .proc_handler = &proc_dointvec,
421 #endif
423 .ctl_name = CTL_UNNUMBERED,
424 .procname = "print-fatal-signals",
425 .data = &print_fatal_signals,
426 .maxlen = sizeof(int),
427 .mode = 0644,
428 .proc_handler = &proc_dointvec,
430 #ifdef CONFIG_SPARC
432 .ctl_name = KERN_SPARC_REBOOT,
433 .procname = "reboot-cmd",
434 .data = reboot_command,
435 .maxlen = 256,
436 .mode = 0644,
437 .proc_handler = &proc_dostring,
438 .strategy = &sysctl_string,
441 .ctl_name = KERN_SPARC_STOP_A,
442 .procname = "stop-a",
443 .data = &stop_a_enabled,
444 .maxlen = sizeof (int),
445 .mode = 0644,
446 .proc_handler = &proc_dointvec,
449 .ctl_name = KERN_SPARC_SCONS_PWROFF,
450 .procname = "scons-poweroff",
451 .data = &scons_pwroff,
452 .maxlen = sizeof (int),
453 .mode = 0644,
454 .proc_handler = &proc_dointvec,
456 #endif
457 #ifdef CONFIG_SPARC64
459 .ctl_name = CTL_UNNUMBERED,
460 .procname = "tsb-ratio",
461 .data = &sysctl_tsb_ratio,
462 .maxlen = sizeof (int),
463 .mode = 0644,
464 .proc_handler = &proc_dointvec,
466 #endif
467 #ifdef __hppa__
469 .ctl_name = KERN_HPPA_PWRSW,
470 .procname = "soft-power",
471 .data = &pwrsw_enabled,
472 .maxlen = sizeof (int),
473 .mode = 0644,
474 .proc_handler = &proc_dointvec,
477 .ctl_name = KERN_HPPA_UNALIGNED,
478 .procname = "unaligned-trap",
479 .data = &unaligned_enabled,
480 .maxlen = sizeof (int),
481 .mode = 0644,
482 .proc_handler = &proc_dointvec,
484 #endif
486 .ctl_name = KERN_CTLALTDEL,
487 .procname = "ctrl-alt-del",
488 .data = &C_A_D,
489 .maxlen = sizeof(int),
490 .mode = 0644,
491 .proc_handler = &proc_dointvec,
493 #ifdef CONFIG_FUNCTION_TRACER
495 .ctl_name = CTL_UNNUMBERED,
496 .procname = "ftrace_enabled",
497 .data = &ftrace_enabled,
498 .maxlen = sizeof(int),
499 .mode = 0644,
500 .proc_handler = &ftrace_enable_sysctl,
502 #endif
503 #ifdef CONFIG_STACK_TRACER
505 .ctl_name = CTL_UNNUMBERED,
506 .procname = "stack_tracer_enabled",
507 .data = &stack_tracer_enabled,
508 .maxlen = sizeof(int),
509 .mode = 0644,
510 .proc_handler = &stack_trace_sysctl,
512 #endif
513 #ifdef CONFIG_TRACING
515 .ctl_name = CTL_UNNUMBERED,
516 .procname = "ftrace_dump_on_oops",
517 .data = &ftrace_dump_on_oops,
518 .maxlen = sizeof(int),
519 .mode = 0644,
520 .proc_handler = &proc_dointvec,
522 #endif
523 #ifdef CONFIG_MODULES
525 .ctl_name = KERN_MODPROBE,
526 .procname = "modprobe",
527 .data = &modprobe_path,
528 .maxlen = KMOD_PATH_LEN,
529 .mode = 0644,
530 .proc_handler = &proc_dostring,
531 .strategy = &sysctl_string,
533 #endif
534 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
536 .ctl_name = KERN_HOTPLUG,
537 .procname = "hotplug",
538 .data = &uevent_helper,
539 .maxlen = UEVENT_HELPER_PATH_LEN,
540 .mode = 0644,
541 .proc_handler = &proc_dostring,
542 .strategy = &sysctl_string,
544 #endif
545 #ifdef CONFIG_CHR_DEV_SG
547 .ctl_name = KERN_SG_BIG_BUFF,
548 .procname = "sg-big-buff",
549 .data = &sg_big_buff,
550 .maxlen = sizeof (int),
551 .mode = 0444,
552 .proc_handler = &proc_dointvec,
554 #endif
555 #ifdef CONFIG_BSD_PROCESS_ACCT
557 .ctl_name = KERN_ACCT,
558 .procname = "acct",
559 .data = &acct_parm,
560 .maxlen = 3*sizeof(int),
561 .mode = 0644,
562 .proc_handler = &proc_dointvec,
564 #endif
565 #ifdef CONFIG_MAGIC_SYSRQ
567 .ctl_name = KERN_SYSRQ,
568 .procname = "sysrq",
569 .data = &__sysrq_enabled,
570 .maxlen = sizeof (int),
571 .mode = 0644,
572 .proc_handler = &proc_dointvec,
574 #endif
575 #ifdef CONFIG_PROC_SYSCTL
577 .procname = "cad_pid",
578 .data = NULL,
579 .maxlen = sizeof (int),
580 .mode = 0600,
581 .proc_handler = &proc_do_cad_pid,
583 #endif
585 .ctl_name = KERN_MAX_THREADS,
586 .procname = "threads-max",
587 .data = &max_threads,
588 .maxlen = sizeof(int),
589 .mode = 0644,
590 .proc_handler = &proc_dointvec,
593 .ctl_name = KERN_RANDOM,
594 .procname = "random",
595 .mode = 0555,
596 .child = random_table,
599 .ctl_name = KERN_OVERFLOWUID,
600 .procname = "overflowuid",
601 .data = &overflowuid,
602 .maxlen = sizeof(int),
603 .mode = 0644,
604 .proc_handler = &proc_dointvec_minmax,
605 .strategy = &sysctl_intvec,
606 .extra1 = &minolduid,
607 .extra2 = &maxolduid,
610 .ctl_name = KERN_OVERFLOWGID,
611 .procname = "overflowgid",
612 .data = &overflowgid,
613 .maxlen = sizeof(int),
614 .mode = 0644,
615 .proc_handler = &proc_dointvec_minmax,
616 .strategy = &sysctl_intvec,
617 .extra1 = &minolduid,
618 .extra2 = &maxolduid,
620 #ifdef CONFIG_S390
621 #ifdef CONFIG_MATHEMU
623 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
624 .procname = "ieee_emulation_warnings",
625 .data = &sysctl_ieee_emulation_warnings,
626 .maxlen = sizeof(int),
627 .mode = 0644,
628 .proc_handler = &proc_dointvec,
630 #endif
632 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
633 .procname = "userprocess_debug",
634 .data = &sysctl_userprocess_debug,
635 .maxlen = sizeof(int),
636 .mode = 0644,
637 .proc_handler = &proc_dointvec,
639 #endif
641 .ctl_name = KERN_PIDMAX,
642 .procname = "pid_max",
643 .data = &pid_max,
644 .maxlen = sizeof (int),
645 .mode = 0644,
646 .proc_handler = &proc_dointvec_minmax,
647 .strategy = sysctl_intvec,
648 .extra1 = &pid_max_min,
649 .extra2 = &pid_max_max,
652 .ctl_name = KERN_PANIC_ON_OOPS,
653 .procname = "panic_on_oops",
654 .data = &panic_on_oops,
655 .maxlen = sizeof(int),
656 .mode = 0644,
657 .proc_handler = &proc_dointvec,
659 #if defined CONFIG_PRINTK
661 .ctl_name = KERN_PRINTK,
662 .procname = "printk",
663 .data = &console_loglevel,
664 .maxlen = 4*sizeof(int),
665 .mode = 0644,
666 .proc_handler = &proc_dointvec,
669 .ctl_name = KERN_PRINTK_RATELIMIT,
670 .procname = "printk_ratelimit",
671 .data = &printk_ratelimit_state.interval,
672 .maxlen = sizeof(int),
673 .mode = 0644,
674 .proc_handler = &proc_dointvec_jiffies,
675 .strategy = &sysctl_jiffies,
678 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
679 .procname = "printk_ratelimit_burst",
680 .data = &printk_ratelimit_state.burst,
681 .maxlen = sizeof(int),
682 .mode = 0644,
683 .proc_handler = &proc_dointvec,
685 #endif
687 .ctl_name = KERN_NGROUPS_MAX,
688 .procname = "ngroups_max",
689 .data = &ngroups_max,
690 .maxlen = sizeof (int),
691 .mode = 0444,
692 .proc_handler = &proc_dointvec,
694 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
696 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
697 .procname = "unknown_nmi_panic",
698 .data = &unknown_nmi_panic,
699 .maxlen = sizeof (int),
700 .mode = 0644,
701 .proc_handler = &proc_dointvec,
704 .procname = "nmi_watchdog",
705 .data = &nmi_watchdog_enabled,
706 .maxlen = sizeof (int),
707 .mode = 0644,
708 .proc_handler = &proc_nmi_enabled,
710 #endif
711 #if defined(CONFIG_X86)
713 .ctl_name = KERN_PANIC_ON_NMI,
714 .procname = "panic_on_unrecovered_nmi",
715 .data = &panic_on_unrecovered_nmi,
716 .maxlen = sizeof(int),
717 .mode = 0644,
718 .proc_handler = &proc_dointvec,
721 .ctl_name = KERN_BOOTLOADER_TYPE,
722 .procname = "bootloader_type",
723 .data = &bootloader_type,
724 .maxlen = sizeof (int),
725 .mode = 0444,
726 .proc_handler = &proc_dointvec,
729 .ctl_name = CTL_UNNUMBERED,
730 .procname = "kstack_depth_to_print",
731 .data = &kstack_depth_to_print,
732 .maxlen = sizeof(int),
733 .mode = 0644,
734 .proc_handler = &proc_dointvec,
737 .ctl_name = CTL_UNNUMBERED,
738 .procname = "io_delay_type",
739 .data = &io_delay_type,
740 .maxlen = sizeof(int),
741 .mode = 0644,
742 .proc_handler = &proc_dointvec,
744 #endif
745 #if defined(CONFIG_MMU)
747 .ctl_name = KERN_RANDOMIZE,
748 .procname = "randomize_va_space",
749 .data = &randomize_va_space,
750 .maxlen = sizeof(int),
751 .mode = 0644,
752 .proc_handler = &proc_dointvec,
754 #endif
755 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
757 .ctl_name = KERN_SPIN_RETRY,
758 .procname = "spin_retry",
759 .data = &spin_retry,
760 .maxlen = sizeof (int),
761 .mode = 0644,
762 .proc_handler = &proc_dointvec,
764 #endif
765 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
767 .procname = "acpi_video_flags",
768 .data = &acpi_realmode_flags,
769 .maxlen = sizeof (unsigned long),
770 .mode = 0644,
771 .proc_handler = &proc_doulongvec_minmax,
773 #endif
774 #ifdef CONFIG_IA64
776 .ctl_name = KERN_IA64_UNALIGNED,
777 .procname = "ignore-unaligned-usertrap",
778 .data = &no_unaligned_warning,
779 .maxlen = sizeof (int),
780 .mode = 0644,
781 .proc_handler = &proc_dointvec,
784 .ctl_name = CTL_UNNUMBERED,
785 .procname = "unaligned-dump-stack",
786 .data = &unaligned_dump_stack,
787 .maxlen = sizeof (int),
788 .mode = 0644,
789 .proc_handler = &proc_dointvec,
791 #endif
792 #ifdef CONFIG_DETECT_SOFTLOCKUP
794 .ctl_name = CTL_UNNUMBERED,
795 .procname = "softlockup_panic",
796 .data = &softlockup_panic,
797 .maxlen = sizeof(int),
798 .mode = 0644,
799 .proc_handler = &proc_dointvec_minmax,
800 .strategy = &sysctl_intvec,
801 .extra1 = &zero,
802 .extra2 = &one,
805 .ctl_name = CTL_UNNUMBERED,
806 .procname = "softlockup_thresh",
807 .data = &softlockup_thresh,
808 .maxlen = sizeof(int),
809 .mode = 0644,
810 .proc_handler = &proc_dosoftlockup_thresh,
811 .strategy = &sysctl_intvec,
812 .extra1 = &neg_one,
813 .extra2 = &sixty,
816 .ctl_name = CTL_UNNUMBERED,
817 .procname = "hung_task_check_count",
818 .data = &sysctl_hung_task_check_count,
819 .maxlen = sizeof(unsigned long),
820 .mode = 0644,
821 .proc_handler = &proc_doulongvec_minmax,
822 .strategy = &sysctl_intvec,
825 .ctl_name = CTL_UNNUMBERED,
826 .procname = "hung_task_timeout_secs",
827 .data = &sysctl_hung_task_timeout_secs,
828 .maxlen = sizeof(unsigned long),
829 .mode = 0644,
830 .proc_handler = &proc_doulongvec_minmax,
831 .strategy = &sysctl_intvec,
834 .ctl_name = CTL_UNNUMBERED,
835 .procname = "hung_task_warnings",
836 .data = &sysctl_hung_task_warnings,
837 .maxlen = sizeof(unsigned long),
838 .mode = 0644,
839 .proc_handler = &proc_doulongvec_minmax,
840 .strategy = &sysctl_intvec,
842 #endif
843 #ifdef CONFIG_COMPAT
845 .ctl_name = KERN_COMPAT_LOG,
846 .procname = "compat-log",
847 .data = &compat_log,
848 .maxlen = sizeof (int),
849 .mode = 0644,
850 .proc_handler = &proc_dointvec,
852 #endif
853 #ifdef CONFIG_RT_MUTEXES
855 .ctl_name = KERN_MAX_LOCK_DEPTH,
856 .procname = "max_lock_depth",
857 .data = &max_lock_depth,
858 .maxlen = sizeof(int),
859 .mode = 0644,
860 .proc_handler = &proc_dointvec,
862 #endif
864 .ctl_name = CTL_UNNUMBERED,
865 .procname = "poweroff_cmd",
866 .data = &poweroff_cmd,
867 .maxlen = POWEROFF_CMD_PATH_LEN,
868 .mode = 0644,
869 .proc_handler = &proc_dostring,
870 .strategy = &sysctl_string,
872 #ifdef CONFIG_KEYS
874 .ctl_name = CTL_UNNUMBERED,
875 .procname = "keys",
876 .mode = 0555,
877 .child = key_sysctls,
879 #endif
880 #ifdef CONFIG_RCU_TORTURE_TEST
882 .ctl_name = CTL_UNNUMBERED,
883 .procname = "rcutorture_runnable",
884 .data = &rcutorture_runnable,
885 .maxlen = sizeof(int),
886 .mode = 0644,
887 .proc_handler = &proc_dointvec,
889 #endif
890 #ifdef CONFIG_UNEVICTABLE_LRU
892 .ctl_name = CTL_UNNUMBERED,
893 .procname = "scan_unevictable_pages",
894 .data = &scan_unevictable_pages,
895 .maxlen = sizeof(scan_unevictable_pages),
896 .mode = 0644,
897 .proc_handler = &scan_unevictable_handler,
899 #endif
901 * NOTE: do not add new entries to this table unless you have read
902 * Documentation/sysctl/ctl_unnumbered.txt
904 { .ctl_name = 0 }
907 static struct ctl_table vm_table[] = {
909 .ctl_name = VM_OVERCOMMIT_MEMORY,
910 .procname = "overcommit_memory",
911 .data = &sysctl_overcommit_memory,
912 .maxlen = sizeof(sysctl_overcommit_memory),
913 .mode = 0644,
914 .proc_handler = &proc_dointvec,
917 .ctl_name = VM_PANIC_ON_OOM,
918 .procname = "panic_on_oom",
919 .data = &sysctl_panic_on_oom,
920 .maxlen = sizeof(sysctl_panic_on_oom),
921 .mode = 0644,
922 .proc_handler = &proc_dointvec,
925 .ctl_name = CTL_UNNUMBERED,
926 .procname = "oom_kill_allocating_task",
927 .data = &sysctl_oom_kill_allocating_task,
928 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
929 .mode = 0644,
930 .proc_handler = &proc_dointvec,
933 .ctl_name = CTL_UNNUMBERED,
934 .procname = "oom_dump_tasks",
935 .data = &sysctl_oom_dump_tasks,
936 .maxlen = sizeof(sysctl_oom_dump_tasks),
937 .mode = 0644,
938 .proc_handler = &proc_dointvec,
941 .ctl_name = VM_OVERCOMMIT_RATIO,
942 .procname = "overcommit_ratio",
943 .data = &sysctl_overcommit_ratio,
944 .maxlen = sizeof(sysctl_overcommit_ratio),
945 .mode = 0644,
946 .proc_handler = &proc_dointvec,
949 .ctl_name = VM_PAGE_CLUSTER,
950 .procname = "page-cluster",
951 .data = &page_cluster,
952 .maxlen = sizeof(int),
953 .mode = 0644,
954 .proc_handler = &proc_dointvec,
957 .ctl_name = VM_DIRTY_BACKGROUND,
958 .procname = "dirty_background_ratio",
959 .data = &dirty_background_ratio,
960 .maxlen = sizeof(dirty_background_ratio),
961 .mode = 0644,
962 .proc_handler = &dirty_background_ratio_handler,
963 .strategy = &sysctl_intvec,
964 .extra1 = &zero,
965 .extra2 = &one_hundred,
968 .ctl_name = CTL_UNNUMBERED,
969 .procname = "dirty_background_bytes",
970 .data = &dirty_background_bytes,
971 .maxlen = sizeof(dirty_background_bytes),
972 .mode = 0644,
973 .proc_handler = &dirty_background_bytes_handler,
974 .strategy = &sysctl_intvec,
975 .extra1 = &one_ul,
978 .ctl_name = VM_DIRTY_RATIO,
979 .procname = "dirty_ratio",
980 .data = &vm_dirty_ratio,
981 .maxlen = sizeof(vm_dirty_ratio),
982 .mode = 0644,
983 .proc_handler = &dirty_ratio_handler,
984 .strategy = &sysctl_intvec,
985 .extra1 = &zero,
986 .extra2 = &one_hundred,
989 .ctl_name = CTL_UNNUMBERED,
990 .procname = "dirty_bytes",
991 .data = &vm_dirty_bytes,
992 .maxlen = sizeof(vm_dirty_bytes),
993 .mode = 0644,
994 .proc_handler = &dirty_bytes_handler,
995 .strategy = &sysctl_intvec,
996 .extra1 = &one_ul,
999 .procname = "dirty_writeback_centisecs",
1000 .data = &dirty_writeback_interval,
1001 .maxlen = sizeof(dirty_writeback_interval),
1002 .mode = 0644,
1003 .proc_handler = &dirty_writeback_centisecs_handler,
1006 .procname = "dirty_expire_centisecs",
1007 .data = &dirty_expire_interval,
1008 .maxlen = sizeof(dirty_expire_interval),
1009 .mode = 0644,
1010 .proc_handler = &proc_dointvec_userhz_jiffies,
1013 .ctl_name = VM_NR_PDFLUSH_THREADS,
1014 .procname = "nr_pdflush_threads",
1015 .data = &nr_pdflush_threads,
1016 .maxlen = sizeof nr_pdflush_threads,
1017 .mode = 0444 /* read-only*/,
1018 .proc_handler = &proc_dointvec,
1021 .ctl_name = VM_SWAPPINESS,
1022 .procname = "swappiness",
1023 .data = &vm_swappiness,
1024 .maxlen = sizeof(vm_swappiness),
1025 .mode = 0644,
1026 .proc_handler = &proc_dointvec_minmax,
1027 .strategy = &sysctl_intvec,
1028 .extra1 = &zero,
1029 .extra2 = &one_hundred,
1031 #ifdef CONFIG_HUGETLB_PAGE
1033 .procname = "nr_hugepages",
1034 .data = NULL,
1035 .maxlen = sizeof(unsigned long),
1036 .mode = 0644,
1037 .proc_handler = &hugetlb_sysctl_handler,
1038 .extra1 = (void *)&hugetlb_zero,
1039 .extra2 = (void *)&hugetlb_infinity,
1042 .ctl_name = VM_HUGETLB_GROUP,
1043 .procname = "hugetlb_shm_group",
1044 .data = &sysctl_hugetlb_shm_group,
1045 .maxlen = sizeof(gid_t),
1046 .mode = 0644,
1047 .proc_handler = &proc_dointvec,
1050 .ctl_name = CTL_UNNUMBERED,
1051 .procname = "hugepages_treat_as_movable",
1052 .data = &hugepages_treat_as_movable,
1053 .maxlen = sizeof(int),
1054 .mode = 0644,
1055 .proc_handler = &hugetlb_treat_movable_handler,
1058 .ctl_name = CTL_UNNUMBERED,
1059 .procname = "nr_overcommit_hugepages",
1060 .data = NULL,
1061 .maxlen = sizeof(unsigned long),
1062 .mode = 0644,
1063 .proc_handler = &hugetlb_overcommit_handler,
1064 .extra1 = (void *)&hugetlb_zero,
1065 .extra2 = (void *)&hugetlb_infinity,
1067 #endif
1069 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
1070 .procname = "lowmem_reserve_ratio",
1071 .data = &sysctl_lowmem_reserve_ratio,
1072 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1073 .mode = 0644,
1074 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
1075 .strategy = &sysctl_intvec,
1078 .ctl_name = VM_DROP_PAGECACHE,
1079 .procname = "drop_caches",
1080 .data = &sysctl_drop_caches,
1081 .maxlen = sizeof(int),
1082 .mode = 0644,
1083 .proc_handler = drop_caches_sysctl_handler,
1084 .strategy = &sysctl_intvec,
1087 .ctl_name = VM_MIN_FREE_KBYTES,
1088 .procname = "min_free_kbytes",
1089 .data = &min_free_kbytes,
1090 .maxlen = sizeof(min_free_kbytes),
1091 .mode = 0644,
1092 .proc_handler = &min_free_kbytes_sysctl_handler,
1093 .strategy = &sysctl_intvec,
1094 .extra1 = &zero,
1097 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1098 .procname = "percpu_pagelist_fraction",
1099 .data = &percpu_pagelist_fraction,
1100 .maxlen = sizeof(percpu_pagelist_fraction),
1101 .mode = 0644,
1102 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
1103 .strategy = &sysctl_intvec,
1104 .extra1 = &min_percpu_pagelist_fract,
1106 #ifdef CONFIG_MMU
1108 .ctl_name = VM_MAX_MAP_COUNT,
1109 .procname = "max_map_count",
1110 .data = &sysctl_max_map_count,
1111 .maxlen = sizeof(sysctl_max_map_count),
1112 .mode = 0644,
1113 .proc_handler = &proc_dointvec
1115 #else
1117 .ctl_name = CTL_UNNUMBERED,
1118 .procname = "nr_trim_pages",
1119 .data = &sysctl_nr_trim_pages,
1120 .maxlen = sizeof(sysctl_nr_trim_pages),
1121 .mode = 0644,
1122 .proc_handler = &proc_dointvec_minmax,
1123 .strategy = &sysctl_intvec,
1124 .extra1 = &zero,
1126 #endif
1128 .ctl_name = VM_LAPTOP_MODE,
1129 .procname = "laptop_mode",
1130 .data = &laptop_mode,
1131 .maxlen = sizeof(laptop_mode),
1132 .mode = 0644,
1133 .proc_handler = &proc_dointvec_jiffies,
1134 .strategy = &sysctl_jiffies,
1137 .ctl_name = VM_BLOCK_DUMP,
1138 .procname = "block_dump",
1139 .data = &block_dump,
1140 .maxlen = sizeof(block_dump),
1141 .mode = 0644,
1142 .proc_handler = &proc_dointvec,
1143 .strategy = &sysctl_intvec,
1144 .extra1 = &zero,
1147 .ctl_name = VM_VFS_CACHE_PRESSURE,
1148 .procname = "vfs_cache_pressure",
1149 .data = &sysctl_vfs_cache_pressure,
1150 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1151 .mode = 0644,
1152 .proc_handler = &proc_dointvec,
1153 .strategy = &sysctl_intvec,
1154 .extra1 = &zero,
1156 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1158 .ctl_name = VM_LEGACY_VA_LAYOUT,
1159 .procname = "legacy_va_layout",
1160 .data = &sysctl_legacy_va_layout,
1161 .maxlen = sizeof(sysctl_legacy_va_layout),
1162 .mode = 0644,
1163 .proc_handler = &proc_dointvec,
1164 .strategy = &sysctl_intvec,
1165 .extra1 = &zero,
1167 #endif
1168 #ifdef CONFIG_NUMA
1170 .ctl_name = VM_ZONE_RECLAIM_MODE,
1171 .procname = "zone_reclaim_mode",
1172 .data = &zone_reclaim_mode,
1173 .maxlen = sizeof(zone_reclaim_mode),
1174 .mode = 0644,
1175 .proc_handler = &proc_dointvec,
1176 .strategy = &sysctl_intvec,
1177 .extra1 = &zero,
1180 .ctl_name = VM_MIN_UNMAPPED,
1181 .procname = "min_unmapped_ratio",
1182 .data = &sysctl_min_unmapped_ratio,
1183 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1184 .mode = 0644,
1185 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
1186 .strategy = &sysctl_intvec,
1187 .extra1 = &zero,
1188 .extra2 = &one_hundred,
1191 .ctl_name = VM_MIN_SLAB,
1192 .procname = "min_slab_ratio",
1193 .data = &sysctl_min_slab_ratio,
1194 .maxlen = sizeof(sysctl_min_slab_ratio),
1195 .mode = 0644,
1196 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
1197 .strategy = &sysctl_intvec,
1198 .extra1 = &zero,
1199 .extra2 = &one_hundred,
1201 #endif
1202 #ifdef CONFIG_SMP
1204 .ctl_name = CTL_UNNUMBERED,
1205 .procname = "stat_interval",
1206 .data = &sysctl_stat_interval,
1207 .maxlen = sizeof(sysctl_stat_interval),
1208 .mode = 0644,
1209 .proc_handler = &proc_dointvec_jiffies,
1210 .strategy = &sysctl_jiffies,
1212 #endif
1213 #ifdef CONFIG_SECURITY
1215 .ctl_name = CTL_UNNUMBERED,
1216 .procname = "mmap_min_addr",
1217 .data = &mmap_min_addr,
1218 .maxlen = sizeof(unsigned long),
1219 .mode = 0644,
1220 .proc_handler = &proc_doulongvec_minmax,
1222 #endif
1223 #ifdef CONFIG_NUMA
1225 .ctl_name = CTL_UNNUMBERED,
1226 .procname = "numa_zonelist_order",
1227 .data = &numa_zonelist_order,
1228 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1229 .mode = 0644,
1230 .proc_handler = &numa_zonelist_order_handler,
1231 .strategy = &sysctl_string,
1233 #endif
1234 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1235 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1237 .ctl_name = VM_VDSO_ENABLED,
1238 .procname = "vdso_enabled",
1239 .data = &vdso_enabled,
1240 .maxlen = sizeof(vdso_enabled),
1241 .mode = 0644,
1242 .proc_handler = &proc_dointvec,
1243 .strategy = &sysctl_intvec,
1244 .extra1 = &zero,
1246 #endif
1247 #ifdef CONFIG_HIGHMEM
1249 .ctl_name = CTL_UNNUMBERED,
1250 .procname = "highmem_is_dirtyable",
1251 .data = &vm_highmem_is_dirtyable,
1252 .maxlen = sizeof(vm_highmem_is_dirtyable),
1253 .mode = 0644,
1254 .proc_handler = &proc_dointvec_minmax,
1255 .strategy = &sysctl_intvec,
1256 .extra1 = &zero,
1257 .extra2 = &one,
1259 #endif
1261 * NOTE: do not add new entries to this table unless you have read
1262 * Documentation/sysctl/ctl_unnumbered.txt
1264 { .ctl_name = 0 }
1267 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1268 static struct ctl_table binfmt_misc_table[] = {
1269 { .ctl_name = 0 }
1271 #endif
1273 static struct ctl_table fs_table[] = {
1275 .ctl_name = FS_NRINODE,
1276 .procname = "inode-nr",
1277 .data = &inodes_stat,
1278 .maxlen = 2*sizeof(int),
1279 .mode = 0444,
1280 .proc_handler = &proc_dointvec,
1283 .ctl_name = FS_STATINODE,
1284 .procname = "inode-state",
1285 .data = &inodes_stat,
1286 .maxlen = 7*sizeof(int),
1287 .mode = 0444,
1288 .proc_handler = &proc_dointvec,
1291 .procname = "file-nr",
1292 .data = &files_stat,
1293 .maxlen = 3*sizeof(int),
1294 .mode = 0444,
1295 .proc_handler = &proc_nr_files,
1298 .ctl_name = FS_MAXFILE,
1299 .procname = "file-max",
1300 .data = &files_stat.max_files,
1301 .maxlen = sizeof(int),
1302 .mode = 0644,
1303 .proc_handler = &proc_dointvec,
1306 .ctl_name = CTL_UNNUMBERED,
1307 .procname = "nr_open",
1308 .data = &sysctl_nr_open,
1309 .maxlen = sizeof(int),
1310 .mode = 0644,
1311 .proc_handler = &proc_dointvec_minmax,
1312 .extra1 = &sysctl_nr_open_min,
1313 .extra2 = &sysctl_nr_open_max,
1316 .ctl_name = FS_DENTRY,
1317 .procname = "dentry-state",
1318 .data = &dentry_stat,
1319 .maxlen = 6*sizeof(int),
1320 .mode = 0444,
1321 .proc_handler = &proc_dointvec,
1324 .ctl_name = FS_OVERFLOWUID,
1325 .procname = "overflowuid",
1326 .data = &fs_overflowuid,
1327 .maxlen = sizeof(int),
1328 .mode = 0644,
1329 .proc_handler = &proc_dointvec_minmax,
1330 .strategy = &sysctl_intvec,
1331 .extra1 = &minolduid,
1332 .extra2 = &maxolduid,
1335 .ctl_name = FS_OVERFLOWGID,
1336 .procname = "overflowgid",
1337 .data = &fs_overflowgid,
1338 .maxlen = sizeof(int),
1339 .mode = 0644,
1340 .proc_handler = &proc_dointvec_minmax,
1341 .strategy = &sysctl_intvec,
1342 .extra1 = &minolduid,
1343 .extra2 = &maxolduid,
1345 #ifdef CONFIG_FILE_LOCKING
1347 .ctl_name = FS_LEASES,
1348 .procname = "leases-enable",
1349 .data = &leases_enable,
1350 .maxlen = sizeof(int),
1351 .mode = 0644,
1352 .proc_handler = &proc_dointvec,
1354 #endif
1355 #ifdef CONFIG_DNOTIFY
1357 .ctl_name = FS_DIR_NOTIFY,
1358 .procname = "dir-notify-enable",
1359 .data = &dir_notify_enable,
1360 .maxlen = sizeof(int),
1361 .mode = 0644,
1362 .proc_handler = &proc_dointvec,
1364 #endif
1365 #ifdef CONFIG_MMU
1366 #ifdef CONFIG_FILE_LOCKING
1368 .ctl_name = FS_LEASE_TIME,
1369 .procname = "lease-break-time",
1370 .data = &lease_break_time,
1371 .maxlen = sizeof(int),
1372 .mode = 0644,
1373 .proc_handler = &proc_dointvec,
1375 #endif
1376 #ifdef CONFIG_AIO
1378 .procname = "aio-nr",
1379 .data = &aio_nr,
1380 .maxlen = sizeof(aio_nr),
1381 .mode = 0444,
1382 .proc_handler = &proc_doulongvec_minmax,
1385 .procname = "aio-max-nr",
1386 .data = &aio_max_nr,
1387 .maxlen = sizeof(aio_max_nr),
1388 .mode = 0644,
1389 .proc_handler = &proc_doulongvec_minmax,
1391 #endif /* CONFIG_AIO */
1392 #ifdef CONFIG_INOTIFY_USER
1394 .ctl_name = FS_INOTIFY,
1395 .procname = "inotify",
1396 .mode = 0555,
1397 .child = inotify_table,
1399 #endif
1400 #ifdef CONFIG_EPOLL
1402 .procname = "epoll",
1403 .mode = 0555,
1404 .child = epoll_table,
1406 #endif
1407 #endif
1409 .ctl_name = KERN_SETUID_DUMPABLE,
1410 .procname = "suid_dumpable",
1411 .data = &suid_dumpable,
1412 .maxlen = sizeof(int),
1413 .mode = 0644,
1414 .proc_handler = &proc_dointvec_minmax,
1415 .strategy = &sysctl_intvec,
1416 .extra1 = &zero,
1417 .extra2 = &two,
1419 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1421 .ctl_name = CTL_UNNUMBERED,
1422 .procname = "binfmt_misc",
1423 .mode = 0555,
1424 .child = binfmt_misc_table,
1426 #endif
1428 * NOTE: do not add new entries to this table unless you have read
1429 * Documentation/sysctl/ctl_unnumbered.txt
1431 { .ctl_name = 0 }
1434 static struct ctl_table debug_table[] = {
1435 #if defined(CONFIG_X86) || defined(CONFIG_PPC)
1437 .ctl_name = CTL_UNNUMBERED,
1438 .procname = "exception-trace",
1439 .data = &show_unhandled_signals,
1440 .maxlen = sizeof(int),
1441 .mode = 0644,
1442 .proc_handler = proc_dointvec
1444 #endif
1445 { .ctl_name = 0 }
1448 static struct ctl_table dev_table[] = {
1449 { .ctl_name = 0 }
1452 static DEFINE_SPINLOCK(sysctl_lock);
1454 /* called under sysctl_lock */
1455 static int use_table(struct ctl_table_header *p)
1457 if (unlikely(p->unregistering))
1458 return 0;
1459 p->used++;
1460 return 1;
1463 /* called under sysctl_lock */
1464 static void unuse_table(struct ctl_table_header *p)
1466 if (!--p->used)
1467 if (unlikely(p->unregistering))
1468 complete(p->unregistering);
1471 /* called under sysctl_lock, will reacquire if has to wait */
1472 static void start_unregistering(struct ctl_table_header *p)
1475 * if p->used is 0, nobody will ever touch that entry again;
1476 * we'll eliminate all paths to it before dropping sysctl_lock
1478 if (unlikely(p->used)) {
1479 struct completion wait;
1480 init_completion(&wait);
1481 p->unregistering = &wait;
1482 spin_unlock(&sysctl_lock);
1483 wait_for_completion(&wait);
1484 spin_lock(&sysctl_lock);
1485 } else {
1486 /* anything non-NULL; we'll never dereference it */
1487 p->unregistering = ERR_PTR(-EINVAL);
1490 * do not remove from the list until nobody holds it; walking the
1491 * list in do_sysctl() relies on that.
1493 list_del_init(&p->ctl_entry);
1496 void sysctl_head_get(struct ctl_table_header *head)
1498 spin_lock(&sysctl_lock);
1499 head->count++;
1500 spin_unlock(&sysctl_lock);
1503 void sysctl_head_put(struct ctl_table_header *head)
1505 spin_lock(&sysctl_lock);
1506 if (!--head->count)
1507 kfree(head);
1508 spin_unlock(&sysctl_lock);
1511 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1513 if (!head)
1514 BUG();
1515 spin_lock(&sysctl_lock);
1516 if (!use_table(head))
1517 head = ERR_PTR(-ENOENT);
1518 spin_unlock(&sysctl_lock);
1519 return head;
1522 void sysctl_head_finish(struct ctl_table_header *head)
1524 if (!head)
1525 return;
1526 spin_lock(&sysctl_lock);
1527 unuse_table(head);
1528 spin_unlock(&sysctl_lock);
1531 static struct ctl_table_set *
1532 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1534 struct ctl_table_set *set = &root->default_set;
1535 if (root->lookup)
1536 set = root->lookup(root, namespaces);
1537 return set;
1540 static struct list_head *
1541 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1543 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1544 return &set->list;
1547 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1548 struct ctl_table_header *prev)
1550 struct ctl_table_root *root;
1551 struct list_head *header_list;
1552 struct ctl_table_header *head;
1553 struct list_head *tmp;
1555 spin_lock(&sysctl_lock);
1556 if (prev) {
1557 head = prev;
1558 tmp = &prev->ctl_entry;
1559 unuse_table(prev);
1560 goto next;
1562 tmp = &root_table_header.ctl_entry;
1563 for (;;) {
1564 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1566 if (!use_table(head))
1567 goto next;
1568 spin_unlock(&sysctl_lock);
1569 return head;
1570 next:
1571 root = head->root;
1572 tmp = tmp->next;
1573 header_list = lookup_header_list(root, namespaces);
1574 if (tmp != header_list)
1575 continue;
1577 do {
1578 root = list_entry(root->root_list.next,
1579 struct ctl_table_root, root_list);
1580 if (root == &sysctl_table_root)
1581 goto out;
1582 header_list = lookup_header_list(root, namespaces);
1583 } while (list_empty(header_list));
1584 tmp = header_list->next;
1586 out:
1587 spin_unlock(&sysctl_lock);
1588 return NULL;
1591 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1593 return __sysctl_head_next(current->nsproxy, prev);
1596 void register_sysctl_root(struct ctl_table_root *root)
1598 spin_lock(&sysctl_lock);
1599 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1600 spin_unlock(&sysctl_lock);
1603 #ifdef CONFIG_SYSCTL_SYSCALL
1604 /* Perform the actual read/write of a sysctl table entry. */
1605 static int do_sysctl_strategy(struct ctl_table_root *root,
1606 struct ctl_table *table,
1607 void __user *oldval, size_t __user *oldlenp,
1608 void __user *newval, size_t newlen)
1610 int op = 0, rc;
1612 if (oldval)
1613 op |= MAY_READ;
1614 if (newval)
1615 op |= MAY_WRITE;
1616 if (sysctl_perm(root, table, op))
1617 return -EPERM;
1619 if (table->strategy) {
1620 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1621 if (rc < 0)
1622 return rc;
1623 if (rc > 0)
1624 return 0;
1627 /* If there is no strategy routine, or if the strategy returns
1628 * zero, proceed with automatic r/w */
1629 if (table->data && table->maxlen) {
1630 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1631 if (rc < 0)
1632 return rc;
1634 return 0;
1637 static int parse_table(int __user *name, int nlen,
1638 void __user *oldval, size_t __user *oldlenp,
1639 void __user *newval, size_t newlen,
1640 struct ctl_table_root *root,
1641 struct ctl_table *table)
1643 int n;
1644 repeat:
1645 if (!nlen)
1646 return -ENOTDIR;
1647 if (get_user(n, name))
1648 return -EFAULT;
1649 for ( ; table->ctl_name || table->procname; table++) {
1650 if (!table->ctl_name)
1651 continue;
1652 if (n == table->ctl_name) {
1653 int error;
1654 if (table->child) {
1655 if (sysctl_perm(root, table, MAY_EXEC))
1656 return -EPERM;
1657 name++;
1658 nlen--;
1659 table = table->child;
1660 goto repeat;
1662 error = do_sysctl_strategy(root, table,
1663 oldval, oldlenp,
1664 newval, newlen);
1665 return error;
1668 return -ENOTDIR;
1671 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1672 void __user *newval, size_t newlen)
1674 struct ctl_table_header *head;
1675 int error = -ENOTDIR;
1677 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1678 return -ENOTDIR;
1679 if (oldval) {
1680 int old_len;
1681 if (!oldlenp || get_user(old_len, oldlenp))
1682 return -EFAULT;
1685 for (head = sysctl_head_next(NULL); head;
1686 head = sysctl_head_next(head)) {
1687 error = parse_table(name, nlen, oldval, oldlenp,
1688 newval, newlen,
1689 head->root, head->ctl_table);
1690 if (error != -ENOTDIR) {
1691 sysctl_head_finish(head);
1692 break;
1695 return error;
1698 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1700 struct __sysctl_args tmp;
1701 int error;
1703 if (copy_from_user(&tmp, args, sizeof(tmp)))
1704 return -EFAULT;
1706 error = deprecated_sysctl_warning(&tmp);
1707 if (error)
1708 goto out;
1710 lock_kernel();
1711 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1712 tmp.newval, tmp.newlen);
1713 unlock_kernel();
1714 out:
1715 return error;
1717 #endif /* CONFIG_SYSCTL_SYSCALL */
1720 * sysctl_perm does NOT grant the superuser all rights automatically, because
1721 * some sysctl variables are readonly even to root.
1724 static int test_perm(int mode, int op)
1726 if (!current_euid())
1727 mode >>= 6;
1728 else if (in_egroup_p(0))
1729 mode >>= 3;
1730 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1731 return 0;
1732 return -EACCES;
1735 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1737 int error;
1738 int mode;
1740 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1741 if (error)
1742 return error;
1744 if (root->permissions)
1745 mode = root->permissions(root, current->nsproxy, table);
1746 else
1747 mode = table->mode;
1749 return test_perm(mode, op);
1752 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1754 for (; table->ctl_name || table->procname; table++) {
1755 table->parent = parent;
1756 if (table->child)
1757 sysctl_set_parent(table, table->child);
1761 static __init int sysctl_init(void)
1763 sysctl_set_parent(NULL, root_table);
1764 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1766 int err;
1767 err = sysctl_check_table(current->nsproxy, root_table);
1769 #endif
1770 return 0;
1773 core_initcall(sysctl_init);
1775 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1776 struct ctl_table *table)
1778 struct ctl_table *p;
1779 const char *s = branch->procname;
1781 /* branch should have named subdirectory as its first element */
1782 if (!s || !branch->child)
1783 return NULL;
1785 /* ... and nothing else */
1786 if (branch[1].procname || branch[1].ctl_name)
1787 return NULL;
1789 /* table should contain subdirectory with the same name */
1790 for (p = table; p->procname || p->ctl_name; p++) {
1791 if (!p->child)
1792 continue;
1793 if (p->procname && strcmp(p->procname, s) == 0)
1794 return p;
1796 return NULL;
1799 /* see if attaching q to p would be an improvement */
1800 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1802 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1803 struct ctl_table *next;
1804 int is_better = 0;
1805 int not_in_parent = !p->attached_by;
1807 while ((next = is_branch_in(by, to)) != NULL) {
1808 if (by == q->attached_by)
1809 is_better = 1;
1810 if (to == p->attached_by)
1811 not_in_parent = 1;
1812 by = by->child;
1813 to = next->child;
1816 if (is_better && not_in_parent) {
1817 q->attached_by = by;
1818 q->attached_to = to;
1819 q->parent = p;
1824 * __register_sysctl_paths - register a sysctl hierarchy
1825 * @root: List of sysctl headers to register on
1826 * @namespaces: Data to compute which lists of sysctl entries are visible
1827 * @path: The path to the directory the sysctl table is in.
1828 * @table: the top-level table structure
1830 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1831 * array. A completely 0 filled entry terminates the table.
1833 * The members of the &struct ctl_table structure are used as follows:
1835 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1836 * must be unique within that level of sysctl
1838 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1839 * enter a sysctl file
1841 * data - a pointer to data for use by proc_handler
1843 * maxlen - the maximum size in bytes of the data
1845 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1847 * child - a pointer to the child sysctl table if this entry is a directory, or
1848 * %NULL.
1850 * proc_handler - the text handler routine (described below)
1852 * strategy - the strategy routine (described below)
1854 * de - for internal use by the sysctl routines
1856 * extra1, extra2 - extra pointers usable by the proc handler routines
1858 * Leaf nodes in the sysctl tree will be represented by a single file
1859 * under /proc; non-leaf nodes will be represented by directories.
1861 * sysctl(2) can automatically manage read and write requests through
1862 * the sysctl table. The data and maxlen fields of the ctl_table
1863 * struct enable minimal validation of the values being written to be
1864 * performed, and the mode field allows minimal authentication.
1866 * More sophisticated management can be enabled by the provision of a
1867 * strategy routine with the table entry. This will be called before
1868 * any automatic read or write of the data is performed.
1870 * The strategy routine may return
1872 * < 0 - Error occurred (error is passed to user process)
1874 * 0 - OK - proceed with automatic read or write.
1876 * > 0 - OK - read or write has been done by the strategy routine, so
1877 * return immediately.
1879 * There must be a proc_handler routine for any terminal nodes
1880 * mirrored under /proc/sys (non-terminals are handled by a built-in
1881 * directory handler). Several default handlers are available to
1882 * cover common cases -
1884 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1885 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1886 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1888 * It is the handler's job to read the input buffer from user memory
1889 * and process it. The handler should return 0 on success.
1891 * This routine returns %NULL on a failure to register, and a pointer
1892 * to the table header on success.
1894 struct ctl_table_header *__register_sysctl_paths(
1895 struct ctl_table_root *root,
1896 struct nsproxy *namespaces,
1897 const struct ctl_path *path, struct ctl_table *table)
1899 struct ctl_table_header *header;
1900 struct ctl_table *new, **prevp;
1901 unsigned int n, npath;
1902 struct ctl_table_set *set;
1904 /* Count the path components */
1905 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
1909 * For each path component, allocate a 2-element ctl_table array.
1910 * The first array element will be filled with the sysctl entry
1911 * for this, the second will be the sentinel (ctl_name == 0).
1913 * We allocate everything in one go so that we don't have to
1914 * worry about freeing additional memory in unregister_sysctl_table.
1916 header = kzalloc(sizeof(struct ctl_table_header) +
1917 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1918 if (!header)
1919 return NULL;
1921 new = (struct ctl_table *) (header + 1);
1923 /* Now connect the dots */
1924 prevp = &header->ctl_table;
1925 for (n = 0; n < npath; ++n, ++path) {
1926 /* Copy the procname */
1927 new->procname = path->procname;
1928 new->ctl_name = path->ctl_name;
1929 new->mode = 0555;
1931 *prevp = new;
1932 prevp = &new->child;
1934 new += 2;
1936 *prevp = table;
1937 header->ctl_table_arg = table;
1939 INIT_LIST_HEAD(&header->ctl_entry);
1940 header->used = 0;
1941 header->unregistering = NULL;
1942 header->root = root;
1943 sysctl_set_parent(NULL, header->ctl_table);
1944 header->count = 1;
1945 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1946 if (sysctl_check_table(namespaces, header->ctl_table)) {
1947 kfree(header);
1948 return NULL;
1950 #endif
1951 spin_lock(&sysctl_lock);
1952 header->set = lookup_header_set(root, namespaces);
1953 header->attached_by = header->ctl_table;
1954 header->attached_to = root_table;
1955 header->parent = &root_table_header;
1956 for (set = header->set; set; set = set->parent) {
1957 struct ctl_table_header *p;
1958 list_for_each_entry(p, &set->list, ctl_entry) {
1959 if (p->unregistering)
1960 continue;
1961 try_attach(p, header);
1964 header->parent->count++;
1965 list_add_tail(&header->ctl_entry, &header->set->list);
1966 spin_unlock(&sysctl_lock);
1968 return header;
1972 * register_sysctl_table_path - register a sysctl table hierarchy
1973 * @path: The path to the directory the sysctl table is in.
1974 * @table: the top-level table structure
1976 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1977 * array. A completely 0 filled entry terminates the table.
1979 * See __register_sysctl_paths for more details.
1981 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1982 struct ctl_table *table)
1984 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
1985 path, table);
1989 * register_sysctl_table - register a sysctl table hierarchy
1990 * @table: the top-level table structure
1992 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1993 * array. A completely 0 filled entry terminates the table.
1995 * See register_sysctl_paths for more details.
1997 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1999 static const struct ctl_path null_path[] = { {} };
2001 return register_sysctl_paths(null_path, table);
2005 * unregister_sysctl_table - unregister a sysctl table hierarchy
2006 * @header: the header returned from register_sysctl_table
2008 * Unregisters the sysctl table and all children. proc entries may not
2009 * actually be removed until they are no longer used by anyone.
2011 void unregister_sysctl_table(struct ctl_table_header * header)
2013 might_sleep();
2015 if (header == NULL)
2016 return;
2018 spin_lock(&sysctl_lock);
2019 start_unregistering(header);
2020 if (!--header->parent->count) {
2021 WARN_ON(1);
2022 kfree(header->parent);
2024 if (!--header->count)
2025 kfree(header);
2026 spin_unlock(&sysctl_lock);
2029 int sysctl_is_seen(struct ctl_table_header *p)
2031 struct ctl_table_set *set = p->set;
2032 int res;
2033 spin_lock(&sysctl_lock);
2034 if (p->unregistering)
2035 res = 0;
2036 else if (!set->is_seen)
2037 res = 1;
2038 else
2039 res = set->is_seen(set);
2040 spin_unlock(&sysctl_lock);
2041 return res;
2044 void setup_sysctl_set(struct ctl_table_set *p,
2045 struct ctl_table_set *parent,
2046 int (*is_seen)(struct ctl_table_set *))
2048 INIT_LIST_HEAD(&p->list);
2049 p->parent = parent ? parent : &sysctl_table_root.default_set;
2050 p->is_seen = is_seen;
2053 #else /* !CONFIG_SYSCTL */
2054 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2056 return NULL;
2059 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2060 struct ctl_table *table)
2062 return NULL;
2065 void unregister_sysctl_table(struct ctl_table_header * table)
2069 void setup_sysctl_set(struct ctl_table_set *p,
2070 struct ctl_table_set *parent,
2071 int (*is_seen)(struct ctl_table_set *))
2075 void sysctl_head_put(struct ctl_table_header *head)
2079 #endif /* CONFIG_SYSCTL */
2082 * /proc/sys support
2085 #ifdef CONFIG_PROC_SYSCTL
2087 static int _proc_do_string(void* data, int maxlen, int write,
2088 struct file *filp, void __user *buffer,
2089 size_t *lenp, loff_t *ppos)
2091 size_t len;
2092 char __user *p;
2093 char c;
2095 if (!data || !maxlen || !*lenp) {
2096 *lenp = 0;
2097 return 0;
2100 if (write) {
2101 len = 0;
2102 p = buffer;
2103 while (len < *lenp) {
2104 if (get_user(c, p++))
2105 return -EFAULT;
2106 if (c == 0 || c == '\n')
2107 break;
2108 len++;
2110 if (len >= maxlen)
2111 len = maxlen-1;
2112 if(copy_from_user(data, buffer, len))
2113 return -EFAULT;
2114 ((char *) data)[len] = 0;
2115 *ppos += *lenp;
2116 } else {
2117 len = strlen(data);
2118 if (len > maxlen)
2119 len = maxlen;
2121 if (*ppos > len) {
2122 *lenp = 0;
2123 return 0;
2126 data += *ppos;
2127 len -= *ppos;
2129 if (len > *lenp)
2130 len = *lenp;
2131 if (len)
2132 if(copy_to_user(buffer, data, len))
2133 return -EFAULT;
2134 if (len < *lenp) {
2135 if(put_user('\n', ((char __user *) buffer) + len))
2136 return -EFAULT;
2137 len++;
2139 *lenp = len;
2140 *ppos += len;
2142 return 0;
2146 * proc_dostring - read a string sysctl
2147 * @table: the sysctl table
2148 * @write: %TRUE if this is a write to the sysctl file
2149 * @filp: the file structure
2150 * @buffer: the user buffer
2151 * @lenp: the size of the user buffer
2152 * @ppos: file position
2154 * Reads/writes a string from/to the user buffer. If the kernel
2155 * buffer provided is not large enough to hold the string, the
2156 * string is truncated. The copied string is %NULL-terminated.
2157 * If the string is being read by the user process, it is copied
2158 * and a newline '\n' is added. It is truncated if the buffer is
2159 * not large enough.
2161 * Returns 0 on success.
2163 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2164 void __user *buffer, size_t *lenp, loff_t *ppos)
2166 return _proc_do_string(table->data, table->maxlen, write, filp,
2167 buffer, lenp, ppos);
2171 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
2172 int *valp,
2173 int write, void *data)
2175 if (write) {
2176 *valp = *negp ? -*lvalp : *lvalp;
2177 } else {
2178 int val = *valp;
2179 if (val < 0) {
2180 *negp = -1;
2181 *lvalp = (unsigned long)-val;
2182 } else {
2183 *negp = 0;
2184 *lvalp = (unsigned long)val;
2187 return 0;
2190 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2191 int write, struct file *filp, void __user *buffer,
2192 size_t *lenp, loff_t *ppos,
2193 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2194 int write, void *data),
2195 void *data)
2197 #define TMPBUFLEN 21
2198 int *i, vleft, first=1, neg, val;
2199 unsigned long lval;
2200 size_t left, len;
2202 char buf[TMPBUFLEN], *p;
2203 char __user *s = buffer;
2205 if (!tbl_data || !table->maxlen || !*lenp ||
2206 (*ppos && !write)) {
2207 *lenp = 0;
2208 return 0;
2211 i = (int *) tbl_data;
2212 vleft = table->maxlen / sizeof(*i);
2213 left = *lenp;
2215 if (!conv)
2216 conv = do_proc_dointvec_conv;
2218 for (; left && vleft--; i++, first=0) {
2219 if (write) {
2220 while (left) {
2221 char c;
2222 if (get_user(c, s))
2223 return -EFAULT;
2224 if (!isspace(c))
2225 break;
2226 left--;
2227 s++;
2229 if (!left)
2230 break;
2231 neg = 0;
2232 len = left;
2233 if (len > sizeof(buf) - 1)
2234 len = sizeof(buf) - 1;
2235 if (copy_from_user(buf, s, len))
2236 return -EFAULT;
2237 buf[len] = 0;
2238 p = buf;
2239 if (*p == '-' && left > 1) {
2240 neg = 1;
2241 p++;
2243 if (*p < '0' || *p > '9')
2244 break;
2246 lval = simple_strtoul(p, &p, 0);
2248 len = p-buf;
2249 if ((len < left) && *p && !isspace(*p))
2250 break;
2251 if (neg)
2252 val = -val;
2253 s += len;
2254 left -= len;
2256 if (conv(&neg, &lval, i, 1, data))
2257 break;
2258 } else {
2259 p = buf;
2260 if (!first)
2261 *p++ = '\t';
2263 if (conv(&neg, &lval, i, 0, data))
2264 break;
2266 sprintf(p, "%s%lu", neg ? "-" : "", lval);
2267 len = strlen(buf);
2268 if (len > left)
2269 len = left;
2270 if(copy_to_user(s, buf, len))
2271 return -EFAULT;
2272 left -= len;
2273 s += len;
2277 if (!write && !first && left) {
2278 if(put_user('\n', s))
2279 return -EFAULT;
2280 left--, s++;
2282 if (write) {
2283 while (left) {
2284 char c;
2285 if (get_user(c, s++))
2286 return -EFAULT;
2287 if (!isspace(c))
2288 break;
2289 left--;
2292 if (write && first)
2293 return -EINVAL;
2294 *lenp -= left;
2295 *ppos += *lenp;
2296 return 0;
2297 #undef TMPBUFLEN
2300 static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2301 void __user *buffer, size_t *lenp, loff_t *ppos,
2302 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2303 int write, void *data),
2304 void *data)
2306 return __do_proc_dointvec(table->data, table, write, filp,
2307 buffer, lenp, ppos, conv, data);
2311 * proc_dointvec - read a vector of integers
2312 * @table: the sysctl table
2313 * @write: %TRUE if this is a write to the sysctl file
2314 * @filp: the file structure
2315 * @buffer: the user buffer
2316 * @lenp: the size of the user buffer
2317 * @ppos: file position
2319 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2320 * values from/to the user buffer, treated as an ASCII string.
2322 * Returns 0 on success.
2324 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2325 void __user *buffer, size_t *lenp, loff_t *ppos)
2327 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2328 NULL,NULL);
2332 * Taint values can only be increased
2333 * This means we can safely use a temporary.
2335 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2336 void __user *buffer, size_t *lenp, loff_t *ppos)
2338 struct ctl_table t;
2339 unsigned long tmptaint = get_taint();
2340 int err;
2342 if (write && !capable(CAP_SYS_ADMIN))
2343 return -EPERM;
2345 t = *table;
2346 t.data = &tmptaint;
2347 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos);
2348 if (err < 0)
2349 return err;
2351 if (write) {
2353 * Poor man's atomic or. Not worth adding a primitive
2354 * to everyone's atomic.h for this
2356 int i;
2357 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2358 if ((tmptaint >> i) & 1)
2359 add_taint(i);
2363 return err;
2366 struct do_proc_dointvec_minmax_conv_param {
2367 int *min;
2368 int *max;
2371 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2372 int *valp,
2373 int write, void *data)
2375 struct do_proc_dointvec_minmax_conv_param *param = data;
2376 if (write) {
2377 int val = *negp ? -*lvalp : *lvalp;
2378 if ((param->min && *param->min > val) ||
2379 (param->max && *param->max < val))
2380 return -EINVAL;
2381 *valp = val;
2382 } else {
2383 int val = *valp;
2384 if (val < 0) {
2385 *negp = -1;
2386 *lvalp = (unsigned long)-val;
2387 } else {
2388 *negp = 0;
2389 *lvalp = (unsigned long)val;
2392 return 0;
2396 * proc_dointvec_minmax - read a vector of integers with min/max values
2397 * @table: the sysctl table
2398 * @write: %TRUE if this is a write to the sysctl file
2399 * @filp: the file structure
2400 * @buffer: the user buffer
2401 * @lenp: the size of the user buffer
2402 * @ppos: file position
2404 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2405 * values from/to the user buffer, treated as an ASCII string.
2407 * This routine will ensure the values are within the range specified by
2408 * table->extra1 (min) and table->extra2 (max).
2410 * Returns 0 on success.
2412 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2413 void __user *buffer, size_t *lenp, loff_t *ppos)
2415 struct do_proc_dointvec_minmax_conv_param param = {
2416 .min = (int *) table->extra1,
2417 .max = (int *) table->extra2,
2419 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2420 do_proc_dointvec_minmax_conv, &param);
2423 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2424 struct file *filp,
2425 void __user *buffer,
2426 size_t *lenp, loff_t *ppos,
2427 unsigned long convmul,
2428 unsigned long convdiv)
2430 #define TMPBUFLEN 21
2431 unsigned long *i, *min, *max, val;
2432 int vleft, first=1, neg;
2433 size_t len, left;
2434 char buf[TMPBUFLEN], *p;
2435 char __user *s = buffer;
2437 if (!data || !table->maxlen || !*lenp ||
2438 (*ppos && !write)) {
2439 *lenp = 0;
2440 return 0;
2443 i = (unsigned long *) data;
2444 min = (unsigned long *) table->extra1;
2445 max = (unsigned long *) table->extra2;
2446 vleft = table->maxlen / sizeof(unsigned long);
2447 left = *lenp;
2449 for (; left && vleft--; i++, min++, max++, first=0) {
2450 if (write) {
2451 while (left) {
2452 char c;
2453 if (get_user(c, s))
2454 return -EFAULT;
2455 if (!isspace(c))
2456 break;
2457 left--;
2458 s++;
2460 if (!left)
2461 break;
2462 neg = 0;
2463 len = left;
2464 if (len > TMPBUFLEN-1)
2465 len = TMPBUFLEN-1;
2466 if (copy_from_user(buf, s, len))
2467 return -EFAULT;
2468 buf[len] = 0;
2469 p = buf;
2470 if (*p == '-' && left > 1) {
2471 neg = 1;
2472 p++;
2474 if (*p < '0' || *p > '9')
2475 break;
2476 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
2477 len = p-buf;
2478 if ((len < left) && *p && !isspace(*p))
2479 break;
2480 if (neg)
2481 val = -val;
2482 s += len;
2483 left -= len;
2485 if(neg)
2486 continue;
2487 if ((min && val < *min) || (max && val > *max))
2488 continue;
2489 *i = val;
2490 } else {
2491 p = buf;
2492 if (!first)
2493 *p++ = '\t';
2494 sprintf(p, "%lu", convdiv * (*i) / convmul);
2495 len = strlen(buf);
2496 if (len > left)
2497 len = left;
2498 if(copy_to_user(s, buf, len))
2499 return -EFAULT;
2500 left -= len;
2501 s += len;
2505 if (!write && !first && left) {
2506 if(put_user('\n', s))
2507 return -EFAULT;
2508 left--, s++;
2510 if (write) {
2511 while (left) {
2512 char c;
2513 if (get_user(c, s++))
2514 return -EFAULT;
2515 if (!isspace(c))
2516 break;
2517 left--;
2520 if (write && first)
2521 return -EINVAL;
2522 *lenp -= left;
2523 *ppos += *lenp;
2524 return 0;
2525 #undef TMPBUFLEN
2528 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2529 struct file *filp,
2530 void __user *buffer,
2531 size_t *lenp, loff_t *ppos,
2532 unsigned long convmul,
2533 unsigned long convdiv)
2535 return __do_proc_doulongvec_minmax(table->data, table, write,
2536 filp, buffer, lenp, ppos, convmul, convdiv);
2540 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2541 * @table: the sysctl table
2542 * @write: %TRUE if this is a write to the sysctl file
2543 * @filp: the file structure
2544 * @buffer: the user buffer
2545 * @lenp: the size of the user buffer
2546 * @ppos: file position
2548 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2549 * values from/to the user buffer, treated as an ASCII string.
2551 * This routine will ensure the values are within the range specified by
2552 * table->extra1 (min) and table->extra2 (max).
2554 * Returns 0 on success.
2556 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2557 void __user *buffer, size_t *lenp, loff_t *ppos)
2559 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
2563 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2564 * @table: the sysctl table
2565 * @write: %TRUE if this is a write to the sysctl file
2566 * @filp: the file structure
2567 * @buffer: the user buffer
2568 * @lenp: the size of the user buffer
2569 * @ppos: file position
2571 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2572 * values from/to the user buffer, treated as an ASCII string. The values
2573 * are treated as milliseconds, and converted to jiffies when they are stored.
2575 * This routine will ensure the values are within the range specified by
2576 * table->extra1 (min) and table->extra2 (max).
2578 * Returns 0 on success.
2580 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2581 struct file *filp,
2582 void __user *buffer,
2583 size_t *lenp, loff_t *ppos)
2585 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2586 lenp, ppos, HZ, 1000l);
2590 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2591 int *valp,
2592 int write, void *data)
2594 if (write) {
2595 if (*lvalp > LONG_MAX / HZ)
2596 return 1;
2597 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2598 } else {
2599 int val = *valp;
2600 unsigned long lval;
2601 if (val < 0) {
2602 *negp = -1;
2603 lval = (unsigned long)-val;
2604 } else {
2605 *negp = 0;
2606 lval = (unsigned long)val;
2608 *lvalp = lval / HZ;
2610 return 0;
2613 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2614 int *valp,
2615 int write, void *data)
2617 if (write) {
2618 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2619 return 1;
2620 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2621 } else {
2622 int val = *valp;
2623 unsigned long lval;
2624 if (val < 0) {
2625 *negp = -1;
2626 lval = (unsigned long)-val;
2627 } else {
2628 *negp = 0;
2629 lval = (unsigned long)val;
2631 *lvalp = jiffies_to_clock_t(lval);
2633 return 0;
2636 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2637 int *valp,
2638 int write, void *data)
2640 if (write) {
2641 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2642 } else {
2643 int val = *valp;
2644 unsigned long lval;
2645 if (val < 0) {
2646 *negp = -1;
2647 lval = (unsigned long)-val;
2648 } else {
2649 *negp = 0;
2650 lval = (unsigned long)val;
2652 *lvalp = jiffies_to_msecs(lval);
2654 return 0;
2658 * proc_dointvec_jiffies - read a vector of integers as seconds
2659 * @table: the sysctl table
2660 * @write: %TRUE if this is a write to the sysctl file
2661 * @filp: the file structure
2662 * @buffer: the user buffer
2663 * @lenp: the size of the user buffer
2664 * @ppos: file position
2666 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2667 * values from/to the user buffer, treated as an ASCII string.
2668 * The values read are assumed to be in seconds, and are converted into
2669 * jiffies.
2671 * Returns 0 on success.
2673 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2674 void __user *buffer, size_t *lenp, loff_t *ppos)
2676 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2677 do_proc_dointvec_jiffies_conv,NULL);
2681 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2682 * @table: the sysctl table
2683 * @write: %TRUE if this is a write to the sysctl file
2684 * @filp: the file structure
2685 * @buffer: the user buffer
2686 * @lenp: the size of the user buffer
2687 * @ppos: pointer to the file position
2689 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2690 * values from/to the user buffer, treated as an ASCII string.
2691 * The values read are assumed to be in 1/USER_HZ seconds, and
2692 * are converted into jiffies.
2694 * Returns 0 on success.
2696 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2697 void __user *buffer, size_t *lenp, loff_t *ppos)
2699 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2700 do_proc_dointvec_userhz_jiffies_conv,NULL);
2704 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2705 * @table: the sysctl table
2706 * @write: %TRUE if this is a write to the sysctl file
2707 * @filp: the file structure
2708 * @buffer: the user buffer
2709 * @lenp: the size of the user buffer
2710 * @ppos: file position
2711 * @ppos: the current position in the file
2713 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2714 * values from/to the user buffer, treated as an ASCII string.
2715 * The values read are assumed to be in 1/1000 seconds, and
2716 * are converted into jiffies.
2718 * Returns 0 on success.
2720 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2721 void __user *buffer, size_t *lenp, loff_t *ppos)
2723 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2724 do_proc_dointvec_ms_jiffies_conv, NULL);
2727 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2728 void __user *buffer, size_t *lenp, loff_t *ppos)
2730 struct pid *new_pid;
2731 pid_t tmp;
2732 int r;
2734 tmp = pid_vnr(cad_pid);
2736 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2737 lenp, ppos, NULL, NULL);
2738 if (r || !write)
2739 return r;
2741 new_pid = find_get_pid(tmp);
2742 if (!new_pid)
2743 return -ESRCH;
2745 put_pid(xchg(&cad_pid, new_pid));
2746 return 0;
2749 #else /* CONFIG_PROC_FS */
2751 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2752 void __user *buffer, size_t *lenp, loff_t *ppos)
2754 return -ENOSYS;
2757 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2758 void __user *buffer, size_t *lenp, loff_t *ppos)
2760 return -ENOSYS;
2763 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2764 void __user *buffer, size_t *lenp, loff_t *ppos)
2766 return -ENOSYS;
2769 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2770 void __user *buffer, size_t *lenp, loff_t *ppos)
2772 return -ENOSYS;
2775 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2776 void __user *buffer, size_t *lenp, loff_t *ppos)
2778 return -ENOSYS;
2781 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2782 void __user *buffer, size_t *lenp, loff_t *ppos)
2784 return -ENOSYS;
2787 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2788 void __user *buffer, size_t *lenp, loff_t *ppos)
2790 return -ENOSYS;
2793 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2794 struct file *filp,
2795 void __user *buffer,
2796 size_t *lenp, loff_t *ppos)
2798 return -ENOSYS;
2802 #endif /* CONFIG_PROC_FS */
2805 #ifdef CONFIG_SYSCTL_SYSCALL
2807 * General sysctl support routines
2810 /* The generic sysctl data routine (used if no strategy routine supplied) */
2811 int sysctl_data(struct ctl_table *table,
2812 void __user *oldval, size_t __user *oldlenp,
2813 void __user *newval, size_t newlen)
2815 size_t len;
2817 /* Get out of I don't have a variable */
2818 if (!table->data || !table->maxlen)
2819 return -ENOTDIR;
2821 if (oldval && oldlenp) {
2822 if (get_user(len, oldlenp))
2823 return -EFAULT;
2824 if (len) {
2825 if (len > table->maxlen)
2826 len = table->maxlen;
2827 if (copy_to_user(oldval, table->data, len))
2828 return -EFAULT;
2829 if (put_user(len, oldlenp))
2830 return -EFAULT;
2834 if (newval && newlen) {
2835 if (newlen > table->maxlen)
2836 newlen = table->maxlen;
2838 if (copy_from_user(table->data, newval, newlen))
2839 return -EFAULT;
2841 return 1;
2844 /* The generic string strategy routine: */
2845 int sysctl_string(struct ctl_table *table,
2846 void __user *oldval, size_t __user *oldlenp,
2847 void __user *newval, size_t newlen)
2849 if (!table->data || !table->maxlen)
2850 return -ENOTDIR;
2852 if (oldval && oldlenp) {
2853 size_t bufsize;
2854 if (get_user(bufsize, oldlenp))
2855 return -EFAULT;
2856 if (bufsize) {
2857 size_t len = strlen(table->data), copied;
2859 /* This shouldn't trigger for a well-formed sysctl */
2860 if (len > table->maxlen)
2861 len = table->maxlen;
2863 /* Copy up to a max of bufsize-1 bytes of the string */
2864 copied = (len >= bufsize) ? bufsize - 1 : len;
2866 if (copy_to_user(oldval, table->data, copied) ||
2867 put_user(0, (char __user *)(oldval + copied)))
2868 return -EFAULT;
2869 if (put_user(len, oldlenp))
2870 return -EFAULT;
2873 if (newval && newlen) {
2874 size_t len = newlen;
2875 if (len > table->maxlen)
2876 len = table->maxlen;
2877 if(copy_from_user(table->data, newval, len))
2878 return -EFAULT;
2879 if (len == table->maxlen)
2880 len--;
2881 ((char *) table->data)[len] = 0;
2883 return 1;
2887 * This function makes sure that all of the integers in the vector
2888 * are between the minimum and maximum values given in the arrays
2889 * table->extra1 and table->extra2, respectively.
2891 int sysctl_intvec(struct ctl_table *table,
2892 void __user *oldval, size_t __user *oldlenp,
2893 void __user *newval, size_t newlen)
2896 if (newval && newlen) {
2897 int __user *vec = (int __user *) newval;
2898 int *min = (int *) table->extra1;
2899 int *max = (int *) table->extra2;
2900 size_t length;
2901 int i;
2903 if (newlen % sizeof(int) != 0)
2904 return -EINVAL;
2906 if (!table->extra1 && !table->extra2)
2907 return 0;
2909 if (newlen > table->maxlen)
2910 newlen = table->maxlen;
2911 length = newlen / sizeof(int);
2913 for (i = 0; i < length; i++) {
2914 int value;
2915 if (get_user(value, vec + i))
2916 return -EFAULT;
2917 if (min && value < min[i])
2918 return -EINVAL;
2919 if (max && value > max[i])
2920 return -EINVAL;
2923 return 0;
2926 /* Strategy function to convert jiffies to seconds */
2927 int sysctl_jiffies(struct ctl_table *table,
2928 void __user *oldval, size_t __user *oldlenp,
2929 void __user *newval, size_t newlen)
2931 if (oldval && oldlenp) {
2932 size_t olen;
2934 if (get_user(olen, oldlenp))
2935 return -EFAULT;
2936 if (olen) {
2937 int val;
2939 if (olen < sizeof(int))
2940 return -EINVAL;
2942 val = *(int *)(table->data) / HZ;
2943 if (put_user(val, (int __user *)oldval))
2944 return -EFAULT;
2945 if (put_user(sizeof(int), oldlenp))
2946 return -EFAULT;
2949 if (newval && newlen) {
2950 int new;
2951 if (newlen != sizeof(int))
2952 return -EINVAL;
2953 if (get_user(new, (int __user *)newval))
2954 return -EFAULT;
2955 *(int *)(table->data) = new*HZ;
2957 return 1;
2960 /* Strategy function to convert jiffies to seconds */
2961 int sysctl_ms_jiffies(struct ctl_table *table,
2962 void __user *oldval, size_t __user *oldlenp,
2963 void __user *newval, size_t newlen)
2965 if (oldval && oldlenp) {
2966 size_t olen;
2968 if (get_user(olen, oldlenp))
2969 return -EFAULT;
2970 if (olen) {
2971 int val;
2973 if (olen < sizeof(int))
2974 return -EINVAL;
2976 val = jiffies_to_msecs(*(int *)(table->data));
2977 if (put_user(val, (int __user *)oldval))
2978 return -EFAULT;
2979 if (put_user(sizeof(int), oldlenp))
2980 return -EFAULT;
2983 if (newval && newlen) {
2984 int new;
2985 if (newlen != sizeof(int))
2986 return -EINVAL;
2987 if (get_user(new, (int __user *)newval))
2988 return -EFAULT;
2989 *(int *)(table->data) = msecs_to_jiffies(new);
2991 return 1;
2996 #else /* CONFIG_SYSCTL_SYSCALL */
2999 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
3001 struct __sysctl_args tmp;
3002 int error;
3004 if (copy_from_user(&tmp, args, sizeof(tmp)))
3005 return -EFAULT;
3007 error = deprecated_sysctl_warning(&tmp);
3009 /* If no error reading the parameters then just -ENOSYS ... */
3010 if (!error)
3011 error = -ENOSYS;
3013 return error;
3016 int sysctl_data(struct ctl_table *table,
3017 void __user *oldval, size_t __user *oldlenp,
3018 void __user *newval, size_t newlen)
3020 return -ENOSYS;
3023 int sysctl_string(struct ctl_table *table,
3024 void __user *oldval, size_t __user *oldlenp,
3025 void __user *newval, size_t newlen)
3027 return -ENOSYS;
3030 int sysctl_intvec(struct ctl_table *table,
3031 void __user *oldval, size_t __user *oldlenp,
3032 void __user *newval, size_t newlen)
3034 return -ENOSYS;
3037 int sysctl_jiffies(struct ctl_table *table,
3038 void __user *oldval, size_t __user *oldlenp,
3039 void __user *newval, size_t newlen)
3041 return -ENOSYS;
3044 int sysctl_ms_jiffies(struct ctl_table *table,
3045 void __user *oldval, size_t __user *oldlenp,
3046 void __user *newval, size_t newlen)
3048 return -ENOSYS;
3051 #endif /* CONFIG_SYSCTL_SYSCALL */
3053 static int deprecated_sysctl_warning(struct __sysctl_args *args)
3055 static int msg_count;
3056 int name[CTL_MAXNAME];
3057 int i;
3059 /* Check args->nlen. */
3060 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
3061 return -ENOTDIR;
3063 /* Read in the sysctl name for better debug message logging */
3064 for (i = 0; i < args->nlen; i++)
3065 if (get_user(name[i], args->name + i))
3066 return -EFAULT;
3068 /* Ignore accesses to kernel.version */
3069 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
3070 return 0;
3072 if (msg_count < 5) {
3073 msg_count++;
3074 printk(KERN_INFO
3075 "warning: process `%s' used the deprecated sysctl "
3076 "system call with ", current->comm);
3077 for (i = 0; i < args->nlen; i++)
3078 printk("%d.", name[i]);
3079 printk("\n");
3081 return 0;
3085 * No sense putting this after each symbol definition, twice,
3086 * exception granted :-)
3088 EXPORT_SYMBOL(proc_dointvec);
3089 EXPORT_SYMBOL(proc_dointvec_jiffies);
3090 EXPORT_SYMBOL(proc_dointvec_minmax);
3091 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3092 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3093 EXPORT_SYMBOL(proc_dostring);
3094 EXPORT_SYMBOL(proc_doulongvec_minmax);
3095 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3096 EXPORT_SYMBOL(register_sysctl_table);
3097 EXPORT_SYMBOL(register_sysctl_paths);
3098 EXPORT_SYMBOL(sysctl_intvec);
3099 EXPORT_SYMBOL(sysctl_jiffies);
3100 EXPORT_SYMBOL(sysctl_ms_jiffies);
3101 EXPORT_SYMBOL(sysctl_string);
3102 EXPORT_SYMBOL(sysctl_data);
3103 EXPORT_SYMBOL(unregister_sysctl_table);