[PATCH] fix arm26 THREAD_SIZE
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / sysctl.c
blobf5d69b6e29f50fb051b8ecf1add5964865c105f4
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/config.h>
22 #include <linux/module.h>
23 #include <linux/mm.h>
24 #include <linux/swap.h>
25 #include <linux/slab.h>
26 #include <linux/sysctl.h>
27 #include <linux/proc_fs.h>
28 #include <linux/capability.h>
29 #include <linux/ctype.h>
30 #include <linux/utsname.h>
31 #include <linux/capability.h>
32 #include <linux/smp_lock.h>
33 #include <linux/init.h>
34 #include <linux/kernel.h>
35 #include <linux/kobject.h>
36 #include <linux/net.h>
37 #include <linux/sysrq.h>
38 #include <linux/highuid.h>
39 #include <linux/writeback.h>
40 #include <linux/hugetlb.h>
41 #include <linux/security.h>
42 #include <linux/initrd.h>
43 #include <linux/times.h>
44 #include <linux/limits.h>
45 #include <linux/dcache.h>
46 #include <linux/syscalls.h>
48 #include <asm/uaccess.h>
49 #include <asm/processor.h>
51 #ifdef CONFIG_ROOT_NFS
52 #include <linux/nfs_fs.h>
53 #endif
55 #if defined(CONFIG_SYSCTL)
57 /* External variables not in a header file. */
58 extern int C_A_D;
59 extern int sysctl_overcommit_memory;
60 extern int sysctl_overcommit_ratio;
61 extern int max_threads;
62 extern int sysrq_enabled;
63 extern int core_uses_pid;
64 extern int suid_dumpable;
65 extern char core_pattern[];
66 extern int cad_pid;
67 extern int pid_max;
68 extern int min_free_kbytes;
69 extern int printk_ratelimit_jiffies;
70 extern int printk_ratelimit_burst;
71 extern int pid_max_min, pid_max_max;
72 extern int sysctl_drop_caches;
73 extern int percpu_pagelist_fraction;
75 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
76 int unknown_nmi_panic;
77 extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *,
78 void __user *, size_t *, loff_t *);
79 #endif
81 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
82 static int maxolduid = 65535;
83 static int minolduid;
84 static int min_percpu_pagelist_fract = 8;
86 static int ngroups_max = NGROUPS_MAX;
88 #ifdef CONFIG_KMOD
89 extern char modprobe_path[];
90 #endif
91 #ifdef CONFIG_CHR_DEV_SG
92 extern int sg_big_buff;
93 #endif
94 #ifdef CONFIG_SYSVIPC
95 extern size_t shm_ctlmax;
96 extern size_t shm_ctlall;
97 extern int shm_ctlmni;
98 extern int msg_ctlmax;
99 extern int msg_ctlmnb;
100 extern int msg_ctlmni;
101 extern int sem_ctls[];
102 #endif
104 #ifdef __sparc__
105 extern char reboot_command [];
106 extern int stop_a_enabled;
107 extern int scons_pwroff;
108 #endif
110 #ifdef __hppa__
111 extern int pwrsw_enabled;
112 extern int unaligned_enabled;
113 #endif
115 #ifdef CONFIG_S390
116 #ifdef CONFIG_MATHEMU
117 extern int sysctl_ieee_emulation_warnings;
118 #endif
119 extern int sysctl_userprocess_debug;
120 extern int spin_retry;
121 #endif
123 extern int sysctl_hz_timer;
125 #ifdef CONFIG_BSD_PROCESS_ACCT
126 extern int acct_parm[];
127 #endif
129 int randomize_va_space = 1;
131 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
132 ctl_table *, void **);
133 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
134 void __user *buffer, size_t *lenp, loff_t *ppos);
136 static ctl_table root_table[];
137 static struct ctl_table_header root_table_header =
138 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
140 static ctl_table kern_table[];
141 static ctl_table vm_table[];
142 static ctl_table proc_table[];
143 static ctl_table fs_table[];
144 static ctl_table debug_table[];
145 static ctl_table dev_table[];
146 extern ctl_table random_table[];
147 #ifdef CONFIG_UNIX98_PTYS
148 extern ctl_table pty_table[];
149 #endif
150 #ifdef CONFIG_INOTIFY
151 extern ctl_table inotify_table[];
152 #endif
154 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
155 int sysctl_legacy_va_layout;
156 #endif
158 /* /proc declarations: */
160 #ifdef CONFIG_PROC_FS
162 static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *);
163 static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
164 static int proc_opensys(struct inode *, struct file *);
166 struct file_operations proc_sys_file_operations = {
167 .open = proc_opensys,
168 .read = proc_readsys,
169 .write = proc_writesys,
172 extern struct proc_dir_entry *proc_sys_root;
174 static void register_proc_table(ctl_table *, struct proc_dir_entry *, void *);
175 static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
176 #endif
178 /* The default sysctl tables: */
180 static ctl_table root_table[] = {
182 .ctl_name = CTL_KERN,
183 .procname = "kernel",
184 .mode = 0555,
185 .child = kern_table,
188 .ctl_name = CTL_VM,
189 .procname = "vm",
190 .mode = 0555,
191 .child = vm_table,
193 #ifdef CONFIG_NET
195 .ctl_name = CTL_NET,
196 .procname = "net",
197 .mode = 0555,
198 .child = net_table,
200 #endif
202 .ctl_name = CTL_PROC,
203 .procname = "proc",
204 .mode = 0555,
205 .child = proc_table,
208 .ctl_name = CTL_FS,
209 .procname = "fs",
210 .mode = 0555,
211 .child = fs_table,
214 .ctl_name = CTL_DEBUG,
215 .procname = "debug",
216 .mode = 0555,
217 .child = debug_table,
220 .ctl_name = CTL_DEV,
221 .procname = "dev",
222 .mode = 0555,
223 .child = dev_table,
226 { .ctl_name = 0 }
229 static ctl_table kern_table[] = {
231 .ctl_name = KERN_OSTYPE,
232 .procname = "ostype",
233 .data = system_utsname.sysname,
234 .maxlen = sizeof(system_utsname.sysname),
235 .mode = 0444,
236 .proc_handler = &proc_doutsstring,
237 .strategy = &sysctl_string,
240 .ctl_name = KERN_OSRELEASE,
241 .procname = "osrelease",
242 .data = system_utsname.release,
243 .maxlen = sizeof(system_utsname.release),
244 .mode = 0444,
245 .proc_handler = &proc_doutsstring,
246 .strategy = &sysctl_string,
249 .ctl_name = KERN_VERSION,
250 .procname = "version",
251 .data = system_utsname.version,
252 .maxlen = sizeof(system_utsname.version),
253 .mode = 0444,
254 .proc_handler = &proc_doutsstring,
255 .strategy = &sysctl_string,
258 .ctl_name = KERN_NODENAME,
259 .procname = "hostname",
260 .data = system_utsname.nodename,
261 .maxlen = sizeof(system_utsname.nodename),
262 .mode = 0644,
263 .proc_handler = &proc_doutsstring,
264 .strategy = &sysctl_string,
267 .ctl_name = KERN_DOMAINNAME,
268 .procname = "domainname",
269 .data = system_utsname.domainname,
270 .maxlen = sizeof(system_utsname.domainname),
271 .mode = 0644,
272 .proc_handler = &proc_doutsstring,
273 .strategy = &sysctl_string,
276 .ctl_name = KERN_PANIC,
277 .procname = "panic",
278 .data = &panic_timeout,
279 .maxlen = sizeof(int),
280 .mode = 0644,
281 .proc_handler = &proc_dointvec,
284 .ctl_name = KERN_CORE_USES_PID,
285 .procname = "core_uses_pid",
286 .data = &core_uses_pid,
287 .maxlen = sizeof(int),
288 .mode = 0644,
289 .proc_handler = &proc_dointvec,
292 .ctl_name = KERN_CORE_PATTERN,
293 .procname = "core_pattern",
294 .data = core_pattern,
295 .maxlen = 64,
296 .mode = 0644,
297 .proc_handler = &proc_dostring,
298 .strategy = &sysctl_string,
301 .ctl_name = KERN_TAINTED,
302 .procname = "tainted",
303 .data = &tainted,
304 .maxlen = sizeof(int),
305 .mode = 0444,
306 .proc_handler = &proc_dointvec,
309 .ctl_name = KERN_CAP_BSET,
310 .procname = "cap-bound",
311 .data = &cap_bset,
312 .maxlen = sizeof(kernel_cap_t),
313 .mode = 0600,
314 .proc_handler = &proc_dointvec_bset,
316 #ifdef CONFIG_BLK_DEV_INITRD
318 .ctl_name = KERN_REALROOTDEV,
319 .procname = "real-root-dev",
320 .data = &real_root_dev,
321 .maxlen = sizeof(int),
322 .mode = 0644,
323 .proc_handler = &proc_dointvec,
325 #endif
326 #ifdef __sparc__
328 .ctl_name = KERN_SPARC_REBOOT,
329 .procname = "reboot-cmd",
330 .data = reboot_command,
331 .maxlen = 256,
332 .mode = 0644,
333 .proc_handler = &proc_dostring,
334 .strategy = &sysctl_string,
337 .ctl_name = KERN_SPARC_STOP_A,
338 .procname = "stop-a",
339 .data = &stop_a_enabled,
340 .maxlen = sizeof (int),
341 .mode = 0644,
342 .proc_handler = &proc_dointvec,
345 .ctl_name = KERN_SPARC_SCONS_PWROFF,
346 .procname = "scons-poweroff",
347 .data = &scons_pwroff,
348 .maxlen = sizeof (int),
349 .mode = 0644,
350 .proc_handler = &proc_dointvec,
352 #endif
353 #ifdef __hppa__
355 .ctl_name = KERN_HPPA_PWRSW,
356 .procname = "soft-power",
357 .data = &pwrsw_enabled,
358 .maxlen = sizeof (int),
359 .mode = 0644,
360 .proc_handler = &proc_dointvec,
363 .ctl_name = KERN_HPPA_UNALIGNED,
364 .procname = "unaligned-trap",
365 .data = &unaligned_enabled,
366 .maxlen = sizeof (int),
367 .mode = 0644,
368 .proc_handler = &proc_dointvec,
370 #endif
372 .ctl_name = KERN_CTLALTDEL,
373 .procname = "ctrl-alt-del",
374 .data = &C_A_D,
375 .maxlen = sizeof(int),
376 .mode = 0644,
377 .proc_handler = &proc_dointvec,
380 .ctl_name = KERN_PRINTK,
381 .procname = "printk",
382 .data = &console_loglevel,
383 .maxlen = 4*sizeof(int),
384 .mode = 0644,
385 .proc_handler = &proc_dointvec,
387 #ifdef CONFIG_KMOD
389 .ctl_name = KERN_MODPROBE,
390 .procname = "modprobe",
391 .data = &modprobe_path,
392 .maxlen = KMOD_PATH_LEN,
393 .mode = 0644,
394 .proc_handler = &proc_dostring,
395 .strategy = &sysctl_string,
397 #endif
398 #ifdef CONFIG_HOTPLUG
400 .ctl_name = KERN_HOTPLUG,
401 .procname = "hotplug",
402 .data = &uevent_helper,
403 .maxlen = UEVENT_HELPER_PATH_LEN,
404 .mode = 0644,
405 .proc_handler = &proc_dostring,
406 .strategy = &sysctl_string,
408 #endif
409 #ifdef CONFIG_CHR_DEV_SG
411 .ctl_name = KERN_SG_BIG_BUFF,
412 .procname = "sg-big-buff",
413 .data = &sg_big_buff,
414 .maxlen = sizeof (int),
415 .mode = 0444,
416 .proc_handler = &proc_dointvec,
418 #endif
419 #ifdef CONFIG_BSD_PROCESS_ACCT
421 .ctl_name = KERN_ACCT,
422 .procname = "acct",
423 .data = &acct_parm,
424 .maxlen = 3*sizeof(int),
425 .mode = 0644,
426 .proc_handler = &proc_dointvec,
428 #endif
429 #ifdef CONFIG_SYSVIPC
431 .ctl_name = KERN_SHMMAX,
432 .procname = "shmmax",
433 .data = &shm_ctlmax,
434 .maxlen = sizeof (size_t),
435 .mode = 0644,
436 .proc_handler = &proc_doulongvec_minmax,
439 .ctl_name = KERN_SHMALL,
440 .procname = "shmall",
441 .data = &shm_ctlall,
442 .maxlen = sizeof (size_t),
443 .mode = 0644,
444 .proc_handler = &proc_doulongvec_minmax,
447 .ctl_name = KERN_SHMMNI,
448 .procname = "shmmni",
449 .data = &shm_ctlmni,
450 .maxlen = sizeof (int),
451 .mode = 0644,
452 .proc_handler = &proc_dointvec,
455 .ctl_name = KERN_MSGMAX,
456 .procname = "msgmax",
457 .data = &msg_ctlmax,
458 .maxlen = sizeof (int),
459 .mode = 0644,
460 .proc_handler = &proc_dointvec,
463 .ctl_name = KERN_MSGMNI,
464 .procname = "msgmni",
465 .data = &msg_ctlmni,
466 .maxlen = sizeof (int),
467 .mode = 0644,
468 .proc_handler = &proc_dointvec,
471 .ctl_name = KERN_MSGMNB,
472 .procname = "msgmnb",
473 .data = &msg_ctlmnb,
474 .maxlen = sizeof (int),
475 .mode = 0644,
476 .proc_handler = &proc_dointvec,
479 .ctl_name = KERN_SEM,
480 .procname = "sem",
481 .data = &sem_ctls,
482 .maxlen = 4*sizeof (int),
483 .mode = 0644,
484 .proc_handler = &proc_dointvec,
486 #endif
487 #ifdef CONFIG_MAGIC_SYSRQ
489 .ctl_name = KERN_SYSRQ,
490 .procname = "sysrq",
491 .data = &sysrq_enabled,
492 .maxlen = sizeof (int),
493 .mode = 0644,
494 .proc_handler = &proc_dointvec,
496 #endif
498 .ctl_name = KERN_CADPID,
499 .procname = "cad_pid",
500 .data = &cad_pid,
501 .maxlen = sizeof (int),
502 .mode = 0600,
503 .proc_handler = &proc_dointvec,
506 .ctl_name = KERN_MAX_THREADS,
507 .procname = "threads-max",
508 .data = &max_threads,
509 .maxlen = sizeof(int),
510 .mode = 0644,
511 .proc_handler = &proc_dointvec,
514 .ctl_name = KERN_RANDOM,
515 .procname = "random",
516 .mode = 0555,
517 .child = random_table,
519 #ifdef CONFIG_UNIX98_PTYS
521 .ctl_name = KERN_PTY,
522 .procname = "pty",
523 .mode = 0555,
524 .child = pty_table,
526 #endif
528 .ctl_name = KERN_OVERFLOWUID,
529 .procname = "overflowuid",
530 .data = &overflowuid,
531 .maxlen = sizeof(int),
532 .mode = 0644,
533 .proc_handler = &proc_dointvec_minmax,
534 .strategy = &sysctl_intvec,
535 .extra1 = &minolduid,
536 .extra2 = &maxolduid,
539 .ctl_name = KERN_OVERFLOWGID,
540 .procname = "overflowgid",
541 .data = &overflowgid,
542 .maxlen = sizeof(int),
543 .mode = 0644,
544 .proc_handler = &proc_dointvec_minmax,
545 .strategy = &sysctl_intvec,
546 .extra1 = &minolduid,
547 .extra2 = &maxolduid,
549 #ifdef CONFIG_S390
550 #ifdef CONFIG_MATHEMU
552 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
553 .procname = "ieee_emulation_warnings",
554 .data = &sysctl_ieee_emulation_warnings,
555 .maxlen = sizeof(int),
556 .mode = 0644,
557 .proc_handler = &proc_dointvec,
559 #endif
560 #ifdef CONFIG_NO_IDLE_HZ
562 .ctl_name = KERN_HZ_TIMER,
563 .procname = "hz_timer",
564 .data = &sysctl_hz_timer,
565 .maxlen = sizeof(int),
566 .mode = 0644,
567 .proc_handler = &proc_dointvec,
569 #endif
571 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
572 .procname = "userprocess_debug",
573 .data = &sysctl_userprocess_debug,
574 .maxlen = sizeof(int),
575 .mode = 0644,
576 .proc_handler = &proc_dointvec,
578 #endif
580 .ctl_name = KERN_PIDMAX,
581 .procname = "pid_max",
582 .data = &pid_max,
583 .maxlen = sizeof (int),
584 .mode = 0644,
585 .proc_handler = &proc_dointvec_minmax,
586 .strategy = sysctl_intvec,
587 .extra1 = &pid_max_min,
588 .extra2 = &pid_max_max,
591 .ctl_name = KERN_PANIC_ON_OOPS,
592 .procname = "panic_on_oops",
593 .data = &panic_on_oops,
594 .maxlen = sizeof(int),
595 .mode = 0644,
596 .proc_handler = &proc_dointvec,
599 .ctl_name = KERN_PRINTK_RATELIMIT,
600 .procname = "printk_ratelimit",
601 .data = &printk_ratelimit_jiffies,
602 .maxlen = sizeof(int),
603 .mode = 0644,
604 .proc_handler = &proc_dointvec_jiffies,
605 .strategy = &sysctl_jiffies,
608 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
609 .procname = "printk_ratelimit_burst",
610 .data = &printk_ratelimit_burst,
611 .maxlen = sizeof(int),
612 .mode = 0644,
613 .proc_handler = &proc_dointvec,
616 .ctl_name = KERN_NGROUPS_MAX,
617 .procname = "ngroups_max",
618 .data = &ngroups_max,
619 .maxlen = sizeof (int),
620 .mode = 0444,
621 .proc_handler = &proc_dointvec,
623 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
625 .ctl_name = KERN_UNKNOWN_NMI_PANIC,
626 .procname = "unknown_nmi_panic",
627 .data = &unknown_nmi_panic,
628 .maxlen = sizeof (int),
629 .mode = 0644,
630 .proc_handler = &proc_unknown_nmi_panic,
632 #endif
633 #if defined(CONFIG_X86)
635 .ctl_name = KERN_BOOTLOADER_TYPE,
636 .procname = "bootloader_type",
637 .data = &bootloader_type,
638 .maxlen = sizeof (int),
639 .mode = 0444,
640 .proc_handler = &proc_dointvec,
642 #endif
644 .ctl_name = KERN_RANDOMIZE,
645 .procname = "randomize_va_space",
646 .data = &randomize_va_space,
647 .maxlen = sizeof(int),
648 .mode = 0644,
649 .proc_handler = &proc_dointvec,
651 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
653 .ctl_name = KERN_SPIN_RETRY,
654 .procname = "spin_retry",
655 .data = &spin_retry,
656 .maxlen = sizeof (int),
657 .mode = 0644,
658 .proc_handler = &proc_dointvec,
660 #endif
661 { .ctl_name = 0 }
664 /* Constants for minimum and maximum testing in vm_table.
665 We use these as one-element integer vectors. */
666 static int zero;
667 static int one_hundred = 100;
670 static ctl_table vm_table[] = {
672 .ctl_name = VM_OVERCOMMIT_MEMORY,
673 .procname = "overcommit_memory",
674 .data = &sysctl_overcommit_memory,
675 .maxlen = sizeof(sysctl_overcommit_memory),
676 .mode = 0644,
677 .proc_handler = &proc_dointvec,
680 .ctl_name = VM_OVERCOMMIT_RATIO,
681 .procname = "overcommit_ratio",
682 .data = &sysctl_overcommit_ratio,
683 .maxlen = sizeof(sysctl_overcommit_ratio),
684 .mode = 0644,
685 .proc_handler = &proc_dointvec,
688 .ctl_name = VM_PAGE_CLUSTER,
689 .procname = "page-cluster",
690 .data = &page_cluster,
691 .maxlen = sizeof(int),
692 .mode = 0644,
693 .proc_handler = &proc_dointvec,
696 .ctl_name = VM_DIRTY_BACKGROUND,
697 .procname = "dirty_background_ratio",
698 .data = &dirty_background_ratio,
699 .maxlen = sizeof(dirty_background_ratio),
700 .mode = 0644,
701 .proc_handler = &proc_dointvec_minmax,
702 .strategy = &sysctl_intvec,
703 .extra1 = &zero,
704 .extra2 = &one_hundred,
707 .ctl_name = VM_DIRTY_RATIO,
708 .procname = "dirty_ratio",
709 .data = &vm_dirty_ratio,
710 .maxlen = sizeof(vm_dirty_ratio),
711 .mode = 0644,
712 .proc_handler = &proc_dointvec_minmax,
713 .strategy = &sysctl_intvec,
714 .extra1 = &zero,
715 .extra2 = &one_hundred,
718 .ctl_name = VM_DIRTY_WB_CS,
719 .procname = "dirty_writeback_centisecs",
720 .data = &dirty_writeback_centisecs,
721 .maxlen = sizeof(dirty_writeback_centisecs),
722 .mode = 0644,
723 .proc_handler = &dirty_writeback_centisecs_handler,
726 .ctl_name = VM_DIRTY_EXPIRE_CS,
727 .procname = "dirty_expire_centisecs",
728 .data = &dirty_expire_centisecs,
729 .maxlen = sizeof(dirty_expire_centisecs),
730 .mode = 0644,
731 .proc_handler = &proc_dointvec,
734 .ctl_name = VM_NR_PDFLUSH_THREADS,
735 .procname = "nr_pdflush_threads",
736 .data = &nr_pdflush_threads,
737 .maxlen = sizeof nr_pdflush_threads,
738 .mode = 0444 /* read-only*/,
739 .proc_handler = &proc_dointvec,
742 .ctl_name = VM_SWAPPINESS,
743 .procname = "swappiness",
744 .data = &vm_swappiness,
745 .maxlen = sizeof(vm_swappiness),
746 .mode = 0644,
747 .proc_handler = &proc_dointvec_minmax,
748 .strategy = &sysctl_intvec,
749 .extra1 = &zero,
750 .extra2 = &one_hundred,
752 #ifdef CONFIG_HUGETLB_PAGE
754 .ctl_name = VM_HUGETLB_PAGES,
755 .procname = "nr_hugepages",
756 .data = &max_huge_pages,
757 .maxlen = sizeof(unsigned long),
758 .mode = 0644,
759 .proc_handler = &hugetlb_sysctl_handler,
760 .extra1 = (void *)&hugetlb_zero,
761 .extra2 = (void *)&hugetlb_infinity,
764 .ctl_name = VM_HUGETLB_GROUP,
765 .procname = "hugetlb_shm_group",
766 .data = &sysctl_hugetlb_shm_group,
767 .maxlen = sizeof(gid_t),
768 .mode = 0644,
769 .proc_handler = &proc_dointvec,
771 #endif
773 .ctl_name = VM_LOWMEM_RESERVE_RATIO,
774 .procname = "lowmem_reserve_ratio",
775 .data = &sysctl_lowmem_reserve_ratio,
776 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
777 .mode = 0644,
778 .proc_handler = &lowmem_reserve_ratio_sysctl_handler,
779 .strategy = &sysctl_intvec,
782 .ctl_name = VM_DROP_PAGECACHE,
783 .procname = "drop_caches",
784 .data = &sysctl_drop_caches,
785 .maxlen = sizeof(int),
786 .mode = 0644,
787 .proc_handler = drop_caches_sysctl_handler,
788 .strategy = &sysctl_intvec,
791 .ctl_name = VM_MIN_FREE_KBYTES,
792 .procname = "min_free_kbytes",
793 .data = &min_free_kbytes,
794 .maxlen = sizeof(min_free_kbytes),
795 .mode = 0644,
796 .proc_handler = &min_free_kbytes_sysctl_handler,
797 .strategy = &sysctl_intvec,
798 .extra1 = &zero,
801 .ctl_name = VM_PERCPU_PAGELIST_FRACTION,
802 .procname = "percpu_pagelist_fraction",
803 .data = &percpu_pagelist_fraction,
804 .maxlen = sizeof(percpu_pagelist_fraction),
805 .mode = 0644,
806 .proc_handler = &percpu_pagelist_fraction_sysctl_handler,
807 .strategy = &sysctl_intvec,
808 .extra1 = &min_percpu_pagelist_fract,
810 #ifdef CONFIG_MMU
812 .ctl_name = VM_MAX_MAP_COUNT,
813 .procname = "max_map_count",
814 .data = &sysctl_max_map_count,
815 .maxlen = sizeof(sysctl_max_map_count),
816 .mode = 0644,
817 .proc_handler = &proc_dointvec
819 #endif
821 .ctl_name = VM_LAPTOP_MODE,
822 .procname = "laptop_mode",
823 .data = &laptop_mode,
824 .maxlen = sizeof(laptop_mode),
825 .mode = 0644,
826 .proc_handler = &proc_dointvec,
827 .strategy = &sysctl_intvec,
828 .extra1 = &zero,
831 .ctl_name = VM_BLOCK_DUMP,
832 .procname = "block_dump",
833 .data = &block_dump,
834 .maxlen = sizeof(block_dump),
835 .mode = 0644,
836 .proc_handler = &proc_dointvec,
837 .strategy = &sysctl_intvec,
838 .extra1 = &zero,
841 .ctl_name = VM_VFS_CACHE_PRESSURE,
842 .procname = "vfs_cache_pressure",
843 .data = &sysctl_vfs_cache_pressure,
844 .maxlen = sizeof(sysctl_vfs_cache_pressure),
845 .mode = 0644,
846 .proc_handler = &proc_dointvec,
847 .strategy = &sysctl_intvec,
848 .extra1 = &zero,
850 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
852 .ctl_name = VM_LEGACY_VA_LAYOUT,
853 .procname = "legacy_va_layout",
854 .data = &sysctl_legacy_va_layout,
855 .maxlen = sizeof(sysctl_legacy_va_layout),
856 .mode = 0644,
857 .proc_handler = &proc_dointvec,
858 .strategy = &sysctl_intvec,
859 .extra1 = &zero,
861 #endif
862 #ifdef CONFIG_SWAP
864 .ctl_name = VM_SWAP_TOKEN_TIMEOUT,
865 .procname = "swap_token_timeout",
866 .data = &swap_token_default_timeout,
867 .maxlen = sizeof(swap_token_default_timeout),
868 .mode = 0644,
869 .proc_handler = &proc_dointvec_jiffies,
870 .strategy = &sysctl_jiffies,
872 #endif
873 { .ctl_name = 0 }
876 static ctl_table proc_table[] = {
877 { .ctl_name = 0 }
880 static ctl_table fs_table[] = {
882 .ctl_name = FS_NRINODE,
883 .procname = "inode-nr",
884 .data = &inodes_stat,
885 .maxlen = 2*sizeof(int),
886 .mode = 0444,
887 .proc_handler = &proc_dointvec,
890 .ctl_name = FS_STATINODE,
891 .procname = "inode-state",
892 .data = &inodes_stat,
893 .maxlen = 7*sizeof(int),
894 .mode = 0444,
895 .proc_handler = &proc_dointvec,
898 .ctl_name = FS_NRFILE,
899 .procname = "file-nr",
900 .data = &files_stat,
901 .maxlen = 3*sizeof(int),
902 .mode = 0444,
903 .proc_handler = &proc_dointvec,
906 .ctl_name = FS_MAXFILE,
907 .procname = "file-max",
908 .data = &files_stat.max_files,
909 .maxlen = sizeof(int),
910 .mode = 0644,
911 .proc_handler = &proc_dointvec,
914 .ctl_name = FS_DENTRY,
915 .procname = "dentry-state",
916 .data = &dentry_stat,
917 .maxlen = 6*sizeof(int),
918 .mode = 0444,
919 .proc_handler = &proc_dointvec,
922 .ctl_name = FS_OVERFLOWUID,
923 .procname = "overflowuid",
924 .data = &fs_overflowuid,
925 .maxlen = sizeof(int),
926 .mode = 0644,
927 .proc_handler = &proc_dointvec_minmax,
928 .strategy = &sysctl_intvec,
929 .extra1 = &minolduid,
930 .extra2 = &maxolduid,
933 .ctl_name = FS_OVERFLOWGID,
934 .procname = "overflowgid",
935 .data = &fs_overflowgid,
936 .maxlen = sizeof(int),
937 .mode = 0644,
938 .proc_handler = &proc_dointvec_minmax,
939 .strategy = &sysctl_intvec,
940 .extra1 = &minolduid,
941 .extra2 = &maxolduid,
944 .ctl_name = FS_LEASES,
945 .procname = "leases-enable",
946 .data = &leases_enable,
947 .maxlen = sizeof(int),
948 .mode = 0644,
949 .proc_handler = &proc_dointvec,
951 #ifdef CONFIG_DNOTIFY
953 .ctl_name = FS_DIR_NOTIFY,
954 .procname = "dir-notify-enable",
955 .data = &dir_notify_enable,
956 .maxlen = sizeof(int),
957 .mode = 0644,
958 .proc_handler = &proc_dointvec,
960 #endif
961 #ifdef CONFIG_MMU
963 .ctl_name = FS_LEASE_TIME,
964 .procname = "lease-break-time",
965 .data = &lease_break_time,
966 .maxlen = sizeof(int),
967 .mode = 0644,
968 .proc_handler = &proc_dointvec,
971 .ctl_name = FS_AIO_NR,
972 .procname = "aio-nr",
973 .data = &aio_nr,
974 .maxlen = sizeof(aio_nr),
975 .mode = 0444,
976 .proc_handler = &proc_doulongvec_minmax,
979 .ctl_name = FS_AIO_MAX_NR,
980 .procname = "aio-max-nr",
981 .data = &aio_max_nr,
982 .maxlen = sizeof(aio_max_nr),
983 .mode = 0644,
984 .proc_handler = &proc_doulongvec_minmax,
986 #ifdef CONFIG_INOTIFY
988 .ctl_name = FS_INOTIFY,
989 .procname = "inotify",
990 .mode = 0555,
991 .child = inotify_table,
993 #endif
994 #endif
996 .ctl_name = KERN_SETUID_DUMPABLE,
997 .procname = "suid_dumpable",
998 .data = &suid_dumpable,
999 .maxlen = sizeof(int),
1000 .mode = 0644,
1001 .proc_handler = &proc_dointvec,
1003 { .ctl_name = 0 }
1006 static ctl_table debug_table[] = {
1007 { .ctl_name = 0 }
1010 static ctl_table dev_table[] = {
1011 { .ctl_name = 0 }
1014 extern void init_irq_proc (void);
1016 static DEFINE_SPINLOCK(sysctl_lock);
1018 /* called under sysctl_lock */
1019 static int use_table(struct ctl_table_header *p)
1021 if (unlikely(p->unregistering))
1022 return 0;
1023 p->used++;
1024 return 1;
1027 /* called under sysctl_lock */
1028 static void unuse_table(struct ctl_table_header *p)
1030 if (!--p->used)
1031 if (unlikely(p->unregistering))
1032 complete(p->unregistering);
1035 /* called under sysctl_lock, will reacquire if has to wait */
1036 static void start_unregistering(struct ctl_table_header *p)
1039 * if p->used is 0, nobody will ever touch that entry again;
1040 * we'll eliminate all paths to it before dropping sysctl_lock
1042 if (unlikely(p->used)) {
1043 struct completion wait;
1044 init_completion(&wait);
1045 p->unregistering = &wait;
1046 spin_unlock(&sysctl_lock);
1047 wait_for_completion(&wait);
1048 spin_lock(&sysctl_lock);
1051 * do not remove from the list until nobody holds it; walking the
1052 * list in do_sysctl() relies on that.
1054 list_del_init(&p->ctl_entry);
1057 void __init sysctl_init(void)
1059 #ifdef CONFIG_PROC_FS
1060 register_proc_table(root_table, proc_sys_root, &root_table_header);
1061 init_irq_proc();
1062 #endif
1065 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1066 void __user *newval, size_t newlen)
1068 struct list_head *tmp;
1069 int error = -ENOTDIR;
1071 if (nlen <= 0 || nlen >= CTL_MAXNAME)
1072 return -ENOTDIR;
1073 if (oldval) {
1074 int old_len;
1075 if (!oldlenp || get_user(old_len, oldlenp))
1076 return -EFAULT;
1078 spin_lock(&sysctl_lock);
1079 tmp = &root_table_header.ctl_entry;
1080 do {
1081 struct ctl_table_header *head =
1082 list_entry(tmp, struct ctl_table_header, ctl_entry);
1083 void *context = NULL;
1085 if (!use_table(head))
1086 continue;
1088 spin_unlock(&sysctl_lock);
1090 error = parse_table(name, nlen, oldval, oldlenp,
1091 newval, newlen, head->ctl_table,
1092 &context);
1093 kfree(context);
1095 spin_lock(&sysctl_lock);
1096 unuse_table(head);
1097 if (error != -ENOTDIR)
1098 break;
1099 } while ((tmp = tmp->next) != &root_table_header.ctl_entry);
1100 spin_unlock(&sysctl_lock);
1101 return error;
1104 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1106 struct __sysctl_args tmp;
1107 int error;
1109 if (copy_from_user(&tmp, args, sizeof(tmp)))
1110 return -EFAULT;
1112 lock_kernel();
1113 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1114 tmp.newval, tmp.newlen);
1115 unlock_kernel();
1116 return error;
1120 * ctl_perm does NOT grant the superuser all rights automatically, because
1121 * some sysctl variables are readonly even to root.
1124 static int test_perm(int mode, int op)
1126 if (!current->euid)
1127 mode >>= 6;
1128 else if (in_egroup_p(0))
1129 mode >>= 3;
1130 if ((mode & op & 0007) == op)
1131 return 0;
1132 return -EACCES;
1135 static inline int ctl_perm(ctl_table *table, int op)
1137 int error;
1138 error = security_sysctl(table, op);
1139 if (error)
1140 return error;
1141 return test_perm(table->mode, op);
1144 static int parse_table(int __user *name, int nlen,
1145 void __user *oldval, size_t __user *oldlenp,
1146 void __user *newval, size_t newlen,
1147 ctl_table *table, void **context)
1149 int n;
1150 repeat:
1151 if (!nlen)
1152 return -ENOTDIR;
1153 if (get_user(n, name))
1154 return -EFAULT;
1155 for ( ; table->ctl_name; table++) {
1156 if (n == table->ctl_name || table->ctl_name == CTL_ANY) {
1157 int error;
1158 if (table->child) {
1159 if (ctl_perm(table, 001))
1160 return -EPERM;
1161 if (table->strategy) {
1162 error = table->strategy(
1163 table, name, nlen,
1164 oldval, oldlenp,
1165 newval, newlen, context);
1166 if (error)
1167 return error;
1169 name++;
1170 nlen--;
1171 table = table->child;
1172 goto repeat;
1174 error = do_sysctl_strategy(table, name, nlen,
1175 oldval, oldlenp,
1176 newval, newlen, context);
1177 return error;
1180 return -ENOTDIR;
1183 /* Perform the actual read/write of a sysctl table entry. */
1184 int do_sysctl_strategy (ctl_table *table,
1185 int __user *name, int nlen,
1186 void __user *oldval, size_t __user *oldlenp,
1187 void __user *newval, size_t newlen, void **context)
1189 int op = 0, rc;
1190 size_t len;
1192 if (oldval)
1193 op |= 004;
1194 if (newval)
1195 op |= 002;
1196 if (ctl_perm(table, op))
1197 return -EPERM;
1199 if (table->strategy) {
1200 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1201 newval, newlen, context);
1202 if (rc < 0)
1203 return rc;
1204 if (rc > 0)
1205 return 0;
1208 /* If there is no strategy routine, or if the strategy returns
1209 * zero, proceed with automatic r/w */
1210 if (table->data && table->maxlen) {
1211 if (oldval && oldlenp) {
1212 if (get_user(len, oldlenp))
1213 return -EFAULT;
1214 if (len) {
1215 if (len > table->maxlen)
1216 len = table->maxlen;
1217 if(copy_to_user(oldval, table->data, len))
1218 return -EFAULT;
1219 if(put_user(len, oldlenp))
1220 return -EFAULT;
1223 if (newval && newlen) {
1224 len = newlen;
1225 if (len > table->maxlen)
1226 len = table->maxlen;
1227 if(copy_from_user(table->data, newval, len))
1228 return -EFAULT;
1231 return 0;
1235 * register_sysctl_table - register a sysctl hierarchy
1236 * @table: the top-level table structure
1237 * @insert_at_head: whether the entry should be inserted in front or at the end
1239 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1240 * array. An entry with a ctl_name of 0 terminates the table.
1242 * The members of the &ctl_table structure are used as follows:
1244 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1245 * must be unique within that level of sysctl
1247 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1248 * enter a sysctl file
1250 * data - a pointer to data for use by proc_handler
1252 * maxlen - the maximum size in bytes of the data
1254 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1256 * child - a pointer to the child sysctl table if this entry is a directory, or
1257 * %NULL.
1259 * proc_handler - the text handler routine (described below)
1261 * strategy - the strategy routine (described below)
1263 * de - for internal use by the sysctl routines
1265 * extra1, extra2 - extra pointers usable by the proc handler routines
1267 * Leaf nodes in the sysctl tree will be represented by a single file
1268 * under /proc; non-leaf nodes will be represented by directories.
1270 * sysctl(2) can automatically manage read and write requests through
1271 * the sysctl table. The data and maxlen fields of the ctl_table
1272 * struct enable minimal validation of the values being written to be
1273 * performed, and the mode field allows minimal authentication.
1275 * More sophisticated management can be enabled by the provision of a
1276 * strategy routine with the table entry. This will be called before
1277 * any automatic read or write of the data is performed.
1279 * The strategy routine may return
1281 * < 0 - Error occurred (error is passed to user process)
1283 * 0 - OK - proceed with automatic read or write.
1285 * > 0 - OK - read or write has been done by the strategy routine, so
1286 * return immediately.
1288 * There must be a proc_handler routine for any terminal nodes
1289 * mirrored under /proc/sys (non-terminals are handled by a built-in
1290 * directory handler). Several default handlers are available to
1291 * cover common cases -
1293 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1294 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1295 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1297 * It is the handler's job to read the input buffer from user memory
1298 * and process it. The handler should return 0 on success.
1300 * This routine returns %NULL on a failure to register, and a pointer
1301 * to the table header on success.
1303 struct ctl_table_header *register_sysctl_table(ctl_table * table,
1304 int insert_at_head)
1306 struct ctl_table_header *tmp;
1307 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
1308 if (!tmp)
1309 return NULL;
1310 tmp->ctl_table = table;
1311 INIT_LIST_HEAD(&tmp->ctl_entry);
1312 tmp->used = 0;
1313 tmp->unregistering = NULL;
1314 spin_lock(&sysctl_lock);
1315 if (insert_at_head)
1316 list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
1317 else
1318 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1319 spin_unlock(&sysctl_lock);
1320 #ifdef CONFIG_PROC_FS
1321 register_proc_table(table, proc_sys_root, tmp);
1322 #endif
1323 return tmp;
1327 * unregister_sysctl_table - unregister a sysctl table hierarchy
1328 * @header: the header returned from register_sysctl_table
1330 * Unregisters the sysctl table and all children. proc entries may not
1331 * actually be removed until they are no longer used by anyone.
1333 void unregister_sysctl_table(struct ctl_table_header * header)
1335 might_sleep();
1336 spin_lock(&sysctl_lock);
1337 start_unregistering(header);
1338 #ifdef CONFIG_PROC_FS
1339 unregister_proc_table(header->ctl_table, proc_sys_root);
1340 #endif
1341 spin_unlock(&sysctl_lock);
1342 kfree(header);
1346 * /proc/sys support
1349 #ifdef CONFIG_PROC_FS
1351 /* Scan the sysctl entries in table and add them all into /proc */
1352 static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, void *set)
1354 struct proc_dir_entry *de;
1355 int len;
1356 mode_t mode;
1358 for (; table->ctl_name; table++) {
1359 /* Can't do anything without a proc name. */
1360 if (!table->procname)
1361 continue;
1362 /* Maybe we can't do anything with it... */
1363 if (!table->proc_handler && !table->child) {
1364 printk(KERN_WARNING "SYSCTL: Can't register %s\n",
1365 table->procname);
1366 continue;
1369 len = strlen(table->procname);
1370 mode = table->mode;
1372 de = NULL;
1373 if (table->proc_handler)
1374 mode |= S_IFREG;
1375 else {
1376 mode |= S_IFDIR;
1377 for (de = root->subdir; de; de = de->next) {
1378 if (proc_match(len, table->procname, de))
1379 break;
1381 /* If the subdir exists already, de is non-NULL */
1384 if (!de) {
1385 de = create_proc_entry(table->procname, mode, root);
1386 if (!de)
1387 continue;
1388 de->set = set;
1389 de->data = (void *) table;
1390 if (table->proc_handler)
1391 de->proc_fops = &proc_sys_file_operations;
1393 table->de = de;
1394 if (de->mode & S_IFDIR)
1395 register_proc_table(table->child, de, set);
1400 * Unregister a /proc sysctl table and any subdirectories.
1402 static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root)
1404 struct proc_dir_entry *de;
1405 for (; table->ctl_name; table++) {
1406 if (!(de = table->de))
1407 continue;
1408 if (de->mode & S_IFDIR) {
1409 if (!table->child) {
1410 printk (KERN_ALERT "Help - malformed sysctl tree on free\n");
1411 continue;
1413 unregister_proc_table(table->child, de);
1415 /* Don't unregister directories which still have entries.. */
1416 if (de->subdir)
1417 continue;
1421 * In any case, mark the entry as goner; we'll keep it
1422 * around if it's busy, but we'll know to do nothing with
1423 * its fields. We are under sysctl_lock here.
1425 de->data = NULL;
1427 /* Don't unregister proc entries that are still being used.. */
1428 if (atomic_read(&de->count))
1429 continue;
1431 table->de = NULL;
1432 remove_proc_entry(table->procname, root);
1436 static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
1437 size_t count, loff_t *ppos)
1439 int op;
1440 struct proc_dir_entry *de = PDE(file->f_dentry->d_inode);
1441 struct ctl_table *table;
1442 size_t res;
1443 ssize_t error = -ENOTDIR;
1445 spin_lock(&sysctl_lock);
1446 if (de && de->data && use_table(de->set)) {
1448 * at that point we know that sysctl was not unregistered
1449 * and won't be until we finish
1451 spin_unlock(&sysctl_lock);
1452 table = (struct ctl_table *) de->data;
1453 if (!table || !table->proc_handler)
1454 goto out;
1455 error = -EPERM;
1456 op = (write ? 002 : 004);
1457 if (ctl_perm(table, op))
1458 goto out;
1460 /* careful: calling conventions are nasty here */
1461 res = count;
1462 error = (*table->proc_handler)(table, write, file,
1463 buf, &res, ppos);
1464 if (!error)
1465 error = res;
1466 out:
1467 spin_lock(&sysctl_lock);
1468 unuse_table(de->set);
1470 spin_unlock(&sysctl_lock);
1471 return error;
1474 static int proc_opensys(struct inode *inode, struct file *file)
1476 if (file->f_mode & FMODE_WRITE) {
1478 * sysctl entries that are not writable,
1479 * are _NOT_ writable, capabilities or not.
1481 if (!(inode->i_mode & S_IWUSR))
1482 return -EPERM;
1485 return 0;
1488 static ssize_t proc_readsys(struct file * file, char __user * buf,
1489 size_t count, loff_t *ppos)
1491 return do_rw_proc(0, file, buf, count, ppos);
1494 static ssize_t proc_writesys(struct file * file, const char __user * buf,
1495 size_t count, loff_t *ppos)
1497 return do_rw_proc(1, file, (char __user *) buf, count, ppos);
1501 * proc_dostring - read a string sysctl
1502 * @table: the sysctl table
1503 * @write: %TRUE if this is a write to the sysctl file
1504 * @filp: the file structure
1505 * @buffer: the user buffer
1506 * @lenp: the size of the user buffer
1507 * @ppos: file position
1509 * Reads/writes a string from/to the user buffer. If the kernel
1510 * buffer provided is not large enough to hold the string, the
1511 * string is truncated. The copied string is %NULL-terminated.
1512 * If the string is being read by the user process, it is copied
1513 * and a newline '\n' is added. It is truncated if the buffer is
1514 * not large enough.
1516 * Returns 0 on success.
1518 int proc_dostring(ctl_table *table, int write, struct file *filp,
1519 void __user *buffer, size_t *lenp, loff_t *ppos)
1521 size_t len;
1522 char __user *p;
1523 char c;
1525 if (!table->data || !table->maxlen || !*lenp ||
1526 (*ppos && !write)) {
1527 *lenp = 0;
1528 return 0;
1531 if (write) {
1532 len = 0;
1533 p = buffer;
1534 while (len < *lenp) {
1535 if (get_user(c, p++))
1536 return -EFAULT;
1537 if (c == 0 || c == '\n')
1538 break;
1539 len++;
1541 if (len >= table->maxlen)
1542 len = table->maxlen-1;
1543 if(copy_from_user(table->data, buffer, len))
1544 return -EFAULT;
1545 ((char *) table->data)[len] = 0;
1546 *ppos += *lenp;
1547 } else {
1548 len = strlen(table->data);
1549 if (len > table->maxlen)
1550 len = table->maxlen;
1551 if (len > *lenp)
1552 len = *lenp;
1553 if (len)
1554 if(copy_to_user(buffer, table->data, len))
1555 return -EFAULT;
1556 if (len < *lenp) {
1557 if(put_user('\n', ((char __user *) buffer) + len))
1558 return -EFAULT;
1559 len++;
1561 *lenp = len;
1562 *ppos += len;
1564 return 0;
1568 * Special case of dostring for the UTS structure. This has locks
1569 * to observe. Should this be in kernel/sys.c ????
1572 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1573 void __user *buffer, size_t *lenp, loff_t *ppos)
1575 int r;
1577 if (!write) {
1578 down_read(&uts_sem);
1579 r=proc_dostring(table,0,filp,buffer,lenp, ppos);
1580 up_read(&uts_sem);
1581 } else {
1582 down_write(&uts_sem);
1583 r=proc_dostring(table,1,filp,buffer,lenp, ppos);
1584 up_write(&uts_sem);
1586 return r;
1589 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1590 int *valp,
1591 int write, void *data)
1593 if (write) {
1594 *valp = *negp ? -*lvalp : *lvalp;
1595 } else {
1596 int val = *valp;
1597 if (val < 0) {
1598 *negp = -1;
1599 *lvalp = (unsigned long)-val;
1600 } else {
1601 *negp = 0;
1602 *lvalp = (unsigned long)val;
1605 return 0;
1608 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
1609 void __user *buffer, size_t *lenp, loff_t *ppos,
1610 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1611 int write, void *data),
1612 void *data)
1614 #define TMPBUFLEN 21
1615 int *i, vleft, first=1, neg, val;
1616 unsigned long lval;
1617 size_t left, len;
1619 char buf[TMPBUFLEN], *p;
1620 char __user *s = buffer;
1622 if (!table->data || !table->maxlen || !*lenp ||
1623 (*ppos && !write)) {
1624 *lenp = 0;
1625 return 0;
1628 i = (int *) table->data;
1629 vleft = table->maxlen / sizeof(*i);
1630 left = *lenp;
1632 if (!conv)
1633 conv = do_proc_dointvec_conv;
1635 for (; left && vleft--; i++, first=0) {
1636 if (write) {
1637 while (left) {
1638 char c;
1639 if (get_user(c, s))
1640 return -EFAULT;
1641 if (!isspace(c))
1642 break;
1643 left--;
1644 s++;
1646 if (!left)
1647 break;
1648 neg = 0;
1649 len = left;
1650 if (len > sizeof(buf) - 1)
1651 len = sizeof(buf) - 1;
1652 if (copy_from_user(buf, s, len))
1653 return -EFAULT;
1654 buf[len] = 0;
1655 p = buf;
1656 if (*p == '-' && left > 1) {
1657 neg = 1;
1658 left--, p++;
1660 if (*p < '0' || *p > '9')
1661 break;
1663 lval = simple_strtoul(p, &p, 0);
1665 len = p-buf;
1666 if ((len < left) && *p && !isspace(*p))
1667 break;
1668 if (neg)
1669 val = -val;
1670 s += len;
1671 left -= len;
1673 if (conv(&neg, &lval, i, 1, data))
1674 break;
1675 } else {
1676 p = buf;
1677 if (!first)
1678 *p++ = '\t';
1680 if (conv(&neg, &lval, i, 0, data))
1681 break;
1683 sprintf(p, "%s%lu", neg ? "-" : "", lval);
1684 len = strlen(buf);
1685 if (len > left)
1686 len = left;
1687 if(copy_to_user(s, buf, len))
1688 return -EFAULT;
1689 left -= len;
1690 s += len;
1694 if (!write && !first && left) {
1695 if(put_user('\n', s))
1696 return -EFAULT;
1697 left--, s++;
1699 if (write) {
1700 while (left) {
1701 char c;
1702 if (get_user(c, s++))
1703 return -EFAULT;
1704 if (!isspace(c))
1705 break;
1706 left--;
1709 if (write && first)
1710 return -EINVAL;
1711 *lenp -= left;
1712 *ppos += *lenp;
1713 return 0;
1714 #undef TMPBUFLEN
1718 * proc_dointvec - read a vector of integers
1719 * @table: the sysctl table
1720 * @write: %TRUE if this is a write to the sysctl file
1721 * @filp: the file structure
1722 * @buffer: the user buffer
1723 * @lenp: the size of the user buffer
1724 * @ppos: file position
1726 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1727 * values from/to the user buffer, treated as an ASCII string.
1729 * Returns 0 on success.
1731 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1732 void __user *buffer, size_t *lenp, loff_t *ppos)
1734 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1735 NULL,NULL);
1738 #define OP_SET 0
1739 #define OP_AND 1
1740 #define OP_OR 2
1741 #define OP_MAX 3
1742 #define OP_MIN 4
1744 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1745 int *valp,
1746 int write, void *data)
1748 int op = *(int *)data;
1749 if (write) {
1750 int val = *negp ? -*lvalp : *lvalp;
1751 switch(op) {
1752 case OP_SET: *valp = val; break;
1753 case OP_AND: *valp &= val; break;
1754 case OP_OR: *valp |= val; break;
1755 case OP_MAX: if(*valp < val)
1756 *valp = val;
1757 break;
1758 case OP_MIN: if(*valp > val)
1759 *valp = val;
1760 break;
1762 } else {
1763 int val = *valp;
1764 if (val < 0) {
1765 *negp = -1;
1766 *lvalp = (unsigned long)-val;
1767 } else {
1768 *negp = 0;
1769 *lvalp = (unsigned long)val;
1772 return 0;
1776 * init may raise the set.
1779 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1780 void __user *buffer, size_t *lenp, loff_t *ppos)
1782 int op;
1784 if (!capable(CAP_SYS_MODULE)) {
1785 return -EPERM;
1788 op = (current->pid == 1) ? OP_SET : OP_AND;
1789 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1790 do_proc_dointvec_bset_conv,&op);
1793 struct do_proc_dointvec_minmax_conv_param {
1794 int *min;
1795 int *max;
1798 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1799 int *valp,
1800 int write, void *data)
1802 struct do_proc_dointvec_minmax_conv_param *param = data;
1803 if (write) {
1804 int val = *negp ? -*lvalp : *lvalp;
1805 if ((param->min && *param->min > val) ||
1806 (param->max && *param->max < val))
1807 return -EINVAL;
1808 *valp = val;
1809 } else {
1810 int val = *valp;
1811 if (val < 0) {
1812 *negp = -1;
1813 *lvalp = (unsigned long)-val;
1814 } else {
1815 *negp = 0;
1816 *lvalp = (unsigned long)val;
1819 return 0;
1823 * proc_dointvec_minmax - read a vector of integers with min/max values
1824 * @table: the sysctl table
1825 * @write: %TRUE if this is a write to the sysctl file
1826 * @filp: the file structure
1827 * @buffer: the user buffer
1828 * @lenp: the size of the user buffer
1829 * @ppos: file position
1831 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1832 * values from/to the user buffer, treated as an ASCII string.
1834 * This routine will ensure the values are within the range specified by
1835 * table->extra1 (min) and table->extra2 (max).
1837 * Returns 0 on success.
1839 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1840 void __user *buffer, size_t *lenp, loff_t *ppos)
1842 struct do_proc_dointvec_minmax_conv_param param = {
1843 .min = (int *) table->extra1,
1844 .max = (int *) table->extra2,
1846 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
1847 do_proc_dointvec_minmax_conv, &param);
1850 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
1851 struct file *filp,
1852 void __user *buffer,
1853 size_t *lenp, loff_t *ppos,
1854 unsigned long convmul,
1855 unsigned long convdiv)
1857 #define TMPBUFLEN 21
1858 unsigned long *i, *min, *max, val;
1859 int vleft, first=1, neg;
1860 size_t len, left;
1861 char buf[TMPBUFLEN], *p;
1862 char __user *s = buffer;
1864 if (!table->data || !table->maxlen || !*lenp ||
1865 (*ppos && !write)) {
1866 *lenp = 0;
1867 return 0;
1870 i = (unsigned long *) table->data;
1871 min = (unsigned long *) table->extra1;
1872 max = (unsigned long *) table->extra2;
1873 vleft = table->maxlen / sizeof(unsigned long);
1874 left = *lenp;
1876 for (; left && vleft--; i++, min++, max++, first=0) {
1877 if (write) {
1878 while (left) {
1879 char c;
1880 if (get_user(c, s))
1881 return -EFAULT;
1882 if (!isspace(c))
1883 break;
1884 left--;
1885 s++;
1887 if (!left)
1888 break;
1889 neg = 0;
1890 len = left;
1891 if (len > TMPBUFLEN-1)
1892 len = TMPBUFLEN-1;
1893 if (copy_from_user(buf, s, len))
1894 return -EFAULT;
1895 buf[len] = 0;
1896 p = buf;
1897 if (*p == '-' && left > 1) {
1898 neg = 1;
1899 left--, p++;
1901 if (*p < '0' || *p > '9')
1902 break;
1903 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
1904 len = p-buf;
1905 if ((len < left) && *p && !isspace(*p))
1906 break;
1907 if (neg)
1908 val = -val;
1909 s += len;
1910 left -= len;
1912 if(neg)
1913 continue;
1914 if ((min && val < *min) || (max && val > *max))
1915 continue;
1916 *i = val;
1917 } else {
1918 p = buf;
1919 if (!first)
1920 *p++ = '\t';
1921 sprintf(p, "%lu", convdiv * (*i) / convmul);
1922 len = strlen(buf);
1923 if (len > left)
1924 len = left;
1925 if(copy_to_user(s, buf, len))
1926 return -EFAULT;
1927 left -= len;
1928 s += len;
1932 if (!write && !first && left) {
1933 if(put_user('\n', s))
1934 return -EFAULT;
1935 left--, s++;
1937 if (write) {
1938 while (left) {
1939 char c;
1940 if (get_user(c, s++))
1941 return -EFAULT;
1942 if (!isspace(c))
1943 break;
1944 left--;
1947 if (write && first)
1948 return -EINVAL;
1949 *lenp -= left;
1950 *ppos += *lenp;
1951 return 0;
1952 #undef TMPBUFLEN
1956 * proc_doulongvec_minmax - read a vector of long integers with min/max values
1957 * @table: the sysctl table
1958 * @write: %TRUE if this is a write to the sysctl file
1959 * @filp: the file structure
1960 * @buffer: the user buffer
1961 * @lenp: the size of the user buffer
1962 * @ppos: file position
1964 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1965 * values from/to the user buffer, treated as an ASCII string.
1967 * This routine will ensure the values are within the range specified by
1968 * table->extra1 (min) and table->extra2 (max).
1970 * Returns 0 on success.
1972 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1973 void __user *buffer, size_t *lenp, loff_t *ppos)
1975 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
1979 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
1980 * @table: the sysctl table
1981 * @write: %TRUE if this is a write to the sysctl file
1982 * @filp: the file structure
1983 * @buffer: the user buffer
1984 * @lenp: the size of the user buffer
1985 * @ppos: file position
1987 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1988 * values from/to the user buffer, treated as an ASCII string. The values
1989 * are treated as milliseconds, and converted to jiffies when they are stored.
1991 * This routine will ensure the values are within the range specified by
1992 * table->extra1 (min) and table->extra2 (max).
1994 * Returns 0 on success.
1996 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1997 struct file *filp,
1998 void __user *buffer,
1999 size_t *lenp, loff_t *ppos)
2001 return do_proc_doulongvec_minmax(table, write, filp, buffer,
2002 lenp, ppos, HZ, 1000l);
2006 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
2007 int *valp,
2008 int write, void *data)
2010 if (write) {
2011 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2012 } else {
2013 int val = *valp;
2014 unsigned long lval;
2015 if (val < 0) {
2016 *negp = -1;
2017 lval = (unsigned long)-val;
2018 } else {
2019 *negp = 0;
2020 lval = (unsigned long)val;
2022 *lvalp = lval / HZ;
2024 return 0;
2027 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
2028 int *valp,
2029 int write, void *data)
2031 if (write) {
2032 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2033 } else {
2034 int val = *valp;
2035 unsigned long lval;
2036 if (val < 0) {
2037 *negp = -1;
2038 lval = (unsigned long)-val;
2039 } else {
2040 *negp = 0;
2041 lval = (unsigned long)val;
2043 *lvalp = jiffies_to_clock_t(lval);
2045 return 0;
2048 static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2049 int *valp,
2050 int write, void *data)
2052 if (write) {
2053 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2054 } else {
2055 int val = *valp;
2056 unsigned long lval;
2057 if (val < 0) {
2058 *negp = -1;
2059 lval = (unsigned long)-val;
2060 } else {
2061 *negp = 0;
2062 lval = (unsigned long)val;
2064 *lvalp = jiffies_to_msecs(lval);
2066 return 0;
2070 * proc_dointvec_jiffies - read a vector of integers as seconds
2071 * @table: the sysctl table
2072 * @write: %TRUE if this is a write to the sysctl file
2073 * @filp: the file structure
2074 * @buffer: the user buffer
2075 * @lenp: the size of the user buffer
2076 * @ppos: file position
2078 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2079 * values from/to the user buffer, treated as an ASCII string.
2080 * The values read are assumed to be in seconds, and are converted into
2081 * jiffies.
2083 * Returns 0 on success.
2085 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2086 void __user *buffer, size_t *lenp, loff_t *ppos)
2088 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2089 do_proc_dointvec_jiffies_conv,NULL);
2093 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2094 * @table: the sysctl table
2095 * @write: %TRUE if this is a write to the sysctl file
2096 * @filp: the file structure
2097 * @buffer: the user buffer
2098 * @lenp: the size of the user buffer
2099 * @ppos: pointer to the file position
2101 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2102 * values from/to the user buffer, treated as an ASCII string.
2103 * The values read are assumed to be in 1/USER_HZ seconds, and
2104 * are converted into jiffies.
2106 * Returns 0 on success.
2108 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2109 void __user *buffer, size_t *lenp, loff_t *ppos)
2111 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
2112 do_proc_dointvec_userhz_jiffies_conv,NULL);
2116 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2117 * @table: the sysctl table
2118 * @write: %TRUE if this is a write to the sysctl file
2119 * @filp: the file structure
2120 * @buffer: the user buffer
2121 * @lenp: the size of the user buffer
2122 * @ppos: file position
2123 * @ppos: the current position in the file
2125 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2126 * values from/to the user buffer, treated as an ASCII string.
2127 * The values read are assumed to be in 1/1000 seconds, and
2128 * are converted into jiffies.
2130 * Returns 0 on success.
2132 int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2133 void __user *buffer, size_t *lenp, loff_t *ppos)
2135 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2136 do_proc_dointvec_ms_jiffies_conv, NULL);
2139 #else /* CONFIG_PROC_FS */
2141 int proc_dostring(ctl_table *table, int write, struct file *filp,
2142 void __user *buffer, size_t *lenp, loff_t *ppos)
2144 return -ENOSYS;
2147 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
2148 void __user *buffer, size_t *lenp, loff_t *ppos)
2150 return -ENOSYS;
2153 int proc_dointvec(ctl_table *table, int write, struct file *filp,
2154 void __user *buffer, size_t *lenp, loff_t *ppos)
2156 return -ENOSYS;
2159 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2160 void __user *buffer, size_t *lenp, loff_t *ppos)
2162 return -ENOSYS;
2165 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2166 void __user *buffer, size_t *lenp, loff_t *ppos)
2168 return -ENOSYS;
2171 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2172 void __user *buffer, size_t *lenp, loff_t *ppos)
2174 return -ENOSYS;
2177 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2178 void __user *buffer, size_t *lenp, loff_t *ppos)
2180 return -ENOSYS;
2183 int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2184 void __user *buffer, size_t *lenp, loff_t *ppos)
2186 return -ENOSYS;
2189 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2190 void __user *buffer, size_t *lenp, loff_t *ppos)
2192 return -ENOSYS;
2195 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2196 struct file *filp,
2197 void __user *buffer,
2198 size_t *lenp, loff_t *ppos)
2200 return -ENOSYS;
2204 #endif /* CONFIG_PROC_FS */
2208 * General sysctl support routines
2211 /* The generic string strategy routine: */
2212 int sysctl_string(ctl_table *table, int __user *name, int nlen,
2213 void __user *oldval, size_t __user *oldlenp,
2214 void __user *newval, size_t newlen, void **context)
2216 if (!table->data || !table->maxlen)
2217 return -ENOTDIR;
2219 if (oldval && oldlenp) {
2220 size_t bufsize;
2221 if (get_user(bufsize, oldlenp))
2222 return -EFAULT;
2223 if (bufsize) {
2224 size_t len = strlen(table->data), copied;
2226 /* This shouldn't trigger for a well-formed sysctl */
2227 if (len > table->maxlen)
2228 len = table->maxlen;
2230 /* Copy up to a max of bufsize-1 bytes of the string */
2231 copied = (len >= bufsize) ? bufsize - 1 : len;
2233 if (copy_to_user(oldval, table->data, copied) ||
2234 put_user(0, (char __user *)(oldval + copied)))
2235 return -EFAULT;
2236 if (put_user(len, oldlenp))
2237 return -EFAULT;
2240 if (newval && newlen) {
2241 size_t len = newlen;
2242 if (len > table->maxlen)
2243 len = table->maxlen;
2244 if(copy_from_user(table->data, newval, len))
2245 return -EFAULT;
2246 if (len == table->maxlen)
2247 len--;
2248 ((char *) table->data)[len] = 0;
2250 return 1;
2254 * This function makes sure that all of the integers in the vector
2255 * are between the minimum and maximum values given in the arrays
2256 * table->extra1 and table->extra2, respectively.
2258 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2259 void __user *oldval, size_t __user *oldlenp,
2260 void __user *newval, size_t newlen, void **context)
2263 if (newval && newlen) {
2264 int __user *vec = (int __user *) newval;
2265 int *min = (int *) table->extra1;
2266 int *max = (int *) table->extra2;
2267 size_t length;
2268 int i;
2270 if (newlen % sizeof(int) != 0)
2271 return -EINVAL;
2273 if (!table->extra1 && !table->extra2)
2274 return 0;
2276 if (newlen > table->maxlen)
2277 newlen = table->maxlen;
2278 length = newlen / sizeof(int);
2280 for (i = 0; i < length; i++) {
2281 int value;
2282 if (get_user(value, vec + i))
2283 return -EFAULT;
2284 if (min && value < min[i])
2285 return -EINVAL;
2286 if (max && value > max[i])
2287 return -EINVAL;
2290 return 0;
2293 /* Strategy function to convert jiffies to seconds */
2294 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2295 void __user *oldval, size_t __user *oldlenp,
2296 void __user *newval, size_t newlen, void **context)
2298 if (oldval) {
2299 size_t olen;
2300 if (oldlenp) {
2301 if (get_user(olen, oldlenp))
2302 return -EFAULT;
2303 if (olen!=sizeof(int))
2304 return -EINVAL;
2306 if (put_user(*(int *)(table->data)/HZ, (int __user *)oldval) ||
2307 (oldlenp && put_user(sizeof(int),oldlenp)))
2308 return -EFAULT;
2310 if (newval && newlen) {
2311 int new;
2312 if (newlen != sizeof(int))
2313 return -EINVAL;
2314 if (get_user(new, (int __user *)newval))
2315 return -EFAULT;
2316 *(int *)(table->data) = new*HZ;
2318 return 1;
2321 /* Strategy function to convert jiffies to seconds */
2322 int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2323 void __user *oldval, size_t __user *oldlenp,
2324 void __user *newval, size_t newlen, void **context)
2326 if (oldval) {
2327 size_t olen;
2328 if (oldlenp) {
2329 if (get_user(olen, oldlenp))
2330 return -EFAULT;
2331 if (olen!=sizeof(int))
2332 return -EINVAL;
2334 if (put_user(jiffies_to_msecs(*(int *)(table->data)), (int __user *)oldval) ||
2335 (oldlenp && put_user(sizeof(int),oldlenp)))
2336 return -EFAULT;
2338 if (newval && newlen) {
2339 int new;
2340 if (newlen != sizeof(int))
2341 return -EINVAL;
2342 if (get_user(new, (int __user *)newval))
2343 return -EFAULT;
2344 *(int *)(table->data) = msecs_to_jiffies(new);
2346 return 1;
2349 #else /* CONFIG_SYSCTL */
2352 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
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, void **context)
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, void **context)
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, void **context)
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, void **context)
2382 return -ENOSYS;
2385 int proc_dostring(ctl_table *table, int write, struct file *filp,
2386 void __user *buffer, size_t *lenp, loff_t *ppos)
2388 return -ENOSYS;
2391 int proc_dointvec(ctl_table *table, int write, struct file *filp,
2392 void __user *buffer, size_t *lenp, loff_t *ppos)
2394 return -ENOSYS;
2397 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2398 void __user *buffer, size_t *lenp, loff_t *ppos)
2400 return -ENOSYS;
2403 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2404 void __user *buffer, size_t *lenp, loff_t *ppos)
2406 return -ENOSYS;
2409 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2410 void __user *buffer, size_t *lenp, loff_t *ppos)
2412 return -ENOSYS;
2415 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2416 void __user *buffer, size_t *lenp, loff_t *ppos)
2418 return -ENOSYS;
2421 int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2422 void __user *buffer, size_t *lenp, loff_t *ppos)
2424 return -ENOSYS;
2427 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2428 void __user *buffer, size_t *lenp, loff_t *ppos)
2430 return -ENOSYS;
2433 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2434 struct file *filp,
2435 void __user *buffer,
2436 size_t *lenp, loff_t *ppos)
2438 return -ENOSYS;
2441 struct ctl_table_header * register_sysctl_table(ctl_table * table,
2442 int insert_at_head)
2444 return NULL;
2447 void unregister_sysctl_table(struct ctl_table_header * table)
2451 #endif /* CONFIG_SYSCTL */
2454 * No sense putting this after each symbol definition, twice,
2455 * exception granted :-)
2457 EXPORT_SYMBOL(proc_dointvec);
2458 EXPORT_SYMBOL(proc_dointvec_jiffies);
2459 EXPORT_SYMBOL(proc_dointvec_minmax);
2460 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2461 EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2462 EXPORT_SYMBOL(proc_dostring);
2463 EXPORT_SYMBOL(proc_doulongvec_minmax);
2464 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2465 EXPORT_SYMBOL(register_sysctl_table);
2466 EXPORT_SYMBOL(sysctl_intvec);
2467 EXPORT_SYMBOL(sysctl_jiffies);
2468 EXPORT_SYMBOL(sysctl_ms_jiffies);
2469 EXPORT_SYMBOL(sysctl_string);
2470 EXPORT_SYMBOL(unregister_sysctl_table);