allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / kernel / sysctl.c
blobb02cc238721bcf4e1fcff148a186d30e0b613f67
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/capability.h>
28 #include <linux/ctype.h>
29 #include <linux/utsname.h>
30 #include <linux/capability.h>
31 #include <linux/smp_lock.h>
32 #include <linux/init.h>
33 #include <linux/kernel.h>
34 #include <linux/kobject.h>
35 #include <linux/net.h>
36 #include <linux/sysrq.h>
37 #include <linux/highuid.h>
38 #include <linux/writeback.h>
39 #include <linux/hugetlb.h>
40 #include <linux/security.h>
41 #include <linux/initrd.h>
42 #include <linux/times.h>
43 #include <linux/limits.h>
44 #include <linux/dcache.h>
45 #include <linux/syscalls.h>
46 #include <linux/nfs_fs.h>
47 #include <linux/acpi.h>
49 #include <asm/uaccess.h>
50 #include <asm/processor.h>
52 extern int proc_nr_files(ctl_table *table, int write, struct file *filp,
53 void __user *buffer, size_t *lenp, loff_t *ppos);
55 #ifdef CONFIG_X86
56 #include <asm/nmi.h>
57 #include <asm/stacktrace.h>
58 #endif
60 #if defined(CONFIG_SYSCTL)
62 /* External variables not in a header file. */
63 extern int C_A_D;
64 extern int sysctl_overcommit_memory;
65 extern int sysctl_overcommit_ratio;
66 extern int sysctl_panic_on_oom;
67 extern int sysctl_oom_kill_allocating_task;
68 extern int max_threads;
69 extern int core_uses_pid;
70 extern int suid_dumpable;
71 extern char core_pattern[];
72 extern int pid_max;
73 extern int min_free_kbytes;
74 extern int printk_ratelimit_jiffies;
75 extern int printk_ratelimit_burst;
76 extern int pid_max_min, pid_max_max;
77 extern int sysctl_drop_caches;
78 extern int percpu_pagelist_fraction;
79 extern int compat_log;
80 extern int maps_protect;
81 extern int sysctl_stat_interval;
83 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
84 static int maxolduid = 65535;
85 static int minolduid;
86 static int min_percpu_pagelist_fract = 8;
88 static int ngroups_max = NGROUPS_MAX;
90 #ifdef CONFIG_KMOD
91 extern char modprobe_path[];
92 #endif
93 #ifdef CONFIG_CHR_DEV_SG
94 extern int sg_big_buff;
95 #endif
97 #ifdef __sparc__
98 extern char reboot_command [];
99 extern int stop_a_enabled;
100 extern int scons_pwroff;
101 #endif
103 #ifdef __hppa__
104 extern int pwrsw_enabled;
105 extern int unaligned_enabled;
106 #endif
108 #ifdef CONFIG_S390
109 #ifdef CONFIG_MATHEMU
110 extern int sysctl_ieee_emulation_warnings;
111 #endif
112 extern int sysctl_userprocess_debug;
113 extern int spin_retry;
114 #endif
116 extern int sysctl_hz_timer;
118 #ifdef CONFIG_BSD_PROCESS_ACCT
119 extern int acct_parm[];
120 #endif
122 #ifdef CONFIG_IA64
123 extern int no_unaligned_warning;
124 #endif
126 #ifdef CONFIG_RT_MUTEXES
127 extern int max_lock_depth;
128 #endif
130 #ifdef CONFIG_SYSCTL_SYSCALL
131 static int parse_table(int __user *, int, void __user *, size_t __user *,
132 void __user *, size_t, ctl_table *);
133 #endif
136 #ifdef CONFIG_PROC_SYSCTL
137 static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
138 void __user *buffer, size_t *lenp, loff_t *ppos);
139 static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
140 void __user *buffer, size_t *lenp, loff_t *ppos);
141 #endif
143 static ctl_table root_table[];
144 static struct ctl_table_header root_table_header =
145 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
147 static ctl_table kern_table[];
148 static ctl_table vm_table[];
149 static ctl_table fs_table[];
150 static ctl_table debug_table[];
151 static ctl_table dev_table[];
152 extern ctl_table random_table[];
153 #ifdef CONFIG_UNIX98_PTYS
154 extern ctl_table pty_table[];
155 #endif
156 #ifdef CONFIG_INOTIFY_USER
157 extern ctl_table inotify_table[];
158 #endif
160 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
161 int sysctl_legacy_va_layout;
162 #endif
165 /* The default sysctl tables: */
167 static ctl_table root_table[] = {
169 .ctl_name = CTL_KERN,
170 .procname = "kernel",
171 .mode = 0555,
172 .child = kern_table,
175 .ctl_name = CTL_VM,
176 .procname = "vm",
177 .mode = 0555,
178 .child = vm_table,
180 #ifdef CONFIG_NET
182 .ctl_name = CTL_NET,
183 .procname = "net",
184 .mode = 0555,
185 .child = net_table,
187 #endif
189 .ctl_name = CTL_FS,
190 .procname = "fs",
191 .mode = 0555,
192 .child = fs_table,
195 .ctl_name = CTL_DEBUG,
196 .procname = "debug",
197 .mode = 0555,
198 .child = debug_table,
201 .ctl_name = CTL_DEV,
202 .procname = "dev",
203 .mode = 0555,
204 .child = dev_table,
207 { .ctl_name = 0 }
210 static ctl_table kern_table[] = {
212 .ctl_name = KERN_PANIC,
213 .procname = "panic",
214 .data = &panic_timeout,
215 .maxlen = sizeof(int),
216 .mode = 0644,
217 .proc_handler = &proc_dointvec,
220 .ctl_name = KERN_CORE_USES_PID,
221 .procname = "core_uses_pid",
222 .data = &core_uses_pid,
223 .maxlen = sizeof(int),
224 .mode = 0644,
225 .proc_handler = &proc_dointvec,
228 .ctl_name = KERN_CORE_PATTERN,
229 .procname = "core_pattern",
230 .data = core_pattern,
231 .maxlen = CORENAME_MAX_SIZE,
232 .mode = 0644,
233 .proc_handler = &proc_dostring,
234 .strategy = &sysctl_string,
236 #ifdef CONFIG_PROC_SYSCTL
238 .ctl_name = KERN_TAINTED,
239 .procname = "tainted",
240 .data = &tainted,
241 .maxlen = sizeof(int),
242 .mode = 0644,
243 .proc_handler = &proc_dointvec_taint,
245 #endif
247 .ctl_name = KERN_CAP_BSET,
248 .procname = "cap-bound",
249 .data = &cap_bset,
250 .maxlen = sizeof(kernel_cap_t),
251 .mode = 0600,
252 .proc_handler = &proc_dointvec_bset,
254 #ifdef CONFIG_BLK_DEV_INITRD
256 .ctl_name = KERN_REALROOTDEV,
257 .procname = "real-root-dev",
258 .data = &real_root_dev,
259 .maxlen = sizeof(int),
260 .mode = 0644,
261 .proc_handler = &proc_dointvec,
263 #endif
264 #ifdef __sparc__
266 .ctl_name = KERN_SPARC_REBOOT,
267 .procname = "reboot-cmd",
268 .data = reboot_command,
269 .maxlen = 256,
270 .mode = 0644,
271 .proc_handler = &proc_dostring,
272 .strategy = &sysctl_string,
275 .ctl_name = KERN_SPARC_STOP_A,
276 .procname = "stop-a",
277 .data = &stop_a_enabled,
278 .maxlen = sizeof (int),
279 .mode = 0644,
280 .proc_handler = &proc_dointvec,
283 .ctl_name = KERN_SPARC_SCONS_PWROFF,
284 .procname = "scons-poweroff",
285 .data = &scons_pwroff,
286 .maxlen = sizeof (int),
287 .mode = 0644,
288 .proc_handler = &proc_dointvec,
290 #endif
291 #ifdef __hppa__
293 .ctl_name = KERN_HPPA_PWRSW,
294 .procname = "soft-power",
295 .data = &pwrsw_enabled,
296 .maxlen = sizeof (int),
297 .mode = 0644,
298 .proc_handler = &proc_dointvec,
301 .ctl_name = KERN_HPPA_UNALIGNED,
302 .procname = "unaligned-trap",
303 .data = &unaligned_enabled,
304 .maxlen = sizeof (int),
305 .mode = 0644,
306 .proc_handler = &proc_dointvec,
308 #endif
310 .ctl_name = KERN_CTLALTDEL,
311 .procname = "ctrl-alt-del",
312 .data = &C_A_D,
313 .maxlen = sizeof(int),
314 .mode = 0644,
315 .proc_handler = &proc_dointvec,
318 .ctl_name = KERN_PRINTK,
319 .procname = "printk",
320 .data = &console_loglevel,
321 .maxlen = 4*sizeof(int),
322 .mode = 0644,
323 .proc_handler = &proc_dointvec,
325 #ifdef CONFIG_KMOD
327 .ctl_name = KERN_MODPROBE,
328 .procname = "modprobe",
329 .data = &modprobe_path,
330 .maxlen = KMOD_PATH_LEN,
331 .mode = 0644,
332 .proc_handler = &proc_dostring,
333 .strategy = &sysctl_string,
335 #endif
336 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
338 .ctl_name = KERN_HOTPLUG,
339 .procname = "hotplug",
340 .data = &uevent_helper,
341 .maxlen = UEVENT_HELPER_PATH_LEN,
342 .mode = 0644,
343 .proc_handler = &proc_dostring,
344 .strategy = &sysctl_string,
346 #endif
347 #ifdef CONFIG_CHR_DEV_SG
349 .ctl_name = KERN_SG_BIG_BUFF,
350 .procname = "sg-big-buff",
351 .data = &sg_big_buff,
352 .maxlen = sizeof (int),
353 .mode = 0444,
354 .proc_handler = &proc_dointvec,
356 #endif
357 #ifdef CONFIG_BSD_PROCESS_ACCT
359 .ctl_name = KERN_ACCT,
360 .procname = "acct",
361 .data = &acct_parm,
362 .maxlen = 3*sizeof(int),
363 .mode = 0644,
364 .proc_handler = &proc_dointvec,
366 #endif
367 #ifdef CONFIG_MAGIC_SYSRQ
369 .ctl_name = KERN_SYSRQ,
370 .procname = "sysrq",
371 .data = &__sysrq_enabled,
372 .maxlen = sizeof (int),
373 .mode = 0644,
374 .proc_handler = &proc_dointvec,
376 #endif
377 #ifdef CONFIG_PROC_SYSCTL
379 .ctl_name = KERN_CADPID,
380 .procname = "cad_pid",
381 .data = NULL,
382 .maxlen = sizeof (int),
383 .mode = 0600,
384 .proc_handler = &proc_do_cad_pid,
386 #endif
388 .ctl_name = KERN_MAX_THREADS,
389 .procname = "threads-max",
390 .data = &max_threads,
391 .maxlen = sizeof(int),
392 .mode = 0644,
393 .proc_handler = &proc_dointvec,
396 .ctl_name = KERN_RANDOM,
397 .procname = "random",
398 .mode = 0555,
399 .child = random_table,
401 #ifdef CONFIG_UNIX98_PTYS
403 .ctl_name = KERN_PTY,
404 .procname = "pty",
405 .mode = 0555,
406 .child = pty_table,
408 #endif
410 .ctl_name = KERN_OVERFLOWUID,
411 .procname = "overflowuid",
412 .data = &overflowuid,
413 .maxlen = sizeof(int),
414 .mode = 0644,
415 .proc_handler = &proc_dointvec_minmax,
416 .strategy = &sysctl_intvec,
417 .extra1 = &minolduid,
418 .extra2 = &maxolduid,
421 .ctl_name = KERN_OVERFLOWGID,
422 .procname = "overflowgid",
423 .data = &overflowgid,
424 .maxlen = sizeof(int),
425 .mode = 0644,
426 .proc_handler = &proc_dointvec_minmax,
427 .strategy = &sysctl_intvec,
428 .extra1 = &minolduid,
429 .extra2 = &maxolduid,
431 #ifdef CONFIG_S390
432 #ifdef CONFIG_MATHEMU
434 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
435 .procname = "ieee_emulation_warnings",
436 .data = &sysctl_ieee_emulation_warnings,
437 .maxlen = sizeof(int),
438 .mode = 0644,
439 .proc_handler = &proc_dointvec,
441 #endif
442 #ifdef CONFIG_NO_IDLE_HZ
444 .ctl_name = KERN_HZ_TIMER,
445 .procname = "hz_timer",
446 .data = &sysctl_hz_timer,
447 .maxlen = sizeof(int),
448 .mode = 0644,
449 .proc_handler = &proc_dointvec,
451 #endif
453 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
454 .procname = "userprocess_debug",
455 .data = &sysctl_userprocess_debug,
456 .maxlen = sizeof(int),
457 .mode = 0644,
458 .proc_handler = &proc_dointvec,
460 #endif
462 .ctl_name = KERN_PIDMAX,
463 .procname = "pid_max",
464 .data = &pid_max,
465 .maxlen = sizeof (int),
466 .mode = 0644,
467 .proc_handler = &proc_dointvec_minmax,
468 .strategy = sysctl_intvec,
469 .extra1 = &pid_max_min,
470 .extra2 = &pid_max_max,
473 .ctl_name = KERN_PANIC_ON_OOPS,
474 .procname = "panic_on_oops",
475 .data = &panic_on_oops,
476 .maxlen = sizeof(int),
477 .mode = 0644,
478 .proc_handler = &proc_dointvec,
481 .ctl_name = KERN_PRINTK_RATELIMIT,
482 .procname = "printk_ratelimit",
483 .data = &printk_ratelimit_jiffies,
484 .maxlen = sizeof(int),
485 .mode = 0644,
486 .proc_handler = &proc_dointvec_jiffies,
487 .strategy = &sysctl_jiffies,
490 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
491 .procname = "printk_ratelimit_burst",
492 .data = &printk_ratelimit_burst,
493 .maxlen = sizeof(int),
494 .mode = 0644,
495 .proc_handler = &proc_dointvec,
498 .ctl_name = KERN_NGROUPS_MAX,
499 .procname = "ngroups_max",
500 .data = &ngroups_max,
501 .maxlen = sizeof (int),
502 .mode = 0444,
503 .proc_handler = &proc_dointvec,
505 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
507 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
508 .procname = "unknown_nmi_panic",
509 .data = &unknown_nmi_panic,
510 .maxlen = sizeof (int),
511 .mode = 0644,
512 .proc_handler = &proc_dointvec,
515 .ctl_name = KERN_NMI_WATCHDOG,
516 .procname = "nmi_watchdog",
517 .data = &nmi_watchdog_enabled,
518 .maxlen = sizeof (int),
519 .mode = 0644,
520 .proc_handler = &proc_nmi_enabled,
522 #endif
523 #if defined(CONFIG_X86)
525 .ctl_name = KERN_PANIC_ON_NMI,
526 .procname = "panic_on_unrecovered_nmi",
527 .data = &panic_on_unrecovered_nmi,
528 .maxlen = sizeof(int),
529 .mode = 0644,
530 .proc_handler = &proc_dointvec,
533 .ctl_name = KERN_BOOTLOADER_TYPE,
534 .procname = "bootloader_type",
535 .data = &bootloader_type,
536 .maxlen = sizeof (int),
537 .mode = 0444,
538 .proc_handler = &proc_dointvec,
541 .ctl_name = CTL_UNNUMBERED,
542 .procname = "kstack_depth_to_print",
543 .data = &kstack_depth_to_print,
544 .maxlen = sizeof(int),
545 .mode = 0644,
546 .proc_handler = &proc_dointvec,
548 #endif
549 #if defined(CONFIG_MMU)
551 .ctl_name = KERN_RANDOMIZE,
552 .procname = "randomize_va_space",
553 .data = &randomize_va_space,
554 .maxlen = sizeof(int),
555 .mode = 0644,
556 .proc_handler = &proc_dointvec,
558 #endif
559 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
561 .ctl_name = KERN_SPIN_RETRY,
562 .procname = "spin_retry",
563 .data = &spin_retry,
564 .maxlen = sizeof (int),
565 .mode = 0644,
566 .proc_handler = &proc_dointvec,
568 #endif
569 #ifdef CONFIG_ACPI_SLEEP
571 .ctl_name = KERN_ACPI_VIDEO_FLAGS,
572 .procname = "acpi_video_flags",
573 .data = &acpi_video_flags,
574 .maxlen = sizeof (unsigned long),
575 .mode = 0644,
576 .proc_handler = &proc_doulongvec_minmax,
578 #endif
579 #ifdef CONFIG_IA64
581 .ctl_name = KERN_IA64_UNALIGNED,
582 .procname = "ignore-unaligned-usertrap",
583 .data = &no_unaligned_warning,
584 .maxlen = sizeof (int),
585 .mode = 0644,
586 .proc_handler = &proc_dointvec,
588 #endif
589 #ifdef CONFIG_COMPAT
591 .ctl_name = KERN_COMPAT_LOG,
592 .procname = "compat-log",
593 .data = &compat_log,
594 .maxlen = sizeof (int),
595 .mode = 0644,
596 .proc_handler = &proc_dointvec,
598 #endif
599 #ifdef CONFIG_RT_MUTEXES
601 .ctl_name = KERN_MAX_LOCK_DEPTH,
602 .procname = "max_lock_depth",
603 .data = &max_lock_depth,
604 .maxlen = sizeof(int),
605 .mode = 0644,
606 .proc_handler = &proc_dointvec,
608 #endif
609 #ifdef CONFIG_PROC_FS
611 .ctl_name = CTL_UNNUMBERED,
612 .procname = "maps_protect",
613 .data = &maps_protect,
614 .maxlen = sizeof(int),
615 .mode = 0644,
616 .proc_handler = &proc_dointvec,
618 #endif
620 { .ctl_name = 0 }
623 /* Constants for minimum and maximum testing in vm_table.
624 We use these as one-element integer vectors. */
625 static int zero;
626 static int one_hundred = 100;
629 static ctl_table vm_table[] = {
631 .ctl_name = VM_OVERCOMMIT_MEMORY,
632 .procname = "overcommit_memory",
633 .data = &sysctl_overcommit_memory,
634 .maxlen = sizeof(sysctl_overcommit_memory),
635 .mode = 0644,
636 .proc_handler = &proc_dointvec,
639 .ctl_name = VM_PANIC_ON_OOM,
640 .procname = "panic_on_oom",
641 .data = &sysctl_panic_on_oom,
642 .maxlen = sizeof(sysctl_panic_on_oom),
643 .mode = 0644,
644 .proc_handler = &proc_dointvec,
647 .ctl_name = CTL_UNNUMBERED,
648 .procname = "oom_kill_allocating_task",
649 .data = &sysctl_oom_kill_allocating_task,
650 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
651 .mode = 0644,
652 .proc_handler = &proc_dointvec,
655 .ctl_name = VM_OVERCOMMIT_RATIO,
656 .procname = "overcommit_ratio",
657 .data = &sysctl_overcommit_ratio,
658 .maxlen = sizeof(sysctl_overcommit_ratio),
659 .mode = 0644,
660 .proc_handler = &proc_dointvec,
663 .ctl_name = VM_PAGE_CLUSTER,
664 .procname = "page-cluster",
665 .data = &page_cluster,
666 .maxlen = sizeof(int),
667 .mode = 0644,
668 .proc_handler = &proc_dointvec,
671 .ctl_name = VM_DIRTY_BACKGROUND,
672 .procname = "dirty_background_ratio",
673 .data = &dirty_background_ratio,
674 .maxlen = sizeof(dirty_background_ratio),
675 .mode = 0644,
676 .proc_handler = &proc_dointvec_minmax,
677 .strategy = &sysctl_intvec,
678 .extra1 = &zero,
679 .extra2 = &one_hundred,
682 .ctl_name = VM_DIRTY_RATIO,
683 .procname = "dirty_ratio",
684 .data = &vm_dirty_ratio,
685 .maxlen = sizeof(vm_dirty_ratio),
686 .mode = 0644,
687 .proc_handler = &dirty_ratio_handler,
688 .strategy = &sysctl_intvec,
689 .extra1 = &zero,
690 .extra2 = &one_hundred,
693 .ctl_name = VM_DIRTY_WB_CS,
694 .procname = "dirty_writeback_centisecs",
695 .data = &dirty_writeback_interval,
696 .maxlen = sizeof(dirty_writeback_interval),
697 .mode = 0644,
698 .proc_handler = &dirty_writeback_centisecs_handler,
701 .ctl_name = VM_DIRTY_EXPIRE_CS,
702 .procname = "dirty_expire_centisecs",
703 .data = &dirty_expire_interval,
704 .maxlen = sizeof(dirty_expire_interval),
705 .mode = 0644,
706 .proc_handler = &proc_dointvec_userhz_jiffies,
709 .ctl_name = VM_NR_PDFLUSH_THREADS,
710 .procname = "nr_pdflush_threads",
711 .data = &nr_pdflush_threads,
712 .maxlen = sizeof nr_pdflush_threads,
713 .mode = 0444 /* read-only*/,
714 .proc_handler = &proc_dointvec,
717 .ctl_name = VM_SWAPPINESS,
718 .procname = "swappiness",
719 .data = &vm_swappiness,
720 .maxlen = sizeof(vm_swappiness),
721 .mode = 0644,
722 .proc_handler = &proc_dointvec_minmax,
723 .strategy = &sysctl_intvec,
724 .extra1 = &zero,
725 .extra2 = &one_hundred,
727 #ifdef CONFIG_HUGETLB_PAGE
729 .ctl_name = VM_HUGETLB_PAGES,
730 .procname = "nr_hugepages",
731 .data = &max_huge_pages,
732 .maxlen = sizeof(unsigned long),
733 .mode = 0644,
734 .proc_handler = &hugetlb_sysctl_handler,
735 .extra1 = (void *)&hugetlb_zero,
736 .extra2 = (void *)&hugetlb_infinity,
739 .ctl_name = VM_HUGETLB_GROUP,
740 .procname = "hugetlb_shm_group",
741 .data = &sysctl_hugetlb_shm_group,
742 .maxlen = sizeof(gid_t),
743 .mode = 0644,
744 .proc_handler = &proc_dointvec,
746 #endif
748 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
749 .procname = "lowmem_reserve_ratio",
750 .data = &sysctl_lowmem_reserve_ratio,
751 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
752 .mode = 0644,
753 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
754 .strategy = &sysctl_intvec,
757 .ctl_name = VM_DROP_PAGECACHE,
758 .procname = "drop_caches",
759 .data = &sysctl_drop_caches,
760 .maxlen = sizeof(int),
761 .mode = 0644,
762 .proc_handler = drop_caches_sysctl_handler,
763 .strategy = &sysctl_intvec,
766 .ctl_name = VM_MIN_FREE_KBYTES,
767 .procname = "min_free_kbytes",
768 .data = &min_free_kbytes,
769 .maxlen = sizeof(min_free_kbytes),
770 .mode = 0644,
771 .proc_handler = &min_free_kbytes_sysctl_handler,
772 .strategy = &sysctl_intvec,
773 .extra1 = &zero,
776 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
777 .procname = "percpu_pagelist_fraction",
778 .data = &percpu_pagelist_fraction,
779 .maxlen = sizeof(percpu_pagelist_fraction),
780 .mode = 0644,
781 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
782 .strategy = &sysctl_intvec,
783 .extra1 = &min_percpu_pagelist_fract,
785 #ifdef CONFIG_MMU
787 .ctl_name = VM_MAX_MAP_COUNT,
788 .procname = "max_map_count",
789 .data = &sysctl_max_map_count,
790 .maxlen = sizeof(sysctl_max_map_count),
791 .mode = 0644,
792 .proc_handler = &proc_dointvec
794 #endif
796 .ctl_name = VM_LAPTOP_MODE,
797 .procname = "laptop_mode",
798 .data = &laptop_mode,
799 .maxlen = sizeof(laptop_mode),
800 .mode = 0644,
801 .proc_handler = &proc_dointvec_jiffies,
802 .strategy = &sysctl_jiffies,
805 .ctl_name = VM_BLOCK_DUMP,
806 .procname = "block_dump",
807 .data = &block_dump,
808 .maxlen = sizeof(block_dump),
809 .mode = 0644,
810 .proc_handler = &proc_dointvec,
811 .strategy = &sysctl_intvec,
812 .extra1 = &zero,
815 .ctl_name = VM_VFS_CACHE_PRESSURE,
816 .procname = "vfs_cache_pressure",
817 .data = &sysctl_vfs_cache_pressure,
818 .maxlen = sizeof(sysctl_vfs_cache_pressure),
819 .mode = 0644,
820 .proc_handler = &proc_dointvec,
821 .strategy = &sysctl_intvec,
822 .extra1 = &zero,
824 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
826 .ctl_name = VM_LEGACY_VA_LAYOUT,
827 .procname = "legacy_va_layout",
828 .data = &sysctl_legacy_va_layout,
829 .maxlen = sizeof(sysctl_legacy_va_layout),
830 .mode = 0644,
831 .proc_handler = &proc_dointvec,
832 .strategy = &sysctl_intvec,
833 .extra1 = &zero,
835 #endif
836 #ifdef CONFIG_NUMA
838 .ctl_name = VM_ZONE_RECLAIM_MODE,
839 .procname = "zone_reclaim_mode",
840 .data = &zone_reclaim_mode,
841 .maxlen = sizeof(zone_reclaim_mode),
842 .mode = 0644,
843 .proc_handler = &proc_dointvec,
844 .strategy = &sysctl_intvec,
845 .extra1 = &zero,
848 .ctl_name = VM_MIN_UNMAPPED,
849 .procname = "min_unmapped_ratio",
850 .data = &sysctl_min_unmapped_ratio,
851 .maxlen = sizeof(sysctl_min_unmapped_ratio),
852 .mode = 0644,
853 .proc_handler = &sysctl_min_unmapped_ratio_sysctl_handler,
854 .strategy = &sysctl_intvec,
855 .extra1 = &zero,
856 .extra2 = &one_hundred,
859 .ctl_name = VM_MIN_SLAB,
860 .procname = "min_slab_ratio",
861 .data = &sysctl_min_slab_ratio,
862 .maxlen = sizeof(sysctl_min_slab_ratio),
863 .mode = 0644,
864 .proc_handler = &sysctl_min_slab_ratio_sysctl_handler,
865 .strategy = &sysctl_intvec,
866 .extra1 = &zero,
867 .extra2 = &one_hundred,
869 #endif
870 #ifdef CONFIG_SMP
872 .ctl_name = CTL_UNNUMBERED,
873 .procname = "stat_interval",
874 .data = &sysctl_stat_interval,
875 .maxlen = sizeof(sysctl_stat_interval),
876 .mode = 0644,
877 .proc_handler = &proc_dointvec_jiffies,
878 .strategy = &sysctl_jiffies,
880 #endif
881 #if defined(CONFIG_X86_32) || \
882 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
884 .ctl_name = VM_VDSO_ENABLED,
885 .procname = "vdso_enabled",
886 .data = &vdso_enabled,
887 .maxlen = sizeof(vdso_enabled),
888 .mode = 0644,
889 .proc_handler = &proc_dointvec,
890 .strategy = &sysctl_intvec,
891 .extra1 = &zero,
893 #endif
894 { .ctl_name = 0 }
897 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
898 static ctl_table binfmt_misc_table[] = {
899 { .ctl_name = 0 }
901 #endif
903 static ctl_table fs_table[] = {
905 .ctl_name = FS_NRINODE,
906 .procname = "inode-nr",
907 .data = &inodes_stat,
908 .maxlen = 2*sizeof(int),
909 .mode = 0444,
910 .proc_handler = &proc_dointvec,
913 .ctl_name = FS_STATINODE,
914 .procname = "inode-state",
915 .data = &inodes_stat,
916 .maxlen = 7*sizeof(int),
917 .mode = 0444,
918 .proc_handler = &proc_dointvec,
921 .ctl_name = FS_NRFILE,
922 .procname = "file-nr",
923 .data = &files_stat,
924 .maxlen = 3*sizeof(int),
925 .mode = 0444,
926 .proc_handler = &proc_nr_files,
929 .ctl_name = FS_MAXFILE,
930 .procname = "file-max",
931 .data = &files_stat.max_files,
932 .maxlen = sizeof(int),
933 .mode = 0644,
934 .proc_handler = &proc_dointvec,
937 .ctl_name = FS_DENTRY,
938 .procname = "dentry-state",
939 .data = &dentry_stat,
940 .maxlen = 6*sizeof(int),
941 .mode = 0444,
942 .proc_handler = &proc_dointvec,
945 .ctl_name = FS_OVERFLOWUID,
946 .procname = "overflowuid",
947 .data = &fs_overflowuid,
948 .maxlen = sizeof(int),
949 .mode = 0644,
950 .proc_handler = &proc_dointvec_minmax,
951 .strategy = &sysctl_intvec,
952 .extra1 = &minolduid,
953 .extra2 = &maxolduid,
956 .ctl_name = FS_OVERFLOWGID,
957 .procname = "overflowgid",
958 .data = &fs_overflowgid,
959 .maxlen = sizeof(int),
960 .mode = 0644,
961 .proc_handler = &proc_dointvec_minmax,
962 .strategy = &sysctl_intvec,
963 .extra1 = &minolduid,
964 .extra2 = &maxolduid,
967 .ctl_name = FS_LEASES,
968 .procname = "leases-enable",
969 .data = &leases_enable,
970 .maxlen = sizeof(int),
971 .mode = 0644,
972 .proc_handler = &proc_dointvec,
974 #ifdef CONFIG_DNOTIFY
976 .ctl_name = FS_DIR_NOTIFY,
977 .procname = "dir-notify-enable",
978 .data = &dir_notify_enable,
979 .maxlen = sizeof(int),
980 .mode = 0644,
981 .proc_handler = &proc_dointvec,
983 #endif
984 #ifdef CONFIG_MMU
986 .ctl_name = FS_LEASE_TIME,
987 .procname = "lease-break-time",
988 .data = &lease_break_time,
989 .maxlen = sizeof(int),
990 .mode = 0644,
991 .proc_handler = &proc_dointvec,
994 .ctl_name = FS_AIO_NR,
995 .procname = "aio-nr",
996 .data = &aio_nr,
997 .maxlen = sizeof(aio_nr),
998 .mode = 0444,
999 .proc_handler = &proc_doulongvec_minmax,
1002 .ctl_name = FS_AIO_MAX_NR,
1003 .procname = "aio-max-nr",
1004 .data = &aio_max_nr,
1005 .maxlen = sizeof(aio_max_nr),
1006 .mode = 0644,
1007 .proc_handler = &proc_doulongvec_minmax,
1009 #ifdef CONFIG_INOTIFY_USER
1011 .ctl_name = FS_INOTIFY,
1012 .procname = "inotify",
1013 .mode = 0555,
1014 .child = inotify_table,
1016 #endif
1017 #endif
1019 .ctl_name = KERN_SETUID_DUMPABLE,
1020 .procname = "suid_dumpable",
1021 .data = &suid_dumpable,
1022 .maxlen = sizeof(int),
1023 .mode = 0644,
1024 .proc_handler = &proc_dointvec,
1026 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1028 .ctl_name = CTL_UNNUMBERED,
1029 .procname = "binfmt_misc",
1030 .mode = 0555,
1031 .child = binfmt_misc_table,
1033 #endif
1034 { .ctl_name = 0 }
1037 static ctl_table debug_table[] = {
1038 { .ctl_name = 0 }
1041 static ctl_table dev_table[] = {
1042 { .ctl_name = 0 }
1045 static DEFINE_SPINLOCK(sysctl_lock);
1047 /* called under sysctl_lock */
1048 static int use_table(struct ctl_table_header *p)
1050 if (unlikely(p->unregistering))
1051 return 0;
1052 p->used++;
1053 return 1;
1056 /* called under sysctl_lock */
1057 static void unuse_table(struct ctl_table_header *p)
1059 if (!--p->used)
1060 if (unlikely(p->unregistering))
1061 complete(p->unregistering);
1064 /* called under sysctl_lock, will reacquire if has to wait */
1065 static void start_unregistering(struct ctl_table_header *p)
1068 * if p->used is 0, nobody will ever touch that entry again;
1069 * we'll eliminate all paths to it before dropping sysctl_lock
1071 if (unlikely(p->used)) {
1072 struct completion wait;
1073 init_completion(&wait);
1074 p->unregistering = &wait;
1075 spin_unlock(&sysctl_lock);
1076 wait_for_completion(&wait);
1077 spin_lock(&sysctl_lock);
1080 * do not remove from the list until nobody holds it; walking the
1081 * list in do_sysctl() relies on that.
1083 list_del_init(&p->ctl_entry);
1086 void sysctl_head_finish(struct ctl_table_header *head)
1088 if (!head)
1089 return;
1090 spin_lock(&sysctl_lock);
1091 unuse_table(head);
1092 spin_unlock(&sysctl_lock);
1095 struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1097 struct ctl_table_header *head;
1098 struct list_head *tmp;
1099 spin_lock(&sysctl_lock);
1100 if (prev) {
1101 tmp = &prev->ctl_entry;
1102 unuse_table(prev);
1103 goto next;
1105 tmp = &root_table_header.ctl_entry;
1106 for (;;) {
1107 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1109 if (!use_table(head))
1110 goto next;
1111 spin_unlock(&sysctl_lock);
1112 return head;
1113 next:
1114 tmp = tmp->next;
1115 if (tmp == &root_table_header.ctl_entry)
1116 break;
1118 spin_unlock(&sysctl_lock);
1119 return NULL;
1122 #ifdef CONFIG_SYSCTL_SYSCALL
1123 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1124 void __user *newval, size_t newlen)
1126 struct ctl_table_header *head;
1127 int error = -ENOTDIR;
1129 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1130 return -ENOTDIR;
1131 if (oldval) {
1132 int old_len;
1133 if (!oldlenp || get_user(old_len, oldlenp))
1134 return -EFAULT;
1137 for (head = sysctl_head_next(NULL); head;
1138 head = sysctl_head_next(head)) {
1139 error = parse_table(name, nlen, oldval, oldlenp,
1140 newval, newlen, head->ctl_table);
1141 if (error != -ENOTDIR) {
1142 sysctl_head_finish(head);
1143 break;
1146 return error;
1149 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1151 struct __sysctl_args tmp;
1152 int error;
1154 if (copy_from_user(&tmp, args, sizeof(tmp)))
1155 return -EFAULT;
1157 lock_kernel();
1158 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1159 tmp.newval, tmp.newlen);
1160 unlock_kernel();
1161 return error;
1163 #endif /* CONFIG_SYSCTL_SYSCALL */
1166 * sysctl_perm does NOT grant the superuser all rights automatically, because
1167 * some sysctl variables are readonly even to root.
1170 static int test_perm(int mode, int op)
1172 if (!current->euid)
1173 mode >>= 6;
1174 else if (in_egroup_p(0))
1175 mode >>= 3;
1176 if ((mode & op & 0007) == op)
1177 return 0;
1178 return -EACCES;
1181 int sysctl_perm(ctl_table *table, int op)
1183 int error;
1184 error = security_sysctl(table, op);
1185 if (error)
1186 return error;
1187 return test_perm(table->mode, op);
1190 #ifdef CONFIG_SYSCTL_SYSCALL
1191 static int parse_table(int __user *name, int nlen,
1192 void __user *oldval, size_t __user *oldlenp,
1193 void __user *newval, size_t newlen,
1194 ctl_table *table)
1196 int n;
1197 repeat:
1198 if (!nlen)
1199 return -ENOTDIR;
1200 if (get_user(n, name))
1201 return -EFAULT;
1202 for ( ; table->ctl_name || table->procname; table++) {
1203 if (!table->ctl_name)
1204 continue;
1205 if (n == table->ctl_name) {
1206 int error;
1207 if (table->child) {
1208 if (sysctl_perm(table, 001))
1209 return -EPERM;
1210 name++;
1211 nlen--;
1212 table = table->child;
1213 goto repeat;
1215 error = do_sysctl_strategy(table, name, nlen,
1216 oldval, oldlenp,
1217 newval, newlen);
1218 return error;
1221 return -ENOTDIR;
1224 /* Perform the actual read/write of a sysctl table entry. */
1225 int do_sysctl_strategy (ctl_table *table,
1226 int __user *name, int nlen,
1227 void __user *oldval, size_t __user *oldlenp,
1228 void __user *newval, size_t newlen)
1230 int op = 0, rc;
1231 size_t len;
1233 if (oldval)
1234 op |= 004;
1235 if (newval)
1236 op |= 002;
1237 if (sysctl_perm(table, op))
1238 return -EPERM;
1240 if (table->strategy) {
1241 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1242 newval, newlen);
1243 if (rc < 0)
1244 return rc;
1245 if (rc > 0)
1246 return 0;
1249 /* If there is no strategy routine, or if the strategy returns
1250 * zero, proceed with automatic r/w */
1251 if (table->data && table->maxlen) {
1252 if (oldval && oldlenp) {
1253 if (get_user(len, oldlenp))
1254 return -EFAULT;
1255 if (len) {
1256 if (len > table->maxlen)
1257 len = table->maxlen;
1258 if(copy_to_user(oldval, table->data, len))
1259 return -EFAULT;
1260 if(put_user(len, oldlenp))
1261 return -EFAULT;
1264 if (newval && newlen) {
1265 len = newlen;
1266 if (len > table->maxlen)
1267 len = table->maxlen;
1268 if(copy_from_user(table->data, newval, len))
1269 return -EFAULT;
1272 return 0;
1274 #endif /* CONFIG_SYSCTL_SYSCALL */
1276 static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1278 for (; table->ctl_name || table->procname; table++) {
1279 table->parent = parent;
1280 if (table->child)
1281 sysctl_set_parent(table, table->child);
1285 static __init int sysctl_init(void)
1287 sysctl_set_parent(NULL, root_table);
1288 return 0;
1291 core_initcall(sysctl_init);
1294 * register_sysctl_table - register a sysctl hierarchy
1295 * @table: the top-level table structure
1297 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1298 * array. An entry with a ctl_name of 0 terminates the table.
1300 * The members of the &ctl_table structure are used as follows:
1302 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1303 * must be unique within that level of sysctl
1305 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1306 * enter a sysctl file
1308 * data - a pointer to data for use by proc_handler
1310 * maxlen - the maximum size in bytes of the data
1312 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1314 * child - a pointer to the child sysctl table if this entry is a directory, or
1315 * %NULL.
1317 * proc_handler - the text handler routine (described below)
1319 * strategy - the strategy routine (described below)
1321 * de - for internal use by the sysctl routines
1323 * extra1, extra2 - extra pointers usable by the proc handler routines
1325 * Leaf nodes in the sysctl tree will be represented by a single file
1326 * under /proc; non-leaf nodes will be represented by directories.
1328 * sysctl(2) can automatically manage read and write requests through
1329 * the sysctl table. The data and maxlen fields of the ctl_table
1330 * struct enable minimal validation of the values being written to be
1331 * performed, and the mode field allows minimal authentication.
1333 * More sophisticated management can be enabled by the provision of a
1334 * strategy routine with the table entry. This will be called before
1335 * any automatic read or write of the data is performed.
1337 * The strategy routine may return
1339 * < 0 - Error occurred (error is passed to user process)
1341 * 0 - OK - proceed with automatic read or write.
1343 * > 0 - OK - read or write has been done by the strategy routine, so
1344 * return immediately.
1346 * There must be a proc_handler routine for any terminal nodes
1347 * mirrored under /proc/sys (non-terminals are handled by a built-in
1348 * directory handler). Several default handlers are available to
1349 * cover common cases -
1351 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1352 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1353 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1355 * It is the handler's job to read the input buffer from user memory
1356 * and process it. The handler should return 0 on success.
1358 * This routine returns %NULL on a failure to register, and a pointer
1359 * to the table header on success.
1361 struct ctl_table_header *register_sysctl_table(ctl_table * table)
1363 struct ctl_table_header *tmp;
1364 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
1365 if (!tmp)
1366 return NULL;
1367 tmp->ctl_table = table;
1368 INIT_LIST_HEAD(&tmp->ctl_entry);
1369 tmp->used = 0;
1370 tmp->unregistering = NULL;
1371 sysctl_set_parent(NULL, table);
1372 spin_lock(&sysctl_lock);
1373 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1374 spin_unlock(&sysctl_lock);
1375 return tmp;
1379 * unregister_sysctl_table - unregister a sysctl table hierarchy
1380 * @header: the header returned from register_sysctl_table
1382 * Unregisters the sysctl table and all children. proc entries may not
1383 * actually be removed until they are no longer used by anyone.
1385 void unregister_sysctl_table(struct ctl_table_header * header)
1387 might_sleep();
1388 spin_lock(&sysctl_lock);
1389 start_unregistering(header);
1390 spin_unlock(&sysctl_lock);
1391 kfree(header);
1394 #else /* !CONFIG_SYSCTL */
1395 struct ctl_table_header *register_sysctl_table(ctl_table * table)
1397 return NULL;
1400 void unregister_sysctl_table(struct ctl_table_header * table)
1404 #endif /* CONFIG_SYSCTL */
1407 * /proc/sys support
1410 #ifdef CONFIG_PROC_SYSCTL
1412 static int _proc_do_string(void* data, int maxlen, int write,
1413 struct file *filp, void __user *buffer,
1414 size_t *lenp, loff_t *ppos)
1416 size_t len;
1417 char __user *p;
1418 char c;
1420 if (!data || !maxlen || !*lenp) {
1421 *lenp = 0;
1422 return 0;
1425 if (write) {
1426 len = 0;
1427 p = buffer;
1428 while (len < *lenp) {
1429 if (get_user(c, p++))
1430 return -EFAULT;
1431 if (c == 0 || c == '\n')
1432 break;
1433 len++;
1435 if (len >= maxlen)
1436 len = maxlen-1;
1437 if(copy_from_user(data, buffer, len))
1438 return -EFAULT;
1439 ((char *) data)[len] = 0;
1440 *ppos += *lenp;
1441 } else {
1442 len = strlen(data);
1443 if (len > maxlen)
1444 len = maxlen;
1446 if (*ppos > len) {
1447 *lenp = 0;
1448 return 0;
1451 data += *ppos;
1452 len -= *ppos;
1454 if (len > *lenp)
1455 len = *lenp;
1456 if (len)
1457 if(copy_to_user(buffer, data, len))
1458 return -EFAULT;
1459 if (len < *lenp) {
1460 if(put_user('\n', ((char __user *) buffer) + len))
1461 return -EFAULT;
1462 len++;
1464 *lenp = len;
1465 *ppos += len;
1467 return 0;
1471 * proc_dostring - read a string sysctl
1472 * @table: the sysctl table
1473 * @write: %TRUE if this is a write to the sysctl file
1474 * @filp: the file structure
1475 * @buffer: the user buffer
1476 * @lenp: the size of the user buffer
1477 * @ppos: file position
1479 * Reads/writes a string from/to the user buffer. If the kernel
1480 * buffer provided is not large enough to hold the string, the
1481 * string is truncated. The copied string is %NULL-terminated.
1482 * If the string is being read by the user process, it is copied
1483 * and a newline '\n' is added. It is truncated if the buffer is
1484 * not large enough.
1486 * Returns 0 on success.
1488 int proc_dostring(ctl_table *table, int write, struct file *filp,
1489 void __user *buffer, size_t *lenp, loff_t *ppos)
1491 return _proc_do_string(table->data, table->maxlen, write, filp,
1492 buffer, lenp, ppos);
1496 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1497 int *valp,
1498 int write, void *data)
1500 if (write) {
1501 *valp = *negp ? -*lvalp : *lvalp;
1502 } else {
1503 int val = *valp;
1504 if (val < 0) {
1505 *negp = -1;
1506 *lvalp = (unsigned long)-val;
1507 } else {
1508 *negp = 0;
1509 *lvalp = (unsigned long)val;
1512 return 0;
1515 static int __do_proc_dointvec(void *tbl_data, ctl_table *table,
1516 int write, struct file *filp, void __user *buffer,
1517 size_t *lenp, loff_t *ppos,
1518 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1519 int write, void *data),
1520 void *data)
1522 #define TMPBUFLEN 21
1523 int *i, vleft, first=1, neg, val;
1524 unsigned long lval;
1525 size_t left, len;
1527 char buf[TMPBUFLEN], *p;
1528 char __user *s = buffer;
1530 if (!tbl_data || !table->maxlen || !*lenp ||
1531 (*ppos && !write)) {
1532 *lenp = 0;
1533 return 0;
1536 i = (int *) tbl_data;
1537 vleft = table->maxlen / sizeof(*i);
1538 left = *lenp;
1540 if (!conv)
1541 conv = do_proc_dointvec_conv;
1543 for (; left && vleft--; i++, first=0) {
1544 if (write) {
1545 while (left) {
1546 char c;
1547 if (get_user(c, s))
1548 return -EFAULT;
1549 if (!isspace(c))
1550 break;
1551 left--;
1552 s++;
1554 if (!left)
1555 break;
1556 neg = 0;
1557 len = left;
1558 if (len > sizeof(buf) - 1)
1559 len = sizeof(buf) - 1;
1560 if (copy_from_user(buf, s, len))
1561 return -EFAULT;
1562 buf[len] = 0;
1563 p = buf;
1564 if (*p == '-' && left > 1) {
1565 neg = 1;
1566 p++;
1568 if (*p < '0' || *p > '9')
1569 break;
1571 lval = simple_strtoul(p, &p, 0);
1573 len = p-buf;
1574 if ((len < left) && *p && !isspace(*p))
1575 break;
1576 if (neg)
1577 val = -val;
1578 s += len;
1579 left -= len;
1581 if (conv(&neg, &lval, i, 1, data))
1582 break;
1583 } else {
1584 p = buf;
1585 if (!first)
1586 *p++ = '\t';
1588 if (conv(&neg, &lval, i, 0, data))
1589 break;
1591 sprintf(p, "%s%lu", neg ? "-" : "", lval);
1592 len = strlen(buf);
1593 if (len > left)
1594 len = left;
1595 if(copy_to_user(s, buf, len))
1596 return -EFAULT;
1597 left -= len;
1598 s += len;
1602 if (!write && !first && left) {
1603 if(put_user('\n', s))
1604 return -EFAULT;
1605 left--, s++;
1607 if (write) {
1608 while (left) {
1609 char c;
1610 if (get_user(c, s++))
1611 return -EFAULT;
1612 if (!isspace(c))
1613 break;
1614 left--;
1617 if (write && first)
1618 return -EINVAL;
1619 *lenp -= left;
1620 *ppos += *lenp;
1621 return 0;
1622 #undef TMPBUFLEN
1625 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
1626 void __user *buffer, size_t *lenp, loff_t *ppos,
1627 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1628 int write, void *data),
1629 void *data)
1631 return __do_proc_dointvec(table->data, table, write, filp,
1632 buffer, lenp, ppos, conv, data);
1636 * proc_dointvec - read a vector of integers
1637 * @table: the sysctl table
1638 * @write: %TRUE if this is a write to the sysctl file
1639 * @filp: the file structure
1640 * @buffer: the user buffer
1641 * @lenp: the size of the user buffer
1642 * @ppos: file position
1644 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1645 * values from/to the user buffer, treated as an ASCII string.
1647 * Returns 0 on success.
1649 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1650 void __user *buffer, size_t *lenp, loff_t *ppos)
1652 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1653 NULL,NULL);
1656 #define OP_SET 0
1657 #define OP_AND 1
1658 #define OP_OR 2
1660 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1661 int *valp,
1662 int write, void *data)
1664 int op = *(int *)data;
1665 if (write) {
1666 int val = *negp ? -*lvalp : *lvalp;
1667 switch(op) {
1668 case OP_SET: *valp = val; break;
1669 case OP_AND: *valp &= val; break;
1670 case OP_OR: *valp |= val; break;
1672 } else {
1673 int val = *valp;
1674 if (val < 0) {
1675 *negp = -1;
1676 *lvalp = (unsigned long)-val;
1677 } else {
1678 *negp = 0;
1679 *lvalp = (unsigned long)val;
1682 return 0;
1686 * init may raise the set.
1689 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1690 void __user *buffer, size_t *lenp, loff_t *ppos)
1692 int op;
1694 if (write && !capable(CAP_SYS_MODULE)) {
1695 return -EPERM;
1698 op = is_init(current) ? OP_SET : OP_AND;
1699 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1700 do_proc_dointvec_bset_conv,&op);
1704 * Taint values can only be increased
1706 static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp,
1707 void __user *buffer, size_t *lenp, loff_t *ppos)
1709 int op;
1711 if (write && !capable(CAP_SYS_ADMIN))
1712 return -EPERM;
1714 op = OP_OR;
1715 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1716 do_proc_dointvec_bset_conv,&op);
1719 struct do_proc_dointvec_minmax_conv_param {
1720 int *min;
1721 int *max;
1724 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1725 int *valp,
1726 int write, void *data)
1728 struct do_proc_dointvec_minmax_conv_param *param = data;
1729 if (write) {
1730 int val = *negp ? -*lvalp : *lvalp;
1731 if ((param->min && *param->min > val) ||
1732 (param->max && *param->max < val))
1733 return -EINVAL;
1734 *valp = val;
1735 } else {
1736 int val = *valp;
1737 if (val < 0) {
1738 *negp = -1;
1739 *lvalp = (unsigned long)-val;
1740 } else {
1741 *negp = 0;
1742 *lvalp = (unsigned long)val;
1745 return 0;
1749 * proc_dointvec_minmax - read a vector of integers with min/max values
1750 * @table: the sysctl table
1751 * @write: %TRUE if this is a write to the sysctl file
1752 * @filp: the file structure
1753 * @buffer: the user buffer
1754 * @lenp: the size of the user buffer
1755 * @ppos: file position
1757 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1758 * values from/to the user buffer, treated as an ASCII string.
1760 * This routine will ensure the values are within the range specified by
1761 * table->extra1 (min) and table->extra2 (max).
1763 * Returns 0 on success.
1765 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1766 void __user *buffer, size_t *lenp, loff_t *ppos)
1768 struct do_proc_dointvec_minmax_conv_param param = {
1769 .min = (int *) table->extra1,
1770 .max = (int *) table->extra2,
1772 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
1773 do_proc_dointvec_minmax_conv, &param);
1776 static int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write,
1777 struct file *filp,
1778 void __user *buffer,
1779 size_t *lenp, loff_t *ppos,
1780 unsigned long convmul,
1781 unsigned long convdiv)
1783 #define TMPBUFLEN 21
1784 unsigned long *i, *min, *max, val;
1785 int vleft, first=1, neg;
1786 size_t len, left;
1787 char buf[TMPBUFLEN], *p;
1788 char __user *s = buffer;
1790 if (!data || !table->maxlen || !*lenp ||
1791 (*ppos && !write)) {
1792 *lenp = 0;
1793 return 0;
1796 i = (unsigned long *) data;
1797 min = (unsigned long *) table->extra1;
1798 max = (unsigned long *) table->extra2;
1799 vleft = table->maxlen / sizeof(unsigned long);
1800 left = *lenp;
1802 for (; left && vleft--; i++, min++, max++, first=0) {
1803 if (write) {
1804 while (left) {
1805 char c;
1806 if (get_user(c, s))
1807 return -EFAULT;
1808 if (!isspace(c))
1809 break;
1810 left--;
1811 s++;
1813 if (!left)
1814 break;
1815 neg = 0;
1816 len = left;
1817 if (len > TMPBUFLEN-1)
1818 len = TMPBUFLEN-1;
1819 if (copy_from_user(buf, s, len))
1820 return -EFAULT;
1821 buf[len] = 0;
1822 p = buf;
1823 if (*p == '-' && left > 1) {
1824 neg = 1;
1825 p++;
1827 if (*p < '0' || *p > '9')
1828 break;
1829 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
1830 len = p-buf;
1831 if ((len < left) && *p && !isspace(*p))
1832 break;
1833 if (neg)
1834 val = -val;
1835 s += len;
1836 left -= len;
1838 if(neg)
1839 continue;
1840 if ((min && val < *min) || (max && val > *max))
1841 continue;
1842 *i = val;
1843 } else {
1844 p = buf;
1845 if (!first)
1846 *p++ = '\t';
1847 sprintf(p, "%lu", convdiv * (*i) / convmul);
1848 len = strlen(buf);
1849 if (len > left)
1850 len = left;
1851 if(copy_to_user(s, buf, len))
1852 return -EFAULT;
1853 left -= len;
1854 s += len;
1858 if (!write && !first && left) {
1859 if(put_user('\n', s))
1860 return -EFAULT;
1861 left--, s++;
1863 if (write) {
1864 while (left) {
1865 char c;
1866 if (get_user(c, s++))
1867 return -EFAULT;
1868 if (!isspace(c))
1869 break;
1870 left--;
1873 if (write && first)
1874 return -EINVAL;
1875 *lenp -= left;
1876 *ppos += *lenp;
1877 return 0;
1878 #undef TMPBUFLEN
1881 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
1882 struct file *filp,
1883 void __user *buffer,
1884 size_t *lenp, loff_t *ppos,
1885 unsigned long convmul,
1886 unsigned long convdiv)
1888 return __do_proc_doulongvec_minmax(table->data, table, write,
1889 filp, buffer, lenp, ppos, convmul, convdiv);
1893 * proc_doulongvec_minmax - read a vector of long integers with min/max values
1894 * @table: the sysctl table
1895 * @write: %TRUE if this is a write to the sysctl file
1896 * @filp: the file structure
1897 * @buffer: the user buffer
1898 * @lenp: the size of the user buffer
1899 * @ppos: file position
1901 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1902 * values from/to the user buffer, treated as an ASCII string.
1904 * This routine will ensure the values are within the range specified by
1905 * table->extra1 (min) and table->extra2 (max).
1907 * Returns 0 on success.
1909 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1910 void __user *buffer, size_t *lenp, loff_t *ppos)
1912 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
1916 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
1917 * @table: the sysctl table
1918 * @write: %TRUE if this is a write to the sysctl file
1919 * @filp: the file structure
1920 * @buffer: the user buffer
1921 * @lenp: the size of the user buffer
1922 * @ppos: file position
1924 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1925 * values from/to the user buffer, treated as an ASCII string. The values
1926 * are treated as milliseconds, and converted to jiffies when they are stored.
1928 * This routine will ensure the values are within the range specified by
1929 * table->extra1 (min) and table->extra2 (max).
1931 * Returns 0 on success.
1933 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1934 struct file *filp,
1935 void __user *buffer,
1936 size_t *lenp, loff_t *ppos)
1938 return do_proc_doulongvec_minmax(table, write, filp, buffer,
1939 lenp, ppos, HZ, 1000l);
1943 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
1944 int *valp,
1945 int write, void *data)
1947 if (write) {
1948 if (*lvalp > LONG_MAX / HZ)
1949 return 1;
1950 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
1951 } else {
1952 int val = *valp;
1953 unsigned long lval;
1954 if (val < 0) {
1955 *negp = -1;
1956 lval = (unsigned long)-val;
1957 } else {
1958 *negp = 0;
1959 lval = (unsigned long)val;
1961 *lvalp = lval / HZ;
1963 return 0;
1966 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
1967 int *valp,
1968 int write, void *data)
1970 if (write) {
1971 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
1972 return 1;
1973 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
1974 } else {
1975 int val = *valp;
1976 unsigned long lval;
1977 if (val < 0) {
1978 *negp = -1;
1979 lval = (unsigned long)-val;
1980 } else {
1981 *negp = 0;
1982 lval = (unsigned long)val;
1984 *lvalp = jiffies_to_clock_t(lval);
1986 return 0;
1989 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
1990 int *valp,
1991 int write, void *data)
1993 if (write) {
1994 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
1995 } else {
1996 int val = *valp;
1997 unsigned long lval;
1998 if (val < 0) {
1999 *negp = -1;
2000 lval = (unsigned long)-val;
2001 } else {
2002 *negp = 0;
2003 lval = (unsigned long)val;
2005 *lvalp = jiffies_to_msecs(lval);
2007 return 0;
2011 * proc_dointvec_jiffies - read a vector of integers as seconds
2012 * @table: the sysctl table
2013 * @write: %TRUE if this is a write to the sysctl file
2014 * @filp: the file structure
2015 * @buffer: the user buffer
2016 * @lenp: the size of the user buffer
2017 * @ppos: file position
2019 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2020 * values from/to the user buffer, treated as an ASCII string.
2021 * The values read are assumed to be in seconds, and are converted into
2022 * jiffies.
2024 * Returns 0 on success.
2026 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2027 void __user *buffer, size_t *lenp, loff_t *ppos)
2029 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2030 do_proc_dointvec_jiffies_conv,NULL);
2034 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2035 * @table: the sysctl table
2036 * @write: %TRUE if this is a write to the sysctl file
2037 * @filp: the file structure
2038 * @buffer: the user buffer
2039 * @lenp: the size of the user buffer
2040 * @ppos: pointer to the file position
2042 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2043 * values from/to the user buffer, treated as an ASCII string.
2044 * The values read are assumed to be in 1/USER_HZ seconds, and
2045 * are converted into jiffies.
2047 * Returns 0 on success.
2049 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2050 void __user *buffer, size_t *lenp, loff_t *ppos)
2052 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2053 do_proc_dointvec_userhz_jiffies_conv,NULL);
2057 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2058 * @table: the sysctl table
2059 * @write: %TRUE if this is a write to the sysctl file
2060 * @filp: the file structure
2061 * @buffer: the user buffer
2062 * @lenp: the size of the user buffer
2063 * @ppos: file position
2064 * @ppos: the current position in the file
2066 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2067 * values from/to the user buffer, treated as an ASCII string.
2068 * The values read are assumed to be in 1/1000 seconds, and
2069 * are converted into jiffies.
2071 * Returns 0 on success.
2073 int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2074 void __user *buffer, size_t *lenp, loff_t *ppos)
2076 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2077 do_proc_dointvec_ms_jiffies_conv, NULL);
2080 static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
2081 void __user *buffer, size_t *lenp, loff_t *ppos)
2083 struct pid *new_pid;
2084 pid_t tmp;
2085 int r;
2087 tmp = pid_nr(cad_pid);
2089 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2090 lenp, ppos, NULL, NULL);
2091 if (r || !write)
2092 return r;
2094 new_pid = find_get_pid(tmp);
2095 if (!new_pid)
2096 return -ESRCH;
2098 put_pid(xchg(&cad_pid, new_pid));
2099 return 0;
2102 #else /* CONFIG_PROC_FS */
2104 int proc_dostring(ctl_table *table, int write, struct file *filp,
2105 void __user *buffer, size_t *lenp, loff_t *ppos)
2107 return -ENOSYS;
2110 int proc_dointvec(ctl_table *table, int write, struct file *filp,
2111 void __user *buffer, size_t *lenp, loff_t *ppos)
2113 return -ENOSYS;
2116 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2117 void __user *buffer, size_t *lenp, loff_t *ppos)
2119 return -ENOSYS;
2122 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2123 void __user *buffer, size_t *lenp, loff_t *ppos)
2125 return -ENOSYS;
2128 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2129 void __user *buffer, size_t *lenp, loff_t *ppos)
2131 return -ENOSYS;
2134 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2135 void __user *buffer, size_t *lenp, loff_t *ppos)
2137 return -ENOSYS;
2140 int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2141 void __user *buffer, size_t *lenp, loff_t *ppos)
2143 return -ENOSYS;
2146 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2147 void __user *buffer, size_t *lenp, loff_t *ppos)
2149 return -ENOSYS;
2152 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2153 struct file *filp,
2154 void __user *buffer,
2155 size_t *lenp, loff_t *ppos)
2157 return -ENOSYS;
2161 #endif /* CONFIG_PROC_FS */
2164 #ifdef CONFIG_SYSCTL_SYSCALL
2166 * General sysctl support routines
2169 /* The generic string strategy routine: */
2170 int sysctl_string(ctl_table *table, int __user *name, int nlen,
2171 void __user *oldval, size_t __user *oldlenp,
2172 void __user *newval, size_t newlen)
2174 if (!table->data || !table->maxlen)
2175 return -ENOTDIR;
2177 if (oldval && oldlenp) {
2178 size_t bufsize;
2179 if (get_user(bufsize, oldlenp))
2180 return -EFAULT;
2181 if (bufsize) {
2182 size_t len = strlen(table->data), copied;
2184 /* This shouldn't trigger for a well-formed sysctl */
2185 if (len > table->maxlen)
2186 len = table->maxlen;
2188 /* Copy up to a max of bufsize-1 bytes of the string */
2189 copied = (len >= bufsize) ? bufsize - 1 : len;
2191 if (copy_to_user(oldval, table->data, copied) ||
2192 put_user(0, (char __user *)(oldval + copied)))
2193 return -EFAULT;
2194 if (put_user(len, oldlenp))
2195 return -EFAULT;
2198 if (newval && newlen) {
2199 size_t len = newlen;
2200 if (len > table->maxlen)
2201 len = table->maxlen;
2202 if(copy_from_user(table->data, newval, len))
2203 return -EFAULT;
2204 if (len == table->maxlen)
2205 len--;
2206 ((char *) table->data)[len] = 0;
2208 return 1;
2212 * This function makes sure that all of the integers in the vector
2213 * are between the minimum and maximum values given in the arrays
2214 * table->extra1 and table->extra2, respectively.
2216 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2217 void __user *oldval, size_t __user *oldlenp,
2218 void __user *newval, size_t newlen)
2221 if (newval && newlen) {
2222 int __user *vec = (int __user *) newval;
2223 int *min = (int *) table->extra1;
2224 int *max = (int *) table->extra2;
2225 size_t length;
2226 int i;
2228 if (newlen % sizeof(int) != 0)
2229 return -EINVAL;
2231 if (!table->extra1 && !table->extra2)
2232 return 0;
2234 if (newlen > table->maxlen)
2235 newlen = table->maxlen;
2236 length = newlen / sizeof(int);
2238 for (i = 0; i < length; i++) {
2239 int value;
2240 if (get_user(value, vec + i))
2241 return -EFAULT;
2242 if (min && value < min[i])
2243 return -EINVAL;
2244 if (max && value > max[i])
2245 return -EINVAL;
2248 return 0;
2251 /* Strategy function to convert jiffies to seconds */
2252 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2253 void __user *oldval, size_t __user *oldlenp,
2254 void __user *newval, size_t newlen)
2256 if (oldval && oldlenp) {
2257 size_t olen;
2259 if (get_user(olen, oldlenp))
2260 return -EFAULT;
2261 if (olen) {
2262 int val;
2264 if (olen < sizeof(int))
2265 return -EINVAL;
2267 val = *(int *)(table->data) / HZ;
2268 if (put_user(val, (int __user *)oldval))
2269 return -EFAULT;
2270 if (put_user(sizeof(int), oldlenp))
2271 return -EFAULT;
2274 if (newval && newlen) {
2275 int new;
2276 if (newlen != sizeof(int))
2277 return -EINVAL;
2278 if (get_user(new, (int __user *)newval))
2279 return -EFAULT;
2280 *(int *)(table->data) = new*HZ;
2282 return 1;
2285 /* Strategy function to convert jiffies to seconds */
2286 int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2287 void __user *oldval, size_t __user *oldlenp,
2288 void __user *newval, size_t newlen)
2290 if (oldval && oldlenp) {
2291 size_t olen;
2293 if (get_user(olen, oldlenp))
2294 return -EFAULT;
2295 if (olen) {
2296 int val;
2298 if (olen < sizeof(int))
2299 return -EINVAL;
2301 val = jiffies_to_msecs(*(int *)(table->data));
2302 if (put_user(val, (int __user *)oldval))
2303 return -EFAULT;
2304 if (put_user(sizeof(int), oldlenp))
2305 return -EFAULT;
2308 if (newval && newlen) {
2309 int new;
2310 if (newlen != sizeof(int))
2311 return -EINVAL;
2312 if (get_user(new, (int __user *)newval))
2313 return -EFAULT;
2314 *(int *)(table->data) = msecs_to_jiffies(new);
2316 return 1;
2321 #else /* CONFIG_SYSCTL_SYSCALL */
2324 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2326 static int msg_count;
2327 struct __sysctl_args tmp;
2328 int name[CTL_MAXNAME];
2329 int i;
2331 /* Read in the sysctl name for better debug message logging */
2332 if (copy_from_user(&tmp, args, sizeof(tmp)))
2333 return -EFAULT;
2334 if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
2335 return -ENOTDIR;
2336 for (i = 0; i < tmp.nlen; i++)
2337 if (get_user(name[i], tmp.name + i))
2338 return -EFAULT;
2340 /* Ignore accesses to kernel.version */
2341 if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
2342 goto out;
2344 if (msg_count < 5) {
2345 msg_count++;
2346 printk(KERN_INFO
2347 "warning: process `%s' used the removed sysctl "
2348 "system call with ", current->comm);
2349 for (i = 0; i < tmp.nlen; i++)
2350 printk("%d.", name[i]);
2351 printk("\n");
2353 out:
2354 return -ENOSYS;
2357 int sysctl_string(ctl_table *table, int __user *name, int nlen,
2358 void __user *oldval, size_t __user *oldlenp,
2359 void __user *newval, size_t newlen)
2361 return -ENOSYS;
2364 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2365 void __user *oldval, size_t __user *oldlenp,
2366 void __user *newval, size_t newlen)
2368 return -ENOSYS;
2371 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2372 void __user *oldval, size_t __user *oldlenp,
2373 void __user *newval, size_t newlen)
2375 return -ENOSYS;
2378 int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2379 void __user *oldval, size_t __user *oldlenp,
2380 void __user *newval, size_t newlen)
2382 return -ENOSYS;
2385 #endif /* CONFIG_SYSCTL_SYSCALL */
2388 * No sense putting this after each symbol definition, twice,
2389 * exception granted :-)
2391 EXPORT_SYMBOL(proc_dointvec);
2392 EXPORT_SYMBOL(proc_dointvec_jiffies);
2393 EXPORT_SYMBOL(proc_dointvec_minmax);
2394 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2395 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2396 EXPORT_SYMBOL(proc_dostring);
2397 EXPORT_SYMBOL(proc_doulongvec_minmax);
2398 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2399 EXPORT_SYMBOL(register_sysctl_table);
2400 EXPORT_SYMBOL(sysctl_intvec);
2401 EXPORT_SYMBOL(sysctl_jiffies);
2402 EXPORT_SYMBOL(sysctl_ms_jiffies);
2403 EXPORT_SYMBOL(sysctl_string);
2404 EXPORT_SYMBOL(unregister_sysctl_table);