ACPI: thinkpad-acpi: add development version tag
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / sysctl.c
blobe5bfcc768bdd5e5fcc94e6f714c4873c27fcedb7
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>
51 #include <linux/slow-work.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 __maybe_unused one = 1;
101 static int __maybe_unused two = 2;
102 static unsigned long one_ul = 1;
103 static int one_hundred = 100;
105 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
106 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
108 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
109 static int maxolduid = 65535;
110 static int minolduid;
111 static int min_percpu_pagelist_fract = 8;
113 static int ngroups_max = NGROUPS_MAX;
115 #ifdef CONFIG_MODULES
116 extern char modprobe_path[];
117 #endif
118 #ifdef CONFIG_CHR_DEV_SG
119 extern int sg_big_buff;
120 #endif
122 #ifdef CONFIG_SPARC
123 #include <asm/system.h>
124 #endif
126 #ifdef CONFIG_SPARC64
127 extern int sysctl_tsb_ratio;
128 #endif
130 #ifdef __hppa__
131 extern int pwrsw_enabled;
132 extern int unaligned_enabled;
133 #endif
135 #ifdef CONFIG_S390
136 #ifdef CONFIG_MATHEMU
137 extern int sysctl_ieee_emulation_warnings;
138 #endif
139 extern int sysctl_userprocess_debug;
140 extern int spin_retry;
141 #endif
143 #ifdef CONFIG_BSD_PROCESS_ACCT
144 extern int acct_parm[];
145 #endif
147 #ifdef CONFIG_IA64
148 extern int no_unaligned_warning;
149 extern int unaligned_dump_stack;
150 #endif
152 #ifdef CONFIG_RT_MUTEXES
153 extern int max_lock_depth;
154 #endif
156 #ifdef CONFIG_PROC_SYSCTL
157 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
158 void __user *buffer, size_t *lenp, loff_t *ppos);
159 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
160 void __user *buffer, size_t *lenp, loff_t *ppos);
161 #endif
163 static struct ctl_table root_table[];
164 static struct ctl_table_root sysctl_table_root;
165 static struct ctl_table_header root_table_header = {
166 .count = 1,
167 .ctl_table = root_table,
168 .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),
169 .root = &sysctl_table_root,
170 .set = &sysctl_table_root.default_set,
172 static struct ctl_table_root sysctl_table_root = {
173 .root_list = LIST_HEAD_INIT(sysctl_table_root.root_list),
174 .default_set.list = LIST_HEAD_INIT(root_table_header.ctl_entry),
177 static struct ctl_table kern_table[];
178 static struct ctl_table vm_table[];
179 static struct ctl_table fs_table[];
180 static struct ctl_table debug_table[];
181 static struct ctl_table dev_table[];
182 extern struct ctl_table random_table[];
183 #ifdef CONFIG_INOTIFY_USER
184 extern struct ctl_table inotify_table[];
185 #endif
186 #ifdef CONFIG_EPOLL
187 extern struct ctl_table epoll_table[];
188 #endif
190 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
191 int sysctl_legacy_va_layout;
192 #endif
194 extern int prove_locking;
195 extern int lock_stat;
197 /* The default sysctl tables: */
199 static struct ctl_table root_table[] = {
201 .ctl_name = CTL_KERN,
202 .procname = "kernel",
203 .mode = 0555,
204 .child = kern_table,
207 .ctl_name = CTL_VM,
208 .procname = "vm",
209 .mode = 0555,
210 .child = vm_table,
213 .ctl_name = CTL_FS,
214 .procname = "fs",
215 .mode = 0555,
216 .child = fs_table,
219 .ctl_name = CTL_DEBUG,
220 .procname = "debug",
221 .mode = 0555,
222 .child = debug_table,
225 .ctl_name = CTL_DEV,
226 .procname = "dev",
227 .mode = 0555,
228 .child = dev_table,
231 * NOTE: do not add new entries to this table unless you have read
232 * Documentation/sysctl/ctl_unnumbered.txt
234 { .ctl_name = 0 }
237 #ifdef CONFIG_SCHED_DEBUG
238 static int min_sched_granularity_ns = 100000; /* 100 usecs */
239 static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
240 static int min_wakeup_granularity_ns; /* 0 usecs */
241 static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
242 #endif
244 static struct ctl_table kern_table[] = {
245 #ifdef CONFIG_SCHED_DEBUG
247 .ctl_name = CTL_UNNUMBERED,
248 .procname = "sched_min_granularity_ns",
249 .data = &sysctl_sched_min_granularity,
250 .maxlen = sizeof(unsigned int),
251 .mode = 0644,
252 .proc_handler = &sched_nr_latency_handler,
253 .strategy = &sysctl_intvec,
254 .extra1 = &min_sched_granularity_ns,
255 .extra2 = &max_sched_granularity_ns,
258 .ctl_name = CTL_UNNUMBERED,
259 .procname = "sched_latency_ns",
260 .data = &sysctl_sched_latency,
261 .maxlen = sizeof(unsigned int),
262 .mode = 0644,
263 .proc_handler = &sched_nr_latency_handler,
264 .strategy = &sysctl_intvec,
265 .extra1 = &min_sched_granularity_ns,
266 .extra2 = &max_sched_granularity_ns,
269 .ctl_name = CTL_UNNUMBERED,
270 .procname = "sched_wakeup_granularity_ns",
271 .data = &sysctl_sched_wakeup_granularity,
272 .maxlen = sizeof(unsigned int),
273 .mode = 0644,
274 .proc_handler = &proc_dointvec_minmax,
275 .strategy = &sysctl_intvec,
276 .extra1 = &min_wakeup_granularity_ns,
277 .extra2 = &max_wakeup_granularity_ns,
280 .ctl_name = CTL_UNNUMBERED,
281 .procname = "sched_shares_ratelimit",
282 .data = &sysctl_sched_shares_ratelimit,
283 .maxlen = sizeof(unsigned int),
284 .mode = 0644,
285 .proc_handler = &proc_dointvec,
288 .ctl_name = CTL_UNNUMBERED,
289 .procname = "sched_shares_thresh",
290 .data = &sysctl_sched_shares_thresh,
291 .maxlen = sizeof(unsigned int),
292 .mode = 0644,
293 .proc_handler = &proc_dointvec_minmax,
294 .strategy = &sysctl_intvec,
295 .extra1 = &zero,
298 .ctl_name = CTL_UNNUMBERED,
299 .procname = "sched_child_runs_first",
300 .data = &sysctl_sched_child_runs_first,
301 .maxlen = sizeof(unsigned int),
302 .mode = 0644,
303 .proc_handler = &proc_dointvec,
306 .ctl_name = CTL_UNNUMBERED,
307 .procname = "sched_features",
308 .data = &sysctl_sched_features,
309 .maxlen = sizeof(unsigned int),
310 .mode = 0644,
311 .proc_handler = &proc_dointvec,
314 .ctl_name = CTL_UNNUMBERED,
315 .procname = "sched_migration_cost",
316 .data = &sysctl_sched_migration_cost,
317 .maxlen = sizeof(unsigned int),
318 .mode = 0644,
319 .proc_handler = &proc_dointvec,
322 .ctl_name = CTL_UNNUMBERED,
323 .procname = "sched_nr_migrate",
324 .data = &sysctl_sched_nr_migrate,
325 .maxlen = sizeof(unsigned int),
326 .mode = 0644,
327 .proc_handler = &proc_dointvec,
329 #endif
331 .ctl_name = CTL_UNNUMBERED,
332 .procname = "sched_rt_period_us",
333 .data = &sysctl_sched_rt_period,
334 .maxlen = sizeof(unsigned int),
335 .mode = 0644,
336 .proc_handler = &sched_rt_handler,
339 .ctl_name = CTL_UNNUMBERED,
340 .procname = "sched_rt_runtime_us",
341 .data = &sysctl_sched_rt_runtime,
342 .maxlen = sizeof(int),
343 .mode = 0644,
344 .proc_handler = &sched_rt_handler,
347 .ctl_name = CTL_UNNUMBERED,
348 .procname = "sched_compat_yield",
349 .data = &sysctl_sched_compat_yield,
350 .maxlen = sizeof(unsigned int),
351 .mode = 0644,
352 .proc_handler = &proc_dointvec,
354 #ifdef CONFIG_PROVE_LOCKING
356 .ctl_name = CTL_UNNUMBERED,
357 .procname = "prove_locking",
358 .data = &prove_locking,
359 .maxlen = sizeof(int),
360 .mode = 0644,
361 .proc_handler = &proc_dointvec,
363 #endif
364 #ifdef CONFIG_LOCK_STAT
366 .ctl_name = CTL_UNNUMBERED,
367 .procname = "lock_stat",
368 .data = &lock_stat,
369 .maxlen = sizeof(int),
370 .mode = 0644,
371 .proc_handler = &proc_dointvec,
373 #endif
375 .ctl_name = KERN_PANIC,
376 .procname = "panic",
377 .data = &panic_timeout,
378 .maxlen = sizeof(int),
379 .mode = 0644,
380 .proc_handler = &proc_dointvec,
383 .ctl_name = KERN_CORE_USES_PID,
384 .procname = "core_uses_pid",
385 .data = &core_uses_pid,
386 .maxlen = sizeof(int),
387 .mode = 0644,
388 .proc_handler = &proc_dointvec,
391 .ctl_name = KERN_CORE_PATTERN,
392 .procname = "core_pattern",
393 .data = core_pattern,
394 .maxlen = CORENAME_MAX_SIZE,
395 .mode = 0644,
396 .proc_handler = &proc_dostring,
397 .strategy = &sysctl_string,
399 #ifdef CONFIG_PROC_SYSCTL
401 .procname = "tainted",
402 .maxlen = sizeof(long),
403 .mode = 0644,
404 .proc_handler = &proc_taint,
406 #endif
407 #ifdef CONFIG_LATENCYTOP
409 .procname = "latencytop",
410 .data = &latencytop_enabled,
411 .maxlen = sizeof(int),
412 .mode = 0644,
413 .proc_handler = &proc_dointvec,
415 #endif
416 #ifdef CONFIG_BLK_DEV_INITRD
418 .ctl_name = KERN_REALROOTDEV,
419 .procname = "real-root-dev",
420 .data = &real_root_dev,
421 .maxlen = sizeof(int),
422 .mode = 0644,
423 .proc_handler = &proc_dointvec,
425 #endif
427 .ctl_name = CTL_UNNUMBERED,
428 .procname = "print-fatal-signals",
429 .data = &print_fatal_signals,
430 .maxlen = sizeof(int),
431 .mode = 0644,
432 .proc_handler = &proc_dointvec,
434 #ifdef CONFIG_SPARC
436 .ctl_name = KERN_SPARC_REBOOT,
437 .procname = "reboot-cmd",
438 .data = reboot_command,
439 .maxlen = 256,
440 .mode = 0644,
441 .proc_handler = &proc_dostring,
442 .strategy = &sysctl_string,
445 .ctl_name = KERN_SPARC_STOP_A,
446 .procname = "stop-a",
447 .data = &stop_a_enabled,
448 .maxlen = sizeof (int),
449 .mode = 0644,
450 .proc_handler = &proc_dointvec,
453 .ctl_name = KERN_SPARC_SCONS_PWROFF,
454 .procname = "scons-poweroff",
455 .data = &scons_pwroff,
456 .maxlen = sizeof (int),
457 .mode = 0644,
458 .proc_handler = &proc_dointvec,
460 #endif
461 #ifdef CONFIG_SPARC64
463 .ctl_name = CTL_UNNUMBERED,
464 .procname = "tsb-ratio",
465 .data = &sysctl_tsb_ratio,
466 .maxlen = sizeof (int),
467 .mode = 0644,
468 .proc_handler = &proc_dointvec,
470 #endif
471 #ifdef __hppa__
473 .ctl_name = KERN_HPPA_PWRSW,
474 .procname = "soft-power",
475 .data = &pwrsw_enabled,
476 .maxlen = sizeof (int),
477 .mode = 0644,
478 .proc_handler = &proc_dointvec,
481 .ctl_name = KERN_HPPA_UNALIGNED,
482 .procname = "unaligned-trap",
483 .data = &unaligned_enabled,
484 .maxlen = sizeof (int),
485 .mode = 0644,
486 .proc_handler = &proc_dointvec,
488 #endif
490 .ctl_name = KERN_CTLALTDEL,
491 .procname = "ctrl-alt-del",
492 .data = &C_A_D,
493 .maxlen = sizeof(int),
494 .mode = 0644,
495 .proc_handler = &proc_dointvec,
497 #ifdef CONFIG_FUNCTION_TRACER
499 .ctl_name = CTL_UNNUMBERED,
500 .procname = "ftrace_enabled",
501 .data = &ftrace_enabled,
502 .maxlen = sizeof(int),
503 .mode = 0644,
504 .proc_handler = &ftrace_enable_sysctl,
506 #endif
507 #ifdef CONFIG_STACK_TRACER
509 .ctl_name = CTL_UNNUMBERED,
510 .procname = "stack_tracer_enabled",
511 .data = &stack_tracer_enabled,
512 .maxlen = sizeof(int),
513 .mode = 0644,
514 .proc_handler = &stack_trace_sysctl,
516 #endif
517 #ifdef CONFIG_TRACING
519 .ctl_name = CTL_UNNUMBERED,
520 .procname = "ftrace_dump_on_oops",
521 .data = &ftrace_dump_on_oops,
522 .maxlen = sizeof(int),
523 .mode = 0644,
524 .proc_handler = &proc_dointvec,
526 #endif
527 #ifdef CONFIG_MODULES
529 .ctl_name = KERN_MODPROBE,
530 .procname = "modprobe",
531 .data = &modprobe_path,
532 .maxlen = KMOD_PATH_LEN,
533 .mode = 0644,
534 .proc_handler = &proc_dostring,
535 .strategy = &sysctl_string,
537 #endif
538 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
540 .ctl_name = KERN_HOTPLUG,
541 .procname = "hotplug",
542 .data = &uevent_helper,
543 .maxlen = UEVENT_HELPER_PATH_LEN,
544 .mode = 0644,
545 .proc_handler = &proc_dostring,
546 .strategy = &sysctl_string,
548 #endif
549 #ifdef CONFIG_CHR_DEV_SG
551 .ctl_name = KERN_SG_BIG_BUFF,
552 .procname = "sg-big-buff",
553 .data = &sg_big_buff,
554 .maxlen = sizeof (int),
555 .mode = 0444,
556 .proc_handler = &proc_dointvec,
558 #endif
559 #ifdef CONFIG_BSD_PROCESS_ACCT
561 .ctl_name = KERN_ACCT,
562 .procname = "acct",
563 .data = &acct_parm,
564 .maxlen = 3*sizeof(int),
565 .mode = 0644,
566 .proc_handler = &proc_dointvec,
568 #endif
569 #ifdef CONFIG_MAGIC_SYSRQ
571 .ctl_name = KERN_SYSRQ,
572 .procname = "sysrq",
573 .data = &__sysrq_enabled,
574 .maxlen = sizeof (int),
575 .mode = 0644,
576 .proc_handler = &proc_dointvec,
578 #endif
579 #ifdef CONFIG_PROC_SYSCTL
581 .procname = "cad_pid",
582 .data = NULL,
583 .maxlen = sizeof (int),
584 .mode = 0600,
585 .proc_handler = &proc_do_cad_pid,
587 #endif
589 .ctl_name = KERN_MAX_THREADS,
590 .procname = "threads-max",
591 .data = &max_threads,
592 .maxlen = sizeof(int),
593 .mode = 0644,
594 .proc_handler = &proc_dointvec,
597 .ctl_name = KERN_RANDOM,
598 .procname = "random",
599 .mode = 0555,
600 .child = random_table,
603 .ctl_name = KERN_OVERFLOWUID,
604 .procname = "overflowuid",
605 .data = &overflowuid,
606 .maxlen = sizeof(int),
607 .mode = 0644,
608 .proc_handler = &proc_dointvec_minmax,
609 .strategy = &sysctl_intvec,
610 .extra1 = &minolduid,
611 .extra2 = &maxolduid,
614 .ctl_name = KERN_OVERFLOWGID,
615 .procname = "overflowgid",
616 .data = &overflowgid,
617 .maxlen = sizeof(int),
618 .mode = 0644,
619 .proc_handler = &proc_dointvec_minmax,
620 .strategy = &sysctl_intvec,
621 .extra1 = &minolduid,
622 .extra2 = &maxolduid,
624 #ifdef CONFIG_S390
625 #ifdef CONFIG_MATHEMU
627 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
628 .procname = "ieee_emulation_warnings",
629 .data = &sysctl_ieee_emulation_warnings,
630 .maxlen = sizeof(int),
631 .mode = 0644,
632 .proc_handler = &proc_dointvec,
634 #endif
636 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
637 .procname = "userprocess_debug",
638 .data = &sysctl_userprocess_debug,
639 .maxlen = sizeof(int),
640 .mode = 0644,
641 .proc_handler = &proc_dointvec,
643 #endif
645 .ctl_name = KERN_PIDMAX,
646 .procname = "pid_max",
647 .data = &pid_max,
648 .maxlen = sizeof (int),
649 .mode = 0644,
650 .proc_handler = &proc_dointvec_minmax,
651 .strategy = sysctl_intvec,
652 .extra1 = &pid_max_min,
653 .extra2 = &pid_max_max,
656 .ctl_name = KERN_PANIC_ON_OOPS,
657 .procname = "panic_on_oops",
658 .data = &panic_on_oops,
659 .maxlen = sizeof(int),
660 .mode = 0644,
661 .proc_handler = &proc_dointvec,
663 #if defined CONFIG_PRINTK
665 .ctl_name = KERN_PRINTK,
666 .procname = "printk",
667 .data = &console_loglevel,
668 .maxlen = 4*sizeof(int),
669 .mode = 0644,
670 .proc_handler = &proc_dointvec,
673 .ctl_name = KERN_PRINTK_RATELIMIT,
674 .procname = "printk_ratelimit",
675 .data = &printk_ratelimit_state.interval,
676 .maxlen = sizeof(int),
677 .mode = 0644,
678 .proc_handler = &proc_dointvec_jiffies,
679 .strategy = &sysctl_jiffies,
682 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
683 .procname = "printk_ratelimit_burst",
684 .data = &printk_ratelimit_state.burst,
685 .maxlen = sizeof(int),
686 .mode = 0644,
687 .proc_handler = &proc_dointvec,
689 #endif
691 .ctl_name = KERN_NGROUPS_MAX,
692 .procname = "ngroups_max",
693 .data = &ngroups_max,
694 .maxlen = sizeof (int),
695 .mode = 0444,
696 .proc_handler = &proc_dointvec,
698 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
700 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
701 .procname = "unknown_nmi_panic",
702 .data = &unknown_nmi_panic,
703 .maxlen = sizeof (int),
704 .mode = 0644,
705 .proc_handler = &proc_dointvec,
708 .procname = "nmi_watchdog",
709 .data = &nmi_watchdog_enabled,
710 .maxlen = sizeof (int),
711 .mode = 0644,
712 .proc_handler = &proc_nmi_enabled,
714 #endif
715 #if defined(CONFIG_X86)
717 .ctl_name = KERN_PANIC_ON_NMI,
718 .procname = "panic_on_unrecovered_nmi",
719 .data = &panic_on_unrecovered_nmi,
720 .maxlen = sizeof(int),
721 .mode = 0644,
722 .proc_handler = &proc_dointvec,
725 .ctl_name = KERN_BOOTLOADER_TYPE,
726 .procname = "bootloader_type",
727 .data = &bootloader_type,
728 .maxlen = sizeof (int),
729 .mode = 0444,
730 .proc_handler = &proc_dointvec,
733 .ctl_name = CTL_UNNUMBERED,
734 .procname = "kstack_depth_to_print",
735 .data = &kstack_depth_to_print,
736 .maxlen = sizeof(int),
737 .mode = 0644,
738 .proc_handler = &proc_dointvec,
741 .ctl_name = CTL_UNNUMBERED,
742 .procname = "io_delay_type",
743 .data = &io_delay_type,
744 .maxlen = sizeof(int),
745 .mode = 0644,
746 .proc_handler = &proc_dointvec,
748 #endif
749 #if defined(CONFIG_MMU)
751 .ctl_name = KERN_RANDOMIZE,
752 .procname = "randomize_va_space",
753 .data = &randomize_va_space,
754 .maxlen = sizeof(int),
755 .mode = 0644,
756 .proc_handler = &proc_dointvec,
758 #endif
759 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
761 .ctl_name = KERN_SPIN_RETRY,
762 .procname = "spin_retry",
763 .data = &spin_retry,
764 .maxlen = sizeof (int),
765 .mode = 0644,
766 .proc_handler = &proc_dointvec,
768 #endif
769 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
771 .procname = "acpi_video_flags",
772 .data = &acpi_realmode_flags,
773 .maxlen = sizeof (unsigned long),
774 .mode = 0644,
775 .proc_handler = &proc_doulongvec_minmax,
777 #endif
778 #ifdef CONFIG_IA64
780 .ctl_name = KERN_IA64_UNALIGNED,
781 .procname = "ignore-unaligned-usertrap",
782 .data = &no_unaligned_warning,
783 .maxlen = sizeof (int),
784 .mode = 0644,
785 .proc_handler = &proc_dointvec,
788 .ctl_name = CTL_UNNUMBERED,
789 .procname = "unaligned-dump-stack",
790 .data = &unaligned_dump_stack,
791 .maxlen = sizeof (int),
792 .mode = 0644,
793 .proc_handler = &proc_dointvec,
795 #endif
796 #ifdef CONFIG_DETECT_SOFTLOCKUP
798 .ctl_name = CTL_UNNUMBERED,
799 .procname = "softlockup_panic",
800 .data = &softlockup_panic,
801 .maxlen = sizeof(int),
802 .mode = 0644,
803 .proc_handler = &proc_dointvec_minmax,
804 .strategy = &sysctl_intvec,
805 .extra1 = &zero,
806 .extra2 = &one,
809 .ctl_name = CTL_UNNUMBERED,
810 .procname = "softlockup_thresh",
811 .data = &softlockup_thresh,
812 .maxlen = sizeof(int),
813 .mode = 0644,
814 .proc_handler = &proc_dosoftlockup_thresh,
815 .strategy = &sysctl_intvec,
816 .extra1 = &neg_one,
817 .extra2 = &sixty,
819 #endif
820 #ifdef CONFIG_DETECT_HUNG_TASK
822 .ctl_name = CTL_UNNUMBERED,
823 .procname = "hung_task_panic",
824 .data = &sysctl_hung_task_panic,
825 .maxlen = sizeof(int),
826 .mode = 0644,
827 .proc_handler = &proc_dointvec_minmax,
828 .strategy = &sysctl_intvec,
829 .extra1 = &zero,
830 .extra2 = &one,
833 .ctl_name = CTL_UNNUMBERED,
834 .procname = "hung_task_check_count",
835 .data = &sysctl_hung_task_check_count,
836 .maxlen = sizeof(unsigned long),
837 .mode = 0644,
838 .proc_handler = &proc_doulongvec_minmax,
839 .strategy = &sysctl_intvec,
842 .ctl_name = CTL_UNNUMBERED,
843 .procname = "hung_task_timeout_secs",
844 .data = &sysctl_hung_task_timeout_secs,
845 .maxlen = sizeof(unsigned long),
846 .mode = 0644,
847 .proc_handler = &proc_dohung_task_timeout_secs,
848 .strategy = &sysctl_intvec,
851 .ctl_name = CTL_UNNUMBERED,
852 .procname = "hung_task_warnings",
853 .data = &sysctl_hung_task_warnings,
854 .maxlen = sizeof(unsigned long),
855 .mode = 0644,
856 .proc_handler = &proc_doulongvec_minmax,
857 .strategy = &sysctl_intvec,
859 #endif
860 #ifdef CONFIG_COMPAT
862 .ctl_name = KERN_COMPAT_LOG,
863 .procname = "compat-log",
864 .data = &compat_log,
865 .maxlen = sizeof (int),
866 .mode = 0644,
867 .proc_handler = &proc_dointvec,
869 #endif
870 #ifdef CONFIG_RT_MUTEXES
872 .ctl_name = KERN_MAX_LOCK_DEPTH,
873 .procname = "max_lock_depth",
874 .data = &max_lock_depth,
875 .maxlen = sizeof(int),
876 .mode = 0644,
877 .proc_handler = &proc_dointvec,
879 #endif
881 .ctl_name = CTL_UNNUMBERED,
882 .procname = "poweroff_cmd",
883 .data = &poweroff_cmd,
884 .maxlen = POWEROFF_CMD_PATH_LEN,
885 .mode = 0644,
886 .proc_handler = &proc_dostring,
887 .strategy = &sysctl_string,
889 #ifdef CONFIG_KEYS
891 .ctl_name = CTL_UNNUMBERED,
892 .procname = "keys",
893 .mode = 0555,
894 .child = key_sysctls,
896 #endif
897 #ifdef CONFIG_RCU_TORTURE_TEST
899 .ctl_name = CTL_UNNUMBERED,
900 .procname = "rcutorture_runnable",
901 .data = &rcutorture_runnable,
902 .maxlen = sizeof(int),
903 .mode = 0644,
904 .proc_handler = &proc_dointvec,
906 #endif
907 #ifdef CONFIG_SLOW_WORK
909 .ctl_name = CTL_UNNUMBERED,
910 .procname = "slow-work",
911 .mode = 0555,
912 .child = slow_work_sysctls,
914 #endif
916 * NOTE: do not add new entries to this table unless you have read
917 * Documentation/sysctl/ctl_unnumbered.txt
919 { .ctl_name = 0 }
922 static struct ctl_table vm_table[] = {
924 .ctl_name = VM_OVERCOMMIT_MEMORY,
925 .procname = "overcommit_memory",
926 .data = &sysctl_overcommit_memory,
927 .maxlen = sizeof(sysctl_overcommit_memory),
928 .mode = 0644,
929 .proc_handler = &proc_dointvec,
932 .ctl_name = VM_PANIC_ON_OOM,
933 .procname = "panic_on_oom",
934 .data = &sysctl_panic_on_oom,
935 .maxlen = sizeof(sysctl_panic_on_oom),
936 .mode = 0644,
937 .proc_handler = &proc_dointvec,
940 .ctl_name = CTL_UNNUMBERED,
941 .procname = "oom_kill_allocating_task",
942 .data = &sysctl_oom_kill_allocating_task,
943 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
944 .mode = 0644,
945 .proc_handler = &proc_dointvec,
948 .ctl_name = CTL_UNNUMBERED,
949 .procname = "oom_dump_tasks",
950 .data = &sysctl_oom_dump_tasks,
951 .maxlen = sizeof(sysctl_oom_dump_tasks),
952 .mode = 0644,
953 .proc_handler = &proc_dointvec,
956 .ctl_name = VM_OVERCOMMIT_RATIO,
957 .procname = "overcommit_ratio",
958 .data = &sysctl_overcommit_ratio,
959 .maxlen = sizeof(sysctl_overcommit_ratio),
960 .mode = 0644,
961 .proc_handler = &proc_dointvec,
964 .ctl_name = VM_PAGE_CLUSTER,
965 .procname = "page-cluster",
966 .data = &page_cluster,
967 .maxlen = sizeof(int),
968 .mode = 0644,
969 .proc_handler = &proc_dointvec,
972 .ctl_name = VM_DIRTY_BACKGROUND,
973 .procname = "dirty_background_ratio",
974 .data = &dirty_background_ratio,
975 .maxlen = sizeof(dirty_background_ratio),
976 .mode = 0644,
977 .proc_handler = &dirty_background_ratio_handler,
978 .strategy = &sysctl_intvec,
979 .extra1 = &zero,
980 .extra2 = &one_hundred,
983 .ctl_name = CTL_UNNUMBERED,
984 .procname = "dirty_background_bytes",
985 .data = &dirty_background_bytes,
986 .maxlen = sizeof(dirty_background_bytes),
987 .mode = 0644,
988 .proc_handler = &dirty_background_bytes_handler,
989 .strategy = &sysctl_intvec,
990 .extra1 = &one_ul,
993 .ctl_name = VM_DIRTY_RATIO,
994 .procname = "dirty_ratio",
995 .data = &vm_dirty_ratio,
996 .maxlen = sizeof(vm_dirty_ratio),
997 .mode = 0644,
998 .proc_handler = &dirty_ratio_handler,
999 .strategy = &sysctl_intvec,
1000 .extra1 = &zero,
1001 .extra2 = &one_hundred,
1004 .ctl_name = CTL_UNNUMBERED,
1005 .procname = "dirty_bytes",
1006 .data = &vm_dirty_bytes,
1007 .maxlen = sizeof(vm_dirty_bytes),
1008 .mode = 0644,
1009 .proc_handler = &dirty_bytes_handler,
1010 .strategy = &sysctl_intvec,
1011 .extra1 = &dirty_bytes_min,
1014 .procname = "dirty_writeback_centisecs",
1015 .data = &dirty_writeback_interval,
1016 .maxlen = sizeof(dirty_writeback_interval),
1017 .mode = 0644,
1018 .proc_handler = &dirty_writeback_centisecs_handler,
1021 .procname = "dirty_expire_centisecs",
1022 .data = &dirty_expire_interval,
1023 .maxlen = sizeof(dirty_expire_interval),
1024 .mode = 0644,
1025 .proc_handler = &proc_dointvec,
1028 .ctl_name = VM_NR_PDFLUSH_THREADS,
1029 .procname = "nr_pdflush_threads",
1030 .data = &nr_pdflush_threads,
1031 .maxlen = sizeof nr_pdflush_threads,
1032 .mode = 0444 /* read-only*/,
1033 .proc_handler = &proc_dointvec,
1036 .ctl_name = VM_SWAPPINESS,
1037 .procname = "swappiness",
1038 .data = &vm_swappiness,
1039 .maxlen = sizeof(vm_swappiness),
1040 .mode = 0644,
1041 .proc_handler = &proc_dointvec_minmax,
1042 .strategy = &sysctl_intvec,
1043 .extra1 = &zero,
1044 .extra2 = &one_hundred,
1046 #ifdef CONFIG_HUGETLB_PAGE
1048 .procname = "nr_hugepages",
1049 .data = NULL,
1050 .maxlen = sizeof(unsigned long),
1051 .mode = 0644,
1052 .proc_handler = &hugetlb_sysctl_handler,
1053 .extra1 = (void *)&hugetlb_zero,
1054 .extra2 = (void *)&hugetlb_infinity,
1057 .ctl_name = VM_HUGETLB_GROUP,
1058 .procname = "hugetlb_shm_group",
1059 .data = &sysctl_hugetlb_shm_group,
1060 .maxlen = sizeof(gid_t),
1061 .mode = 0644,
1062 .proc_handler = &proc_dointvec,
1065 .ctl_name = CTL_UNNUMBERED,
1066 .procname = "hugepages_treat_as_movable",
1067 .data = &hugepages_treat_as_movable,
1068 .maxlen = sizeof(int),
1069 .mode = 0644,
1070 .proc_handler = &hugetlb_treat_movable_handler,
1073 .ctl_name = CTL_UNNUMBERED,
1074 .procname = "nr_overcommit_hugepages",
1075 .data = NULL,
1076 .maxlen = sizeof(unsigned long),
1077 .mode = 0644,
1078 .proc_handler = &hugetlb_overcommit_handler,
1079 .extra1 = (void *)&hugetlb_zero,
1080 .extra2 = (void *)&hugetlb_infinity,
1082 #endif
1084 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
1085 .procname = "lowmem_reserve_ratio",
1086 .data = &sysctl_lowmem_reserve_ratio,
1087 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1088 .mode = 0644,
1089 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
1090 .strategy = &sysctl_intvec,
1093 .ctl_name = VM_DROP_PAGECACHE,
1094 .procname = "drop_caches",
1095 .data = &sysctl_drop_caches,
1096 .maxlen = sizeof(int),
1097 .mode = 0644,
1098 .proc_handler = drop_caches_sysctl_handler,
1099 .strategy = &sysctl_intvec,
1102 .ctl_name = VM_MIN_FREE_KBYTES,
1103 .procname = "min_free_kbytes",
1104 .data = &min_free_kbytes,
1105 .maxlen = sizeof(min_free_kbytes),
1106 .mode = 0644,
1107 .proc_handler = &min_free_kbytes_sysctl_handler,
1108 .strategy = &sysctl_intvec,
1109 .extra1 = &zero,
1112 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
1113 .procname = "percpu_pagelist_fraction",
1114 .data = &percpu_pagelist_fraction,
1115 .maxlen = sizeof(percpu_pagelist_fraction),
1116 .mode = 0644,
1117 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
1118 .strategy = &sysctl_intvec,
1119 .extra1 = &min_percpu_pagelist_fract,
1121 #ifdef CONFIG_MMU
1123 .ctl_name = VM_MAX_MAP_COUNT,
1124 .procname = "max_map_count",
1125 .data = &sysctl_max_map_count,
1126 .maxlen = sizeof(sysctl_max_map_count),
1127 .mode = 0644,
1128 .proc_handler = &proc_dointvec
1130 #else
1132 .ctl_name = CTL_UNNUMBERED,
1133 .procname = "nr_trim_pages",
1134 .data = &sysctl_nr_trim_pages,
1135 .maxlen = sizeof(sysctl_nr_trim_pages),
1136 .mode = 0644,
1137 .proc_handler = &proc_dointvec_minmax,
1138 .strategy = &sysctl_intvec,
1139 .extra1 = &zero,
1141 #endif
1143 .ctl_name = VM_LAPTOP_MODE,
1144 .procname = "laptop_mode",
1145 .data = &laptop_mode,
1146 .maxlen = sizeof(laptop_mode),
1147 .mode = 0644,
1148 .proc_handler = &proc_dointvec_jiffies,
1149 .strategy = &sysctl_jiffies,
1152 .ctl_name = VM_BLOCK_DUMP,
1153 .procname = "block_dump",
1154 .data = &block_dump,
1155 .maxlen = sizeof(block_dump),
1156 .mode = 0644,
1157 .proc_handler = &proc_dointvec,
1158 .strategy = &sysctl_intvec,
1159 .extra1 = &zero,
1162 .ctl_name = VM_VFS_CACHE_PRESSURE,
1163 .procname = "vfs_cache_pressure",
1164 .data = &sysctl_vfs_cache_pressure,
1165 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1166 .mode = 0644,
1167 .proc_handler = &proc_dointvec,
1168 .strategy = &sysctl_intvec,
1169 .extra1 = &zero,
1171 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1173 .ctl_name = VM_LEGACY_VA_LAYOUT,
1174 .procname = "legacy_va_layout",
1175 .data = &sysctl_legacy_va_layout,
1176 .maxlen = sizeof(sysctl_legacy_va_layout),
1177 .mode = 0644,
1178 .proc_handler = &proc_dointvec,
1179 .strategy = &sysctl_intvec,
1180 .extra1 = &zero,
1182 #endif
1183 #ifdef CONFIG_NUMA
1185 .ctl_name = VM_ZONE_RECLAIM_MODE,
1186 .procname = "zone_reclaim_mode",
1187 .data = &zone_reclaim_mode,
1188 .maxlen = sizeof(zone_reclaim_mode),
1189 .mode = 0644,
1190 .proc_handler = &proc_dointvec,
1191 .strategy = &sysctl_intvec,
1192 .extra1 = &zero,
1195 .ctl_name = VM_MIN_UNMAPPED,
1196 .procname = "min_unmapped_ratio",
1197 .data = &sysctl_min_unmapped_ratio,
1198 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1199 .mode = 0644,
1200 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
1201 .strategy = &sysctl_intvec,
1202 .extra1 = &zero,
1203 .extra2 = &one_hundred,
1206 .ctl_name = VM_MIN_SLAB,
1207 .procname = "min_slab_ratio",
1208 .data = &sysctl_min_slab_ratio,
1209 .maxlen = sizeof(sysctl_min_slab_ratio),
1210 .mode = 0644,
1211 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
1212 .strategy = &sysctl_intvec,
1213 .extra1 = &zero,
1214 .extra2 = &one_hundred,
1216 #endif
1217 #ifdef CONFIG_SMP
1219 .ctl_name = CTL_UNNUMBERED,
1220 .procname = "stat_interval",
1221 .data = &sysctl_stat_interval,
1222 .maxlen = sizeof(sysctl_stat_interval),
1223 .mode = 0644,
1224 .proc_handler = &proc_dointvec_jiffies,
1225 .strategy = &sysctl_jiffies,
1227 #endif
1229 .ctl_name = CTL_UNNUMBERED,
1230 .procname = "mmap_min_addr",
1231 .data = &mmap_min_addr,
1232 .maxlen = sizeof(unsigned long),
1233 .mode = 0644,
1234 .proc_handler = &proc_doulongvec_minmax,
1236 #ifdef CONFIG_NUMA
1238 .ctl_name = CTL_UNNUMBERED,
1239 .procname = "numa_zonelist_order",
1240 .data = &numa_zonelist_order,
1241 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1242 .mode = 0644,
1243 .proc_handler = &numa_zonelist_order_handler,
1244 .strategy = &sysctl_string,
1246 #endif
1247 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1248 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1250 .ctl_name = VM_VDSO_ENABLED,
1251 .procname = "vdso_enabled",
1252 .data = &vdso_enabled,
1253 .maxlen = sizeof(vdso_enabled),
1254 .mode = 0644,
1255 .proc_handler = &proc_dointvec,
1256 .strategy = &sysctl_intvec,
1257 .extra1 = &zero,
1259 #endif
1260 #ifdef CONFIG_HIGHMEM
1262 .ctl_name = CTL_UNNUMBERED,
1263 .procname = "highmem_is_dirtyable",
1264 .data = &vm_highmem_is_dirtyable,
1265 .maxlen = sizeof(vm_highmem_is_dirtyable),
1266 .mode = 0644,
1267 .proc_handler = &proc_dointvec_minmax,
1268 .strategy = &sysctl_intvec,
1269 .extra1 = &zero,
1270 .extra2 = &one,
1272 #endif
1273 #ifdef CONFIG_UNEVICTABLE_LRU
1275 .ctl_name = CTL_UNNUMBERED,
1276 .procname = "scan_unevictable_pages",
1277 .data = &scan_unevictable_pages,
1278 .maxlen = sizeof(scan_unevictable_pages),
1279 .mode = 0644,
1280 .proc_handler = &scan_unevictable_handler,
1282 #endif
1284 * NOTE: do not add new entries to this table unless you have read
1285 * Documentation/sysctl/ctl_unnumbered.txt
1287 { .ctl_name = 0 }
1290 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1291 static struct ctl_table binfmt_misc_table[] = {
1292 { .ctl_name = 0 }
1294 #endif
1296 static struct ctl_table fs_table[] = {
1298 .ctl_name = FS_NRINODE,
1299 .procname = "inode-nr",
1300 .data = &inodes_stat,
1301 .maxlen = 2*sizeof(int),
1302 .mode = 0444,
1303 .proc_handler = &proc_dointvec,
1306 .ctl_name = FS_STATINODE,
1307 .procname = "inode-state",
1308 .data = &inodes_stat,
1309 .maxlen = 7*sizeof(int),
1310 .mode = 0444,
1311 .proc_handler = &proc_dointvec,
1314 .procname = "file-nr",
1315 .data = &files_stat,
1316 .maxlen = 3*sizeof(int),
1317 .mode = 0444,
1318 .proc_handler = &proc_nr_files,
1321 .ctl_name = FS_MAXFILE,
1322 .procname = "file-max",
1323 .data = &files_stat.max_files,
1324 .maxlen = sizeof(int),
1325 .mode = 0644,
1326 .proc_handler = &proc_dointvec,
1329 .ctl_name = CTL_UNNUMBERED,
1330 .procname = "nr_open",
1331 .data = &sysctl_nr_open,
1332 .maxlen = sizeof(int),
1333 .mode = 0644,
1334 .proc_handler = &proc_dointvec_minmax,
1335 .extra1 = &sysctl_nr_open_min,
1336 .extra2 = &sysctl_nr_open_max,
1339 .ctl_name = FS_DENTRY,
1340 .procname = "dentry-state",
1341 .data = &dentry_stat,
1342 .maxlen = 6*sizeof(int),
1343 .mode = 0444,
1344 .proc_handler = &proc_dointvec,
1347 .ctl_name = FS_OVERFLOWUID,
1348 .procname = "overflowuid",
1349 .data = &fs_overflowuid,
1350 .maxlen = sizeof(int),
1351 .mode = 0644,
1352 .proc_handler = &proc_dointvec_minmax,
1353 .strategy = &sysctl_intvec,
1354 .extra1 = &minolduid,
1355 .extra2 = &maxolduid,
1358 .ctl_name = FS_OVERFLOWGID,
1359 .procname = "overflowgid",
1360 .data = &fs_overflowgid,
1361 .maxlen = sizeof(int),
1362 .mode = 0644,
1363 .proc_handler = &proc_dointvec_minmax,
1364 .strategy = &sysctl_intvec,
1365 .extra1 = &minolduid,
1366 .extra2 = &maxolduid,
1368 #ifdef CONFIG_FILE_LOCKING
1370 .ctl_name = FS_LEASES,
1371 .procname = "leases-enable",
1372 .data = &leases_enable,
1373 .maxlen = sizeof(int),
1374 .mode = 0644,
1375 .proc_handler = &proc_dointvec,
1377 #endif
1378 #ifdef CONFIG_DNOTIFY
1380 .ctl_name = FS_DIR_NOTIFY,
1381 .procname = "dir-notify-enable",
1382 .data = &dir_notify_enable,
1383 .maxlen = sizeof(int),
1384 .mode = 0644,
1385 .proc_handler = &proc_dointvec,
1387 #endif
1388 #ifdef CONFIG_MMU
1389 #ifdef CONFIG_FILE_LOCKING
1391 .ctl_name = FS_LEASE_TIME,
1392 .procname = "lease-break-time",
1393 .data = &lease_break_time,
1394 .maxlen = sizeof(int),
1395 .mode = 0644,
1396 .proc_handler = &proc_dointvec,
1398 #endif
1399 #ifdef CONFIG_AIO
1401 .procname = "aio-nr",
1402 .data = &aio_nr,
1403 .maxlen = sizeof(aio_nr),
1404 .mode = 0444,
1405 .proc_handler = &proc_doulongvec_minmax,
1408 .procname = "aio-max-nr",
1409 .data = &aio_max_nr,
1410 .maxlen = sizeof(aio_max_nr),
1411 .mode = 0644,
1412 .proc_handler = &proc_doulongvec_minmax,
1414 #endif /* CONFIG_AIO */
1415 #ifdef CONFIG_INOTIFY_USER
1417 .ctl_name = FS_INOTIFY,
1418 .procname = "inotify",
1419 .mode = 0555,
1420 .child = inotify_table,
1422 #endif
1423 #ifdef CONFIG_EPOLL
1425 .procname = "epoll",
1426 .mode = 0555,
1427 .child = epoll_table,
1429 #endif
1430 #endif
1432 .ctl_name = KERN_SETUID_DUMPABLE,
1433 .procname = "suid_dumpable",
1434 .data = &suid_dumpable,
1435 .maxlen = sizeof(int),
1436 .mode = 0644,
1437 .proc_handler = &proc_dointvec_minmax,
1438 .strategy = &sysctl_intvec,
1439 .extra1 = &zero,
1440 .extra2 = &two,
1442 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1444 .ctl_name = CTL_UNNUMBERED,
1445 .procname = "binfmt_misc",
1446 .mode = 0555,
1447 .child = binfmt_misc_table,
1449 #endif
1451 * NOTE: do not add new entries to this table unless you have read
1452 * Documentation/sysctl/ctl_unnumbered.txt
1454 { .ctl_name = 0 }
1457 static struct ctl_table debug_table[] = {
1458 #if defined(CONFIG_X86) || defined(CONFIG_PPC)
1460 .ctl_name = CTL_UNNUMBERED,
1461 .procname = "exception-trace",
1462 .data = &show_unhandled_signals,
1463 .maxlen = sizeof(int),
1464 .mode = 0644,
1465 .proc_handler = proc_dointvec
1467 #endif
1468 { .ctl_name = 0 }
1471 static struct ctl_table dev_table[] = {
1472 { .ctl_name = 0 }
1475 static DEFINE_SPINLOCK(sysctl_lock);
1477 /* called under sysctl_lock */
1478 static int use_table(struct ctl_table_header *p)
1480 if (unlikely(p->unregistering))
1481 return 0;
1482 p->used++;
1483 return 1;
1486 /* called under sysctl_lock */
1487 static void unuse_table(struct ctl_table_header *p)
1489 if (!--p->used)
1490 if (unlikely(p->unregistering))
1491 complete(p->unregistering);
1494 /* called under sysctl_lock, will reacquire if has to wait */
1495 static void start_unregistering(struct ctl_table_header *p)
1498 * if p->used is 0, nobody will ever touch that entry again;
1499 * we'll eliminate all paths to it before dropping sysctl_lock
1501 if (unlikely(p->used)) {
1502 struct completion wait;
1503 init_completion(&wait);
1504 p->unregistering = &wait;
1505 spin_unlock(&sysctl_lock);
1506 wait_for_completion(&wait);
1507 spin_lock(&sysctl_lock);
1508 } else {
1509 /* anything non-NULL; we'll never dereference it */
1510 p->unregistering = ERR_PTR(-EINVAL);
1513 * do not remove from the list until nobody holds it; walking the
1514 * list in do_sysctl() relies on that.
1516 list_del_init(&p->ctl_entry);
1519 void sysctl_head_get(struct ctl_table_header *head)
1521 spin_lock(&sysctl_lock);
1522 head->count++;
1523 spin_unlock(&sysctl_lock);
1526 void sysctl_head_put(struct ctl_table_header *head)
1528 spin_lock(&sysctl_lock);
1529 if (!--head->count)
1530 kfree(head);
1531 spin_unlock(&sysctl_lock);
1534 struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
1536 if (!head)
1537 BUG();
1538 spin_lock(&sysctl_lock);
1539 if (!use_table(head))
1540 head = ERR_PTR(-ENOENT);
1541 spin_unlock(&sysctl_lock);
1542 return head;
1545 void sysctl_head_finish(struct ctl_table_header *head)
1547 if (!head)
1548 return;
1549 spin_lock(&sysctl_lock);
1550 unuse_table(head);
1551 spin_unlock(&sysctl_lock);
1554 static struct ctl_table_set *
1555 lookup_header_set(struct ctl_table_root *root, struct nsproxy *namespaces)
1557 struct ctl_table_set *set = &root->default_set;
1558 if (root->lookup)
1559 set = root->lookup(root, namespaces);
1560 return set;
1563 static struct list_head *
1564 lookup_header_list(struct ctl_table_root *root, struct nsproxy *namespaces)
1566 struct ctl_table_set *set = lookup_header_set(root, namespaces);
1567 return &set->list;
1570 struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
1571 struct ctl_table_header *prev)
1573 struct ctl_table_root *root;
1574 struct list_head *header_list;
1575 struct ctl_table_header *head;
1576 struct list_head *tmp;
1578 spin_lock(&sysctl_lock);
1579 if (prev) {
1580 head = prev;
1581 tmp = &prev->ctl_entry;
1582 unuse_table(prev);
1583 goto next;
1585 tmp = &root_table_header.ctl_entry;
1586 for (;;) {
1587 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1589 if (!use_table(head))
1590 goto next;
1591 spin_unlock(&sysctl_lock);
1592 return head;
1593 next:
1594 root = head->root;
1595 tmp = tmp->next;
1596 header_list = lookup_header_list(root, namespaces);
1597 if (tmp != header_list)
1598 continue;
1600 do {
1601 root = list_entry(root->root_list.next,
1602 struct ctl_table_root, root_list);
1603 if (root == &sysctl_table_root)
1604 goto out;
1605 header_list = lookup_header_list(root, namespaces);
1606 } while (list_empty(header_list));
1607 tmp = header_list->next;
1609 out:
1610 spin_unlock(&sysctl_lock);
1611 return NULL;
1614 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1616 return __sysctl_head_next(current->nsproxy, prev);
1619 void register_sysctl_root(struct ctl_table_root *root)
1621 spin_lock(&sysctl_lock);
1622 list_add_tail(&root->root_list, &sysctl_table_root.root_list);
1623 spin_unlock(&sysctl_lock);
1626 #ifdef CONFIG_SYSCTL_SYSCALL
1627 /* Perform the actual read/write of a sysctl table entry. */
1628 static int do_sysctl_strategy(struct ctl_table_root *root,
1629 struct ctl_table *table,
1630 void __user *oldval, size_t __user *oldlenp,
1631 void __user *newval, size_t newlen)
1633 int op = 0, rc;
1635 if (oldval)
1636 op |= MAY_READ;
1637 if (newval)
1638 op |= MAY_WRITE;
1639 if (sysctl_perm(root, table, op))
1640 return -EPERM;
1642 if (table->strategy) {
1643 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1644 if (rc < 0)
1645 return rc;
1646 if (rc > 0)
1647 return 0;
1650 /* If there is no strategy routine, or if the strategy returns
1651 * zero, proceed with automatic r/w */
1652 if (table->data && table->maxlen) {
1653 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1654 if (rc < 0)
1655 return rc;
1657 return 0;
1660 static int parse_table(int __user *name, int nlen,
1661 void __user *oldval, size_t __user *oldlenp,
1662 void __user *newval, size_t newlen,
1663 struct ctl_table_root *root,
1664 struct ctl_table *table)
1666 int n;
1667 repeat:
1668 if (!nlen)
1669 return -ENOTDIR;
1670 if (get_user(n, name))
1671 return -EFAULT;
1672 for ( ; table->ctl_name || table->procname; table++) {
1673 if (!table->ctl_name)
1674 continue;
1675 if (n == table->ctl_name) {
1676 int error;
1677 if (table->child) {
1678 if (sysctl_perm(root, table, MAY_EXEC))
1679 return -EPERM;
1680 name++;
1681 nlen--;
1682 table = table->child;
1683 goto repeat;
1685 error = do_sysctl_strategy(root, table,
1686 oldval, oldlenp,
1687 newval, newlen);
1688 return error;
1691 return -ENOTDIR;
1694 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1695 void __user *newval, size_t newlen)
1697 struct ctl_table_header *head;
1698 int error = -ENOTDIR;
1700 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1701 return -ENOTDIR;
1702 if (oldval) {
1703 int old_len;
1704 if (!oldlenp || get_user(old_len, oldlenp))
1705 return -EFAULT;
1708 for (head = sysctl_head_next(NULL); head;
1709 head = sysctl_head_next(head)) {
1710 error = parse_table(name, nlen, oldval, oldlenp,
1711 newval, newlen,
1712 head->root, head->ctl_table);
1713 if (error != -ENOTDIR) {
1714 sysctl_head_finish(head);
1715 break;
1718 return error;
1721 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
1723 struct __sysctl_args tmp;
1724 int error;
1726 if (copy_from_user(&tmp, args, sizeof(tmp)))
1727 return -EFAULT;
1729 error = deprecated_sysctl_warning(&tmp);
1730 if (error)
1731 goto out;
1733 lock_kernel();
1734 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1735 tmp.newval, tmp.newlen);
1736 unlock_kernel();
1737 out:
1738 return error;
1740 #endif /* CONFIG_SYSCTL_SYSCALL */
1743 * sysctl_perm does NOT grant the superuser all rights automatically, because
1744 * some sysctl variables are readonly even to root.
1747 static int test_perm(int mode, int op)
1749 if (!current_euid())
1750 mode >>= 6;
1751 else if (in_egroup_p(0))
1752 mode >>= 3;
1753 if ((op & ~mode & (MAY_READ|MAY_WRITE|MAY_EXEC)) == 0)
1754 return 0;
1755 return -EACCES;
1758 int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
1760 int error;
1761 int mode;
1763 error = security_sysctl(table, op & (MAY_READ | MAY_WRITE | MAY_EXEC));
1764 if (error)
1765 return error;
1767 if (root->permissions)
1768 mode = root->permissions(root, current->nsproxy, table);
1769 else
1770 mode = table->mode;
1772 return test_perm(mode, op);
1775 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1777 for (; table->ctl_name || table->procname; table++) {
1778 table->parent = parent;
1779 if (table->child)
1780 sysctl_set_parent(table, table->child);
1784 static __init int sysctl_init(void)
1786 sysctl_set_parent(NULL, root_table);
1787 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1789 int err;
1790 err = sysctl_check_table(current->nsproxy, root_table);
1792 #endif
1793 return 0;
1796 core_initcall(sysctl_init);
1798 static struct ctl_table *is_branch_in(struct ctl_table *branch,
1799 struct ctl_table *table)
1801 struct ctl_table *p;
1802 const char *s = branch->procname;
1804 /* branch should have named subdirectory as its first element */
1805 if (!s || !branch->child)
1806 return NULL;
1808 /* ... and nothing else */
1809 if (branch[1].procname || branch[1].ctl_name)
1810 return NULL;
1812 /* table should contain subdirectory with the same name */
1813 for (p = table; p->procname || p->ctl_name; p++) {
1814 if (!p->child)
1815 continue;
1816 if (p->procname && strcmp(p->procname, s) == 0)
1817 return p;
1819 return NULL;
1822 /* see if attaching q to p would be an improvement */
1823 static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
1825 struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
1826 struct ctl_table *next;
1827 int is_better = 0;
1828 int not_in_parent = !p->attached_by;
1830 while ((next = is_branch_in(by, to)) != NULL) {
1831 if (by == q->attached_by)
1832 is_better = 1;
1833 if (to == p->attached_by)
1834 not_in_parent = 1;
1835 by = by->child;
1836 to = next->child;
1839 if (is_better && not_in_parent) {
1840 q->attached_by = by;
1841 q->attached_to = to;
1842 q->parent = p;
1847 * __register_sysctl_paths - register a sysctl hierarchy
1848 * @root: List of sysctl headers to register on
1849 * @namespaces: Data to compute which lists of sysctl entries are visible
1850 * @path: The path to the directory the sysctl table is in.
1851 * @table: the top-level table structure
1853 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1854 * array. A completely 0 filled entry terminates the table.
1856 * The members of the &struct ctl_table structure are used as follows:
1858 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1859 * must be unique within that level of sysctl
1861 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1862 * enter a sysctl file
1864 * data - a pointer to data for use by proc_handler
1866 * maxlen - the maximum size in bytes of the data
1868 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1870 * child - a pointer to the child sysctl table if this entry is a directory, or
1871 * %NULL.
1873 * proc_handler - the text handler routine (described below)
1875 * strategy - the strategy routine (described below)
1877 * de - for internal use by the sysctl routines
1879 * extra1, extra2 - extra pointers usable by the proc handler routines
1881 * Leaf nodes in the sysctl tree will be represented by a single file
1882 * under /proc; non-leaf nodes will be represented by directories.
1884 * sysctl(2) can automatically manage read and write requests through
1885 * the sysctl table. The data and maxlen fields of the ctl_table
1886 * struct enable minimal validation of the values being written to be
1887 * performed, and the mode field allows minimal authentication.
1889 * More sophisticated management can be enabled by the provision of a
1890 * strategy routine with the table entry. This will be called before
1891 * any automatic read or write of the data is performed.
1893 * The strategy routine may return
1895 * < 0 - Error occurred (error is passed to user process)
1897 * 0 - OK - proceed with automatic read or write.
1899 * > 0 - OK - read or write has been done by the strategy routine, so
1900 * return immediately.
1902 * There must be a proc_handler routine for any terminal nodes
1903 * mirrored under /proc/sys (non-terminals are handled by a built-in
1904 * directory handler). Several default handlers are available to
1905 * cover common cases -
1907 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1908 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1909 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1911 * It is the handler's job to read the input buffer from user memory
1912 * and process it. The handler should return 0 on success.
1914 * This routine returns %NULL on a failure to register, and a pointer
1915 * to the table header on success.
1917 struct ctl_table_header *__register_sysctl_paths(
1918 struct ctl_table_root *root,
1919 struct nsproxy *namespaces,
1920 const struct ctl_path *path, struct ctl_table *table)
1922 struct ctl_table_header *header;
1923 struct ctl_table *new, **prevp;
1924 unsigned int n, npath;
1925 struct ctl_table_set *set;
1927 /* Count the path components */
1928 for (npath = 0; path[npath].ctl_name || path[npath].procname; ++npath)
1932 * For each path component, allocate a 2-element ctl_table array.
1933 * The first array element will be filled with the sysctl entry
1934 * for this, the second will be the sentinel (ctl_name == 0).
1936 * We allocate everything in one go so that we don't have to
1937 * worry about freeing additional memory in unregister_sysctl_table.
1939 header = kzalloc(sizeof(struct ctl_table_header) +
1940 (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL);
1941 if (!header)
1942 return NULL;
1944 new = (struct ctl_table *) (header + 1);
1946 /* Now connect the dots */
1947 prevp = &header->ctl_table;
1948 for (n = 0; n < npath; ++n, ++path) {
1949 /* Copy the procname */
1950 new->procname = path->procname;
1951 new->ctl_name = path->ctl_name;
1952 new->mode = 0555;
1954 *prevp = new;
1955 prevp = &new->child;
1957 new += 2;
1959 *prevp = table;
1960 header->ctl_table_arg = table;
1962 INIT_LIST_HEAD(&header->ctl_entry);
1963 header->used = 0;
1964 header->unregistering = NULL;
1965 header->root = root;
1966 sysctl_set_parent(NULL, header->ctl_table);
1967 header->count = 1;
1968 #ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1969 if (sysctl_check_table(namespaces, header->ctl_table)) {
1970 kfree(header);
1971 return NULL;
1973 #endif
1974 spin_lock(&sysctl_lock);
1975 header->set = lookup_header_set(root, namespaces);
1976 header->attached_by = header->ctl_table;
1977 header->attached_to = root_table;
1978 header->parent = &root_table_header;
1979 for (set = header->set; set; set = set->parent) {
1980 struct ctl_table_header *p;
1981 list_for_each_entry(p, &set->list, ctl_entry) {
1982 if (p->unregistering)
1983 continue;
1984 try_attach(p, header);
1987 header->parent->count++;
1988 list_add_tail(&header->ctl_entry, &header->set->list);
1989 spin_unlock(&sysctl_lock);
1991 return header;
1995 * register_sysctl_table_path - register a sysctl table hierarchy
1996 * @path: The path to the directory the sysctl table is in.
1997 * @table: the top-level table structure
1999 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
2000 * array. A completely 0 filled entry terminates the table.
2002 * See __register_sysctl_paths for more details.
2004 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2005 struct ctl_table *table)
2007 return __register_sysctl_paths(&sysctl_table_root, current->nsproxy,
2008 path, table);
2012 * register_sysctl_table - register a sysctl table hierarchy
2013 * @table: the top-level table structure
2015 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
2016 * array. A completely 0 filled entry terminates the table.
2018 * See register_sysctl_paths for more details.
2020 struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
2022 static const struct ctl_path null_path[] = { {} };
2024 return register_sysctl_paths(null_path, table);
2028 * unregister_sysctl_table - unregister a sysctl table hierarchy
2029 * @header: the header returned from register_sysctl_table
2031 * Unregisters the sysctl table and all children. proc entries may not
2032 * actually be removed until they are no longer used by anyone.
2034 void unregister_sysctl_table(struct ctl_table_header * header)
2036 might_sleep();
2038 if (header == NULL)
2039 return;
2041 spin_lock(&sysctl_lock);
2042 start_unregistering(header);
2043 if (!--header->parent->count) {
2044 WARN_ON(1);
2045 kfree(header->parent);
2047 if (!--header->count)
2048 kfree(header);
2049 spin_unlock(&sysctl_lock);
2052 int sysctl_is_seen(struct ctl_table_header *p)
2054 struct ctl_table_set *set = p->set;
2055 int res;
2056 spin_lock(&sysctl_lock);
2057 if (p->unregistering)
2058 res = 0;
2059 else if (!set->is_seen)
2060 res = 1;
2061 else
2062 res = set->is_seen(set);
2063 spin_unlock(&sysctl_lock);
2064 return res;
2067 void setup_sysctl_set(struct ctl_table_set *p,
2068 struct ctl_table_set *parent,
2069 int (*is_seen)(struct ctl_table_set *))
2071 INIT_LIST_HEAD(&p->list);
2072 p->parent = parent ? parent : &sysctl_table_root.default_set;
2073 p->is_seen = is_seen;
2076 #else /* !CONFIG_SYSCTL */
2077 struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
2079 return NULL;
2082 struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
2083 struct ctl_table *table)
2085 return NULL;
2088 void unregister_sysctl_table(struct ctl_table_header * table)
2092 void setup_sysctl_set(struct ctl_table_set *p,
2093 struct ctl_table_set *parent,
2094 int (*is_seen)(struct ctl_table_set *))
2098 void sysctl_head_put(struct ctl_table_header *head)
2102 #endif /* CONFIG_SYSCTL */
2105 * /proc/sys support
2108 #ifdef CONFIG_PROC_SYSCTL
2110 static int _proc_do_string(void* data, int maxlen, int write,
2111 struct file *filp, void __user *buffer,
2112 size_t *lenp, loff_t *ppos)
2114 size_t len;
2115 char __user *p;
2116 char c;
2118 if (!data || !maxlen || !*lenp) {
2119 *lenp = 0;
2120 return 0;
2123 if (write) {
2124 len = 0;
2125 p = buffer;
2126 while (len < *lenp) {
2127 if (get_user(c, p++))
2128 return -EFAULT;
2129 if (c == 0 || c == '\n')
2130 break;
2131 len++;
2133 if (len >= maxlen)
2134 len = maxlen-1;
2135 if(copy_from_user(data, buffer, len))
2136 return -EFAULT;
2137 ((char *) data)[len] = 0;
2138 *ppos += *lenp;
2139 } else {
2140 len = strlen(data);
2141 if (len > maxlen)
2142 len = maxlen;
2144 if (*ppos > len) {
2145 *lenp = 0;
2146 return 0;
2149 data += *ppos;
2150 len -= *ppos;
2152 if (len > *lenp)
2153 len = *lenp;
2154 if (len)
2155 if(copy_to_user(buffer, data, len))
2156 return -EFAULT;
2157 if (len < *lenp) {
2158 if(put_user('\n', ((char __user *) buffer) + len))
2159 return -EFAULT;
2160 len++;
2162 *lenp = len;
2163 *ppos += len;
2165 return 0;
2169 * proc_dostring - read a string sysctl
2170 * @table: the sysctl table
2171 * @write: %TRUE if this is a write to the sysctl file
2172 * @filp: the file structure
2173 * @buffer: the user buffer
2174 * @lenp: the size of the user buffer
2175 * @ppos: file position
2177 * Reads/writes a string from/to the user buffer. If the kernel
2178 * buffer provided is not large enough to hold the string, the
2179 * string is truncated. The copied string is %NULL-terminated.
2180 * If the string is being read by the user process, it is copied
2181 * and a newline '\n' is added. It is truncated if the buffer is
2182 * not large enough.
2184 * Returns 0 on success.
2186 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2187 void __user *buffer, size_t *lenp, loff_t *ppos)
2189 return _proc_do_string(table->data, table->maxlen, write, filp,
2190 buffer, lenp, ppos);
2194 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
2195 int *valp,
2196 int write, void *data)
2198 if (write) {
2199 *valp = *negp ? -*lvalp : *lvalp;
2200 } else {
2201 int val = *valp;
2202 if (val < 0) {
2203 *negp = -1;
2204 *lvalp = (unsigned long)-val;
2205 } else {
2206 *negp = 0;
2207 *lvalp = (unsigned long)val;
2210 return 0;
2213 static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
2214 int write, struct file *filp, void __user *buffer,
2215 size_t *lenp, loff_t *ppos,
2216 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2217 int write, void *data),
2218 void *data)
2220 #define TMPBUFLEN 21
2221 int *i, vleft, first=1, neg, val;
2222 unsigned long lval;
2223 size_t left, len;
2225 char buf[TMPBUFLEN], *p;
2226 char __user *s = buffer;
2228 if (!tbl_data || !table->maxlen || !*lenp ||
2229 (*ppos && !write)) {
2230 *lenp = 0;
2231 return 0;
2234 i = (int *) tbl_data;
2235 vleft = table->maxlen / sizeof(*i);
2236 left = *lenp;
2238 if (!conv)
2239 conv = do_proc_dointvec_conv;
2241 for (; left && vleft--; i++, first=0) {
2242 if (write) {
2243 while (left) {
2244 char c;
2245 if (get_user(c, s))
2246 return -EFAULT;
2247 if (!isspace(c))
2248 break;
2249 left--;
2250 s++;
2252 if (!left)
2253 break;
2254 neg = 0;
2255 len = left;
2256 if (len > sizeof(buf) - 1)
2257 len = sizeof(buf) - 1;
2258 if (copy_from_user(buf, s, len))
2259 return -EFAULT;
2260 buf[len] = 0;
2261 p = buf;
2262 if (*p == '-' && left > 1) {
2263 neg = 1;
2264 p++;
2266 if (*p < '0' || *p > '9')
2267 break;
2269 lval = simple_strtoul(p, &p, 0);
2271 len = p-buf;
2272 if ((len < left) && *p && !isspace(*p))
2273 break;
2274 if (neg)
2275 val = -val;
2276 s += len;
2277 left -= len;
2279 if (conv(&neg, &lval, i, 1, data))
2280 break;
2281 } else {
2282 p = buf;
2283 if (!first)
2284 *p++ = '\t';
2286 if (conv(&neg, &lval, i, 0, data))
2287 break;
2289 sprintf(p, "%s%lu", neg ? "-" : "", lval);
2290 len = strlen(buf);
2291 if (len > left)
2292 len = left;
2293 if(copy_to_user(s, buf, len))
2294 return -EFAULT;
2295 left -= len;
2296 s += len;
2300 if (!write && !first && left) {
2301 if(put_user('\n', s))
2302 return -EFAULT;
2303 left--, s++;
2305 if (write) {
2306 while (left) {
2307 char c;
2308 if (get_user(c, s++))
2309 return -EFAULT;
2310 if (!isspace(c))
2311 break;
2312 left--;
2315 if (write && first)
2316 return -EINVAL;
2317 *lenp -= left;
2318 *ppos += *lenp;
2319 return 0;
2320 #undef TMPBUFLEN
2323 static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2324 void __user *buffer, size_t *lenp, loff_t *ppos,
2325 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
2326 int write, void *data),
2327 void *data)
2329 return __do_proc_dointvec(table->data, table, write, filp,
2330 buffer, lenp, ppos, conv, data);
2334 * proc_dointvec - read a vector of integers
2335 * @table: the sysctl table
2336 * @write: %TRUE if this is a write to the sysctl file
2337 * @filp: the file structure
2338 * @buffer: the user buffer
2339 * @lenp: the size of the user buffer
2340 * @ppos: file position
2342 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2343 * values from/to the user buffer, treated as an ASCII string.
2345 * Returns 0 on success.
2347 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2348 void __user *buffer, size_t *lenp, loff_t *ppos)
2350 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2351 NULL,NULL);
2355 * Taint values can only be increased
2356 * This means we can safely use a temporary.
2358 static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2359 void __user *buffer, size_t *lenp, loff_t *ppos)
2361 struct ctl_table t;
2362 unsigned long tmptaint = get_taint();
2363 int err;
2365 if (write && !capable(CAP_SYS_ADMIN))
2366 return -EPERM;
2368 t = *table;
2369 t.data = &tmptaint;
2370 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos);
2371 if (err < 0)
2372 return err;
2374 if (write) {
2376 * Poor man's atomic or. Not worth adding a primitive
2377 * to everyone's atomic.h for this
2379 int i;
2380 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2381 if ((tmptaint >> i) & 1)
2382 add_taint(i);
2386 return err;
2389 struct do_proc_dointvec_minmax_conv_param {
2390 int *min;
2391 int *max;
2394 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
2395 int *valp,
2396 int write, void *data)
2398 struct do_proc_dointvec_minmax_conv_param *param = data;
2399 if (write) {
2400 int val = *negp ? -*lvalp : *lvalp;
2401 if ((param->min && *param->min > val) ||
2402 (param->max && *param->max < val))
2403 return -EINVAL;
2404 *valp = val;
2405 } else {
2406 int val = *valp;
2407 if (val < 0) {
2408 *negp = -1;
2409 *lvalp = (unsigned long)-val;
2410 } else {
2411 *negp = 0;
2412 *lvalp = (unsigned long)val;
2415 return 0;
2419 * proc_dointvec_minmax - read a vector of integers with min/max values
2420 * @table: the sysctl table
2421 * @write: %TRUE if this is a write to the sysctl file
2422 * @filp: the file structure
2423 * @buffer: the user buffer
2424 * @lenp: the size of the user buffer
2425 * @ppos: file position
2427 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2428 * values from/to the user buffer, treated as an ASCII string.
2430 * This routine will ensure the values are within the range specified by
2431 * table->extra1 (min) and table->extra2 (max).
2433 * Returns 0 on success.
2435 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2436 void __user *buffer, size_t *lenp, loff_t *ppos)
2438 struct do_proc_dointvec_minmax_conv_param param = {
2439 .min = (int *) table->extra1,
2440 .max = (int *) table->extra2,
2442 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2443 do_proc_dointvec_minmax_conv, &param);
2446 static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2447 struct file *filp,
2448 void __user *buffer,
2449 size_t *lenp, loff_t *ppos,
2450 unsigned long convmul,
2451 unsigned long convdiv)
2453 #define TMPBUFLEN 21
2454 unsigned long *i, *min, *max, val;
2455 int vleft, first=1, neg;
2456 size_t len, left;
2457 char buf[TMPBUFLEN], *p;
2458 char __user *s = buffer;
2460 if (!data || !table->maxlen || !*lenp ||
2461 (*ppos && !write)) {
2462 *lenp = 0;
2463 return 0;
2466 i = (unsigned long *) data;
2467 min = (unsigned long *) table->extra1;
2468 max = (unsigned long *) table->extra2;
2469 vleft = table->maxlen / sizeof(unsigned long);
2470 left = *lenp;
2472 for (; left && vleft--; i++, min++, max++, first=0) {
2473 if (write) {
2474 while (left) {
2475 char c;
2476 if (get_user(c, s))
2477 return -EFAULT;
2478 if (!isspace(c))
2479 break;
2480 left--;
2481 s++;
2483 if (!left)
2484 break;
2485 neg = 0;
2486 len = left;
2487 if (len > TMPBUFLEN-1)
2488 len = TMPBUFLEN-1;
2489 if (copy_from_user(buf, s, len))
2490 return -EFAULT;
2491 buf[len] = 0;
2492 p = buf;
2493 if (*p == '-' && left > 1) {
2494 neg = 1;
2495 p++;
2497 if (*p < '0' || *p > '9')
2498 break;
2499 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
2500 len = p-buf;
2501 if ((len < left) && *p && !isspace(*p))
2502 break;
2503 if (neg)
2504 val = -val;
2505 s += len;
2506 left -= len;
2508 if(neg)
2509 continue;
2510 if ((min && val < *min) || (max && val > *max))
2511 continue;
2512 *i = val;
2513 } else {
2514 p = buf;
2515 if (!first)
2516 *p++ = '\t';
2517 sprintf(p, "%lu", convdiv * (*i) / convmul);
2518 len = strlen(buf);
2519 if (len > left)
2520 len = left;
2521 if(copy_to_user(s, buf, len))
2522 return -EFAULT;
2523 left -= len;
2524 s += len;
2528 if (!write && !first && left) {
2529 if(put_user('\n', s))
2530 return -EFAULT;
2531 left--, s++;
2533 if (write) {
2534 while (left) {
2535 char c;
2536 if (get_user(c, s++))
2537 return -EFAULT;
2538 if (!isspace(c))
2539 break;
2540 left--;
2543 if (write && first)
2544 return -EINVAL;
2545 *lenp -= left;
2546 *ppos += *lenp;
2547 return 0;
2548 #undef TMPBUFLEN
2551 static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2552 struct file *filp,
2553 void __user *buffer,
2554 size_t *lenp, loff_t *ppos,
2555 unsigned long convmul,
2556 unsigned long convdiv)
2558 return __do_proc_doulongvec_minmax(table->data, table, write,
2559 filp, buffer, lenp, ppos, convmul, convdiv);
2563 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2564 * @table: the sysctl table
2565 * @write: %TRUE if this is a write to the sysctl file
2566 * @filp: the file structure
2567 * @buffer: the user buffer
2568 * @lenp: the size of the user buffer
2569 * @ppos: file position
2571 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2572 * values from/to the user buffer, treated as an ASCII string.
2574 * This routine will ensure the values are within the range specified by
2575 * table->extra1 (min) and table->extra2 (max).
2577 * Returns 0 on success.
2579 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2580 void __user *buffer, size_t *lenp, loff_t *ppos)
2582 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
2586 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2587 * @table: the sysctl table
2588 * @write: %TRUE if this is a write to the sysctl file
2589 * @filp: the file structure
2590 * @buffer: the user buffer
2591 * @lenp: the size of the user buffer
2592 * @ppos: file position
2594 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2595 * values from/to the user buffer, treated as an ASCII string. The values
2596 * are treated as milliseconds, and converted to jiffies when they are stored.
2598 * This routine will ensure the values are within the range specified by
2599 * table->extra1 (min) and table->extra2 (max).
2601 * Returns 0 on success.
2603 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2604 struct file *filp,
2605 void __user *buffer,
2606 size_t *lenp, loff_t *ppos)
2608 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2609 lenp, ppos, HZ, 1000l);
2613 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2614 int *valp,
2615 int write, void *data)
2617 if (write) {
2618 if (*lvalp > LONG_MAX / HZ)
2619 return 1;
2620 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2621 } else {
2622 int val = *valp;
2623 unsigned long lval;
2624 if (val < 0) {
2625 *negp = -1;
2626 lval = (unsigned long)-val;
2627 } else {
2628 *negp = 0;
2629 lval = (unsigned long)val;
2631 *lvalp = lval / HZ;
2633 return 0;
2636 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2637 int *valp,
2638 int write, void *data)
2640 if (write) {
2641 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2642 return 1;
2643 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2644 } else {
2645 int val = *valp;
2646 unsigned long lval;
2647 if (val < 0) {
2648 *negp = -1;
2649 lval = (unsigned long)-val;
2650 } else {
2651 *negp = 0;
2652 lval = (unsigned long)val;
2654 *lvalp = jiffies_to_clock_t(lval);
2656 return 0;
2659 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2660 int *valp,
2661 int write, void *data)
2663 if (write) {
2664 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2665 } else {
2666 int val = *valp;
2667 unsigned long lval;
2668 if (val < 0) {
2669 *negp = -1;
2670 lval = (unsigned long)-val;
2671 } else {
2672 *negp = 0;
2673 lval = (unsigned long)val;
2675 *lvalp = jiffies_to_msecs(lval);
2677 return 0;
2681 * proc_dointvec_jiffies - read a vector of integers as seconds
2682 * @table: the sysctl table
2683 * @write: %TRUE if this is a write to the sysctl file
2684 * @filp: the file structure
2685 * @buffer: the user buffer
2686 * @lenp: the size of the user buffer
2687 * @ppos: file position
2689 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2690 * values from/to the user buffer, treated as an ASCII string.
2691 * The values read are assumed to be in seconds, and are converted into
2692 * jiffies.
2694 * Returns 0 on success.
2696 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2697 void __user *buffer, size_t *lenp, loff_t *ppos)
2699 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2700 do_proc_dointvec_jiffies_conv,NULL);
2704 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2705 * @table: the sysctl table
2706 * @write: %TRUE if this is a write to the sysctl file
2707 * @filp: the file structure
2708 * @buffer: the user buffer
2709 * @lenp: the size of the user buffer
2710 * @ppos: pointer to the file position
2712 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2713 * values from/to the user buffer, treated as an ASCII string.
2714 * The values read are assumed to be in 1/USER_HZ seconds, and
2715 * are converted into jiffies.
2717 * Returns 0 on success.
2719 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2720 void __user *buffer, size_t *lenp, loff_t *ppos)
2722 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2723 do_proc_dointvec_userhz_jiffies_conv,NULL);
2727 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2728 * @table: the sysctl table
2729 * @write: %TRUE if this is a write to the sysctl file
2730 * @filp: the file structure
2731 * @buffer: the user buffer
2732 * @lenp: the size of the user buffer
2733 * @ppos: file position
2734 * @ppos: the current position in the file
2736 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2737 * values from/to the user buffer, treated as an ASCII string.
2738 * The values read are assumed to be in 1/1000 seconds, and
2739 * are converted into jiffies.
2741 * Returns 0 on success.
2743 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2744 void __user *buffer, size_t *lenp, loff_t *ppos)
2746 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2747 do_proc_dointvec_ms_jiffies_conv, NULL);
2750 static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2751 void __user *buffer, size_t *lenp, loff_t *ppos)
2753 struct pid *new_pid;
2754 pid_t tmp;
2755 int r;
2757 tmp = pid_vnr(cad_pid);
2759 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2760 lenp, ppos, NULL, NULL);
2761 if (r || !write)
2762 return r;
2764 new_pid = find_get_pid(tmp);
2765 if (!new_pid)
2766 return -ESRCH;
2768 put_pid(xchg(&cad_pid, new_pid));
2769 return 0;
2772 #else /* CONFIG_PROC_FS */
2774 int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2775 void __user *buffer, size_t *lenp, loff_t *ppos)
2777 return -ENOSYS;
2780 int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2781 void __user *buffer, size_t *lenp, loff_t *ppos)
2783 return -ENOSYS;
2786 int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2787 void __user *buffer, size_t *lenp, loff_t *ppos)
2789 return -ENOSYS;
2792 int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2793 void __user *buffer, size_t *lenp, loff_t *ppos)
2795 return -ENOSYS;
2798 int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2799 void __user *buffer, size_t *lenp, loff_t *ppos)
2801 return -ENOSYS;
2804 int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2805 void __user *buffer, size_t *lenp, loff_t *ppos)
2807 return -ENOSYS;
2810 int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2811 void __user *buffer, size_t *lenp, loff_t *ppos)
2813 return -ENOSYS;
2816 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2817 struct file *filp,
2818 void __user *buffer,
2819 size_t *lenp, loff_t *ppos)
2821 return -ENOSYS;
2825 #endif /* CONFIG_PROC_FS */
2828 #ifdef CONFIG_SYSCTL_SYSCALL
2830 * General sysctl support routines
2833 /* The generic sysctl data routine (used if no strategy routine supplied) */
2834 int sysctl_data(struct ctl_table *table,
2835 void __user *oldval, size_t __user *oldlenp,
2836 void __user *newval, size_t newlen)
2838 size_t len;
2840 /* Get out of I don't have a variable */
2841 if (!table->data || !table->maxlen)
2842 return -ENOTDIR;
2844 if (oldval && oldlenp) {
2845 if (get_user(len, oldlenp))
2846 return -EFAULT;
2847 if (len) {
2848 if (len > table->maxlen)
2849 len = table->maxlen;
2850 if (copy_to_user(oldval, table->data, len))
2851 return -EFAULT;
2852 if (put_user(len, oldlenp))
2853 return -EFAULT;
2857 if (newval && newlen) {
2858 if (newlen > table->maxlen)
2859 newlen = table->maxlen;
2861 if (copy_from_user(table->data, newval, newlen))
2862 return -EFAULT;
2864 return 1;
2867 /* The generic string strategy routine: */
2868 int sysctl_string(struct ctl_table *table,
2869 void __user *oldval, size_t __user *oldlenp,
2870 void __user *newval, size_t newlen)
2872 if (!table->data || !table->maxlen)
2873 return -ENOTDIR;
2875 if (oldval && oldlenp) {
2876 size_t bufsize;
2877 if (get_user(bufsize, oldlenp))
2878 return -EFAULT;
2879 if (bufsize) {
2880 size_t len = strlen(table->data), copied;
2882 /* This shouldn't trigger for a well-formed sysctl */
2883 if (len > table->maxlen)
2884 len = table->maxlen;
2886 /* Copy up to a max of bufsize-1 bytes of the string */
2887 copied = (len >= bufsize) ? bufsize - 1 : len;
2889 if (copy_to_user(oldval, table->data, copied) ||
2890 put_user(0, (char __user *)(oldval + copied)))
2891 return -EFAULT;
2892 if (put_user(len, oldlenp))
2893 return -EFAULT;
2896 if (newval && newlen) {
2897 size_t len = newlen;
2898 if (len > table->maxlen)
2899 len = table->maxlen;
2900 if(copy_from_user(table->data, newval, len))
2901 return -EFAULT;
2902 if (len == table->maxlen)
2903 len--;
2904 ((char *) table->data)[len] = 0;
2906 return 1;
2910 * This function makes sure that all of the integers in the vector
2911 * are between the minimum and maximum values given in the arrays
2912 * table->extra1 and table->extra2, respectively.
2914 int sysctl_intvec(struct ctl_table *table,
2915 void __user *oldval, size_t __user *oldlenp,
2916 void __user *newval, size_t newlen)
2919 if (newval && newlen) {
2920 int __user *vec = (int __user *) newval;
2921 int *min = (int *) table->extra1;
2922 int *max = (int *) table->extra2;
2923 size_t length;
2924 int i;
2926 if (newlen % sizeof(int) != 0)
2927 return -EINVAL;
2929 if (!table->extra1 && !table->extra2)
2930 return 0;
2932 if (newlen > table->maxlen)
2933 newlen = table->maxlen;
2934 length = newlen / sizeof(int);
2936 for (i = 0; i < length; i++) {
2937 int value;
2938 if (get_user(value, vec + i))
2939 return -EFAULT;
2940 if (min && value < min[i])
2941 return -EINVAL;
2942 if (max && value > max[i])
2943 return -EINVAL;
2946 return 0;
2949 /* Strategy function to convert jiffies to seconds */
2950 int sysctl_jiffies(struct ctl_table *table,
2951 void __user *oldval, size_t __user *oldlenp,
2952 void __user *newval, size_t newlen)
2954 if (oldval && oldlenp) {
2955 size_t olen;
2957 if (get_user(olen, oldlenp))
2958 return -EFAULT;
2959 if (olen) {
2960 int val;
2962 if (olen < sizeof(int))
2963 return -EINVAL;
2965 val = *(int *)(table->data) / HZ;
2966 if (put_user(val, (int __user *)oldval))
2967 return -EFAULT;
2968 if (put_user(sizeof(int), oldlenp))
2969 return -EFAULT;
2972 if (newval && newlen) {
2973 int new;
2974 if (newlen != sizeof(int))
2975 return -EINVAL;
2976 if (get_user(new, (int __user *)newval))
2977 return -EFAULT;
2978 *(int *)(table->data) = new*HZ;
2980 return 1;
2983 /* Strategy function to convert jiffies to seconds */
2984 int sysctl_ms_jiffies(struct ctl_table *table,
2985 void __user *oldval, size_t __user *oldlenp,
2986 void __user *newval, size_t newlen)
2988 if (oldval && oldlenp) {
2989 size_t olen;
2991 if (get_user(olen, oldlenp))
2992 return -EFAULT;
2993 if (olen) {
2994 int val;
2996 if (olen < sizeof(int))
2997 return -EINVAL;
2999 val = jiffies_to_msecs(*(int *)(table->data));
3000 if (put_user(val, (int __user *)oldval))
3001 return -EFAULT;
3002 if (put_user(sizeof(int), oldlenp))
3003 return -EFAULT;
3006 if (newval && newlen) {
3007 int new;
3008 if (newlen != sizeof(int))
3009 return -EINVAL;
3010 if (get_user(new, (int __user *)newval))
3011 return -EFAULT;
3012 *(int *)(table->data) = msecs_to_jiffies(new);
3014 return 1;
3019 #else /* CONFIG_SYSCTL_SYSCALL */
3022 SYSCALL_DEFINE1(sysctl, struct __sysctl_args __user *, args)
3024 struct __sysctl_args tmp;
3025 int error;
3027 if (copy_from_user(&tmp, args, sizeof(tmp)))
3028 return -EFAULT;
3030 error = deprecated_sysctl_warning(&tmp);
3032 /* If no error reading the parameters then just -ENOSYS ... */
3033 if (!error)
3034 error = -ENOSYS;
3036 return error;
3039 int sysctl_data(struct ctl_table *table,
3040 void __user *oldval, size_t __user *oldlenp,
3041 void __user *newval, size_t newlen)
3043 return -ENOSYS;
3046 int sysctl_string(struct ctl_table *table,
3047 void __user *oldval, size_t __user *oldlenp,
3048 void __user *newval, size_t newlen)
3050 return -ENOSYS;
3053 int sysctl_intvec(struct ctl_table *table,
3054 void __user *oldval, size_t __user *oldlenp,
3055 void __user *newval, size_t newlen)
3057 return -ENOSYS;
3060 int sysctl_jiffies(struct ctl_table *table,
3061 void __user *oldval, size_t __user *oldlenp,
3062 void __user *newval, size_t newlen)
3064 return -ENOSYS;
3067 int sysctl_ms_jiffies(struct ctl_table *table,
3068 void __user *oldval, size_t __user *oldlenp,
3069 void __user *newval, size_t newlen)
3071 return -ENOSYS;
3074 #endif /* CONFIG_SYSCTL_SYSCALL */
3076 static int deprecated_sysctl_warning(struct __sysctl_args *args)
3078 static int msg_count;
3079 int name[CTL_MAXNAME];
3080 int i;
3082 /* Check args->nlen. */
3083 if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
3084 return -ENOTDIR;
3086 /* Read in the sysctl name for better debug message logging */
3087 for (i = 0; i < args->nlen; i++)
3088 if (get_user(name[i], args->name + i))
3089 return -EFAULT;
3091 /* Ignore accesses to kernel.version */
3092 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
3093 return 0;
3095 if (msg_count < 5) {
3096 msg_count++;
3097 printk(KERN_INFO
3098 "warning: process `%s' used the deprecated sysctl "
3099 "system call with ", current->comm);
3100 for (i = 0; i < args->nlen; i++)
3101 printk("%d.", name[i]);
3102 printk("\n");
3104 return 0;
3108 * No sense putting this after each symbol definition, twice,
3109 * exception granted :-)
3111 EXPORT_SYMBOL(proc_dointvec);
3112 EXPORT_SYMBOL(proc_dointvec_jiffies);
3113 EXPORT_SYMBOL(proc_dointvec_minmax);
3114 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
3115 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
3116 EXPORT_SYMBOL(proc_dostring);
3117 EXPORT_SYMBOL(proc_doulongvec_minmax);
3118 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
3119 EXPORT_SYMBOL(register_sysctl_table);
3120 EXPORT_SYMBOL(register_sysctl_paths);
3121 EXPORT_SYMBOL(sysctl_intvec);
3122 EXPORT_SYMBOL(sysctl_jiffies);
3123 EXPORT_SYMBOL(sysctl_ms_jiffies);
3124 EXPORT_SYMBOL(sysctl_string);
3125 EXPORT_SYMBOL(sysctl_data);
3126 EXPORT_SYMBOL(unregister_sysctl_table);