Initial commit
[cbs-scheduler.git] / kernel / sysctl.c
blobcf523e003a92c6c1a8d629d92156fee846c659b6
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/kmemcheck.h>
31 #include <linux/smp_lock.h>
32 #include <linux/fs.h>
33 #include <linux/init.h>
34 #include <linux/kernel.h>
35 #include <linux/kobject.h>
36 #include <linux/net.h>
37 #include <linux/sysrq.h>
38 #include <linux/highuid.h>
39 #include <linux/writeback.h>
40 #include <linux/hugetlb.h>
41 #include <linux/initrd.h>
42 #include <linux/key.h>
43 #include <linux/times.h>
44 #include <linux/limits.h>
45 #include <linux/dcache.h>
46 #include <linux/syscalls.h>
47 #include <linux/vmstat.h>
48 #include <linux/nfs_fs.h>
49 #include <linux/acpi.h>
50 #include <linux/reboot.h>
51 #include <linux/ftrace.h>
53 #include <asm/uaccess.h>
54 #include <asm/processor.h>
56 #ifdef CONFIG_X86
57 #include <asm/nmi.h>
58 #include <asm/stacktrace.h>
59 #include <asm/io.h>
60 #endif
62 static int deprecated_sysctl_warning(struct __sysctl_args *args);
64 #if defined(CONFIG_SYSCTL)
66 /* External variables not in a header file. */
67 extern int C_A_D;
68 extern int print_fatal_signals;
69 extern int sysctl_overcommit_memory;
70 extern int sysctl_overcommit_ratio;
71 extern int sysctl_panic_on_oom;
72 extern int sysctl_oom_kill_allocating_task;
73 extern int sysctl_oom_dump_tasks;
74 extern int max_threads;
75 extern int core_uses_pid;
76 extern int suid_dumpable;
77 extern char core_pattern[];
78 extern int pid_max;
79 extern int min_free_kbytes;
80 extern int pid_max_min, pid_max_max;
81 extern int sysctl_drop_caches;
82 extern int percpu_pagelist_fraction;
83 extern int compat_log;
84 extern int latencytop_enabled;
85 extern int sysctl_nr_open_min, sysctl_nr_open_max;
86 #ifndef CONFIG_MMU
87 extern int sysctl_nr_trim_pages;
88 #endif
89 #ifdef CONFIG_RCU_TORTURE_TEST
90 extern int rcutorture_runnable;
91 #endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
93 /* Constants used for minimum and maximum */
94 #ifdef CONFIG_DETECT_SOFTLOCKUP
95 static int sixty = 60;
96 static int neg_one = -1;
97 #endif
99 static int zero;
100 static int one = 1;
101 static int two = 2;
102 static unsigned long one_ul = 1;
103 static int one_hundred = 100;
105 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
106 static int maxolduid = 65535;
107 static int minolduid;
108 static int min_percpu_pagelist_fract = 8;
110 static int ngroups_max = NGROUPS_MAX;
112 #ifdef CONFIG_MODULES
113 extern char modprobe_path[];
114 #endif
115 #ifdef CONFIG_CHR_DEV_SG
116 extern int sg_big_buff;
117 #endif
119 #ifdef CONFIG_SPARC
120 #include <asm/system.h>
121 #endif
123 #ifdef CONFIG_SPARC64
124 extern int sysctl_tsb_ratio;
125 #endif
127 #ifdef __hppa__
128 extern int pwrsw_enabled;
129 extern int unaligned_enabled;
130 #endif
132 #ifdef CONFIG_S390
133 #ifdef CONFIG_MATHEMU
134 extern int sysctl_ieee_emulation_warnings;
135 #endif
136 extern int sysctl_userprocess_debug;
137 extern int spin_retry;
138 #endif
140 #ifdef CONFIG_BSD_PROCESS_ACCT
141 extern int acct_parm[];
142 #endif
144 #ifdef CONFIG_IA64
145 extern int no_unaligned_warning;
146 extern int unaligned_dump_stack;
147 #endif
149 #ifdef CONFIG_RT_MUTEXES
150 extern int max_lock_depth;
151 #endif
153 #ifdef CONFIG_PROC_SYSCTL
154 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
155 void __user *buffer, size_t *lenp, loff_t *ppos);
156 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
157 void __user *buffer, size_t *lenp, loff_t *ppos);
158 #endif
160 static struct ctl_table root_table[];
161 static struct ctl_table_root sysctl_table_root;
162 static struct ctl_table_header root_table_header = {
163 .count = 1,
164 .ctl_table = root_table,
165 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
166 .root = &sysctl_table_root,
167 .set = &sysctl_table_root.default_set,
169 static struct ctl_table_root sysctl_table_root = {
170 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
171 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
174 static struct ctl_table kern_table[];
175 static struct ctl_table vm_table[];
176 static struct ctl_table fs_table[];
177 static struct ctl_table debug_table[];
178 static struct ctl_table dev_table[];
179 extern struct ctl_table random_table[];
180 #ifdef CONFIG_INOTIFY_USER
181 extern struct ctl_table inotify_table[];
182 #endif
183 #ifdef CONFIG_EPOLL
184 extern struct ctl_table epoll_table[];
185 #endif
187 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
188 int sysctl_legacy_va_layout;
189 #endif
191 extern int prove_locking;
192 extern int lock_stat;
194 /* The default sysctl tables: */
196 static struct ctl_table root_table[] = {
198 .ctl_name = CTL_KERN,
199 .procname = "kernel",
200 .mode = 0555,
201 .child = kern_table,
204 .ctl_name = CTL_VM,
205 .procname = "vm",
206 .mode = 0555,
207 .child = vm_table,
210 .ctl_name = CTL_FS,
211 .procname = "fs",
212 .mode = 0555,
213 .child = fs_table,
216 .ctl_name = CTL_DEBUG,
217 .procname = "debug",
218 .mode = 0555,
219 .child = debug_table,
222 .ctl_name = CTL_DEV,
223 .procname = "dev",
224 .mode = 0555,
225 .child = dev_table,
228 * NOTE: do not add new entries to this table unless you have read
229 * Documentation/sysctl/ctl_unnumbered.txt
231 { .ctl_name = 0 }
234 #ifdef CONFIG_SCHED_DEBUG
235 static int min_sched_granularity_ns = 100000; /* 100 usecs */
236 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
237 static int min_wakeup_granularity_ns; /* 0 usecs */
238 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
239 #endif
241 static struct ctl_table kern_table[] = {
242 #ifdef CONFIG_SCHED_DEBUG
244 .ctl_name = CTL_UNNUMBERED,
245 .procname = "sched_min_granularity_ns",
246 .data = &sysctl_sched_min_granularity,
247 .maxlen = sizeof(unsigned int),
248 .mode = 0644,
249 .proc_handler = &sched_nr_latency_handler,
250 .strategy = &sysctl_intvec,
251 .extra1 = &min_sched_granularity_ns,
252 .extra2 = &max_sched_granularity_ns,
255 .ctl_name = CTL_UNNUMBERED,
256 .procname = "sched_latency_ns",
257 .data = &sysctl_sched_latency,
258 .maxlen = sizeof(unsigned int),
259 .mode = 0644,
260 .proc_handler = &sched_nr_latency_handler,
261 .strategy = &sysctl_intvec,
262 .extra1 = &min_sched_granularity_ns,
263 .extra2 = &max_sched_granularity_ns,
266 .ctl_name = CTL_UNNUMBERED,
267 .procname = "sched_wakeup_granularity_ns",
268 .data = &sysctl_sched_wakeup_granularity,
269 .maxlen = sizeof(unsigned int),
270 .mode = 0644,
271 .proc_handler = &proc_dointvec_minmax,
272 .strategy = &sysctl_intvec,
273 .extra1 = &min_wakeup_granularity_ns,
274 .extra2 = &max_wakeup_granularity_ns,
277 .ctl_name = CTL_UNNUMBERED,
278 .procname = "sched_shares_ratelimit",
279 .data = &sysctl_sched_shares_ratelimit,
280 .maxlen = sizeof(unsigned int),
281 .mode = 0644,
282 .proc_handler = &proc_dointvec,
285 .ctl_name = CTL_UNNUMBERED,
286 .procname = "sched_shares_thresh",
287 .data = &sysctl_sched_shares_thresh,
288 .maxlen = sizeof(unsigned int),
289 .mode = 0644,
290 .proc_handler = &proc_dointvec_minmax,
291 .strategy = &sysctl_intvec,
292 .extra1 = &zero,
295 .ctl_name = CTL_UNNUMBERED,
296 .procname = "sched_child_runs_first",
297 .data = &sysctl_sched_child_runs_first,
298 .maxlen = sizeof(unsigned int),
299 .mode = 0644,
300 .proc_handler = &proc_dointvec,
303 .ctl_name = CTL_UNNUMBERED,
304 .procname = "sched_features",
305 .data = &sysctl_sched_features,
306 .maxlen = sizeof(unsigned int),
307 .mode = 0644,
308 .proc_handler = &proc_dointvec,
311 .ctl_name = CTL_UNNUMBERED,
312 .procname = "sched_migration_cost",
313 .data = &sysctl_sched_migration_cost,
314 .maxlen = sizeof(unsigned int),
315 .mode = 0644,
316 .proc_handler = &proc_dointvec,
319 .ctl_name = CTL_UNNUMBERED,
320 .procname = "sched_nr_migrate",
321 .data = &sysctl_sched_nr_migrate,
322 .maxlen = sizeof(unsigned int),
323 .mode = 0644,
324 .proc_handler = &proc_dointvec,
326 #endif
328 .ctl_name = CTL_UNNUMBERED,
329 .procname = "sched_rt_period_us",
330 .data = &sysctl_sched_rt_period,
331 .maxlen = sizeof(unsigned int),
332 .mode = 0644,
333 .proc_handler = &sched_rt_handler,
336 .ctl_name = CTL_UNNUMBERED,
337 .procname = "sched_rt_runtime_us",
338 .data = &sysctl_sched_rt_runtime,
339 .maxlen = sizeof(int),
340 .mode = 0644,
341 .proc_handler = &sched_rt_handler,
344 .ctl_name = CTL_UNNUMBERED,
345 .procname = "sched_compat_yield",
346 .data = &sysctl_sched_compat_yield,
347 .maxlen = sizeof(unsigned int),
348 .mode = 0644,
349 .proc_handler = &proc_dointvec,
351 #ifdef CONFIG_PROVE_LOCKING
353 .ctl_name = CTL_UNNUMBERED,
354 .procname = "prove_locking",
355 .data = &prove_locking,
356 .maxlen = sizeof(int),
357 .mode = 0644,
358 .proc_handler = &proc_dointvec,
360 #endif
361 #ifdef CONFIG_LOCK_STAT
363 .ctl_name = CTL_UNNUMBERED,
364 .procname = "lock_stat",
365 .data = &lock_stat,
366 .maxlen = sizeof(int),
367 .mode = 0644,
368 .proc_handler = &proc_dointvec,
370 #endif
372 .ctl_name = KERN_PANIC,
373 .procname = "panic",
374 .data = &panic_timeout,
375 .maxlen = sizeof(int),
376 .mode = 0644,
377 .proc_handler = &proc_dointvec,
380 .ctl_name = KERN_CORE_USES_PID,
381 .procname = "core_uses_pid",
382 .data = &core_uses_pid,
383 .maxlen = sizeof(int),
384 .mode = 0644,
385 .proc_handler = &proc_dointvec,
388 .ctl_name = KERN_CORE_PATTERN,
389 .procname = "core_pattern",
390 .data = core_pattern,
391 .maxlen = CORENAME_MAX_SIZE,
392 .mode = 0644,
393 .proc_handler = &proc_dostring,
394 .strategy = &sysctl_string,
396 #ifdef CONFIG_PROC_SYSCTL
398 .procname = "tainted",
399 .maxlen = sizeof(long),
400 .mode = 0644,
401 .proc_handler = &proc_taint,
403 #endif
404 #ifdef CONFIG_LATENCYTOP
406 .procname = "latencytop",
407 .data = &latencytop_enabled,
408 .maxlen = sizeof(int),
409 .mode = 0644,
410 .proc_handler = &proc_dointvec,
412 #endif
413 #ifdef CONFIG_BLK_DEV_INITRD
415 .ctl_name = KERN_REALROOTDEV,
416 .procname = "real-root-dev",
417 .data = &real_root_dev,
418 .maxlen = sizeof(int),
419 .mode = 0644,
420 .proc_handler = &proc_dointvec,
422 #endif
424 .ctl_name = CTL_UNNUMBERED,
425 .procname = "print-fatal-signals",
426 .data = &print_fatal_signals,
427 .maxlen = sizeof(int),
428 .mode = 0644,
429 .proc_handler = &proc_dointvec,
431 #ifdef CONFIG_SPARC
433 .ctl_name = KERN_SPARC_REBOOT,
434 .procname = "reboot-cmd",
435 .data = reboot_command,
436 .maxlen = 256,
437 .mode = 0644,
438 .proc_handler = &proc_dostring,
439 .strategy = &sysctl_string,
442 .ctl_name = KERN_SPARC_STOP_A,
443 .procname = "stop-a",
444 .data = &stop_a_enabled,
445 .maxlen = sizeof (int),
446 .mode = 0644,
447 .proc_handler = &proc_dointvec,
450 .ctl_name = KERN_SPARC_SCONS_PWROFF,
451 .procname = "scons-poweroff",
452 .data = &scons_pwroff,
453 .maxlen = sizeof (int),
454 .mode = 0644,
455 .proc_handler = &proc_dointvec,
457 #endif
458 #ifdef CONFIG_SPARC64
460 .ctl_name = CTL_UNNUMBERED,
461 .procname = "tsb-ratio",
462 .data = &sysctl_tsb_ratio,
463 .maxlen = sizeof (int),
464 .mode = 0644,
465 .proc_handler = &proc_dointvec,
467 #endif
468 #ifdef __hppa__
470 .ctl_name = KERN_HPPA_PWRSW,
471 .procname = "soft-power",
472 .data = &pwrsw_enabled,
473 .maxlen = sizeof (int),
474 .mode = 0644,
475 .proc_handler = &proc_dointvec,
478 .ctl_name = KERN_HPPA_UNALIGNED,
479 .procname = "unaligned-trap",
480 .data = &unaligned_enabled,
481 .maxlen = sizeof (int),
482 .mode = 0644,
483 .proc_handler = &proc_dointvec,
485 #endif
487 .ctl_name = KERN_CTLALTDEL,
488 .procname = "ctrl-alt-del",
489 .data = &C_A_D,
490 .maxlen = sizeof(int),
491 .mode = 0644,
492 .proc_handler = &proc_dointvec,
494 #ifdef CONFIG_FUNCTION_TRACER
496 .ctl_name = CTL_UNNUMBERED,
497 .procname = "ftrace_enabled",
498 .data = &ftrace_enabled,
499 .maxlen = sizeof(int),
500 .mode = 0644,
501 .proc_handler = &ftrace_enable_sysctl,
503 #endif
504 #ifdef CONFIG_STACK_TRACER
506 .ctl_name = CTL_UNNUMBERED,
507 .procname = "stack_tracer_enabled",
508 .data = &stack_tracer_enabled,
509 .maxlen = sizeof(int),
510 .mode = 0644,
511 .proc_handler = &stack_trace_sysctl,
513 #endif
514 #ifdef CONFIG_TRACING
516 .ctl_name = CTL_UNNUMBERED,
517 .procname = "ftrace_dump_on_oops",
518 .data = &ftrace_dump_on_oops,
519 .maxlen = sizeof(int),
520 .mode = 0644,
521 .proc_handler = &proc_dointvec,
523 #endif
524 #ifdef CONFIG_MODULES
526 .ctl_name = KERN_MODPROBE,
527 .procname = "modprobe",
528 .data = &modprobe_path,
529 .maxlen = KMOD_PATH_LEN,
530 .mode = 0644,
531 .proc_handler = &proc_dostring,
532 .strategy = &sysctl_string,
534 #endif
535 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
537 .ctl_name = KERN_HOTPLUG,
538 .procname = "hotplug",
539 .data = &uevent_helper,
540 .maxlen = UEVENT_HELPER_PATH_LEN,
541 .mode = 0644,
542 .proc_handler = &proc_dostring,
543 .strategy = &sysctl_string,
545 #endif
546 #ifdef CONFIG_CHR_DEV_SG
548 .ctl_name = KERN_SG_BIG_BUFF,
549 .procname = "sg-big-buff",
550 .data = &sg_big_buff,
551 .maxlen = sizeof (int),
552 .mode = 0444,
553 .proc_handler = &proc_dointvec,
555 #endif
556 #ifdef CONFIG_BSD_PROCESS_ACCT
558 .ctl_name = KERN_ACCT,
559 .procname = "acct",
560 .data = &acct_parm,
561 .maxlen = 3*sizeof(int),
562 .mode = 0644,
563 .proc_handler = &proc_dointvec,
565 #endif
566 #ifdef CONFIG_MAGIC_SYSRQ
568 .ctl_name = KERN_SYSRQ,
569 .procname = "sysrq",
570 .data = &__sysrq_enabled,
571 .maxlen = sizeof (int),
572 .mode = 0644,
573 .proc_handler = &proc_dointvec,
575 #endif
576 #ifdef CONFIG_PROC_SYSCTL
578 .procname = "cad_pid",
579 .data = NULL,
580 .maxlen = sizeof (int),
581 .mode = 0600,
582 .proc_handler = &proc_do_cad_pid,
584 #endif
586 .ctl_name = KERN_MAX_THREADS,
587 .procname = "threads-max",
588 .data = &max_threads,
589 .maxlen = sizeof(int),
590 .mode = 0644,
591 .proc_handler = &proc_dointvec,
594 .ctl_name = KERN_RANDOM,
595 .procname = "random",
596 .mode = 0555,
597 .child = random_table,
600 .ctl_name = KERN_OVERFLOWUID,
601 .procname = "overflowuid",
602 .data = &overflowuid,
603 .maxlen = sizeof(int),
604 .mode = 0644,
605 .proc_handler = &proc_dointvec_minmax,
606 .strategy = &sysctl_intvec,
607 .extra1 = &minolduid,
608 .extra2 = &maxolduid,
611 .ctl_name = KERN_OVERFLOWGID,
612 .procname = "overflowgid",
613 .data = &overflowgid,
614 .maxlen = sizeof(int),
615 .mode = 0644,
616 .proc_handler = &proc_dointvec_minmax,
617 .strategy = &sysctl_intvec,
618 .extra1 = &minolduid,
619 .extra2 = &maxolduid,
621 #ifdef CONFIG_S390
622 #ifdef CONFIG_MATHEMU
624 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
625 .procname = "ieee_emulation_warnings",
626 .data = &sysctl_ieee_emulation_warnings,
627 .maxlen = sizeof(int),
628 .mode = 0644,
629 .proc_handler = &proc_dointvec,
631 #endif
633 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
634 .procname = "userprocess_debug",
635 .data = &sysctl_userprocess_debug,
636 .maxlen = sizeof(int),
637 .mode = 0644,
638 .proc_handler = &proc_dointvec,
640 #endif
642 .ctl_name = KERN_PIDMAX,
643 .procname = "pid_max",
644 .data = &pid_max,
645 .maxlen = sizeof (int),
646 .mode = 0644,
647 .proc_handler = &proc_dointvec_minmax,
648 .strategy = sysctl_intvec,
649 .extra1 = &pid_max_min,
650 .extra2 = &pid_max_max,
653 .ctl_name = KERN_PANIC_ON_OOPS,
654 .procname = "panic_on_oops",
655 .data = &panic_on_oops,
656 .maxlen = sizeof(int),
657 .mode = 0644,
658 .proc_handler = &proc_dointvec,
660 #if defined CONFIG_PRINTK
662 .ctl_name = KERN_PRINTK,
663 .procname = "printk",
664 .data = &console_loglevel,
665 .maxlen = 4*sizeof(int),
666 .mode = 0644,
667 .proc_handler = &proc_dointvec,
670 .ctl_name = KERN_PRINTK_RATELIMIT,
671 .procname = "printk_ratelimit",
672 .data = &printk_ratelimit_state.interval,
673 .maxlen = sizeof(int),
674 .mode = 0644,
675 .proc_handler = &proc_dointvec_jiffies,
676 .strategy = &sysctl_jiffies,
679 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
680 .procname = "printk_ratelimit_burst",
681 .data = &printk_ratelimit_state.burst,
682 .maxlen = sizeof(int),
683 .mode = 0644,
684 .proc_handler = &proc_dointvec,
686 #endif
688 .ctl_name = KERN_NGROUPS_MAX,
689 .procname = "ngroups_max",
690 .data = &ngroups_max,
691 .maxlen = sizeof (int),
692 .mode = 0444,
693 .proc_handler = &proc_dointvec,
695 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
697 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
698 .procname = "unknown_nmi_panic",
699 .data = &unknown_nmi_panic,
700 .maxlen = sizeof (int),
701 .mode = 0644,
702 .proc_handler = &proc_dointvec,
705 .procname = "nmi_watchdog",
706 .data = &nmi_watchdog_enabled,
707 .maxlen = sizeof (int),
708 .mode = 0644,
709 .proc_handler = &proc_nmi_enabled,
711 #endif
712 #if defined(CONFIG_X86)
714 .ctl_name = KERN_PANIC_ON_NMI,
715 .procname = "panic_on_unrecovered_nmi",
716 .data = &panic_on_unrecovered_nmi,
717 .maxlen = sizeof(int),
718 .mode = 0644,
719 .proc_handler = &proc_dointvec,
722 .ctl_name = KERN_BOOTLOADER_TYPE,
723 .procname = "bootloader_type",
724 .data = &bootloader_type,
725 .maxlen = sizeof (int),
726 .mode = 0444,
727 .proc_handler = &proc_dointvec,
730 .ctl_name = CTL_UNNUMBERED,
731 .procname = "kstack_depth_to_print",
732 .data = &kstack_depth_to_print,
733 .maxlen = sizeof(int),
734 .mode = 0644,
735 .proc_handler = &proc_dointvec,
738 .ctl_name = CTL_UNNUMBERED,
739 .procname = "io_delay_type",
740 .data = &io_delay_type,
741 .maxlen = sizeof(int),
742 .mode = 0644,
743 .proc_handler = &proc_dointvec,
745 #endif
746 #if defined(CONFIG_MMU)
748 .ctl_name = KERN_RANDOMIZE,
749 .procname = "randomize_va_space",
750 .data = &randomize_va_space,
751 .maxlen = sizeof(int),
752 .mode = 0644,
753 .proc_handler = &proc_dointvec,
755 #endif
756 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
758 .ctl_name = KERN_SPIN_RETRY,
759 .procname = "spin_retry",
760 .data = &spin_retry,
761 .maxlen = sizeof (int),
762 .mode = 0644,
763 .proc_handler = &proc_dointvec,
765 #endif
766 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
768 .procname = "acpi_video_flags",
769 .data = &acpi_realmode_flags,
770 .maxlen = sizeof (unsigned long),
771 .mode = 0644,
772 .proc_handler = &proc_doulongvec_minmax,
774 #endif
775 #ifdef CONFIG_IA64
777 .ctl_name = KERN_IA64_UNALIGNED,
778 .procname = "ignore-unaligned-usertrap",
779 .data = &no_unaligned_warning,
780 .maxlen = sizeof (int),
781 .mode = 0644,
782 .proc_handler = &proc_dointvec,
785 .ctl_name = CTL_UNNUMBERED,
786 .procname = "unaligned-dump-stack",
787 .data = &unaligned_dump_stack,
788 .maxlen = sizeof (int),
789 .mode = 0644,
790 .proc_handler = &proc_dointvec,
792 #endif
793 #ifdef CONFIG_DETECT_SOFTLOCKUP
795 .ctl_name = CTL_UNNUMBERED,
796 .procname = "softlockup_panic",
797 .data = &softlockup_panic,
798 .maxlen = sizeof(int),
799 .mode = 0644,
800 .proc_handler = &proc_dointvec_minmax,
801 .strategy = &sysctl_intvec,
802 .extra1 = &zero,
803 .extra2 = &one,
806 .ctl_name = CTL_UNNUMBERED,
807 .procname = "softlockup_thresh",
808 .data = &softlockup_thresh,
809 .maxlen = sizeof(int),
810 .mode = 0644,
811 .proc_handler = &proc_dosoftlockup_thresh,
812 .strategy = &sysctl_intvec,
813 .extra1 = &neg_one,
814 .extra2 = &sixty,
816 #endif
817 #ifdef CONFIG_DETECT_HUNG_TASK
819 .ctl_name = CTL_UNNUMBERED,
820 .procname = "hung_task_panic",
821 .data = &sysctl_hung_task_panic,
822 .maxlen = sizeof(int),
823 .mode = 0644,
824 .proc_handler = &proc_dointvec_minmax,
825 .strategy = &sysctl_intvec,
826 .extra1 = &zero,
827 .extra2 = &one,
830 .ctl_name = CTL_UNNUMBERED,
831 .procname = "hung_task_check_count",
832 .data = &sysctl_hung_task_check_count,
833 .maxlen = sizeof(unsigned long),
834 .mode = 0644,
835 .proc_handler = &proc_doulongvec_minmax,
836 .strategy = &sysctl_intvec,
839 .ctl_name = CTL_UNNUMBERED,
840 .procname = "hung_task_timeout_secs",
841 .data = &sysctl_hung_task_timeout_secs,
842 .maxlen = sizeof(unsigned long),
843 .mode = 0644,
844 .proc_handler = &proc_dohung_task_timeout_secs,
845 .strategy = &sysctl_intvec,
848 .ctl_name = CTL_UNNUMBERED,
849 .procname = "hung_task_warnings",
850 .data = &sysctl_hung_task_warnings,
851 .maxlen = sizeof(unsigned long),
852 .mode = 0644,
853 .proc_handler = &proc_doulongvec_minmax,
854 .strategy = &sysctl_intvec,
856 #endif
857 #ifdef CONFIG_COMPAT
859 .ctl_name = KERN_COMPAT_LOG,
860 .procname = "compat-log",
861 .data = &compat_log,
862 .maxlen = sizeof (int),
863 .mode = 0644,
864 .proc_handler = &proc_dointvec,
866 #endif
867 #ifdef CONFIG_RT_MUTEXES
869 .ctl_name = KERN_MAX_LOCK_DEPTH,
870 .procname = "max_lock_depth",
871 .data = &max_lock_depth,
872 .maxlen = sizeof(int),
873 .mode = 0644,
874 .proc_handler = &proc_dointvec,
876 #endif
878 .ctl_name = CTL_UNNUMBERED,
879 .procname = "poweroff_cmd",
880 .data = &poweroff_cmd,
881 .maxlen = POWEROFF_CMD_PATH_LEN,
882 .mode = 0644,
883 .proc_handler = &proc_dostring,
884 .strategy = &sysctl_string,
886 #ifdef CONFIG_KEYS
888 .ctl_name = CTL_UNNUMBERED,
889 .procname = "keys",
890 .mode = 0555,
891 .child = key_sysctls,
893 #endif
894 #ifdef CONFIG_RCU_TORTURE_TEST
896 .ctl_name = CTL_UNNUMBERED,
897 .procname = "rcutorture_runnable",
898 .data = &rcutorture_runnable,
899 .maxlen = sizeof(int),
900 .mode = 0644,
901 .proc_handler = &proc_dointvec,
903 #endif
904 #ifdef CONFIG_KMEMCHECK
906 .ctl_name = CTL_UNNUMBERED,
907 .procname = "kmemcheck",
908 .data = &kmemcheck_enabled,
909 .maxlen = sizeof(int),
910 .mode = 0644,
911 .proc_handler = &proc_dointvec,
913 #endif
914 #ifdef CONFIG_UNEVICTABLE_LRU
916 .ctl_name = CTL_UNNUMBERED,
917 .procname = "scan_unevictable_pages",
918 .data = &scan_unevictable_pages,
919 .maxlen = sizeof(scan_unevictable_pages),
920 .mode = 0644,
921 .proc_handler = &scan_unevictable_handler,
923 #endif
925 * NOTE: do not add new entries to this table unless you have read
926 * Documentation/sysctl/ctl_unnumbered.txt
928 { .ctl_name = 0 }
931 static struct ctl_table vm_table[] = {
933 .ctl_name = VM_OVERCOMMIT_MEMORY,
934 .procname = "overcommit_memory",
935 .data = &sysctl_overcommit_memory,
936 .maxlen = sizeof(sysctl_overcommit_memory),
937 .mode = 0644,
938 .proc_handler = &proc_dointvec,
941 .ctl_name = VM_PANIC_ON_OOM,
942 .procname = "panic_on_oom",
943 .data = &sysctl_panic_on_oom,
944 .maxlen = sizeof(sysctl_panic_on_oom),
945 .mode = 0644,
946 .proc_handler = &proc_dointvec,
949 .ctl_name = CTL_UNNUMBERED,
950 .procname = "oom_kill_allocating_task",
951 .data = &sysctl_oom_kill_allocating_task,
952 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
953 .mode = 0644,
954 .proc_handler = &proc_dointvec,
957 .ctl_name = CTL_UNNUMBERED,
958 .procname = "oom_dump_tasks",
959 .data = &sysctl_oom_dump_tasks,
960 .maxlen = sizeof(sysctl_oom_dump_tasks),
961 .mode = 0644,
962 .proc_handler = &proc_dointvec,
965 .ctl_name = VM_OVERCOMMIT_RATIO,
966 .procname = "overcommit_ratio",
967 .data = &sysctl_overcommit_ratio,
968 .maxlen = sizeof(sysctl_overcommit_ratio),
969 .mode = 0644,
970 .proc_handler = &proc_dointvec,
973 .ctl_name = VM_PAGE_CLUSTER,
974 .procname = "page-cluster",
975 .data = &page_cluster,
976 .maxlen = sizeof(int),
977 .mode = 0644,
978 .proc_handler = &proc_dointvec,
981 .ctl_name = VM_DIRTY_BACKGROUND,
982 .procname = "dirty_background_ratio",
983 .data = &dirty_background_ratio,
984 .maxlen = sizeof(dirty_background_ratio),
985 .mode = 0644,
986 .proc_handler = &dirty_background_ratio_handler,
987 .strategy = &sysctl_intvec,
988 .extra1 = &zero,
989 .extra2 = &one_hundred,
992 .ctl_name = CTL_UNNUMBERED,
993 .procname = "dirty_background_bytes",
994 .data = &dirty_background_bytes,
995 .maxlen = sizeof(dirty_background_bytes),
996 .mode = 0644,
997 .proc_handler = &dirty_background_bytes_handler,
998 .strategy = &sysctl_intvec,
999 .extra1 = &one_ul,
1002 .ctl_name = VM_DIRTY_RATIO,
1003 .procname = "dirty_ratio",
1004 .data = &vm_dirty_ratio,
1005 .maxlen = sizeof(vm_dirty_ratio),
1006 .mode = 0644,
1007 .proc_handler = &dirty_ratio_handler,
1008 .strategy = &sysctl_intvec,
1009 .extra1 = &zero,
1010 .extra2 = &one_hundred,
1013 .ctl_name = CTL_UNNUMBERED,
1014 .procname = "dirty_bytes",
1015 .data = &vm_dirty_bytes,
1016 .maxlen = sizeof(vm_dirty_bytes),
1017 .mode = 0644,
1018 .proc_handler = &dirty_bytes_handler,
1019 .strategy = &sysctl_intvec,
1020 .extra1 = &one_ul,
1023 .procname = "dirty_writeback_centisecs",
1024 .data = &dirty_writeback_interval,
1025 .maxlen = sizeof(dirty_writeback_interval),
1026 .mode = 0644,
1027 .proc_handler = &dirty_writeback_centisecs_handler,
1030 .procname = "dirty_expire_centisecs",
1031 .data = &dirty_expire_interval,
1032 .maxlen = sizeof(dirty_expire_interval),
1033 .mode = 0644,
1034 .proc_handler = &proc_dointvec_userhz_jiffies,
1037 .ctl_name = VM_NR_PDFLUSH_THREADS,
1038 .procname = "nr_pdflush_threads",
1039 .data = &nr_pdflush_threads,
1040 .maxlen = sizeof nr_pdflush_threads,
1041 .mode = 0444 /* read-only*/,
1042 .proc_handler = &proc_dointvec,
1045 .ctl_name = VM_SWAPPINESS,
1046 .procname = "swappiness",
1047 .data = &vm_swappiness,
1048 .maxlen = sizeof(vm_swappiness),
1049 .mode = 0644,
1050 .proc_handler = &proc_dointvec_minmax,
1051 .strategy = &sysctl_intvec,
1052 .extra1 = &zero,
1053 .extra2 = &one_hundred,
1055 #ifdef CONFIG_HUGETLB_PAGE
1057 .procname = "nr_hugepages",
1058 .data = NULL,
1059 .maxlen = sizeof(unsigned long),
1060 .mode = 0644,
1061 .proc_handler = &hugetlb_sysctl_handler,
1062 .extra1 = (void *)&hugetlb_zero,
1063 .extra2 = (void *)&hugetlb_infinity,
1066 .ctl_name = VM_HUGETLB_GROUP,
1067 .procname = "hugetlb_shm_group",
1068 .data = &sysctl_hugetlb_shm_group,
1069 .maxlen = sizeof(gid_t),
1070 .mode = 0644,
1071 .proc_handler = &proc_dointvec,
1074 .ctl_name = CTL_UNNUMBERED,
1075 .procname = "hugepages_treat_as_movable",
1076 .data = &hugepages_treat_as_movable,
1077 .maxlen = sizeof(int),
1078 .mode = 0644,
1079 .proc_handler = &hugetlb_treat_movable_handler,
1082 .ctl_name = CTL_UNNUMBERED,
1083 .procname = "nr_overcommit_hugepages",
1084 .data = NULL,
1085 .maxlen = sizeof(unsigned long),
1086 .mode = 0644,
1087 .proc_handler = &hugetlb_overcommit_handler,
1088 .extra1 = (void *)&hugetlb_zero,
1089 .extra2 = (void *)&hugetlb_infinity,
1091 #endif
1093 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
1094 .procname = "lowmem_reserve_ratio",
1095 .data = &sysctl_lowmem_reserve_ratio,
1096 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1097 .mode = 0644,
1098 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
1099 .strategy = &sysctl_intvec,
1102 .ctl_name = VM_DROP_PAGECACHE,
1103 .procname = "drop_caches",
1104 .data = &sysctl_drop_caches,
1105 .maxlen = sizeof(int),
1106 .mode = 0644,
1107 .proc_handler = drop_caches_sysctl_handler,
1108 .strategy = &sysctl_intvec,
1111 .ctl_name = VM_MIN_FREE_KBYTES,
1112 .procname = "min_free_kbytes",
1113 .data = &min_free_kbytes,
1114 .maxlen = sizeof(min_free_kbytes),
1115 .mode = 0644,
1116 .proc_handler = &min_free_kbytes_sysctl_handler,
1117 .strategy = &sysctl_intvec,
1118 .extra1 = &zero,
1121 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1122 .procname = "percpu_pagelist_fraction",
1123 .data = &percpu_pagelist_fraction,
1124 .maxlen = sizeof(percpu_pagelist_fraction),
1125 .mode = 0644,
1126 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
1127 .strategy = &sysctl_intvec,
1128 .extra1 = &min_percpu_pagelist_fract,
1130 #ifdef CONFIG_MMU
1132 .ctl_name = VM_MAX_MAP_COUNT,
1133 .procname = "max_map_count",
1134 .data = &sysctl_max_map_count,
1135 .maxlen = sizeof(sysctl_max_map_count),
1136 .mode = 0644,
1137 .proc_handler = &proc_dointvec
1139 #else
1141 .ctl_name = CTL_UNNUMBERED,
1142 .procname = "nr_trim_pages",
1143 .data = &sysctl_nr_trim_pages,
1144 .maxlen = sizeof(sysctl_nr_trim_pages),
1145 .mode = 0644,
1146 .proc_handler = &proc_dointvec_minmax,
1147 .strategy = &sysctl_intvec,
1148 .extra1 = &zero,
1150 #endif
1152 .ctl_name = VM_LAPTOP_MODE,
1153 .procname = "laptop_mode",
1154 .data = &laptop_mode,
1155 .maxlen = sizeof(laptop_mode),
1156 .mode = 0644,
1157 .proc_handler = &proc_dointvec_jiffies,
1158 .strategy = &sysctl_jiffies,
1161 .ctl_name = VM_BLOCK_DUMP,
1162 .procname = "block_dump",
1163 .data = &block_dump,
1164 .maxlen = sizeof(block_dump),
1165 .mode = 0644,
1166 .proc_handler = &proc_dointvec,
1167 .strategy = &sysctl_intvec,
1168 .extra1 = &zero,
1171 .ctl_name = VM_VFS_CACHE_PRESSURE,
1172 .procname = "vfs_cache_pressure",
1173 .data = &sysctl_vfs_cache_pressure,
1174 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1175 .mode = 0644,
1176 .proc_handler = &proc_dointvec,
1177 .strategy = &sysctl_intvec,
1178 .extra1 = &zero,
1180 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1182 .ctl_name = VM_LEGACY_VA_LAYOUT,
1183 .procname = "legacy_va_layout",
1184 .data = &sysctl_legacy_va_layout,
1185 .maxlen = sizeof(sysctl_legacy_va_layout),
1186 .mode = 0644,
1187 .proc_handler = &proc_dointvec,
1188 .strategy = &sysctl_intvec,
1189 .extra1 = &zero,
1191 #endif
1192 #ifdef CONFIG_NUMA
1194 .ctl_name = VM_ZONE_RECLAIM_MODE,
1195 .procname = "zone_reclaim_mode",
1196 .data = &zone_reclaim_mode,
1197 .maxlen = sizeof(zone_reclaim_mode),
1198 .mode = 0644,
1199 .proc_handler = &proc_dointvec,
1200 .strategy = &sysctl_intvec,
1201 .extra1 = &zero,
1204 .ctl_name = VM_MIN_UNMAPPED,
1205 .procname = "min_unmapped_ratio",
1206 .data = &sysctl_min_unmapped_ratio,
1207 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1208 .mode = 0644,
1209 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
1210 .strategy = &sysctl_intvec,
1211 .extra1 = &zero,
1212 .extra2 = &one_hundred,
1215 .ctl_name = VM_MIN_SLAB,
1216 .procname = "min_slab_ratio",
1217 .data = &sysctl_min_slab_ratio,
1218 .maxlen = sizeof(sysctl_min_slab_ratio),
1219 .mode = 0644,
1220 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
1221 .strategy = &sysctl_intvec,
1222 .extra1 = &zero,
1223 .extra2 = &one_hundred,
1225 #endif
1226 #ifdef CONFIG_SMP
1228 .ctl_name = CTL_UNNUMBERED,
1229 .procname = "stat_interval",
1230 .data = &sysctl_stat_interval,
1231 .maxlen = sizeof(sysctl_stat_interval),
1232 .mode = 0644,
1233 .proc_handler = &proc_dointvec_jiffies,
1234 .strategy = &sysctl_jiffies,
1236 #endif
1237 #ifdef CONFIG_SECURITY
1239 .ctl_name = CTL_UNNUMBERED,
1240 .procname = "mmap_min_addr",
1241 .data = &mmap_min_addr,
1242 .maxlen = sizeof(unsigned long),
1243 .mode = 0644,
1244 .proc_handler = &proc_doulongvec_minmax,
1246 #endif
1247 #ifdef CONFIG_NUMA
1249 .ctl_name = CTL_UNNUMBERED,
1250 .procname = "numa_zonelist_order",
1251 .data = &numa_zonelist_order,
1252 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1253 .mode = 0644,
1254 .proc_handler = &numa_zonelist_order_handler,
1255 .strategy = &sysctl_string,
1257 #endif
1258 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1259 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1261 .ctl_name = VM_VDSO_ENABLED,
1262 .procname = "vdso_enabled",
1263 .data = &vdso_enabled,
1264 .maxlen = sizeof(vdso_enabled),
1265 .mode = 0644,
1266 .proc_handler = &proc_dointvec,
1267 .strategy = &sysctl_intvec,
1268 .extra1 = &zero,
1270 #endif
1271 #ifdef CONFIG_HIGHMEM
1273 .ctl_name = CTL_UNNUMBERED,
1274 .procname = "highmem_is_dirtyable",
1275 .data = &vm_highmem_is_dirtyable,
1276 .maxlen = sizeof(vm_highmem_is_dirtyable),
1277 .mode = 0644,
1278 .proc_handler = &proc_dointvec_minmax,
1279 .strategy = &sysctl_intvec,
1280 .extra1 = &zero,
1281 .extra2 = &one,
1283 #endif
1285 * NOTE: do not add new entries to this table unless you have read
1286 * Documentation/sysctl/ctl_unnumbered.txt
1288 { .ctl_name = 0 }
1291 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1292 static struct ctl_table binfmt_misc_table[] = {
1293 { .ctl_name = 0 }
1295 #endif
1297 static struct ctl_table fs_table[] = {
1299 .ctl_name = FS_NRINODE,
1300 .procname = "inode-nr",
1301 .data = &inodes_stat,
1302 .maxlen = 2*sizeof(int),
1303 .mode = 0444,
1304 .proc_handler = &proc_dointvec,
1307 .ctl_name = FS_STATINODE,
1308 .procname = "inode-state",
1309 .data = &inodes_stat,
1310 .maxlen = 7*sizeof(int),
1311 .mode = 0444,
1312 .proc_handler = &proc_dointvec,
1315 .procname = "file-nr",
1316 .data = &files_stat,
1317 .maxlen = 3*sizeof(int),
1318 .mode = 0444,
1319 .proc_handler = &proc_nr_files,
1322 .ctl_name = FS_MAXFILE,
1323 .procname = "file-max",
1324 .data = &files_stat.max_files,
1325 .maxlen = sizeof(int),
1326 .mode = 0644,
1327 .proc_handler = &proc_dointvec,
1330 .ctl_name = CTL_UNNUMBERED,
1331 .procname = "nr_open",
1332 .data = &sysctl_nr_open,
1333 .maxlen = sizeof(int),
1334 .mode = 0644,
1335 .proc_handler = &proc_dointvec_minmax,
1336 .extra1 = &sysctl_nr_open_min,
1337 .extra2 = &sysctl_nr_open_max,
1340 .ctl_name = FS_DENTRY,
1341 .procname = "dentry-state",
1342 .data = &dentry_stat,
1343 .maxlen = 6*sizeof(int),
1344 .mode = 0444,
1345 .proc_handler = &proc_dointvec,
1348 .ctl_name = FS_OVERFLOWUID,
1349 .procname = "overflowuid",
1350 .data = &fs_overflowuid,
1351 .maxlen = sizeof(int),
1352 .mode = 0644,
1353 .proc_handler = &proc_dointvec_minmax,
1354 .strategy = &sysctl_intvec,
1355 .extra1 = &minolduid,
1356 .extra2 = &maxolduid,
1359 .ctl_name = FS_OVERFLOWGID,
1360 .procname = "overflowgid",
1361 .data = &fs_overflowgid,
1362 .maxlen = sizeof(int),
1363 .mode = 0644,
1364 .proc_handler = &proc_dointvec_minmax,
1365 .strategy = &sysctl_intvec,
1366 .extra1 = &minolduid,
1367 .extra2 = &maxolduid,
1369 #ifdef CONFIG_FILE_LOCKING
1371 .ctl_name = FS_LEASES,
1372 .procname = "leases-enable",
1373 .data = &leases_enable,
1374 .maxlen = sizeof(int),
1375 .mode = 0644,
1376 .proc_handler = &proc_dointvec,
1378 #endif
1379 #ifdef CONFIG_DNOTIFY
1381 .ctl_name = FS_DIR_NOTIFY,
1382 .procname = "dir-notify-enable",
1383 .data = &dir_notify_enable,
1384 .maxlen = sizeof(int),
1385 .mode = 0644,
1386 .proc_handler = &proc_dointvec,
1388 #endif
1389 #ifdef CONFIG_MMU
1390 #ifdef CONFIG_FILE_LOCKING
1392 .ctl_name = FS_LEASE_TIME,
1393 .procname = "lease-break-time",
1394 .data = &lease_break_time,
1395 .maxlen = sizeof(int),
1396 .mode = 0644,
1397 .proc_handler = &proc_dointvec,
1399 #endif
1400 #ifdef CONFIG_AIO
1402 .procname = "aio-nr",
1403 .data = &aio_nr,
1404 .maxlen = sizeof(aio_nr),
1405 .mode = 0444,
1406 .proc_handler = &proc_doulongvec_minmax,
1409 .procname = "aio-max-nr",
1410 .data = &aio_max_nr,
1411 .maxlen = sizeof(aio_max_nr),
1412 .mode = 0644,
1413 .proc_handler = &proc_doulongvec_minmax,
1415 #endif /* CONFIG_AIO */
1416 #ifdef CONFIG_INOTIFY_USER
1418 .ctl_name = FS_INOTIFY,
1419 .procname = "inotify",
1420 .mode = 0555,
1421 .child = inotify_table,
1423 #endif
1424 #ifdef CONFIG_EPOLL
1426 .procname = "epoll",
1427 .mode = 0555,
1428 .child = epoll_table,
1430 #endif
1431 #endif
1433 .ctl_name = KERN_SETUID_DUMPABLE,
1434 .procname = "suid_dumpable",
1435 .data = &suid_dumpable,
1436 .maxlen = sizeof(int),
1437 .mode = 0644,
1438 .proc_handler = &proc_dointvec_minmax,
1439 .strategy = &sysctl_intvec,
1440 .extra1 = &zero,
1441 .extra2 = &two,
1443 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1445 .ctl_name = CTL_UNNUMBERED,
1446 .procname = "binfmt_misc",
1447 .mode = 0555,
1448 .child = binfmt_misc_table,
1450 #endif
1452 * NOTE: do not add new entries to this table unless you have read
1453 * Documentation/sysctl/ctl_unnumbered.txt
1455 { .ctl_name = 0 }
1458 static struct ctl_table debug_table[] = {
1459 #if defined(CONFIG_X86) || defined(CONFIG_PPC)
1461 .ctl_name = CTL_UNNUMBERED,
1462 .procname = "exception-trace",
1463 .data = &show_unhandled_signals,
1464 .maxlen = sizeof(int),
1465 .mode = 0644,
1466 .proc_handler = proc_dointvec
1468 #endif
1469 { .ctl_name = 0 }
1472 static struct ctl_table dev_table[] = {
1473 { .ctl_name = 0 }
1476 static DEFINE_SPINLOCK(sysctl_lock);
1478 /* called under sysctl_lock */
1479 static int use_table(struct ctl_table_header *p)
1481 if (unlikely(p->unregistering))
1482 return 0;
1483 p->used++;
1484 return 1;
1487 /* called under sysctl_lock */
1488 static void unuse_table(struct ctl_table_header *p)
1490 if (!--p->used)
1491 if (unlikely(p->unregistering))
1492 complete(p->unregistering);
1495 /* called under sysctl_lock, will reacquire if has to wait */
1496 static void start_unregistering(struct ctl_table_header *p)
1499 * if p->used is 0, nobody will ever touch that entry again;
1500 * we'll eliminate all paths to it before dropping sysctl_lock
1502 if (unlikely(p->used)) {
1503 struct completion wait;
1504 init_completion(&wait);
1505 p->unregistering = &wait;
1506 spin_unlock(&sysctl_lock);
1507 wait_for_completion(&wait);
1508 spin_lock(&sysctl_lock);
1509 } else {
1510 /* anything non-NULL; we'll never dereference it */
1511 p->unregistering = ERR_PTR(-EINVAL);
1514 * do not remove from the list until nobody holds it; walking the
1515 * list in do_sysctl() relies on that.
1517 list_del_init(&p->ctl_entry);
1520 void sysctl_head_get(struct ctl_table_header *head)
1522 spin_lock(&sysctl_lock);
1523 head->count++;
1524 spin_unlock(&sysctl_lock);
1527 void sysctl_head_put(struct ctl_table_header *head)
1529 spin_lock(&sysctl_lock);
1530 if (!--head->count)
1531 kfree(head);
1532 spin_unlock(&sysctl_lock);
1535 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1537 if (!head)
1538 BUG();
1539 spin_lock(&sysctl_lock);
1540 if (!use_table(head))
1541 head = ERR_PTR(-ENOENT);
1542 spin_unlock(&sysctl_lock);
1543 return head;
1546 void sysctl_head_finish(struct ctl_table_header *head)
1548 if (!head)
1549 return;
1550 spin_lock(&sysctl_lock);
1551 unuse_table(head);
1552 spin_unlock(&sysctl_lock);
1555 static struct ctl_table_set *
1556 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1558 struct ctl_table_set *set = &root->default_set;
1559 if (root->lookup)
1560 set = root->lookup(root, namespaces);
1561 return set;
1564 static struct list_head *
1565 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1567 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1568 return &set->list;
1571 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1572 struct ctl_table_header *prev)
1574 struct ctl_table_root *root;
1575 struct list_head *header_list;
1576 struct ctl_table_header *head;
1577 struct list_head *tmp;
1579 spin_lock(&sysctl_lock);
1580 if (prev) {
1581 head = prev;
1582 tmp = &prev->ctl_entry;
1583 unuse_table(prev);
1584 goto next;
1586 tmp = &root_table_header.ctl_entry;
1587 for (;;) {
1588 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1590 if (!use_table(head))
1591 goto next;
1592 spin_unlock(&sysctl_lock);
1593 return head;
1594 next:
1595 root = head->root;
1596 tmp = tmp->next;
1597 header_list = lookup_header_list(root, namespaces);
1598 if (tmp != header_list)
1599 continue;
1601 do {
1602 root = list_entry(root->root_list.next,
1603 struct ctl_table_root, root_list);
1604 if (root == &sysctl_table_root)
1605 goto out;
1606 header_list = lookup_header_list(root, namespaces);
1607 } while (list_empty(header_list));
1608 tmp = header_list->next;
1610 out:
1611 spin_unlock(&sysctl_lock);
1612 return NULL;
1615 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1617 return __sysctl_head_next(current->nsproxy, prev);
1620 void register_sysctl_root(struct ctl_table_root *root)
1622 spin_lock(&sysctl_lock);
1623 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1624 spin_unlock(&sysctl_lock);
1627 #ifdef CONFIG_SYSCTL_SYSCALL
1628 /* Perform the actual read/write of a sysctl table entry. */
1629 static int do_sysctl_strategy(struct ctl_table_root *root,
1630 struct ctl_table *table,
1631 void __user *oldval, size_t __user *oldlenp,
1632 void __user *newval, size_t newlen)
1634 int op = 0, rc;
1636 if (oldval)
1637 op |= MAY_READ;
1638 if (newval)
1639 op |= MAY_WRITE;
1640 if (sysctl_perm(root, table, op))
1641 return -EPERM;
1643 if (table->strategy) {
1644 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1645 if (rc < 0)
1646 return rc;
1647 if (rc > 0)
1648 return 0;
1651 /* If there is no strategy routine, or if the strategy returns
1652 * zero, proceed with automatic r/w */
1653 if (table->data && table->maxlen) {
1654 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1655 if (rc < 0)
1656 return rc;
1658 return 0;
1661 static int parse_table(int __user *name, int nlen,
1662 void __user *oldval, size_t __user *oldlenp,
1663 void __user *newval, size_t newlen,
1664 struct ctl_table_root *root,
1665 struct ctl_table *table)
1667 int n;
1668 repeat:
1669 if (!nlen)
1670 return -ENOTDIR;
1671 if (get_user(n, name))
1672 return -EFAULT;
1673 for ( ; table->ctl_name || table->procname; table++) {
1674 if (!table->ctl_name)
1675 continue;
1676 if (n == table->ctl_name) {
1677 int error;
1678 if (table->child) {
1679 if (sysctl_perm(root, table, MAY_EXEC))
1680 return -EPERM;
1681 name++;
1682 nlen--;
1683 table = table->child;
1684 goto repeat;
1686 error = do_sysctl_strategy(root, table,
1687 oldval, oldlenp,
1688 newval, newlen);
1689 return error;
1692 return -ENOTDIR;
1695 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1696 void __user *newval, size_t newlen)
1698 struct ctl_table_header *head;
1699 int error = -ENOTDIR;
1701 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1702 return -ENOTDIR;
1703 if (oldval) {
1704 int old_len;
1705 if (!oldlenp || get_user(old_len, oldlenp))
1706 return -EFAULT;
1709 for (head = sysctl_head_next(NULL); head;
1710 head = sysctl_head_next(head)) {
1711 error = parse_table(name, nlen, oldval, oldlenp,
1712 newval, newlen,
1713 head->root, head->ctl_table);
1714 if (error != -ENOTDIR) {
1715 sysctl_head_finish(head);
1716 break;
1719 return error;
1722 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1724 struct __sysctl_args tmp;
1725 int error;
1727 if (copy_from_user(&tmp, args, sizeof(tmp)))
1728 return -EFAULT;
1730 error = deprecated_sysctl_warning(&tmp);
1731 if (error)
1732 goto out;
1734 lock_kernel();
1735 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1736 tmp.newval, tmp.newlen);
1737 unlock_kernel();
1738 out:
1739 return error;
1741 #endif /* CONFIG_SYSCTL_SYSCALL */
1744 * sysctl_perm does NOT grant the superuser all rights automatically, because
1745 * some sysctl variables are readonly even to root.
1748 static int test_perm(int mode, int op)
1750 if (!current_euid())
1751 mode >>= 6;
1752 else if (in_egroup_p(0))
1753 mode >>= 3;
1754 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1755 return 0;
1756 return -EACCES;
1759 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1761 int error;
1762 int mode;
1764 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1765 if (error)
1766 return error;
1768 if (root->permissions)
1769 mode = root->permissions(root, current->nsproxy, table);
1770 else
1771 mode = table->mode;
1773 return test_perm(mode, op);
1776 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1778 for (; table->ctl_name || table->procname; table++) {
1779 table->parent = parent;
1780 if (table->child)
1781 sysctl_set_parent(table, table->child);
1785 static __init int sysctl_init(void)
1787 sysctl_set_parent(NULL, root_table);
1788 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1790 int err;
1791 err = sysctl_check_table(current->nsproxy, root_table);
1793 #endif
1794 return 0;
1797 core_initcall(sysctl_init);
1799 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1800 struct ctl_table *table)
1802 struct ctl_table *p;
1803 const char *s = branch->procname;
1805 /* branch should have named subdirectory as its first element */
1806 if (!s || !branch->child)
1807 return NULL;
1809 /* ... and nothing else */
1810 if (branch[1].procname || branch[1].ctl_name)
1811 return NULL;
1813 /* table should contain subdirectory with the same name */
1814 for (p = table; p->procname || p->ctl_name; p++) {
1815 if (!p->child)
1816 continue;
1817 if (p->procname && strcmp(p->procname, s) == 0)
1818 return p;
1820 return NULL;
1823 /* see if attaching q to p would be an improvement */
1824 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1826 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1827 struct ctl_table *next;
1828 int is_better = 0;
1829 int not_in_parent = !p->attached_by;
1831 while ((next = is_branch_in(by, to)) != NULL) {
1832 if (by == q->attached_by)
1833 is_better = 1;
1834 if (to == p->attached_by)
1835 not_in_parent = 1;
1836 by = by->child;
1837 to = next->child;
1840 if (is_better && not_in_parent) {
1841 q->attached_by = by;
1842 q->attached_to = to;
1843 q->parent = p;
1848 * __register_sysctl_paths - register a sysctl hierarchy
1849 * @root: List of sysctl headers to register on
1850 * @namespaces: Data to compute which lists of sysctl entries are visible
1851 * @path: The path to the directory the sysctl table is in.
1852 * @table: the top-level table structure
1854 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1855 * array. A completely 0 filled entry terminates the table.
1857 * The members of the &struct ctl_table structure are used as follows:
1859 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1860 * must be unique within that level of sysctl
1862 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1863 * enter a sysctl file
1865 * data - a pointer to data for use by proc_handler
1867 * maxlen - the maximum size in bytes of the data
1869 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1871 * child - a pointer to the child sysctl table if this entry is a directory, or
1872 * %NULL.
1874 * proc_handler - the text handler routine (described below)
1876 * strategy - the strategy routine (described below)
1878 * de - for internal use by the sysctl routines
1880 * extra1, extra2 - extra pointers usable by the proc handler routines
1882 * Leaf nodes in the sysctl tree will be represented by a single file
1883 * under /proc; non-leaf nodes will be represented by directories.
1885 * sysctl(2) can automatically manage read and write requests through
1886 * the sysctl table. The data and maxlen fields of the ctl_table
1887 * struct enable minimal validation of the values being written to be
1888 * performed, and the mode field allows minimal authentication.
1890 * More sophisticated management can be enabled by the provision of a
1891 * strategy routine with the table entry. This will be called before
1892 * any automatic read or write of the data is performed.
1894 * The strategy routine may return
1896 * < 0 - Error occurred (error is passed to user process)
1898 * 0 - OK - proceed with automatic read or write.
1900 * > 0 - OK - read or write has been done by the strategy routine, so
1901 * return immediately.
1903 * There must be a proc_handler routine for any terminal nodes
1904 * mirrored under /proc/sys (non-terminals are handled by a built-in
1905 * directory handler). Several default handlers are available to
1906 * cover common cases -
1908 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1909 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1910 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1912 * It is the handler's job to read the input buffer from user memory
1913 * and process it. The handler should return 0 on success.
1915 * This routine returns %NULL on a failure to register, and a pointer
1916 * to the table header on success.
1918 struct ctl_table_header *__register_sysctl_paths(
1919 struct ctl_table_root *root,
1920 struct nsproxy *namespaces,
1921 const struct ctl_path *path, struct ctl_table *table)
1923 struct ctl_table_header *header;
1924 struct ctl_table *new, **prevp;
1925 unsigned int n, npath;
1926 struct ctl_table_set *set;
1928 /* Count the path components */
1929 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
1933 * For each path component, allocate a 2-element ctl_table array.
1934 * The first array element will be filled with the sysctl entry
1935 * for this, the second will be the sentinel (ctl_name == 0).
1937 * We allocate everything in one go so that we don't have to
1938 * worry about freeing additional memory in unregister_sysctl_table.
1940 header = kzalloc(sizeof(struct ctl_table_header) +
1941 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1942 if (!header)
1943 return NULL;
1945 new = (struct ctl_table *) (header + 1);
1947 /* Now connect the dots */
1948 prevp = &header->ctl_table;
1949 for (n = 0; n < npath; ++n, ++path) {
1950 /* Copy the procname */
1951 new->procname = path->procname;
1952 new->ctl_name = path->ctl_name;
1953 new->mode = 0555;
1955 *prevp = new;
1956 prevp = &new->child;
1958 new += 2;
1960 *prevp = table;
1961 header->ctl_table_arg = table;
1963 INIT_LIST_HEAD(&header->ctl_entry);
1964 header->used = 0;
1965 header->unregistering = NULL;
1966 header->root = root;
1967 sysctl_set_parent(NULL, header->ctl_table);
1968 header->count = 1;
1969 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1970 if (sysctl_check_table(namespaces, header->ctl_table)) {
1971 kfree(header);
1972 return NULL;
1974 #endif
1975 spin_lock(&sysctl_lock);
1976 header->set = lookup_header_set(root, namespaces);
1977 header->attached_by = header->ctl_table;
1978 header->attached_to = root_table;
1979 header->parent = &root_table_header;
1980 for (set = header->set; set; set = set->parent) {
1981 struct ctl_table_header *p;
1982 list_for_each_entry(p, &set->list, ctl_entry) {
1983 if (p->unregistering)
1984 continue;
1985 try_attach(p, header);
1988 header->parent->count++;
1989 list_add_tail(&header->ctl_entry, &header->set->list);
1990 spin_unlock(&sysctl_lock);
1992 return header;
1996 * register_sysctl_table_path - register a sysctl table hierarchy
1997 * @path: The path to the directory the sysctl table is in.
1998 * @table: the top-level table structure
2000 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
2001 * array. A completely 0 filled entry terminates the table.
2003 * See __register_sysctl_paths for more details.
2005 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2006 struct ctl_table *table)
2008 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
2009 path, table);
2013 * register_sysctl_table - register a sysctl table hierarchy
2014 * @table: the top-level table structure
2016 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
2017 * array. A completely 0 filled entry terminates the table.
2019 * See register_sysctl_paths for more details.
2021 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
2023 static const struct ctl_path null_path[] = { {} };
2025 return register_sysctl_paths(null_path, table);
2029 * unregister_sysctl_table - unregister a sysctl table hierarchy
2030 * @header: the header returned from register_sysctl_table
2032 * Unregisters the sysctl table and all children. proc entries may not
2033 * actually be removed until they are no longer used by anyone.
2035 void unregister_sysctl_table(struct ctl_table_header * header)
2037 might_sleep();
2039 if (header == NULL)
2040 return;
2042 spin_lock(&sysctl_lock);
2043 start_unregistering(header);
2044 if (!--header->parent->count) {
2045 WARN_ON(1);
2046 kfree(header->parent);
2048 if (!--header->count)
2049 kfree(header);
2050 spin_unlock(&sysctl_lock);
2053 int sysctl_is_seen(struct ctl_table_header *p)
2055 struct ctl_table_set *set = p->set;
2056 int res;
2057 spin_lock(&sysctl_lock);
2058 if (p->unregistering)
2059 res = 0;
2060 else if (!set->is_seen)
2061 res = 1;
2062 else
2063 res = set->is_seen(set);
2064 spin_unlock(&sysctl_lock);
2065 return res;
2068 void setup_sysctl_set(struct ctl_table_set *p,
2069 struct ctl_table_set *parent,
2070 int (*is_seen)(struct ctl_table_set *))
2072 INIT_LIST_HEAD(&p->list);
2073 p->parent = parent ? parent : &sysctl_table_root.default_set;
2074 p->is_seen = is_seen;
2077 #else /* !CONFIG_SYSCTL */
2078 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2080 return NULL;
2083 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2084 struct ctl_table *table)
2086 return NULL;
2089 void unregister_sysctl_table(struct ctl_table_header * table)
2093 void setup_sysctl_set(struct ctl_table_set *p,
2094 struct ctl_table_set *parent,
2095 int (*is_seen)(struct ctl_table_set *))
2099 void sysctl_head_put(struct ctl_table_header *head)
2103 #endif /* CONFIG_SYSCTL */
2106 * /proc/sys support
2109 #ifdef CONFIG_PROC_SYSCTL
2111 static int _proc_do_string(void* data, int maxlen, int write,
2112 struct file *filp, void __user *buffer,
2113 size_t *lenp, loff_t *ppos)
2115 size_t len;
2116 char __user *p;
2117 char c;
2119 if (!data || !maxlen || !*lenp) {
2120 *lenp = 0;
2121 return 0;
2124 if (write) {
2125 len = 0;
2126 p = buffer;
2127 while (len < *lenp) {
2128 if (get_user(c, p++))
2129 return -EFAULT;
2130 if (c == 0 || c == '\n')
2131 break;
2132 len++;
2134 if (len >= maxlen)
2135 len = maxlen-1;
2136 if(copy_from_user(data, buffer, len))
2137 return -EFAULT;
2138 ((char *) data)[len] = 0;
2139 *ppos += *lenp;
2140 } else {
2141 len = strlen(data);
2142 if (len > maxlen)
2143 len = maxlen;
2145 if (*ppos > len) {
2146 *lenp = 0;
2147 return 0;
2150 data += *ppos;
2151 len -= *ppos;
2153 if (len > *lenp)
2154 len = *lenp;
2155 if (len)
2156 if(copy_to_user(buffer, data, len))
2157 return -EFAULT;
2158 if (len < *lenp) {
2159 if(put_user('\n', ((char __user *) buffer) + len))
2160 return -EFAULT;
2161 len++;
2163 *lenp = len;
2164 *ppos += len;
2166 return 0;
2170 * proc_dostring - read a string sysctl
2171 * @table: the sysctl table
2172 * @write: %TRUE if this is a write to the sysctl file
2173 * @filp: the file structure
2174 * @buffer: the user buffer
2175 * @lenp: the size of the user buffer
2176 * @ppos: file position
2178 * Reads/writes a string from/to the user buffer. If the kernel
2179 * buffer provided is not large enough to hold the string, the
2180 * string is truncated. The copied string is %NULL-terminated.
2181 * If the string is being read by the user process, it is copied
2182 * and a newline '\n' is added. It is truncated if the buffer is
2183 * not large enough.
2185 * Returns 0 on success.
2187 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2188 void __user *buffer, size_t *lenp, loff_t *ppos)
2190 return _proc_do_string(table->data, table->maxlen, write, filp,
2191 buffer, lenp, ppos);
2195 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
2196 int *valp,
2197 int write, void *data)
2199 if (write) {
2200 *valp = *negp ? -*lvalp : *lvalp;
2201 } else {
2202 int val = *valp;
2203 if (val < 0) {
2204 *negp = -1;
2205 *lvalp = (unsigned long)-val;
2206 } else {
2207 *negp = 0;
2208 *lvalp = (unsigned long)val;
2211 return 0;
2214 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2215 int write, struct file *filp, void __user *buffer,
2216 size_t *lenp, loff_t *ppos,
2217 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2218 int write, void *data),
2219 void *data)
2221 #define TMPBUFLEN 21
2222 int *i, vleft, first=1, neg, val;
2223 unsigned long lval;
2224 size_t left, len;
2226 char buf[TMPBUFLEN], *p;
2227 char __user *s = buffer;
2229 if (!tbl_data || !table->maxlen || !*lenp ||
2230 (*ppos && !write)) {
2231 *lenp = 0;
2232 return 0;
2235 i = (int *) tbl_data;
2236 vleft = table->maxlen / sizeof(*i);
2237 left = *lenp;
2239 if (!conv)
2240 conv = do_proc_dointvec_conv;
2242 for (; left && vleft--; i++, first=0) {
2243 if (write) {
2244 while (left) {
2245 char c;
2246 if (get_user(c, s))
2247 return -EFAULT;
2248 if (!isspace(c))
2249 break;
2250 left--;
2251 s++;
2253 if (!left)
2254 break;
2255 neg = 0;
2256 len = left;
2257 if (len > sizeof(buf) - 1)
2258 len = sizeof(buf) - 1;
2259 if (copy_from_user(buf, s, len))
2260 return -EFAULT;
2261 buf[len] = 0;
2262 p = buf;
2263 if (*p == '-' && left > 1) {
2264 neg = 1;
2265 p++;
2267 if (*p < '0' || *p > '9')
2268 break;
2270 lval = simple_strtoul(p, &p, 0);
2272 len = p-buf;
2273 if ((len < left) && *p && !isspace(*p))
2274 break;
2275 if (neg)
2276 val = -val;
2277 s += len;
2278 left -= len;
2280 if (conv(&neg, &lval, i, 1, data))
2281 break;
2282 } else {
2283 p = buf;
2284 if (!first)
2285 *p++ = '\t';
2287 if (conv(&neg, &lval, i, 0, data))
2288 break;
2290 sprintf(p, "%s%lu", neg ? "-" : "", lval);
2291 len = strlen(buf);
2292 if (len > left)
2293 len = left;
2294 if(copy_to_user(s, buf, len))
2295 return -EFAULT;
2296 left -= len;
2297 s += len;
2301 if (!write && !first && left) {
2302 if(put_user('\n', s))
2303 return -EFAULT;
2304 left--, s++;
2306 if (write) {
2307 while (left) {
2308 char c;
2309 if (get_user(c, s++))
2310 return -EFAULT;
2311 if (!isspace(c))
2312 break;
2313 left--;
2316 if (write && first)
2317 return -EINVAL;
2318 *lenp -= left;
2319 *ppos += *lenp;
2320 return 0;
2321 #undef TMPBUFLEN
2324 static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2325 void __user *buffer, size_t *lenp, loff_t *ppos,
2326 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2327 int write, void *data),
2328 void *data)
2330 return __do_proc_dointvec(table->data, table, write, filp,
2331 buffer, lenp, ppos, conv, data);
2335 * proc_dointvec - read a vector of integers
2336 * @table: the sysctl table
2337 * @write: %TRUE if this is a write to the sysctl file
2338 * @filp: the file structure
2339 * @buffer: the user buffer
2340 * @lenp: the size of the user buffer
2341 * @ppos: file position
2343 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2344 * values from/to the user buffer, treated as an ASCII string.
2346 * Returns 0 on success.
2348 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2349 void __user *buffer, size_t *lenp, loff_t *ppos)
2351 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2352 NULL,NULL);
2356 * Taint values can only be increased
2357 * This means we can safely use a temporary.
2359 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2360 void __user *buffer, size_t *lenp, loff_t *ppos)
2362 struct ctl_table t;
2363 unsigned long tmptaint = get_taint();
2364 int err;
2366 if (write && !capable(CAP_SYS_ADMIN))
2367 return -EPERM;
2369 t = *table;
2370 t.data = &tmptaint;
2371 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos);
2372 if (err < 0)
2373 return err;
2375 if (write) {
2377 * Poor man's atomic or. Not worth adding a primitive
2378 * to everyone's atomic.h for this
2380 int i;
2381 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2382 if ((tmptaint >> i) & 1)
2383 add_taint(i);
2387 return err;
2390 struct do_proc_dointvec_minmax_conv_param {
2391 int *min;
2392 int *max;
2395 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2396 int *valp,
2397 int write, void *data)
2399 struct do_proc_dointvec_minmax_conv_param *param = data;
2400 if (write) {
2401 int val = *negp ? -*lvalp : *lvalp;
2402 if ((param->min && *param->min > val) ||
2403 (param->max && *param->max < val))
2404 return -EINVAL;
2405 *valp = val;
2406 } else {
2407 int val = *valp;
2408 if (val < 0) {
2409 *negp = -1;
2410 *lvalp = (unsigned long)-val;
2411 } else {
2412 *negp = 0;
2413 *lvalp = (unsigned long)val;
2416 return 0;
2420 * proc_dointvec_minmax - read a vector of integers with min/max values
2421 * @table: the sysctl table
2422 * @write: %TRUE if this is a write to the sysctl file
2423 * @filp: the file structure
2424 * @buffer: the user buffer
2425 * @lenp: the size of the user buffer
2426 * @ppos: file position
2428 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2429 * values from/to the user buffer, treated as an ASCII string.
2431 * This routine will ensure the values are within the range specified by
2432 * table->extra1 (min) and table->extra2 (max).
2434 * Returns 0 on success.
2436 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2437 void __user *buffer, size_t *lenp, loff_t *ppos)
2439 struct do_proc_dointvec_minmax_conv_param param = {
2440 .min = (int *) table->extra1,
2441 .max = (int *) table->extra2,
2443 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2444 do_proc_dointvec_minmax_conv, &param);
2447 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2448 struct file *filp,
2449 void __user *buffer,
2450 size_t *lenp, loff_t *ppos,
2451 unsigned long convmul,
2452 unsigned long convdiv)
2454 #define TMPBUFLEN 21
2455 unsigned long *i, *min, *max, val;
2456 int vleft, first=1, neg;
2457 size_t len, left;
2458 char buf[TMPBUFLEN], *p;
2459 char __user *s = buffer;
2461 if (!data || !table->maxlen || !*lenp ||
2462 (*ppos && !write)) {
2463 *lenp = 0;
2464 return 0;
2467 i = (unsigned long *) data;
2468 min = (unsigned long *) table->extra1;
2469 max = (unsigned long *) table->extra2;
2470 vleft = table->maxlen / sizeof(unsigned long);
2471 left = *lenp;
2473 for (; left && vleft--; i++, min++, max++, first=0) {
2474 if (write) {
2475 while (left) {
2476 char c;
2477 if (get_user(c, s))
2478 return -EFAULT;
2479 if (!isspace(c))
2480 break;
2481 left--;
2482 s++;
2484 if (!left)
2485 break;
2486 neg = 0;
2487 len = left;
2488 if (len > TMPBUFLEN-1)
2489 len = TMPBUFLEN-1;
2490 if (copy_from_user(buf, s, len))
2491 return -EFAULT;
2492 buf[len] = 0;
2493 p = buf;
2494 if (*p == '-' && left > 1) {
2495 neg = 1;
2496 p++;
2498 if (*p < '0' || *p > '9')
2499 break;
2500 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
2501 len = p-buf;
2502 if ((len < left) && *p && !isspace(*p))
2503 break;
2504 if (neg)
2505 val = -val;
2506 s += len;
2507 left -= len;
2509 if(neg)
2510 continue;
2511 if ((min && val < *min) || (max && val > *max))
2512 continue;
2513 *i = val;
2514 } else {
2515 p = buf;
2516 if (!first)
2517 *p++ = '\t';
2518 sprintf(p, "%lu", convdiv * (*i) / convmul);
2519 len = strlen(buf);
2520 if (len > left)
2521 len = left;
2522 if(copy_to_user(s, buf, len))
2523 return -EFAULT;
2524 left -= len;
2525 s += len;
2529 if (!write && !first && left) {
2530 if(put_user('\n', s))
2531 return -EFAULT;
2532 left--, s++;
2534 if (write) {
2535 while (left) {
2536 char c;
2537 if (get_user(c, s++))
2538 return -EFAULT;
2539 if (!isspace(c))
2540 break;
2541 left--;
2544 if (write && first)
2545 return -EINVAL;
2546 *lenp -= left;
2547 *ppos += *lenp;
2548 return 0;
2549 #undef TMPBUFLEN
2552 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2553 struct file *filp,
2554 void __user *buffer,
2555 size_t *lenp, loff_t *ppos,
2556 unsigned long convmul,
2557 unsigned long convdiv)
2559 return __do_proc_doulongvec_minmax(table->data, table, write,
2560 filp, buffer, lenp, ppos, convmul, convdiv);
2564 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2565 * @table: the sysctl table
2566 * @write: %TRUE if this is a write to the sysctl file
2567 * @filp: the file structure
2568 * @buffer: the user buffer
2569 * @lenp: the size of the user buffer
2570 * @ppos: file position
2572 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2573 * values from/to the user buffer, treated as an ASCII string.
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_minmax(struct ctl_table *table, int write, struct file *filp,
2581 void __user *buffer, size_t *lenp, loff_t *ppos)
2583 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
2587 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2588 * @table: the sysctl table
2589 * @write: %TRUE if this is a write to the sysctl file
2590 * @filp: the file structure
2591 * @buffer: the user buffer
2592 * @lenp: the size of the user buffer
2593 * @ppos: file position
2595 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2596 * values from/to the user buffer, treated as an ASCII string. The values
2597 * are treated as milliseconds, and converted to jiffies when they are stored.
2599 * This routine will ensure the values are within the range specified by
2600 * table->extra1 (min) and table->extra2 (max).
2602 * Returns 0 on success.
2604 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2605 struct file *filp,
2606 void __user *buffer,
2607 size_t *lenp, loff_t *ppos)
2609 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2610 lenp, ppos, HZ, 1000l);
2614 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2615 int *valp,
2616 int write, void *data)
2618 if (write) {
2619 if (*lvalp > LONG_MAX / HZ)
2620 return 1;
2621 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2622 } else {
2623 int val = *valp;
2624 unsigned long lval;
2625 if (val < 0) {
2626 *negp = -1;
2627 lval = (unsigned long)-val;
2628 } else {
2629 *negp = 0;
2630 lval = (unsigned long)val;
2632 *lvalp = lval / HZ;
2634 return 0;
2637 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2638 int *valp,
2639 int write, void *data)
2641 if (write) {
2642 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2643 return 1;
2644 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2645 } else {
2646 int val = *valp;
2647 unsigned long lval;
2648 if (val < 0) {
2649 *negp = -1;
2650 lval = (unsigned long)-val;
2651 } else {
2652 *negp = 0;
2653 lval = (unsigned long)val;
2655 *lvalp = jiffies_to_clock_t(lval);
2657 return 0;
2660 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2661 int *valp,
2662 int write, void *data)
2664 if (write) {
2665 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2666 } else {
2667 int val = *valp;
2668 unsigned long lval;
2669 if (val < 0) {
2670 *negp = -1;
2671 lval = (unsigned long)-val;
2672 } else {
2673 *negp = 0;
2674 lval = (unsigned long)val;
2676 *lvalp = jiffies_to_msecs(lval);
2678 return 0;
2682 * proc_dointvec_jiffies - read a vector of integers as seconds
2683 * @table: the sysctl table
2684 * @write: %TRUE if this is a write to the sysctl file
2685 * @filp: the file structure
2686 * @buffer: the user buffer
2687 * @lenp: the size of the user buffer
2688 * @ppos: file position
2690 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2691 * values from/to the user buffer, treated as an ASCII string.
2692 * The values read are assumed to be in seconds, and are converted into
2693 * jiffies.
2695 * Returns 0 on success.
2697 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2698 void __user *buffer, size_t *lenp, loff_t *ppos)
2700 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2701 do_proc_dointvec_jiffies_conv,NULL);
2705 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2706 * @table: the sysctl table
2707 * @write: %TRUE if this is a write to the sysctl file
2708 * @filp: the file structure
2709 * @buffer: the user buffer
2710 * @lenp: the size of the user buffer
2711 * @ppos: pointer to the file position
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/USER_HZ seconds, and
2716 * are converted into jiffies.
2718 * Returns 0 on success.
2720 int proc_dointvec_userhz_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_userhz_jiffies_conv,NULL);
2728 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2729 * @table: the sysctl table
2730 * @write: %TRUE if this is a write to the sysctl file
2731 * @filp: the file structure
2732 * @buffer: the user buffer
2733 * @lenp: the size of the user buffer
2734 * @ppos: file position
2735 * @ppos: the current position in the file
2737 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2738 * values from/to the user buffer, treated as an ASCII string.
2739 * The values read are assumed to be in 1/1000 seconds, and
2740 * are converted into jiffies.
2742 * Returns 0 on success.
2744 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2745 void __user *buffer, size_t *lenp, loff_t *ppos)
2747 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2748 do_proc_dointvec_ms_jiffies_conv, NULL);
2751 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2752 void __user *buffer, size_t *lenp, loff_t *ppos)
2754 struct pid *new_pid;
2755 pid_t tmp;
2756 int r;
2758 tmp = pid_vnr(cad_pid);
2760 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2761 lenp, ppos, NULL, NULL);
2762 if (r || !write)
2763 return r;
2765 new_pid = find_get_pid(tmp);
2766 if (!new_pid)
2767 return -ESRCH;
2769 put_pid(xchg(&cad_pid, new_pid));
2770 return 0;
2773 #else /* CONFIG_PROC_FS */
2775 int proc_dostring(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(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_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_dointvec_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_userhz_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_dointvec_ms_jiffies(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_minmax(struct ctl_table *table, int write, struct file *filp,
2812 void __user *buffer, size_t *lenp, loff_t *ppos)
2814 return -ENOSYS;
2817 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2818 struct file *filp,
2819 void __user *buffer,
2820 size_t *lenp, loff_t *ppos)
2822 return -ENOSYS;
2826 #endif /* CONFIG_PROC_FS */
2829 #ifdef CONFIG_SYSCTL_SYSCALL
2831 * General sysctl support routines
2834 /* The generic sysctl data routine (used if no strategy routine supplied) */
2835 int sysctl_data(struct ctl_table *table,
2836 void __user *oldval, size_t __user *oldlenp,
2837 void __user *newval, size_t newlen)
2839 size_t len;
2841 /* Get out of I don't have a variable */
2842 if (!table->data || !table->maxlen)
2843 return -ENOTDIR;
2845 if (oldval && oldlenp) {
2846 if (get_user(len, oldlenp))
2847 return -EFAULT;
2848 if (len) {
2849 if (len > table->maxlen)
2850 len = table->maxlen;
2851 if (copy_to_user(oldval, table->data, len))
2852 return -EFAULT;
2853 if (put_user(len, oldlenp))
2854 return -EFAULT;
2858 if (newval && newlen) {
2859 if (newlen > table->maxlen)
2860 newlen = table->maxlen;
2862 if (copy_from_user(table->data, newval, newlen))
2863 return -EFAULT;
2865 return 1;
2868 /* The generic string strategy routine: */
2869 int sysctl_string(struct ctl_table *table,
2870 void __user *oldval, size_t __user *oldlenp,
2871 void __user *newval, size_t newlen)
2873 if (!table->data || !table->maxlen)
2874 return -ENOTDIR;
2876 if (oldval && oldlenp) {
2877 size_t bufsize;
2878 if (get_user(bufsize, oldlenp))
2879 return -EFAULT;
2880 if (bufsize) {
2881 size_t len = strlen(table->data), copied;
2883 /* This shouldn't trigger for a well-formed sysctl */
2884 if (len > table->maxlen)
2885 len = table->maxlen;
2887 /* Copy up to a max of bufsize-1 bytes of the string */
2888 copied = (len >= bufsize) ? bufsize - 1 : len;
2890 if (copy_to_user(oldval, table->data, copied) ||
2891 put_user(0, (char __user *)(oldval + copied)))
2892 return -EFAULT;
2893 if (put_user(len, oldlenp))
2894 return -EFAULT;
2897 if (newval && newlen) {
2898 size_t len = newlen;
2899 if (len > table->maxlen)
2900 len = table->maxlen;
2901 if(copy_from_user(table->data, newval, len))
2902 return -EFAULT;
2903 if (len == table->maxlen)
2904 len--;
2905 ((char *) table->data)[len] = 0;
2907 return 1;
2911 * This function makes sure that all of the integers in the vector
2912 * are between the minimum and maximum values given in the arrays
2913 * table->extra1 and table->extra2, respectively.
2915 int sysctl_intvec(struct ctl_table *table,
2916 void __user *oldval, size_t __user *oldlenp,
2917 void __user *newval, size_t newlen)
2920 if (newval && newlen) {
2921 int __user *vec = (int __user *) newval;
2922 int *min = (int *) table->extra1;
2923 int *max = (int *) table->extra2;
2924 size_t length;
2925 int i;
2927 if (newlen % sizeof(int) != 0)
2928 return -EINVAL;
2930 if (!table->extra1 && !table->extra2)
2931 return 0;
2933 if (newlen > table->maxlen)
2934 newlen = table->maxlen;
2935 length = newlen / sizeof(int);
2937 for (i = 0; i < length; i++) {
2938 int value;
2939 if (get_user(value, vec + i))
2940 return -EFAULT;
2941 if (min && value < min[i])
2942 return -EINVAL;
2943 if (max && value > max[i])
2944 return -EINVAL;
2947 return 0;
2950 /* Strategy function to convert jiffies to seconds */
2951 int sysctl_jiffies(struct ctl_table *table,
2952 void __user *oldval, size_t __user *oldlenp,
2953 void __user *newval, size_t newlen)
2955 if (oldval && oldlenp) {
2956 size_t olen;
2958 if (get_user(olen, oldlenp))
2959 return -EFAULT;
2960 if (olen) {
2961 int val;
2963 if (olen < sizeof(int))
2964 return -EINVAL;
2966 val = *(int *)(table->data) / HZ;
2967 if (put_user(val, (int __user *)oldval))
2968 return -EFAULT;
2969 if (put_user(sizeof(int), oldlenp))
2970 return -EFAULT;
2973 if (newval && newlen) {
2974 int new;
2975 if (newlen != sizeof(int))
2976 return -EINVAL;
2977 if (get_user(new, (int __user *)newval))
2978 return -EFAULT;
2979 *(int *)(table->data) = new*HZ;
2981 return 1;
2984 /* Strategy function to convert jiffies to seconds */
2985 int sysctl_ms_jiffies(struct ctl_table *table,
2986 void __user *oldval, size_t __user *oldlenp,
2987 void __user *newval, size_t newlen)
2989 if (oldval && oldlenp) {
2990 size_t olen;
2992 if (get_user(olen, oldlenp))
2993 return -EFAULT;
2994 if (olen) {
2995 int val;
2997 if (olen < sizeof(int))
2998 return -EINVAL;
3000 val = jiffies_to_msecs(*(int *)(table->data));
3001 if (put_user(val, (int __user *)oldval))
3002 return -EFAULT;
3003 if (put_user(sizeof(int), oldlenp))
3004 return -EFAULT;
3007 if (newval && newlen) {
3008 int new;
3009 if (newlen != sizeof(int))
3010 return -EINVAL;
3011 if (get_user(new, (int __user *)newval))
3012 return -EFAULT;
3013 *(int *)(table->data) = msecs_to_jiffies(new);
3015 return 1;
3020 #else /* CONFIG_SYSCTL_SYSCALL */
3023 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
3025 struct __sysctl_args tmp;
3026 int error;
3028 if (copy_from_user(&tmp, args, sizeof(tmp)))
3029 return -EFAULT;
3031 error = deprecated_sysctl_warning(&tmp);
3033 /* If no error reading the parameters then just -ENOSYS ... */
3034 if (!error)
3035 error = -ENOSYS;
3037 return error;
3040 int sysctl_data(struct ctl_table *table,
3041 void __user *oldval, size_t __user *oldlenp,
3042 void __user *newval, size_t newlen)
3044 return -ENOSYS;
3047 int sysctl_string(struct ctl_table *table,
3048 void __user *oldval, size_t __user *oldlenp,
3049 void __user *newval, size_t newlen)
3051 return -ENOSYS;
3054 int sysctl_intvec(struct ctl_table *table,
3055 void __user *oldval, size_t __user *oldlenp,
3056 void __user *newval, size_t newlen)
3058 return -ENOSYS;
3061 int sysctl_jiffies(struct ctl_table *table,
3062 void __user *oldval, size_t __user *oldlenp,
3063 void __user *newval, size_t newlen)
3065 return -ENOSYS;
3068 int sysctl_ms_jiffies(struct ctl_table *table,
3069 void __user *oldval, size_t __user *oldlenp,
3070 void __user *newval, size_t newlen)
3072 return -ENOSYS;
3075 #endif /* CONFIG_SYSCTL_SYSCALL */
3077 static int deprecated_sysctl_warning(struct __sysctl_args *args)
3079 static int msg_count;
3080 int name[CTL_MAXNAME];
3081 int i;
3083 /* Check args->nlen. */
3084 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
3085 return -ENOTDIR;
3087 /* Read in the sysctl name for better debug message logging */
3088 for (i = 0; i < args->nlen; i++)
3089 if (get_user(name[i], args->name + i))
3090 return -EFAULT;
3092 /* Ignore accesses to kernel.version */
3093 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
3094 return 0;
3096 if (msg_count < 5) {
3097 msg_count++;
3098 printk(KERN_INFO
3099 "warning: process `%s' used the deprecated sysctl "
3100 "system call with ", current->comm);
3101 for (i = 0; i < args->nlen; i++)
3102 printk("%d.", name[i]);
3103 printk("\n");
3105 return 0;
3109 * No sense putting this after each symbol definition, twice,
3110 * exception granted :-)
3112 EXPORT_SYMBOL(proc_dointvec);
3113 EXPORT_SYMBOL(proc_dointvec_jiffies);
3114 EXPORT_SYMBOL(proc_dointvec_minmax);
3115 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3116 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3117 EXPORT_SYMBOL(proc_dostring);
3118 EXPORT_SYMBOL(proc_doulongvec_minmax);
3119 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3120 EXPORT_SYMBOL(register_sysctl_table);
3121 EXPORT_SYMBOL(register_sysctl_paths);
3122 EXPORT_SYMBOL(sysctl_intvec);
3123 EXPORT_SYMBOL(sysctl_jiffies);
3124 EXPORT_SYMBOL(sysctl_ms_jiffies);
3125 EXPORT_SYMBOL(sysctl_string);
3126 EXPORT_SYMBOL(sysctl_data);
3127 EXPORT_SYMBOL(unregister_sysctl_table);