ext4: add EXT4_IOC_ALLOC_DA_BLKS ioctl
[linux-2.6/linux-loongson.git] / kernel / sysctl.c
bloba64a0ec33c21ef4ae66ac9b546bb08a7ad2ac006
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 #if defined(CONFIG_MMU) && defined(CONFIG_FILE_LOCKING)
99 static int two = 2;
100 #endif
102 static int zero;
103 static int one = 1;
104 static unsigned long one_ul = 1;
105 static int one_hundred = 100;
107 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
108 static int maxolduid = 65535;
109 static int minolduid;
110 static int min_percpu_pagelist_fract = 8;
112 static int ngroups_max = NGROUPS_MAX;
114 #ifdef CONFIG_MODULES
115 extern char modprobe_path[];
116 #endif
117 #ifdef CONFIG_FB_CON_DECOR
118 extern char fbcon_decor_path[];
119 #endif
120 #ifdef CONFIG_CHR_DEV_SG
121 extern int sg_big_buff;
122 #endif
124 #ifdef CONFIG_SPARC
125 #include <asm/system.h>
126 #endif
128 #ifdef CONFIG_SPARC64
129 extern int sysctl_tsb_ratio;
130 #endif
132 #ifdef __hppa__
133 extern int pwrsw_enabled;
134 extern int unaligned_enabled;
135 #endif
137 #ifdef CONFIG_S390
138 #ifdef CONFIG_MATHEMU
139 extern int sysctl_ieee_emulation_warnings;
140 #endif
141 extern int sysctl_userprocess_debug;
142 extern int spin_retry;
143 #endif
145 #ifdef CONFIG_BSD_PROCESS_ACCT
146 extern int acct_parm[];
147 #endif
149 #ifdef CONFIG_IA64
150 extern int no_unaligned_warning;
151 extern int unaligned_dump_stack;
152 #endif
154 #ifdef CONFIG_RT_MUTEXES
155 extern int max_lock_depth;
156 #endif
158 #ifdef CONFIG_PROC_SYSCTL
159 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
160 void __user *buffer, size_t *lenp, loff_t *ppos);
161 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
162 void __user *buffer, size_t *lenp, loff_t *ppos);
163 #endif
165 static struct ctl_table root_table[];
166 static struct ctl_table_root sysctl_table_root;
167 static struct ctl_table_header root_table_header = {
168 .count = 1,
169 .ctl_table = root_table,
170 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
171 .root = &sysctl_table_root,
172 .set = &sysctl_table_root.default_set,
174 static struct ctl_table_root sysctl_table_root = {
175 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
176 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
179 static struct ctl_table kern_table[];
180 static struct ctl_table vm_table[];
181 static struct ctl_table fs_table[];
182 static struct ctl_table debug_table[];
183 static struct ctl_table dev_table[];
184 extern struct ctl_table random_table[];
185 #ifdef CONFIG_INOTIFY_USER
186 extern struct ctl_table inotify_table[];
187 #endif
188 #ifdef CONFIG_EPOLL
189 extern struct ctl_table epoll_table[];
190 #endif
192 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
193 int sysctl_legacy_va_layout;
194 #endif
196 extern int prove_locking;
197 extern int lock_stat;
199 /* The default sysctl tables: */
201 static struct ctl_table root_table[] = {
203 .ctl_name = CTL_KERN,
204 .procname = "kernel",
205 .mode = 0555,
206 .child = kern_table,
209 .ctl_name = CTL_VM,
210 .procname = "vm",
211 .mode = 0555,
212 .child = vm_table,
215 .ctl_name = CTL_FS,
216 .procname = "fs",
217 .mode = 0555,
218 .child = fs_table,
221 .ctl_name = CTL_DEBUG,
222 .procname = "debug",
223 .mode = 0555,
224 .child = debug_table,
227 .ctl_name = CTL_DEV,
228 .procname = "dev",
229 .mode = 0555,
230 .child = dev_table,
232 #ifdef CONFIG_FB_CON_DECOR
234 .ctl_name = CTL_UNNUMBERED,
235 .procname = "fbcondecor",
236 .data = &fbcon_decor_path,
237 .maxlen = KMOD_PATH_LEN,
238 .mode = 0644,
239 .proc_handler = &proc_dostring,
240 .strategy = &sysctl_string,
242 #endif
245 * NOTE: do not add new entries to this table unless you have read
246 * Documentation/sysctl/ctl_unnumbered.txt
248 { .ctl_name = 0 }
251 #ifdef CONFIG_SCHED_DEBUG
252 static int min_sched_granularity_ns = 100000; /* 100 usecs */
253 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
254 static int min_wakeup_granularity_ns; /* 0 usecs */
255 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
256 #endif
258 static struct ctl_table kern_table[] = {
259 #ifdef CONFIG_SCHED_DEBUG
261 .ctl_name = CTL_UNNUMBERED,
262 .procname = "sched_min_granularity_ns",
263 .data = &sysctl_sched_min_granularity,
264 .maxlen = sizeof(unsigned int),
265 .mode = 0644,
266 .proc_handler = &sched_nr_latency_handler,
267 .strategy = &sysctl_intvec,
268 .extra1 = &min_sched_granularity_ns,
269 .extra2 = &max_sched_granularity_ns,
272 .ctl_name = CTL_UNNUMBERED,
273 .procname = "sched_latency_ns",
274 .data = &sysctl_sched_latency,
275 .maxlen = sizeof(unsigned int),
276 .mode = 0644,
277 .proc_handler = &sched_nr_latency_handler,
278 .strategy = &sysctl_intvec,
279 .extra1 = &min_sched_granularity_ns,
280 .extra2 = &max_sched_granularity_ns,
283 .ctl_name = CTL_UNNUMBERED,
284 .procname = "sched_wakeup_granularity_ns",
285 .data = &sysctl_sched_wakeup_granularity,
286 .maxlen = sizeof(unsigned int),
287 .mode = 0644,
288 .proc_handler = &proc_dointvec_minmax,
289 .strategy = &sysctl_intvec,
290 .extra1 = &min_wakeup_granularity_ns,
291 .extra2 = &max_wakeup_granularity_ns,
294 .ctl_name = CTL_UNNUMBERED,
295 .procname = "sched_shares_ratelimit",
296 .data = &sysctl_sched_shares_ratelimit,
297 .maxlen = sizeof(unsigned int),
298 .mode = 0644,
299 .proc_handler = &proc_dointvec,
302 .ctl_name = CTL_UNNUMBERED,
303 .procname = "sched_shares_thresh",
304 .data = &sysctl_sched_shares_thresh,
305 .maxlen = sizeof(unsigned int),
306 .mode = 0644,
307 .proc_handler = &proc_dointvec_minmax,
308 .strategy = &sysctl_intvec,
309 .extra1 = &zero,
312 .ctl_name = CTL_UNNUMBERED,
313 .procname = "sched_child_runs_first",
314 .data = &sysctl_sched_child_runs_first,
315 .maxlen = sizeof(unsigned int),
316 .mode = 0644,
317 .proc_handler = &proc_dointvec,
320 .ctl_name = CTL_UNNUMBERED,
321 .procname = "sched_features",
322 .data = &sysctl_sched_features,
323 .maxlen = sizeof(unsigned int),
324 .mode = 0644,
325 .proc_handler = &proc_dointvec,
328 .ctl_name = CTL_UNNUMBERED,
329 .procname = "sched_migration_cost",
330 .data = &sysctl_sched_migration_cost,
331 .maxlen = sizeof(unsigned int),
332 .mode = 0644,
333 .proc_handler = &proc_dointvec,
336 .ctl_name = CTL_UNNUMBERED,
337 .procname = "sched_nr_migrate",
338 .data = &sysctl_sched_nr_migrate,
339 .maxlen = sizeof(unsigned int),
340 .mode = 0644,
341 .proc_handler = &proc_dointvec,
343 #endif
345 .ctl_name = CTL_UNNUMBERED,
346 .procname = "sched_rt_period_us",
347 .data = &sysctl_sched_rt_period,
348 .maxlen = sizeof(unsigned int),
349 .mode = 0644,
350 .proc_handler = &sched_rt_handler,
353 .ctl_name = CTL_UNNUMBERED,
354 .procname = "sched_rt_runtime_us",
355 .data = &sysctl_sched_rt_runtime,
356 .maxlen = sizeof(int),
357 .mode = 0644,
358 .proc_handler = &sched_rt_handler,
361 .ctl_name = CTL_UNNUMBERED,
362 .procname = "sched_compat_yield",
363 .data = &sysctl_sched_compat_yield,
364 .maxlen = sizeof(unsigned int),
365 .mode = 0644,
366 .proc_handler = &proc_dointvec,
368 #ifdef CONFIG_PROVE_LOCKING
370 .ctl_name = CTL_UNNUMBERED,
371 .procname = "prove_locking",
372 .data = &prove_locking,
373 .maxlen = sizeof(int),
374 .mode = 0644,
375 .proc_handler = &proc_dointvec,
377 #endif
378 #ifdef CONFIG_LOCK_STAT
380 .ctl_name = CTL_UNNUMBERED,
381 .procname = "lock_stat",
382 .data = &lock_stat,
383 .maxlen = sizeof(int),
384 .mode = 0644,
385 .proc_handler = &proc_dointvec,
387 #endif
389 .ctl_name = KERN_PANIC,
390 .procname = "panic",
391 .data = &panic_timeout,
392 .maxlen = sizeof(int),
393 .mode = 0644,
394 .proc_handler = &proc_dointvec,
397 .ctl_name = KERN_CORE_USES_PID,
398 .procname = "core_uses_pid",
399 .data = &core_uses_pid,
400 .maxlen = sizeof(int),
401 .mode = 0644,
402 .proc_handler = &proc_dointvec,
405 .ctl_name = KERN_CORE_PATTERN,
406 .procname = "core_pattern",
407 .data = core_pattern,
408 .maxlen = CORENAME_MAX_SIZE,
409 .mode = 0644,
410 .proc_handler = &proc_dostring,
411 .strategy = &sysctl_string,
413 #ifdef CONFIG_PROC_SYSCTL
415 .procname = "tainted",
416 .maxlen = sizeof(long),
417 .mode = 0644,
418 .proc_handler = &proc_taint,
420 #endif
421 #ifdef CONFIG_LATENCYTOP
423 .procname = "latencytop",
424 .data = &latencytop_enabled,
425 .maxlen = sizeof(int),
426 .mode = 0644,
427 .proc_handler = &proc_dointvec,
429 #endif
430 #ifdef CONFIG_BLK_DEV_INITRD
432 .ctl_name = KERN_REALROOTDEV,
433 .procname = "real-root-dev",
434 .data = &real_root_dev,
435 .maxlen = sizeof(int),
436 .mode = 0644,
437 .proc_handler = &proc_dointvec,
439 #endif
441 .ctl_name = CTL_UNNUMBERED,
442 .procname = "print-fatal-signals",
443 .data = &print_fatal_signals,
444 .maxlen = sizeof(int),
445 .mode = 0644,
446 .proc_handler = &proc_dointvec,
448 #ifdef CONFIG_SPARC
450 .ctl_name = KERN_SPARC_REBOOT,
451 .procname = "reboot-cmd",
452 .data = reboot_command,
453 .maxlen = 256,
454 .mode = 0644,
455 .proc_handler = &proc_dostring,
456 .strategy = &sysctl_string,
459 .ctl_name = KERN_SPARC_STOP_A,
460 .procname = "stop-a",
461 .data = &stop_a_enabled,
462 .maxlen = sizeof (int),
463 .mode = 0644,
464 .proc_handler = &proc_dointvec,
467 .ctl_name = KERN_SPARC_SCONS_PWROFF,
468 .procname = "scons-poweroff",
469 .data = &scons_pwroff,
470 .maxlen = sizeof (int),
471 .mode = 0644,
472 .proc_handler = &proc_dointvec,
474 #endif
475 #ifdef CONFIG_SPARC64
477 .ctl_name = CTL_UNNUMBERED,
478 .procname = "tsb-ratio",
479 .data = &sysctl_tsb_ratio,
480 .maxlen = sizeof (int),
481 .mode = 0644,
482 .proc_handler = &proc_dointvec,
484 #endif
485 #ifdef __hppa__
487 .ctl_name = KERN_HPPA_PWRSW,
488 .procname = "soft-power",
489 .data = &pwrsw_enabled,
490 .maxlen = sizeof (int),
491 .mode = 0644,
492 .proc_handler = &proc_dointvec,
495 .ctl_name = KERN_HPPA_UNALIGNED,
496 .procname = "unaligned-trap",
497 .data = &unaligned_enabled,
498 .maxlen = sizeof (int),
499 .mode = 0644,
500 .proc_handler = &proc_dointvec,
502 #endif
504 .ctl_name = KERN_CTLALTDEL,
505 .procname = "ctrl-alt-del",
506 .data = &C_A_D,
507 .maxlen = sizeof(int),
508 .mode = 0644,
509 .proc_handler = &proc_dointvec,
511 #ifdef CONFIG_FUNCTION_TRACER
513 .ctl_name = CTL_UNNUMBERED,
514 .procname = "ftrace_enabled",
515 .data = &ftrace_enabled,
516 .maxlen = sizeof(int),
517 .mode = 0644,
518 .proc_handler = &ftrace_enable_sysctl,
520 #endif
521 #ifdef CONFIG_STACK_TRACER
523 .ctl_name = CTL_UNNUMBERED,
524 .procname = "stack_tracer_enabled",
525 .data = &stack_tracer_enabled,
526 .maxlen = sizeof(int),
527 .mode = 0644,
528 .proc_handler = &stack_trace_sysctl,
530 #endif
531 #ifdef CONFIG_TRACING
533 .ctl_name = CTL_UNNUMBERED,
534 .procname = "ftrace_dump_on_oops",
535 .data = &ftrace_dump_on_oops,
536 .maxlen = sizeof(int),
537 .mode = 0644,
538 .proc_handler = &proc_dointvec,
540 #endif
541 #ifdef CONFIG_MODULES
543 .ctl_name = KERN_MODPROBE,
544 .procname = "modprobe",
545 .data = &modprobe_path,
546 .maxlen = KMOD_PATH_LEN,
547 .mode = 0644,
548 .proc_handler = &proc_dostring,
549 .strategy = &sysctl_string,
551 #endif
552 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
554 .ctl_name = KERN_HOTPLUG,
555 .procname = "hotplug",
556 .data = &uevent_helper,
557 .maxlen = UEVENT_HELPER_PATH_LEN,
558 .mode = 0644,
559 .proc_handler = &proc_dostring,
560 .strategy = &sysctl_string,
562 #endif
563 #ifdef CONFIG_CHR_DEV_SG
565 .ctl_name = KERN_SG_BIG_BUFF,
566 .procname = "sg-big-buff",
567 .data = &sg_big_buff,
568 .maxlen = sizeof (int),
569 .mode = 0444,
570 .proc_handler = &proc_dointvec,
572 #endif
573 #ifdef CONFIG_BSD_PROCESS_ACCT
575 .ctl_name = KERN_ACCT,
576 .procname = "acct",
577 .data = &acct_parm,
578 .maxlen = 3*sizeof(int),
579 .mode = 0644,
580 .proc_handler = &proc_dointvec,
582 #endif
583 #ifdef CONFIG_MAGIC_SYSRQ
585 .ctl_name = KERN_SYSRQ,
586 .procname = "sysrq",
587 .data = &__sysrq_enabled,
588 .maxlen = sizeof (int),
589 .mode = 0644,
590 .proc_handler = &proc_dointvec,
592 #endif
593 #ifdef CONFIG_PROC_SYSCTL
595 .procname = "cad_pid",
596 .data = NULL,
597 .maxlen = sizeof (int),
598 .mode = 0600,
599 .proc_handler = &proc_do_cad_pid,
601 #endif
603 .ctl_name = KERN_MAX_THREADS,
604 .procname = "threads-max",
605 .data = &max_threads,
606 .maxlen = sizeof(int),
607 .mode = 0644,
608 .proc_handler = &proc_dointvec,
611 .ctl_name = KERN_RANDOM,
612 .procname = "random",
613 .mode = 0555,
614 .child = random_table,
617 .ctl_name = KERN_OVERFLOWUID,
618 .procname = "overflowuid",
619 .data = &overflowuid,
620 .maxlen = sizeof(int),
621 .mode = 0644,
622 .proc_handler = &proc_dointvec_minmax,
623 .strategy = &sysctl_intvec,
624 .extra1 = &minolduid,
625 .extra2 = &maxolduid,
628 .ctl_name = KERN_OVERFLOWGID,
629 .procname = "overflowgid",
630 .data = &overflowgid,
631 .maxlen = sizeof(int),
632 .mode = 0644,
633 .proc_handler = &proc_dointvec_minmax,
634 .strategy = &sysctl_intvec,
635 .extra1 = &minolduid,
636 .extra2 = &maxolduid,
638 #ifdef CONFIG_S390
639 #ifdef CONFIG_MATHEMU
641 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
642 .procname = "ieee_emulation_warnings",
643 .data = &sysctl_ieee_emulation_warnings,
644 .maxlen = sizeof(int),
645 .mode = 0644,
646 .proc_handler = &proc_dointvec,
648 #endif
650 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
651 .procname = "userprocess_debug",
652 .data = &sysctl_userprocess_debug,
653 .maxlen = sizeof(int),
654 .mode = 0644,
655 .proc_handler = &proc_dointvec,
657 #endif
659 .ctl_name = KERN_PIDMAX,
660 .procname = "pid_max",
661 .data = &pid_max,
662 .maxlen = sizeof (int),
663 .mode = 0644,
664 .proc_handler = &proc_dointvec_minmax,
665 .strategy = sysctl_intvec,
666 .extra1 = &pid_max_min,
667 .extra2 = &pid_max_max,
670 .ctl_name = KERN_PANIC_ON_OOPS,
671 .procname = "panic_on_oops",
672 .data = &panic_on_oops,
673 .maxlen = sizeof(int),
674 .mode = 0644,
675 .proc_handler = &proc_dointvec,
677 #if defined CONFIG_PRINTK
679 .ctl_name = KERN_PRINTK,
680 .procname = "printk",
681 .data = &console_loglevel,
682 .maxlen = 4*sizeof(int),
683 .mode = 0644,
684 .proc_handler = &proc_dointvec,
687 .ctl_name = KERN_PRINTK_RATELIMIT,
688 .procname = "printk_ratelimit",
689 .data = &printk_ratelimit_state.interval,
690 .maxlen = sizeof(int),
691 .mode = 0644,
692 .proc_handler = &proc_dointvec_jiffies,
693 .strategy = &sysctl_jiffies,
696 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
697 .procname = "printk_ratelimit_burst",
698 .data = &printk_ratelimit_state.burst,
699 .maxlen = sizeof(int),
700 .mode = 0644,
701 .proc_handler = &proc_dointvec,
703 #endif
705 .ctl_name = KERN_NGROUPS_MAX,
706 .procname = "ngroups_max",
707 .data = &ngroups_max,
708 .maxlen = sizeof (int),
709 .mode = 0444,
710 .proc_handler = &proc_dointvec,
712 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
714 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
715 .procname = "unknown_nmi_panic",
716 .data = &unknown_nmi_panic,
717 .maxlen = sizeof (int),
718 .mode = 0644,
719 .proc_handler = &proc_dointvec,
722 .procname = "nmi_watchdog",
723 .data = &nmi_watchdog_enabled,
724 .maxlen = sizeof (int),
725 .mode = 0644,
726 .proc_handler = &proc_nmi_enabled,
728 #endif
729 #if defined(CONFIG_X86)
731 .ctl_name = KERN_PANIC_ON_NMI,
732 .procname = "panic_on_unrecovered_nmi",
733 .data = &panic_on_unrecovered_nmi,
734 .maxlen = sizeof(int),
735 .mode = 0644,
736 .proc_handler = &proc_dointvec,
739 .ctl_name = KERN_BOOTLOADER_TYPE,
740 .procname = "bootloader_type",
741 .data = &bootloader_type,
742 .maxlen = sizeof (int),
743 .mode = 0444,
744 .proc_handler = &proc_dointvec,
747 .ctl_name = CTL_UNNUMBERED,
748 .procname = "kstack_depth_to_print",
749 .data = &kstack_depth_to_print,
750 .maxlen = sizeof(int),
751 .mode = 0644,
752 .proc_handler = &proc_dointvec,
755 .ctl_name = CTL_UNNUMBERED,
756 .procname = "io_delay_type",
757 .data = &io_delay_type,
758 .maxlen = sizeof(int),
759 .mode = 0644,
760 .proc_handler = &proc_dointvec,
762 #endif
763 #if defined(CONFIG_MMU)
765 .ctl_name = KERN_RANDOMIZE,
766 .procname = "randomize_va_space",
767 .data = &randomize_va_space,
768 .maxlen = sizeof(int),
769 .mode = 0644,
770 .proc_handler = &proc_dointvec,
772 #endif
773 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
775 .ctl_name = KERN_SPIN_RETRY,
776 .procname = "spin_retry",
777 .data = &spin_retry,
778 .maxlen = sizeof (int),
779 .mode = 0644,
780 .proc_handler = &proc_dointvec,
782 #endif
783 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
785 .procname = "acpi_video_flags",
786 .data = &acpi_realmode_flags,
787 .maxlen = sizeof (unsigned long),
788 .mode = 0644,
789 .proc_handler = &proc_doulongvec_minmax,
791 #endif
792 #ifdef CONFIG_IA64
794 .ctl_name = KERN_IA64_UNALIGNED,
795 .procname = "ignore-unaligned-usertrap",
796 .data = &no_unaligned_warning,
797 .maxlen = sizeof (int),
798 .mode = 0644,
799 .proc_handler = &proc_dointvec,
802 .ctl_name = CTL_UNNUMBERED,
803 .procname = "unaligned-dump-stack",
804 .data = &unaligned_dump_stack,
805 .maxlen = sizeof (int),
806 .mode = 0644,
807 .proc_handler = &proc_dointvec,
809 #endif
810 #ifdef CONFIG_DETECT_SOFTLOCKUP
812 .ctl_name = CTL_UNNUMBERED,
813 .procname = "softlockup_panic",
814 .data = &softlockup_panic,
815 .maxlen = sizeof(int),
816 .mode = 0644,
817 .proc_handler = &proc_dointvec_minmax,
818 .strategy = &sysctl_intvec,
819 .extra1 = &zero,
820 .extra2 = &one,
823 .ctl_name = CTL_UNNUMBERED,
824 .procname = "softlockup_thresh",
825 .data = &softlockup_thresh,
826 .maxlen = sizeof(int),
827 .mode = 0644,
828 .proc_handler = &proc_dosoftlockup_thresh,
829 .strategy = &sysctl_intvec,
830 .extra1 = &neg_one,
831 .extra2 = &sixty,
834 .ctl_name = CTL_UNNUMBERED,
835 .procname = "hung_task_check_count",
836 .data = &sysctl_hung_task_check_count,
837 .maxlen = sizeof(unsigned long),
838 .mode = 0644,
839 .proc_handler = &proc_doulongvec_minmax,
840 .strategy = &sysctl_intvec,
843 .ctl_name = CTL_UNNUMBERED,
844 .procname = "hung_task_timeout_secs",
845 .data = &sysctl_hung_task_timeout_secs,
846 .maxlen = sizeof(unsigned long),
847 .mode = 0644,
848 .proc_handler = &proc_doulongvec_minmax,
849 .strategy = &sysctl_intvec,
852 .ctl_name = CTL_UNNUMBERED,
853 .procname = "hung_task_warnings",
854 .data = &sysctl_hung_task_warnings,
855 .maxlen = sizeof(unsigned long),
856 .mode = 0644,
857 .proc_handler = &proc_doulongvec_minmax,
858 .strategy = &sysctl_intvec,
860 #endif
861 #ifdef CONFIG_COMPAT
863 .ctl_name = KERN_COMPAT_LOG,
864 .procname = "compat-log",
865 .data = &compat_log,
866 .maxlen = sizeof (int),
867 .mode = 0644,
868 .proc_handler = &proc_dointvec,
870 #endif
871 #ifdef CONFIG_RT_MUTEXES
873 .ctl_name = KERN_MAX_LOCK_DEPTH,
874 .procname = "max_lock_depth",
875 .data = &max_lock_depth,
876 .maxlen = sizeof(int),
877 .mode = 0644,
878 .proc_handler = &proc_dointvec,
880 #endif
882 .ctl_name = CTL_UNNUMBERED,
883 .procname = "poweroff_cmd",
884 .data = &poweroff_cmd,
885 .maxlen = POWEROFF_CMD_PATH_LEN,
886 .mode = 0644,
887 .proc_handler = &proc_dostring,
888 .strategy = &sysctl_string,
890 #ifdef CONFIG_KEYS
892 .ctl_name = CTL_UNNUMBERED,
893 .procname = "keys",
894 .mode = 0555,
895 .child = key_sysctls,
897 #endif
898 #ifdef CONFIG_RCU_TORTURE_TEST
900 .ctl_name = CTL_UNNUMBERED,
901 .procname = "rcutorture_runnable",
902 .data = &rcutorture_runnable,
903 .maxlen = sizeof(int),
904 .mode = 0644,
905 .proc_handler = &proc_dointvec,
907 #endif
908 #ifdef CONFIG_UNEVICTABLE_LRU
910 .ctl_name = CTL_UNNUMBERED,
911 .procname = "scan_unevictable_pages",
912 .data = &scan_unevictable_pages,
913 .maxlen = sizeof(scan_unevictable_pages),
914 .mode = 0644,
915 .proc_handler = &scan_unevictable_handler,
917 #endif
919 * NOTE: do not add new entries to this table unless you have read
920 * Documentation/sysctl/ctl_unnumbered.txt
922 { .ctl_name = 0 }
925 static struct ctl_table vm_table[] = {
927 .ctl_name = VM_OVERCOMMIT_MEMORY,
928 .procname = "overcommit_memory",
929 .data = &sysctl_overcommit_memory,
930 .maxlen = sizeof(sysctl_overcommit_memory),
931 .mode = 0644,
932 .proc_handler = &proc_dointvec,
935 .ctl_name = VM_PANIC_ON_OOM,
936 .procname = "panic_on_oom",
937 .data = &sysctl_panic_on_oom,
938 .maxlen = sizeof(sysctl_panic_on_oom),
939 .mode = 0644,
940 .proc_handler = &proc_dointvec,
943 .ctl_name = CTL_UNNUMBERED,
944 .procname = "oom_kill_allocating_task",
945 .data = &sysctl_oom_kill_allocating_task,
946 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
947 .mode = 0644,
948 .proc_handler = &proc_dointvec,
951 .ctl_name = CTL_UNNUMBERED,
952 .procname = "oom_dump_tasks",
953 .data = &sysctl_oom_dump_tasks,
954 .maxlen = sizeof(sysctl_oom_dump_tasks),
955 .mode = 0644,
956 .proc_handler = &proc_dointvec,
959 .ctl_name = VM_OVERCOMMIT_RATIO,
960 .procname = "overcommit_ratio",
961 .data = &sysctl_overcommit_ratio,
962 .maxlen = sizeof(sysctl_overcommit_ratio),
963 .mode = 0644,
964 .proc_handler = &proc_dointvec,
967 .ctl_name = VM_PAGE_CLUSTER,
968 .procname = "page-cluster",
969 .data = &page_cluster,
970 .maxlen = sizeof(int),
971 .mode = 0644,
972 .proc_handler = &proc_dointvec,
975 .ctl_name = VM_DIRTY_BACKGROUND,
976 .procname = "dirty_background_ratio",
977 .data = &dirty_background_ratio,
978 .maxlen = sizeof(dirty_background_ratio),
979 .mode = 0644,
980 .proc_handler = &dirty_background_ratio_handler,
981 .strategy = &sysctl_intvec,
982 .extra1 = &zero,
983 .extra2 = &one_hundred,
986 .ctl_name = CTL_UNNUMBERED,
987 .procname = "dirty_background_bytes",
988 .data = &dirty_background_bytes,
989 .maxlen = sizeof(dirty_background_bytes),
990 .mode = 0644,
991 .proc_handler = &dirty_background_bytes_handler,
992 .strategy = &sysctl_intvec,
993 .extra1 = &one_ul,
996 .ctl_name = VM_DIRTY_RATIO,
997 .procname = "dirty_ratio",
998 .data = &vm_dirty_ratio,
999 .maxlen = sizeof(vm_dirty_ratio),
1000 .mode = 0644,
1001 .proc_handler = &dirty_ratio_handler,
1002 .strategy = &sysctl_intvec,
1003 .extra1 = &zero,
1004 .extra2 = &one_hundred,
1007 .ctl_name = CTL_UNNUMBERED,
1008 .procname = "dirty_bytes",
1009 .data = &vm_dirty_bytes,
1010 .maxlen = sizeof(vm_dirty_bytes),
1011 .mode = 0644,
1012 .proc_handler = &dirty_bytes_handler,
1013 .strategy = &sysctl_intvec,
1014 .extra1 = &one_ul,
1017 .procname = "dirty_writeback_centisecs",
1018 .data = &dirty_writeback_interval,
1019 .maxlen = sizeof(dirty_writeback_interval),
1020 .mode = 0644,
1021 .proc_handler = &dirty_writeback_centisecs_handler,
1024 .procname = "dirty_expire_centisecs",
1025 .data = &dirty_expire_interval,
1026 .maxlen = sizeof(dirty_expire_interval),
1027 .mode = 0644,
1028 .proc_handler = &proc_dointvec_userhz_jiffies,
1031 .ctl_name = VM_NR_PDFLUSH_THREADS,
1032 .procname = "nr_pdflush_threads",
1033 .data = &nr_pdflush_threads,
1034 .maxlen = sizeof nr_pdflush_threads,
1035 .mode = 0444 /* read-only*/,
1036 .proc_handler = &proc_dointvec,
1039 .ctl_name = VM_SWAPPINESS,
1040 .procname = "swappiness",
1041 .data = &vm_swappiness,
1042 .maxlen = sizeof(vm_swappiness),
1043 .mode = 0644,
1044 .proc_handler = &proc_dointvec_minmax,
1045 .strategy = &sysctl_intvec,
1046 .extra1 = &zero,
1047 .extra2 = &one_hundred,
1049 #ifdef CONFIG_HUGETLB_PAGE
1051 .procname = "nr_hugepages",
1052 .data = NULL,
1053 .maxlen = sizeof(unsigned long),
1054 .mode = 0644,
1055 .proc_handler = &hugetlb_sysctl_handler,
1056 .extra1 = (void *)&hugetlb_zero,
1057 .extra2 = (void *)&hugetlb_infinity,
1060 .ctl_name = VM_HUGETLB_GROUP,
1061 .procname = "hugetlb_shm_group",
1062 .data = &sysctl_hugetlb_shm_group,
1063 .maxlen = sizeof(gid_t),
1064 .mode = 0644,
1065 .proc_handler = &proc_dointvec,
1068 .ctl_name = CTL_UNNUMBERED,
1069 .procname = "hugepages_treat_as_movable",
1070 .data = &hugepages_treat_as_movable,
1071 .maxlen = sizeof(int),
1072 .mode = 0644,
1073 .proc_handler = &hugetlb_treat_movable_handler,
1076 .ctl_name = CTL_UNNUMBERED,
1077 .procname = "nr_overcommit_hugepages",
1078 .data = NULL,
1079 .maxlen = sizeof(unsigned long),
1080 .mode = 0644,
1081 .proc_handler = &hugetlb_overcommit_handler,
1082 .extra1 = (void *)&hugetlb_zero,
1083 .extra2 = (void *)&hugetlb_infinity,
1085 #endif
1087 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
1088 .procname = "lowmem_reserve_ratio",
1089 .data = &sysctl_lowmem_reserve_ratio,
1090 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1091 .mode = 0644,
1092 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
1093 .strategy = &sysctl_intvec,
1096 .ctl_name = VM_DROP_PAGECACHE,
1097 .procname = "drop_caches",
1098 .data = &sysctl_drop_caches,
1099 .maxlen = sizeof(int),
1100 .mode = 0644,
1101 .proc_handler = drop_caches_sysctl_handler,
1102 .strategy = &sysctl_intvec,
1105 .ctl_name = VM_MIN_FREE_KBYTES,
1106 .procname = "min_free_kbytes",
1107 .data = &min_free_kbytes,
1108 .maxlen = sizeof(min_free_kbytes),
1109 .mode = 0644,
1110 .proc_handler = &min_free_kbytes_sysctl_handler,
1111 .strategy = &sysctl_intvec,
1112 .extra1 = &zero,
1115 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1116 .procname = "percpu_pagelist_fraction",
1117 .data = &percpu_pagelist_fraction,
1118 .maxlen = sizeof(percpu_pagelist_fraction),
1119 .mode = 0644,
1120 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
1121 .strategy = &sysctl_intvec,
1122 .extra1 = &min_percpu_pagelist_fract,
1124 #ifdef CONFIG_MMU
1126 .ctl_name = VM_MAX_MAP_COUNT,
1127 .procname = "max_map_count",
1128 .data = &sysctl_max_map_count,
1129 .maxlen = sizeof(sysctl_max_map_count),
1130 .mode = 0644,
1131 .proc_handler = &proc_dointvec
1133 #else
1135 .ctl_name = CTL_UNNUMBERED,
1136 .procname = "nr_trim_pages",
1137 .data = &sysctl_nr_trim_pages,
1138 .maxlen = sizeof(sysctl_nr_trim_pages),
1139 .mode = 0644,
1140 .proc_handler = &proc_dointvec_minmax,
1141 .strategy = &sysctl_intvec,
1142 .extra1 = &zero,
1144 #endif
1146 .ctl_name = VM_LAPTOP_MODE,
1147 .procname = "laptop_mode",
1148 .data = &laptop_mode,
1149 .maxlen = sizeof(laptop_mode),
1150 .mode = 0644,
1151 .proc_handler = &proc_dointvec_jiffies,
1152 .strategy = &sysctl_jiffies,
1155 .ctl_name = VM_BLOCK_DUMP,
1156 .procname = "block_dump",
1157 .data = &block_dump,
1158 .maxlen = sizeof(block_dump),
1159 .mode = 0644,
1160 .proc_handler = &proc_dointvec,
1161 .strategy = &sysctl_intvec,
1162 .extra1 = &zero,
1165 .ctl_name = VM_VFS_CACHE_PRESSURE,
1166 .procname = "vfs_cache_pressure",
1167 .data = &sysctl_vfs_cache_pressure,
1168 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1169 .mode = 0644,
1170 .proc_handler = &proc_dointvec,
1171 .strategy = &sysctl_intvec,
1172 .extra1 = &zero,
1174 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1176 .ctl_name = VM_LEGACY_VA_LAYOUT,
1177 .procname = "legacy_va_layout",
1178 .data = &sysctl_legacy_va_layout,
1179 .maxlen = sizeof(sysctl_legacy_va_layout),
1180 .mode = 0644,
1181 .proc_handler = &proc_dointvec,
1182 .strategy = &sysctl_intvec,
1183 .extra1 = &zero,
1185 #endif
1186 #ifdef CONFIG_NUMA
1188 .ctl_name = VM_ZONE_RECLAIM_MODE,
1189 .procname = "zone_reclaim_mode",
1190 .data = &zone_reclaim_mode,
1191 .maxlen = sizeof(zone_reclaim_mode),
1192 .mode = 0644,
1193 .proc_handler = &proc_dointvec,
1194 .strategy = &sysctl_intvec,
1195 .extra1 = &zero,
1198 .ctl_name = VM_MIN_UNMAPPED,
1199 .procname = "min_unmapped_ratio",
1200 .data = &sysctl_min_unmapped_ratio,
1201 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1202 .mode = 0644,
1203 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
1204 .strategy = &sysctl_intvec,
1205 .extra1 = &zero,
1206 .extra2 = &one_hundred,
1209 .ctl_name = VM_MIN_SLAB,
1210 .procname = "min_slab_ratio",
1211 .data = &sysctl_min_slab_ratio,
1212 .maxlen = sizeof(sysctl_min_slab_ratio),
1213 .mode = 0644,
1214 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
1215 .strategy = &sysctl_intvec,
1216 .extra1 = &zero,
1217 .extra2 = &one_hundred,
1219 #endif
1220 #ifdef CONFIG_SMP
1222 .ctl_name = CTL_UNNUMBERED,
1223 .procname = "stat_interval",
1224 .data = &sysctl_stat_interval,
1225 .maxlen = sizeof(sysctl_stat_interval),
1226 .mode = 0644,
1227 .proc_handler = &proc_dointvec_jiffies,
1228 .strategy = &sysctl_jiffies,
1230 #endif
1231 #ifdef CONFIG_SECURITY
1233 .ctl_name = CTL_UNNUMBERED,
1234 .procname = "mmap_min_addr",
1235 .data = &mmap_min_addr,
1236 .maxlen = sizeof(unsigned long),
1237 .mode = 0644,
1238 .proc_handler = &proc_doulongvec_minmax,
1240 #endif
1241 #ifdef CONFIG_NUMA
1243 .ctl_name = CTL_UNNUMBERED,
1244 .procname = "numa_zonelist_order",
1245 .data = &numa_zonelist_order,
1246 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1247 .mode = 0644,
1248 .proc_handler = &numa_zonelist_order_handler,
1249 .strategy = &sysctl_string,
1251 #endif
1252 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1253 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1255 .ctl_name = VM_VDSO_ENABLED,
1256 .procname = "vdso_enabled",
1257 .data = &vdso_enabled,
1258 .maxlen = sizeof(vdso_enabled),
1259 .mode = 0644,
1260 .proc_handler = &proc_dointvec,
1261 .strategy = &sysctl_intvec,
1262 .extra1 = &zero,
1264 #endif
1265 #ifdef CONFIG_HIGHMEM
1267 .ctl_name = CTL_UNNUMBERED,
1268 .procname = "highmem_is_dirtyable",
1269 .data = &vm_highmem_is_dirtyable,
1270 .maxlen = sizeof(vm_highmem_is_dirtyable),
1271 .mode = 0644,
1272 .proc_handler = &proc_dointvec_minmax,
1273 .strategy = &sysctl_intvec,
1274 .extra1 = &zero,
1275 .extra2 = &one,
1277 #endif
1279 * NOTE: do not add new entries to this table unless you have read
1280 * Documentation/sysctl/ctl_unnumbered.txt
1282 { .ctl_name = 0 }
1285 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1286 static struct ctl_table binfmt_misc_table[] = {
1287 { .ctl_name = 0 }
1289 #endif
1291 static struct ctl_table fs_table[] = {
1293 .ctl_name = FS_NRINODE,
1294 .procname = "inode-nr",
1295 .data = &inodes_stat,
1296 .maxlen = 2*sizeof(int),
1297 .mode = 0444,
1298 .proc_handler = &proc_dointvec,
1301 .ctl_name = FS_STATINODE,
1302 .procname = "inode-state",
1303 .data = &inodes_stat,
1304 .maxlen = 7*sizeof(int),
1305 .mode = 0444,
1306 .proc_handler = &proc_dointvec,
1309 .procname = "file-nr",
1310 .data = &files_stat,
1311 .maxlen = 3*sizeof(int),
1312 .mode = 0444,
1313 .proc_handler = &proc_nr_files,
1316 .ctl_name = FS_MAXFILE,
1317 .procname = "file-max",
1318 .data = &files_stat.max_files,
1319 .maxlen = sizeof(int),
1320 .mode = 0644,
1321 .proc_handler = &proc_dointvec,
1324 .ctl_name = CTL_UNNUMBERED,
1325 .procname = "nr_open",
1326 .data = &sysctl_nr_open,
1327 .maxlen = sizeof(int),
1328 .mode = 0644,
1329 .proc_handler = &proc_dointvec_minmax,
1330 .extra1 = &sysctl_nr_open_min,
1331 .extra2 = &sysctl_nr_open_max,
1334 .ctl_name = FS_DENTRY,
1335 .procname = "dentry-state",
1336 .data = &dentry_stat,
1337 .maxlen = 6*sizeof(int),
1338 .mode = 0444,
1339 .proc_handler = &proc_dointvec,
1342 .ctl_name = FS_OVERFLOWUID,
1343 .procname = "overflowuid",
1344 .data = &fs_overflowuid,
1345 .maxlen = sizeof(int),
1346 .mode = 0644,
1347 .proc_handler = &proc_dointvec_minmax,
1348 .strategy = &sysctl_intvec,
1349 .extra1 = &minolduid,
1350 .extra2 = &maxolduid,
1353 .ctl_name = FS_OVERFLOWGID,
1354 .procname = "overflowgid",
1355 .data = &fs_overflowgid,
1356 .maxlen = sizeof(int),
1357 .mode = 0644,
1358 .proc_handler = &proc_dointvec_minmax,
1359 .strategy = &sysctl_intvec,
1360 .extra1 = &minolduid,
1361 .extra2 = &maxolduid,
1363 #ifdef CONFIG_FILE_LOCKING
1365 .ctl_name = FS_LEASES,
1366 .procname = "leases-enable",
1367 .data = &leases_enable,
1368 .maxlen = sizeof(int),
1369 .mode = 0644,
1370 .proc_handler = &proc_dointvec,
1372 #endif
1373 #ifdef CONFIG_DNOTIFY
1375 .ctl_name = FS_DIR_NOTIFY,
1376 .procname = "dir-notify-enable",
1377 .data = &dir_notify_enable,
1378 .maxlen = sizeof(int),
1379 .mode = 0644,
1380 .proc_handler = &proc_dointvec,
1382 #endif
1383 #ifdef CONFIG_MMU
1384 #ifdef CONFIG_FILE_LOCKING
1386 .ctl_name = FS_LEASE_TIME,
1387 .procname = "lease-break-time",
1388 .data = &lease_break_time,
1389 .maxlen = sizeof(int),
1390 .mode = 0644,
1391 .proc_handler = &proc_dointvec_minmax,
1392 .strategy = &sysctl_intvec,
1393 .extra1 = &zero,
1394 .extra2 = &two,
1396 #endif
1397 #ifdef CONFIG_AIO
1399 .procname = "aio-nr",
1400 .data = &aio_nr,
1401 .maxlen = sizeof(aio_nr),
1402 .mode = 0444,
1403 .proc_handler = &proc_doulongvec_minmax,
1406 .procname = "aio-max-nr",
1407 .data = &aio_max_nr,
1408 .maxlen = sizeof(aio_max_nr),
1409 .mode = 0644,
1410 .proc_handler = &proc_doulongvec_minmax,
1412 #endif /* CONFIG_AIO */
1413 #ifdef CONFIG_INOTIFY_USER
1415 .ctl_name = FS_INOTIFY,
1416 .procname = "inotify",
1417 .mode = 0555,
1418 .child = inotify_table,
1420 #endif
1421 #ifdef CONFIG_EPOLL
1423 .procname = "epoll",
1424 .mode = 0555,
1425 .child = epoll_table,
1427 #endif
1428 #endif
1430 .ctl_name = KERN_SETUID_DUMPABLE,
1431 .procname = "suid_dumpable",
1432 .data = &suid_dumpable,
1433 .maxlen = sizeof(int),
1434 .mode = 0644,
1435 .proc_handler = &proc_dointvec,
1437 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1439 .ctl_name = CTL_UNNUMBERED,
1440 .procname = "binfmt_misc",
1441 .mode = 0555,
1442 .child = binfmt_misc_table,
1444 #endif
1446 * NOTE: do not add new entries to this table unless you have read
1447 * Documentation/sysctl/ctl_unnumbered.txt
1449 { .ctl_name = 0 }
1452 static struct ctl_table debug_table[] = {
1453 #if defined(CONFIG_X86) || defined(CONFIG_PPC)
1455 .ctl_name = CTL_UNNUMBERED,
1456 .procname = "exception-trace",
1457 .data = &show_unhandled_signals,
1458 .maxlen = sizeof(int),
1459 .mode = 0644,
1460 .proc_handler = proc_dointvec
1462 #endif
1463 { .ctl_name = 0 }
1466 static struct ctl_table dev_table[] = {
1467 { .ctl_name = 0 }
1470 static DEFINE_SPINLOCK(sysctl_lock);
1472 /* called under sysctl_lock */
1473 static int use_table(struct ctl_table_header *p)
1475 if (unlikely(p->unregistering))
1476 return 0;
1477 p->used++;
1478 return 1;
1481 /* called under sysctl_lock */
1482 static void unuse_table(struct ctl_table_header *p)
1484 if (!--p->used)
1485 if (unlikely(p->unregistering))
1486 complete(p->unregistering);
1489 /* called under sysctl_lock, will reacquire if has to wait */
1490 static void start_unregistering(struct ctl_table_header *p)
1493 * if p->used is 0, nobody will ever touch that entry again;
1494 * we'll eliminate all paths to it before dropping sysctl_lock
1496 if (unlikely(p->used)) {
1497 struct completion wait;
1498 init_completion(&wait);
1499 p->unregistering = &wait;
1500 spin_unlock(&sysctl_lock);
1501 wait_for_completion(&wait);
1502 spin_lock(&sysctl_lock);
1503 } else {
1504 /* anything non-NULL; we'll never dereference it */
1505 p->unregistering = ERR_PTR(-EINVAL);
1508 * do not remove from the list until nobody holds it; walking the
1509 * list in do_sysctl() relies on that.
1511 list_del_init(&p->ctl_entry);
1514 void sysctl_head_get(struct ctl_table_header *head)
1516 spin_lock(&sysctl_lock);
1517 head->count++;
1518 spin_unlock(&sysctl_lock);
1521 void sysctl_head_put(struct ctl_table_header *head)
1523 spin_lock(&sysctl_lock);
1524 if (!--head->count)
1525 kfree(head);
1526 spin_unlock(&sysctl_lock);
1529 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1531 if (!head)
1532 BUG();
1533 spin_lock(&sysctl_lock);
1534 if (!use_table(head))
1535 head = ERR_PTR(-ENOENT);
1536 spin_unlock(&sysctl_lock);
1537 return head;
1540 void sysctl_head_finish(struct ctl_table_header *head)
1542 if (!head)
1543 return;
1544 spin_lock(&sysctl_lock);
1545 unuse_table(head);
1546 spin_unlock(&sysctl_lock);
1549 static struct ctl_table_set *
1550 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1552 struct ctl_table_set *set = &root->default_set;
1553 if (root->lookup)
1554 set = root->lookup(root, namespaces);
1555 return set;
1558 static struct list_head *
1559 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1561 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1562 return &set->list;
1565 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1566 struct ctl_table_header *prev)
1568 struct ctl_table_root *root;
1569 struct list_head *header_list;
1570 struct ctl_table_header *head;
1571 struct list_head *tmp;
1573 spin_lock(&sysctl_lock);
1574 if (prev) {
1575 head = prev;
1576 tmp = &prev->ctl_entry;
1577 unuse_table(prev);
1578 goto next;
1580 tmp = &root_table_header.ctl_entry;
1581 for (;;) {
1582 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1584 if (!use_table(head))
1585 goto next;
1586 spin_unlock(&sysctl_lock);
1587 return head;
1588 next:
1589 root = head->root;
1590 tmp = tmp->next;
1591 header_list = lookup_header_list(root, namespaces);
1592 if (tmp != header_list)
1593 continue;
1595 do {
1596 root = list_entry(root->root_list.next,
1597 struct ctl_table_root, root_list);
1598 if (root == &sysctl_table_root)
1599 goto out;
1600 header_list = lookup_header_list(root, namespaces);
1601 } while (list_empty(header_list));
1602 tmp = header_list->next;
1604 out:
1605 spin_unlock(&sysctl_lock);
1606 return NULL;
1609 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1611 return __sysctl_head_next(current->nsproxy, prev);
1614 void register_sysctl_root(struct ctl_table_root *root)
1616 spin_lock(&sysctl_lock);
1617 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1618 spin_unlock(&sysctl_lock);
1621 #ifdef CONFIG_SYSCTL_SYSCALL
1622 /* Perform the actual read/write of a sysctl table entry. */
1623 static int do_sysctl_strategy(struct ctl_table_root *root,
1624 struct ctl_table *table,
1625 void __user *oldval, size_t __user *oldlenp,
1626 void __user *newval, size_t newlen)
1628 int op = 0, rc;
1630 if (oldval)
1631 op |= MAY_READ;
1632 if (newval)
1633 op |= MAY_WRITE;
1634 if (sysctl_perm(root, table, op))
1635 return -EPERM;
1637 if (table->strategy) {
1638 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1639 if (rc < 0)
1640 return rc;
1641 if (rc > 0)
1642 return 0;
1645 /* If there is no strategy routine, or if the strategy returns
1646 * zero, proceed with automatic r/w */
1647 if (table->data && table->maxlen) {
1648 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1649 if (rc < 0)
1650 return rc;
1652 return 0;
1655 static int parse_table(int __user *name, int nlen,
1656 void __user *oldval, size_t __user *oldlenp,
1657 void __user *newval, size_t newlen,
1658 struct ctl_table_root *root,
1659 struct ctl_table *table)
1661 int n;
1662 repeat:
1663 if (!nlen)
1664 return -ENOTDIR;
1665 if (get_user(n, name))
1666 return -EFAULT;
1667 for ( ; table->ctl_name || table->procname; table++) {
1668 if (!table->ctl_name)
1669 continue;
1670 if (n == table->ctl_name) {
1671 int error;
1672 if (table->child) {
1673 if (sysctl_perm(root, table, MAY_EXEC))
1674 return -EPERM;
1675 name++;
1676 nlen--;
1677 table = table->child;
1678 goto repeat;
1680 error = do_sysctl_strategy(root, table,
1681 oldval, oldlenp,
1682 newval, newlen);
1683 return error;
1686 return -ENOTDIR;
1689 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1690 void __user *newval, size_t newlen)
1692 struct ctl_table_header *head;
1693 int error = -ENOTDIR;
1695 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1696 return -ENOTDIR;
1697 if (oldval) {
1698 int old_len;
1699 if (!oldlenp || get_user(old_len, oldlenp))
1700 return -EFAULT;
1703 for (head = sysctl_head_next(NULL); head;
1704 head = sysctl_head_next(head)) {
1705 error = parse_table(name, nlen, oldval, oldlenp,
1706 newval, newlen,
1707 head->root, head->ctl_table);
1708 if (error != -ENOTDIR) {
1709 sysctl_head_finish(head);
1710 break;
1713 return error;
1716 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1718 struct __sysctl_args tmp;
1719 int error;
1721 if (copy_from_user(&tmp, args, sizeof(tmp)))
1722 return -EFAULT;
1724 error = deprecated_sysctl_warning(&tmp);
1725 if (error)
1726 goto out;
1728 lock_kernel();
1729 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1730 tmp.newval, tmp.newlen);
1731 unlock_kernel();
1732 out:
1733 return error;
1735 #endif /* CONFIG_SYSCTL_SYSCALL */
1738 * sysctl_perm does NOT grant the superuser all rights automatically, because
1739 * some sysctl variables are readonly even to root.
1742 static int test_perm(int mode, int op)
1744 if (!current_euid())
1745 mode >>= 6;
1746 else if (in_egroup_p(0))
1747 mode >>= 3;
1748 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1749 return 0;
1750 return -EACCES;
1753 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1755 int error;
1756 int mode;
1758 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1759 if (error)
1760 return error;
1762 if (root->permissions)
1763 mode = root->permissions(root, current->nsproxy, table);
1764 else
1765 mode = table->mode;
1767 return test_perm(mode, op);
1770 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1772 for (; table->ctl_name || table->procname; table++) {
1773 table->parent = parent;
1774 if (table->child)
1775 sysctl_set_parent(table, table->child);
1779 static __init int sysctl_init(void)
1781 sysctl_set_parent(NULL, root_table);
1782 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1784 int err;
1785 err = sysctl_check_table(current->nsproxy, root_table);
1787 #endif
1788 return 0;
1791 core_initcall(sysctl_init);
1793 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1794 struct ctl_table *table)
1796 struct ctl_table *p;
1797 const char *s = branch->procname;
1799 /* branch should have named subdirectory as its first element */
1800 if (!s || !branch->child)
1801 return NULL;
1803 /* ... and nothing else */
1804 if (branch[1].procname || branch[1].ctl_name)
1805 return NULL;
1807 /* table should contain subdirectory with the same name */
1808 for (p = table; p->procname || p->ctl_name; p++) {
1809 if (!p->child)
1810 continue;
1811 if (p->procname && strcmp(p->procname, s) == 0)
1812 return p;
1814 return NULL;
1817 /* see if attaching q to p would be an improvement */
1818 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1820 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1821 struct ctl_table *next;
1822 int is_better = 0;
1823 int not_in_parent = !p->attached_by;
1825 while ((next = is_branch_in(by, to)) != NULL) {
1826 if (by == q->attached_by)
1827 is_better = 1;
1828 if (to == p->attached_by)
1829 not_in_parent = 1;
1830 by = by->child;
1831 to = next->child;
1834 if (is_better && not_in_parent) {
1835 q->attached_by = by;
1836 q->attached_to = to;
1837 q->parent = p;
1842 * __register_sysctl_paths - register a sysctl hierarchy
1843 * @root: List of sysctl headers to register on
1844 * @namespaces: Data to compute which lists of sysctl entries are visible
1845 * @path: The path to the directory the sysctl table is in.
1846 * @table: the top-level table structure
1848 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1849 * array. A completely 0 filled entry terminates the table.
1851 * The members of the &struct ctl_table structure are used as follows:
1853 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1854 * must be unique within that level of sysctl
1856 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1857 * enter a sysctl file
1859 * data - a pointer to data for use by proc_handler
1861 * maxlen - the maximum size in bytes of the data
1863 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1865 * child - a pointer to the child sysctl table if this entry is a directory, or
1866 * %NULL.
1868 * proc_handler - the text handler routine (described below)
1870 * strategy - the strategy routine (described below)
1872 * de - for internal use by the sysctl routines
1874 * extra1, extra2 - extra pointers usable by the proc handler routines
1876 * Leaf nodes in the sysctl tree will be represented by a single file
1877 * under /proc; non-leaf nodes will be represented by directories.
1879 * sysctl(2) can automatically manage read and write requests through
1880 * the sysctl table. The data and maxlen fields of the ctl_table
1881 * struct enable minimal validation of the values being written to be
1882 * performed, and the mode field allows minimal authentication.
1884 * More sophisticated management can be enabled by the provision of a
1885 * strategy routine with the table entry. This will be called before
1886 * any automatic read or write of the data is performed.
1888 * The strategy routine may return
1890 * < 0 - Error occurred (error is passed to user process)
1892 * 0 - OK - proceed with automatic read or write.
1894 * > 0 - OK - read or write has been done by the strategy routine, so
1895 * return immediately.
1897 * There must be a proc_handler routine for any terminal nodes
1898 * mirrored under /proc/sys (non-terminals are handled by a built-in
1899 * directory handler). Several default handlers are available to
1900 * cover common cases -
1902 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1903 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1904 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1906 * It is the handler's job to read the input buffer from user memory
1907 * and process it. The handler should return 0 on success.
1909 * This routine returns %NULL on a failure to register, and a pointer
1910 * to the table header on success.
1912 struct ctl_table_header *__register_sysctl_paths(
1913 struct ctl_table_root *root,
1914 struct nsproxy *namespaces,
1915 const struct ctl_path *path, struct ctl_table *table)
1917 struct ctl_table_header *header;
1918 struct ctl_table *new, **prevp;
1919 unsigned int n, npath;
1920 struct ctl_table_set *set;
1922 /* Count the path components */
1923 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
1927 * For each path component, allocate a 2-element ctl_table array.
1928 * The first array element will be filled with the sysctl entry
1929 * for this, the second will be the sentinel (ctl_name == 0).
1931 * We allocate everything in one go so that we don't have to
1932 * worry about freeing additional memory in unregister_sysctl_table.
1934 header = kzalloc(sizeof(struct ctl_table_header) +
1935 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1936 if (!header)
1937 return NULL;
1939 new = (struct ctl_table *) (header + 1);
1941 /* Now connect the dots */
1942 prevp = &header->ctl_table;
1943 for (n = 0; n < npath; ++n, ++path) {
1944 /* Copy the procname */
1945 new->procname = path->procname;
1946 new->ctl_name = path->ctl_name;
1947 new->mode = 0555;
1949 *prevp = new;
1950 prevp = &new->child;
1952 new += 2;
1954 *prevp = table;
1955 header->ctl_table_arg = table;
1957 INIT_LIST_HEAD(&header->ctl_entry);
1958 header->used = 0;
1959 header->unregistering = NULL;
1960 header->root = root;
1961 sysctl_set_parent(NULL, header->ctl_table);
1962 header->count = 1;
1963 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1964 if (sysctl_check_table(namespaces, header->ctl_table)) {
1965 kfree(header);
1966 return NULL;
1968 #endif
1969 spin_lock(&sysctl_lock);
1970 header->set = lookup_header_set(root, namespaces);
1971 header->attached_by = header->ctl_table;
1972 header->attached_to = root_table;
1973 header->parent = &root_table_header;
1974 for (set = header->set; set; set = set->parent) {
1975 struct ctl_table_header *p;
1976 list_for_each_entry(p, &set->list, ctl_entry) {
1977 if (p->unregistering)
1978 continue;
1979 try_attach(p, header);
1982 header->parent->count++;
1983 list_add_tail(&header->ctl_entry, &header->set->list);
1984 spin_unlock(&sysctl_lock);
1986 return header;
1990 * register_sysctl_table_path - register a sysctl table hierarchy
1991 * @path: The path to the directory the sysctl table is in.
1992 * @table: the top-level table structure
1994 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1995 * array. A completely 0 filled entry terminates the table.
1997 * See __register_sysctl_paths for more details.
1999 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2000 struct ctl_table *table)
2002 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
2003 path, table);
2007 * register_sysctl_table - register a sysctl table hierarchy
2008 * @table: the top-level table structure
2010 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
2011 * array. A completely 0 filled entry terminates the table.
2013 * See register_sysctl_paths for more details.
2015 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
2017 static const struct ctl_path null_path[] = { {} };
2019 return register_sysctl_paths(null_path, table);
2023 * unregister_sysctl_table - unregister a sysctl table hierarchy
2024 * @header: the header returned from register_sysctl_table
2026 * Unregisters the sysctl table and all children. proc entries may not
2027 * actually be removed until they are no longer used by anyone.
2029 void unregister_sysctl_table(struct ctl_table_header * header)
2031 might_sleep();
2033 if (header == NULL)
2034 return;
2036 spin_lock(&sysctl_lock);
2037 start_unregistering(header);
2038 if (!--header->parent->count) {
2039 WARN_ON(1);
2040 kfree(header->parent);
2042 if (!--header->count)
2043 kfree(header);
2044 spin_unlock(&sysctl_lock);
2047 int sysctl_is_seen(struct ctl_table_header *p)
2049 struct ctl_table_set *set = p->set;
2050 int res;
2051 spin_lock(&sysctl_lock);
2052 if (p->unregistering)
2053 res = 0;
2054 else if (!set->is_seen)
2055 res = 1;
2056 else
2057 res = set->is_seen(set);
2058 spin_unlock(&sysctl_lock);
2059 return res;
2062 void setup_sysctl_set(struct ctl_table_set *p,
2063 struct ctl_table_set *parent,
2064 int (*is_seen)(struct ctl_table_set *))
2066 INIT_LIST_HEAD(&p->list);
2067 p->parent = parent ? parent : &sysctl_table_root.default_set;
2068 p->is_seen = is_seen;
2071 #else /* !CONFIG_SYSCTL */
2072 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2074 return NULL;
2077 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2078 struct ctl_table *table)
2080 return NULL;
2083 void unregister_sysctl_table(struct ctl_table_header * table)
2087 void setup_sysctl_set(struct ctl_table_set *p,
2088 struct ctl_table_set *parent,
2089 int (*is_seen)(struct ctl_table_set *))
2093 void sysctl_head_put(struct ctl_table_header *head)
2097 #endif /* CONFIG_SYSCTL */
2100 * /proc/sys support
2103 #ifdef CONFIG_PROC_SYSCTL
2105 static int _proc_do_string(void* data, int maxlen, int write,
2106 struct file *filp, void __user *buffer,
2107 size_t *lenp, loff_t *ppos)
2109 size_t len;
2110 char __user *p;
2111 char c;
2113 if (!data || !maxlen || !*lenp) {
2114 *lenp = 0;
2115 return 0;
2118 if (write) {
2119 len = 0;
2120 p = buffer;
2121 while (len < *lenp) {
2122 if (get_user(c, p++))
2123 return -EFAULT;
2124 if (c == 0 || c == '\n')
2125 break;
2126 len++;
2128 if (len >= maxlen)
2129 len = maxlen-1;
2130 if(copy_from_user(data, buffer, len))
2131 return -EFAULT;
2132 ((char *) data)[len] = 0;
2133 *ppos += *lenp;
2134 } else {
2135 len = strlen(data);
2136 if (len > maxlen)
2137 len = maxlen;
2139 if (*ppos > len) {
2140 *lenp = 0;
2141 return 0;
2144 data += *ppos;
2145 len -= *ppos;
2147 if (len > *lenp)
2148 len = *lenp;
2149 if (len)
2150 if(copy_to_user(buffer, data, len))
2151 return -EFAULT;
2152 if (len < *lenp) {
2153 if(put_user('\n', ((char __user *) buffer) + len))
2154 return -EFAULT;
2155 len++;
2157 *lenp = len;
2158 *ppos += len;
2160 return 0;
2164 * proc_dostring - read a string sysctl
2165 * @table: the sysctl table
2166 * @write: %TRUE if this is a write to the sysctl file
2167 * @filp: the file structure
2168 * @buffer: the user buffer
2169 * @lenp: the size of the user buffer
2170 * @ppos: file position
2172 * Reads/writes a string from/to the user buffer. If the kernel
2173 * buffer provided is not large enough to hold the string, the
2174 * string is truncated. The copied string is %NULL-terminated.
2175 * If the string is being read by the user process, it is copied
2176 * and a newline '\n' is added. It is truncated if the buffer is
2177 * not large enough.
2179 * Returns 0 on success.
2181 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2182 void __user *buffer, size_t *lenp, loff_t *ppos)
2184 return _proc_do_string(table->data, table->maxlen, write, filp,
2185 buffer, lenp, ppos);
2189 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
2190 int *valp,
2191 int write, void *data)
2193 if (write) {
2194 *valp = *negp ? -*lvalp : *lvalp;
2195 } else {
2196 int val = *valp;
2197 if (val < 0) {
2198 *negp = -1;
2199 *lvalp = (unsigned long)-val;
2200 } else {
2201 *negp = 0;
2202 *lvalp = (unsigned long)val;
2205 return 0;
2208 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2209 int write, struct file *filp, void __user *buffer,
2210 size_t *lenp, loff_t *ppos,
2211 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2212 int write, void *data),
2213 void *data)
2215 #define TMPBUFLEN 21
2216 int *i, vleft, first=1, neg, val;
2217 unsigned long lval;
2218 size_t left, len;
2220 char buf[TMPBUFLEN], *p;
2221 char __user *s = buffer;
2223 if (!tbl_data || !table->maxlen || !*lenp ||
2224 (*ppos && !write)) {
2225 *lenp = 0;
2226 return 0;
2229 i = (int *) tbl_data;
2230 vleft = table->maxlen / sizeof(*i);
2231 left = *lenp;
2233 if (!conv)
2234 conv = do_proc_dointvec_conv;
2236 for (; left && vleft--; i++, first=0) {
2237 if (write) {
2238 while (left) {
2239 char c;
2240 if (get_user(c, s))
2241 return -EFAULT;
2242 if (!isspace(c))
2243 break;
2244 left--;
2245 s++;
2247 if (!left)
2248 break;
2249 neg = 0;
2250 len = left;
2251 if (len > sizeof(buf) - 1)
2252 len = sizeof(buf) - 1;
2253 if (copy_from_user(buf, s, len))
2254 return -EFAULT;
2255 buf[len] = 0;
2256 p = buf;
2257 if (*p == '-' && left > 1) {
2258 neg = 1;
2259 p++;
2261 if (*p < '0' || *p > '9')
2262 break;
2264 lval = simple_strtoul(p, &p, 0);
2266 len = p-buf;
2267 if ((len < left) && *p && !isspace(*p))
2268 break;
2269 if (neg)
2270 val = -val;
2271 s += len;
2272 left -= len;
2274 if (conv(&neg, &lval, i, 1, data))
2275 break;
2276 } else {
2277 p = buf;
2278 if (!first)
2279 *p++ = '\t';
2281 if (conv(&neg, &lval, i, 0, data))
2282 break;
2284 sprintf(p, "%s%lu", neg ? "-" : "", lval);
2285 len = strlen(buf);
2286 if (len > left)
2287 len = left;
2288 if(copy_to_user(s, buf, len))
2289 return -EFAULT;
2290 left -= len;
2291 s += len;
2295 if (!write && !first && left) {
2296 if(put_user('\n', s))
2297 return -EFAULT;
2298 left--, s++;
2300 if (write) {
2301 while (left) {
2302 char c;
2303 if (get_user(c, s++))
2304 return -EFAULT;
2305 if (!isspace(c))
2306 break;
2307 left--;
2310 if (write && first)
2311 return -EINVAL;
2312 *lenp -= left;
2313 *ppos += *lenp;
2314 return 0;
2315 #undef TMPBUFLEN
2318 static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2319 void __user *buffer, size_t *lenp, loff_t *ppos,
2320 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2321 int write, void *data),
2322 void *data)
2324 return __do_proc_dointvec(table->data, table, write, filp,
2325 buffer, lenp, ppos, conv, data);
2329 * proc_dointvec - read a vector of integers
2330 * @table: the sysctl table
2331 * @write: %TRUE if this is a write to the sysctl file
2332 * @filp: the file structure
2333 * @buffer: the user buffer
2334 * @lenp: the size of the user buffer
2335 * @ppos: file position
2337 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2338 * values from/to the user buffer, treated as an ASCII string.
2340 * Returns 0 on success.
2342 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2343 void __user *buffer, size_t *lenp, loff_t *ppos)
2345 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2346 NULL,NULL);
2350 * Taint values can only be increased
2351 * This means we can safely use a temporary.
2353 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2354 void __user *buffer, size_t *lenp, loff_t *ppos)
2356 struct ctl_table t;
2357 unsigned long tmptaint = get_taint();
2358 int err;
2360 if (write && !capable(CAP_SYS_ADMIN))
2361 return -EPERM;
2363 t = *table;
2364 t.data = &tmptaint;
2365 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos);
2366 if (err < 0)
2367 return err;
2369 if (write) {
2371 * Poor man's atomic or. Not worth adding a primitive
2372 * to everyone's atomic.h for this
2374 int i;
2375 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2376 if ((tmptaint >> i) & 1)
2377 add_taint(i);
2381 return err;
2384 struct do_proc_dointvec_minmax_conv_param {
2385 int *min;
2386 int *max;
2389 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2390 int *valp,
2391 int write, void *data)
2393 struct do_proc_dointvec_minmax_conv_param *param = data;
2394 if (write) {
2395 int val = *negp ? -*lvalp : *lvalp;
2396 if ((param->min && *param->min > val) ||
2397 (param->max && *param->max < val))
2398 return -EINVAL;
2399 *valp = val;
2400 } else {
2401 int val = *valp;
2402 if (val < 0) {
2403 *negp = -1;
2404 *lvalp = (unsigned long)-val;
2405 } else {
2406 *negp = 0;
2407 *lvalp = (unsigned long)val;
2410 return 0;
2414 * proc_dointvec_minmax - read a vector of integers with min/max values
2415 * @table: the sysctl table
2416 * @write: %TRUE if this is a write to the sysctl file
2417 * @filp: the file structure
2418 * @buffer: the user buffer
2419 * @lenp: the size of the user buffer
2420 * @ppos: file position
2422 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2423 * values from/to the user buffer, treated as an ASCII string.
2425 * This routine will ensure the values are within the range specified by
2426 * table->extra1 (min) and table->extra2 (max).
2428 * Returns 0 on success.
2430 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2431 void __user *buffer, size_t *lenp, loff_t *ppos)
2433 struct do_proc_dointvec_minmax_conv_param param = {
2434 .min = (int *) table->extra1,
2435 .max = (int *) table->extra2,
2437 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2438 do_proc_dointvec_minmax_conv, &param);
2441 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2442 struct file *filp,
2443 void __user *buffer,
2444 size_t *lenp, loff_t *ppos,
2445 unsigned long convmul,
2446 unsigned long convdiv)
2448 #define TMPBUFLEN 21
2449 unsigned long *i, *min, *max, val;
2450 int vleft, first=1, neg;
2451 size_t len, left;
2452 char buf[TMPBUFLEN], *p;
2453 char __user *s = buffer;
2455 if (!data || !table->maxlen || !*lenp ||
2456 (*ppos && !write)) {
2457 *lenp = 0;
2458 return 0;
2461 i = (unsigned long *) data;
2462 min = (unsigned long *) table->extra1;
2463 max = (unsigned long *) table->extra2;
2464 vleft = table->maxlen / sizeof(unsigned long);
2465 left = *lenp;
2467 for (; left && vleft--; i++, min++, max++, first=0) {
2468 if (write) {
2469 while (left) {
2470 char c;
2471 if (get_user(c, s))
2472 return -EFAULT;
2473 if (!isspace(c))
2474 break;
2475 left--;
2476 s++;
2478 if (!left)
2479 break;
2480 neg = 0;
2481 len = left;
2482 if (len > TMPBUFLEN-1)
2483 len = TMPBUFLEN-1;
2484 if (copy_from_user(buf, s, len))
2485 return -EFAULT;
2486 buf[len] = 0;
2487 p = buf;
2488 if (*p == '-' && left > 1) {
2489 neg = 1;
2490 p++;
2492 if (*p < '0' || *p > '9')
2493 break;
2494 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
2495 len = p-buf;
2496 if ((len < left) && *p && !isspace(*p))
2497 break;
2498 if (neg)
2499 val = -val;
2500 s += len;
2501 left -= len;
2503 if(neg)
2504 continue;
2505 if ((min && val < *min) || (max && val > *max))
2506 continue;
2507 *i = val;
2508 } else {
2509 p = buf;
2510 if (!first)
2511 *p++ = '\t';
2512 sprintf(p, "%lu", convdiv * (*i) / convmul);
2513 len = strlen(buf);
2514 if (len > left)
2515 len = left;
2516 if(copy_to_user(s, buf, len))
2517 return -EFAULT;
2518 left -= len;
2519 s += len;
2523 if (!write && !first && left) {
2524 if(put_user('\n', s))
2525 return -EFAULT;
2526 left--, s++;
2528 if (write) {
2529 while (left) {
2530 char c;
2531 if (get_user(c, s++))
2532 return -EFAULT;
2533 if (!isspace(c))
2534 break;
2535 left--;
2538 if (write && first)
2539 return -EINVAL;
2540 *lenp -= left;
2541 *ppos += *lenp;
2542 return 0;
2543 #undef TMPBUFLEN
2546 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2547 struct file *filp,
2548 void __user *buffer,
2549 size_t *lenp, loff_t *ppos,
2550 unsigned long convmul,
2551 unsigned long convdiv)
2553 return __do_proc_doulongvec_minmax(table->data, table, write,
2554 filp, buffer, lenp, ppos, convmul, convdiv);
2558 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2559 * @table: the sysctl table
2560 * @write: %TRUE if this is a write to the sysctl file
2561 * @filp: the file structure
2562 * @buffer: the user buffer
2563 * @lenp: the size of the user buffer
2564 * @ppos: file position
2566 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2567 * values from/to the user buffer, treated as an ASCII string.
2569 * This routine will ensure the values are within the range specified by
2570 * table->extra1 (min) and table->extra2 (max).
2572 * Returns 0 on success.
2574 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2575 void __user *buffer, size_t *lenp, loff_t *ppos)
2577 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
2581 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2582 * @table: the sysctl table
2583 * @write: %TRUE if this is a write to the sysctl file
2584 * @filp: the file structure
2585 * @buffer: the user buffer
2586 * @lenp: the size of the user buffer
2587 * @ppos: file position
2589 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2590 * values from/to the user buffer, treated as an ASCII string. The values
2591 * are treated as milliseconds, and converted to jiffies when they are stored.
2593 * This routine will ensure the values are within the range specified by
2594 * table->extra1 (min) and table->extra2 (max).
2596 * Returns 0 on success.
2598 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2599 struct file *filp,
2600 void __user *buffer,
2601 size_t *lenp, loff_t *ppos)
2603 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2604 lenp, ppos, HZ, 1000l);
2608 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2609 int *valp,
2610 int write, void *data)
2612 if (write) {
2613 if (*lvalp > LONG_MAX / HZ)
2614 return 1;
2615 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2616 } else {
2617 int val = *valp;
2618 unsigned long lval;
2619 if (val < 0) {
2620 *negp = -1;
2621 lval = (unsigned long)-val;
2622 } else {
2623 *negp = 0;
2624 lval = (unsigned long)val;
2626 *lvalp = lval / HZ;
2628 return 0;
2631 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2632 int *valp,
2633 int write, void *data)
2635 if (write) {
2636 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2637 return 1;
2638 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2639 } else {
2640 int val = *valp;
2641 unsigned long lval;
2642 if (val < 0) {
2643 *negp = -1;
2644 lval = (unsigned long)-val;
2645 } else {
2646 *negp = 0;
2647 lval = (unsigned long)val;
2649 *lvalp = jiffies_to_clock_t(lval);
2651 return 0;
2654 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2655 int *valp,
2656 int write, void *data)
2658 if (write) {
2659 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2660 } else {
2661 int val = *valp;
2662 unsigned long lval;
2663 if (val < 0) {
2664 *negp = -1;
2665 lval = (unsigned long)-val;
2666 } else {
2667 *negp = 0;
2668 lval = (unsigned long)val;
2670 *lvalp = jiffies_to_msecs(lval);
2672 return 0;
2676 * proc_dointvec_jiffies - read a vector of integers as seconds
2677 * @table: the sysctl table
2678 * @write: %TRUE if this is a write to the sysctl file
2679 * @filp: the file structure
2680 * @buffer: the user buffer
2681 * @lenp: the size of the user buffer
2682 * @ppos: file position
2684 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2685 * values from/to the user buffer, treated as an ASCII string.
2686 * The values read are assumed to be in seconds, and are converted into
2687 * jiffies.
2689 * Returns 0 on success.
2691 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2692 void __user *buffer, size_t *lenp, loff_t *ppos)
2694 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2695 do_proc_dointvec_jiffies_conv,NULL);
2699 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2700 * @table: the sysctl table
2701 * @write: %TRUE if this is a write to the sysctl file
2702 * @filp: the file structure
2703 * @buffer: the user buffer
2704 * @lenp: the size of the user buffer
2705 * @ppos: pointer to the file position
2707 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2708 * values from/to the user buffer, treated as an ASCII string.
2709 * The values read are assumed to be in 1/USER_HZ seconds, and
2710 * are converted into jiffies.
2712 * Returns 0 on success.
2714 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2715 void __user *buffer, size_t *lenp, loff_t *ppos)
2717 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2718 do_proc_dointvec_userhz_jiffies_conv,NULL);
2722 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2723 * @table: the sysctl table
2724 * @write: %TRUE if this is a write to the sysctl file
2725 * @filp: the file structure
2726 * @buffer: the user buffer
2727 * @lenp: the size of the user buffer
2728 * @ppos: file position
2729 * @ppos: the current position in the file
2731 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2732 * values from/to the user buffer, treated as an ASCII string.
2733 * The values read are assumed to be in 1/1000 seconds, and
2734 * are converted into jiffies.
2736 * Returns 0 on success.
2738 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2739 void __user *buffer, size_t *lenp, loff_t *ppos)
2741 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2742 do_proc_dointvec_ms_jiffies_conv, NULL);
2745 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2746 void __user *buffer, size_t *lenp, loff_t *ppos)
2748 struct pid *new_pid;
2749 pid_t tmp;
2750 int r;
2752 tmp = pid_vnr(cad_pid);
2754 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2755 lenp, ppos, NULL, NULL);
2756 if (r || !write)
2757 return r;
2759 new_pid = find_get_pid(tmp);
2760 if (!new_pid)
2761 return -ESRCH;
2763 put_pid(xchg(&cad_pid, new_pid));
2764 return 0;
2767 #else /* CONFIG_PROC_FS */
2769 int proc_dostring(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(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_minmax(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_dointvec_jiffies(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_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2794 void __user *buffer, size_t *lenp, loff_t *ppos)
2796 return -ENOSYS;
2799 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2800 void __user *buffer, size_t *lenp, loff_t *ppos)
2802 return -ENOSYS;
2805 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2806 void __user *buffer, size_t *lenp, loff_t *ppos)
2808 return -ENOSYS;
2811 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2812 struct file *filp,
2813 void __user *buffer,
2814 size_t *lenp, loff_t *ppos)
2816 return -ENOSYS;
2820 #endif /* CONFIG_PROC_FS */
2823 #ifdef CONFIG_SYSCTL_SYSCALL
2825 * General sysctl support routines
2828 /* The generic sysctl data routine (used if no strategy routine supplied) */
2829 int sysctl_data(struct ctl_table *table,
2830 void __user *oldval, size_t __user *oldlenp,
2831 void __user *newval, size_t newlen)
2833 size_t len;
2835 /* Get out of I don't have a variable */
2836 if (!table->data || !table->maxlen)
2837 return -ENOTDIR;
2839 if (oldval && oldlenp) {
2840 if (get_user(len, oldlenp))
2841 return -EFAULT;
2842 if (len) {
2843 if (len > table->maxlen)
2844 len = table->maxlen;
2845 if (copy_to_user(oldval, table->data, len))
2846 return -EFAULT;
2847 if (put_user(len, oldlenp))
2848 return -EFAULT;
2852 if (newval && newlen) {
2853 if (newlen > table->maxlen)
2854 newlen = table->maxlen;
2856 if (copy_from_user(table->data, newval, newlen))
2857 return -EFAULT;
2859 return 1;
2862 /* The generic string strategy routine: */
2863 int sysctl_string(struct ctl_table *table,
2864 void __user *oldval, size_t __user *oldlenp,
2865 void __user *newval, size_t newlen)
2867 if (!table->data || !table->maxlen)
2868 return -ENOTDIR;
2870 if (oldval && oldlenp) {
2871 size_t bufsize;
2872 if (get_user(bufsize, oldlenp))
2873 return -EFAULT;
2874 if (bufsize) {
2875 size_t len = strlen(table->data), copied;
2877 /* This shouldn't trigger for a well-formed sysctl */
2878 if (len > table->maxlen)
2879 len = table->maxlen;
2881 /* Copy up to a max of bufsize-1 bytes of the string */
2882 copied = (len >= bufsize) ? bufsize - 1 : len;
2884 if (copy_to_user(oldval, table->data, copied) ||
2885 put_user(0, (char __user *)(oldval + copied)))
2886 return -EFAULT;
2887 if (put_user(len, oldlenp))
2888 return -EFAULT;
2891 if (newval && newlen) {
2892 size_t len = newlen;
2893 if (len > table->maxlen)
2894 len = table->maxlen;
2895 if(copy_from_user(table->data, newval, len))
2896 return -EFAULT;
2897 if (len == table->maxlen)
2898 len--;
2899 ((char *) table->data)[len] = 0;
2901 return 1;
2905 * This function makes sure that all of the integers in the vector
2906 * are between the minimum and maximum values given in the arrays
2907 * table->extra1 and table->extra2, respectively.
2909 int sysctl_intvec(struct ctl_table *table,
2910 void __user *oldval, size_t __user *oldlenp,
2911 void __user *newval, size_t newlen)
2914 if (newval && newlen) {
2915 int __user *vec = (int __user *) newval;
2916 int *min = (int *) table->extra1;
2917 int *max = (int *) table->extra2;
2918 size_t length;
2919 int i;
2921 if (newlen % sizeof(int) != 0)
2922 return -EINVAL;
2924 if (!table->extra1 && !table->extra2)
2925 return 0;
2927 if (newlen > table->maxlen)
2928 newlen = table->maxlen;
2929 length = newlen / sizeof(int);
2931 for (i = 0; i < length; i++) {
2932 int value;
2933 if (get_user(value, vec + i))
2934 return -EFAULT;
2935 if (min && value < min[i])
2936 return -EINVAL;
2937 if (max && value > max[i])
2938 return -EINVAL;
2941 return 0;
2944 /* Strategy function to convert jiffies to seconds */
2945 int sysctl_jiffies(struct ctl_table *table,
2946 void __user *oldval, size_t __user *oldlenp,
2947 void __user *newval, size_t newlen)
2949 if (oldval && oldlenp) {
2950 size_t olen;
2952 if (get_user(olen, oldlenp))
2953 return -EFAULT;
2954 if (olen) {
2955 int val;
2957 if (olen < sizeof(int))
2958 return -EINVAL;
2960 val = *(int *)(table->data) / HZ;
2961 if (put_user(val, (int __user *)oldval))
2962 return -EFAULT;
2963 if (put_user(sizeof(int), oldlenp))
2964 return -EFAULT;
2967 if (newval && newlen) {
2968 int new;
2969 if (newlen != sizeof(int))
2970 return -EINVAL;
2971 if (get_user(new, (int __user *)newval))
2972 return -EFAULT;
2973 *(int *)(table->data) = new*HZ;
2975 return 1;
2978 /* Strategy function to convert jiffies to seconds */
2979 int sysctl_ms_jiffies(struct ctl_table *table,
2980 void __user *oldval, size_t __user *oldlenp,
2981 void __user *newval, size_t newlen)
2983 if (oldval && oldlenp) {
2984 size_t olen;
2986 if (get_user(olen, oldlenp))
2987 return -EFAULT;
2988 if (olen) {
2989 int val;
2991 if (olen < sizeof(int))
2992 return -EINVAL;
2994 val = jiffies_to_msecs(*(int *)(table->data));
2995 if (put_user(val, (int __user *)oldval))
2996 return -EFAULT;
2997 if (put_user(sizeof(int), oldlenp))
2998 return -EFAULT;
3001 if (newval && newlen) {
3002 int new;
3003 if (newlen != sizeof(int))
3004 return -EINVAL;
3005 if (get_user(new, (int __user *)newval))
3006 return -EFAULT;
3007 *(int *)(table->data) = msecs_to_jiffies(new);
3009 return 1;
3014 #else /* CONFIG_SYSCTL_SYSCALL */
3017 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
3019 struct __sysctl_args tmp;
3020 int error;
3022 if (copy_from_user(&tmp, args, sizeof(tmp)))
3023 return -EFAULT;
3025 error = deprecated_sysctl_warning(&tmp);
3027 /* If no error reading the parameters then just -ENOSYS ... */
3028 if (!error)
3029 error = -ENOSYS;
3031 return error;
3034 int sysctl_data(struct ctl_table *table,
3035 void __user *oldval, size_t __user *oldlenp,
3036 void __user *newval, size_t newlen)
3038 return -ENOSYS;
3041 int sysctl_string(struct ctl_table *table,
3042 void __user *oldval, size_t __user *oldlenp,
3043 void __user *newval, size_t newlen)
3045 return -ENOSYS;
3048 int sysctl_intvec(struct ctl_table *table,
3049 void __user *oldval, size_t __user *oldlenp,
3050 void __user *newval, size_t newlen)
3052 return -ENOSYS;
3055 int sysctl_jiffies(struct ctl_table *table,
3056 void __user *oldval, size_t __user *oldlenp,
3057 void __user *newval, size_t newlen)
3059 return -ENOSYS;
3062 int sysctl_ms_jiffies(struct ctl_table *table,
3063 void __user *oldval, size_t __user *oldlenp,
3064 void __user *newval, size_t newlen)
3066 return -ENOSYS;
3069 #endif /* CONFIG_SYSCTL_SYSCALL */
3071 static int deprecated_sysctl_warning(struct __sysctl_args *args)
3073 static int msg_count;
3074 int name[CTL_MAXNAME];
3075 int i;
3077 /* Check args->nlen. */
3078 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
3079 return -ENOTDIR;
3081 /* Read in the sysctl name for better debug message logging */
3082 for (i = 0; i < args->nlen; i++)
3083 if (get_user(name[i], args->name + i))
3084 return -EFAULT;
3086 /* Ignore accesses to kernel.version */
3087 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
3088 return 0;
3090 if (msg_count < 5) {
3091 msg_count++;
3092 printk(KERN_INFO
3093 "warning: process `%s' used the deprecated sysctl "
3094 "system call with ", current->comm);
3095 for (i = 0; i < args->nlen; i++)
3096 printk("%d.", name[i]);
3097 printk("\n");
3099 return 0;
3103 * No sense putting this after each symbol definition, twice,
3104 * exception granted :-)
3106 EXPORT_SYMBOL(proc_dointvec);
3107 EXPORT_SYMBOL(proc_dointvec_jiffies);
3108 EXPORT_SYMBOL(proc_dointvec_minmax);
3109 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3110 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3111 EXPORT_SYMBOL(proc_dostring);
3112 EXPORT_SYMBOL(proc_doulongvec_minmax);
3113 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3114 EXPORT_SYMBOL(register_sysctl_table);
3115 EXPORT_SYMBOL(register_sysctl_paths);
3116 EXPORT_SYMBOL(sysctl_intvec);
3117 EXPORT_SYMBOL(sysctl_jiffies);
3118 EXPORT_SYMBOL(sysctl_ms_jiffies);
3119 EXPORT_SYMBOL(sysctl_string);
3120 EXPORT_SYMBOL(sysctl_data);
3121 EXPORT_SYMBOL(unregister_sysctl_table);