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
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
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>
24 #include <linux/swap.h>
25 #include <linux/slab.h>
26 #include <linux/sysctl.h>
27 #include <linux/proc_fs.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/sysrq.h>
35 #include <linux/highuid.h>
36 #include <linux/writeback.h>
37 #include <linux/hugetlb.h>
38 #include <linux/security.h>
39 #include <linux/initrd.h>
40 #include <linux/times.h>
41 #include <linux/limits.h>
42 #include <asm/uaccess.h>
44 #ifdef CONFIG_ROOT_NFS
45 #include <linux/nfs_fs.h>
48 #if defined(CONFIG_SYSCTL)
50 /* External variables not in a header file. */
51 extern int panic_timeout;
53 extern int sysctl_overcommit_memory;
54 extern int sysctl_overcommit_ratio;
55 extern int max_threads;
56 extern atomic_t nr_queued_signals;
57 extern int max_queued_signals;
58 extern int sysrq_enabled;
59 extern int core_uses_pid;
60 extern char core_pattern[];
63 extern int sysctl_lower_zone_protection;
64 extern int min_free_kbytes;
65 extern int printk_ratelimit_jiffies;
66 extern int printk_ratelimit_burst;
68 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
69 static int maxolduid = 65535;
72 static int ngroups_max = NGROUPS_MAX;
75 extern char modprobe_path[];
78 extern char hotplug_path[];
80 #ifdef CONFIG_CHR_DEV_SG
81 extern int sg_big_buff;
84 extern size_t shm_ctlmax;
85 extern size_t shm_ctlall;
86 extern int shm_ctlmni;
87 extern int msg_ctlmax;
88 extern int msg_ctlmnb;
89 extern int msg_ctlmni;
90 extern int sem_ctls[];
94 extern char reboot_command [];
95 extern int stop_a_enabled;
96 extern int scons_pwroff;
100 extern int pwrsw_enabled;
101 extern int unaligned_enabled;
104 #ifdef CONFIG_ARCH_S390
105 #ifdef CONFIG_MATHEMU
106 extern int sysctl_ieee_emulation_warnings;
108 extern int sysctl_userprocess_debug;
111 extern int sysctl_hz_timer;
113 #if defined(CONFIG_PPC32) && defined(CONFIG_6xx)
114 extern unsigned long powersave_nap;
115 int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
116 void *buffer, size_t *lenp);
119 #ifdef CONFIG_BSD_PROCESS_ACCT
120 extern int acct_parm[];
123 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
124 ctl_table *, void **);
125 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
126 void __user *buffer, size_t *lenp);
128 static ctl_table root_table[];
129 static struct ctl_table_header root_table_header =
130 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
132 static ctl_table kern_table[];
133 static ctl_table vm_table[];
135 extern ctl_table net_table[];
137 static ctl_table proc_table[];
138 static ctl_table fs_table[];
139 static ctl_table debug_table[];
140 static ctl_table dev_table[];
141 extern ctl_table random_table[];
142 #ifdef CONFIG_UNIX98_PTYS
143 extern ctl_table pty_table[];
146 /* /proc declarations: */
148 #ifdef CONFIG_PROC_FS
150 static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *);
151 static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
152 static int proc_opensys(struct inode *, struct file *);
154 struct file_operations proc_sys_file_operations = {
155 .open = proc_opensys,
156 .read = proc_readsys,
157 .write = proc_writesys,
160 extern struct proc_dir_entry *proc_sys_root;
162 static void register_proc_table(ctl_table *, struct proc_dir_entry *);
163 static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
166 /* The default sysctl tables: */
168 static ctl_table root_table[] = {
170 .ctl_name = CTL_KERN,
171 .procname = "kernel",
190 .ctl_name = CTL_PROC,
202 .ctl_name = CTL_DEBUG,
205 .child = debug_table,
216 static ctl_table kern_table[] = {
218 .ctl_name = KERN_OSTYPE,
219 .procname = "ostype",
220 .data = system_utsname.sysname,
223 .proc_handler = &proc_doutsstring,
224 .strategy = &sysctl_string,
227 .ctl_name = KERN_OSRELEASE,
228 .procname = "osrelease",
229 .data = system_utsname.release,
232 .proc_handler = &proc_doutsstring,
233 .strategy = &sysctl_string,
236 .ctl_name = KERN_VERSION,
237 .procname = "version",
238 .data = system_utsname.version,
241 .proc_handler = &proc_doutsstring,
242 .strategy = &sysctl_string,
245 .ctl_name = KERN_NODENAME,
246 .procname = "hostname",
247 .data = system_utsname.nodename,
250 .proc_handler = &proc_doutsstring,
251 .strategy = &sysctl_string,
254 .ctl_name = KERN_DOMAINNAME,
255 .procname = "domainname",
256 .data = system_utsname.domainname,
259 .proc_handler = &proc_doutsstring,
260 .strategy = &sysctl_string,
263 .ctl_name = KERN_PANIC,
265 .data = &panic_timeout,
266 .maxlen = sizeof(int),
268 .proc_handler = &proc_dointvec,
271 .ctl_name = KERN_CORE_USES_PID,
272 .procname = "core_uses_pid",
273 .data = &core_uses_pid,
274 .maxlen = sizeof(int),
276 .proc_handler = &proc_dointvec,
279 .ctl_name = KERN_CORE_PATTERN,
280 .procname = "core_pattern",
281 .data = core_pattern,
284 .proc_handler = &proc_dostring,
285 .strategy = &sysctl_string,
288 .ctl_name = KERN_TAINTED,
289 .procname = "tainted",
291 .maxlen = sizeof(int),
293 .proc_handler = &proc_dointvec,
296 .ctl_name = KERN_CAP_BSET,
297 .procname = "cap-bound",
299 .maxlen = sizeof(kernel_cap_t),
301 .proc_handler = &proc_dointvec_bset,
303 #ifdef CONFIG_BLK_DEV_INITRD
305 .ctl_name = KERN_REALROOTDEV,
306 .procname = "real-root-dev",
307 .data = &real_root_dev,
308 .maxlen = sizeof(int),
310 .proc_handler = &proc_dointvec,
315 .ctl_name = KERN_SPARC_REBOOT,
316 .procname = "reboot-cmd",
317 .data = reboot_command,
320 .proc_handler = &proc_dostring,
321 .strategy = &sysctl_string,
324 .ctl_name = KERN_SPARC_STOP_A,
325 .procname = "stop-a",
326 .data = &stop_a_enabled,
327 .maxlen = sizeof (int),
329 .proc_handler = &proc_dointvec,
332 .ctl_name = KERN_SPARC_SCONS_PWROFF,
333 .procname = "scons-poweroff",
334 .data = &scons_pwroff,
335 .maxlen = sizeof (int),
337 .proc_handler = &proc_dointvec,
342 .ctl_name = KERN_HPPA_PWRSW,
343 .procname = "soft-power",
344 .data = &pwrsw_enabled,
345 .maxlen = sizeof (int),
347 .proc_handler = &proc_dointvec,
350 .ctl_name = KERN_HPPA_UNALIGNED,
351 .procname = "unaligned-trap",
352 .data = &unaligned_enabled,
353 .maxlen = sizeof (int),
355 .proc_handler = &proc_dointvec,
358 #if defined(CONFIG_PPC32) && defined(CONFIG_6xx)
360 .ctl_name = KERN_PPC_POWERSAVE_NAP,
361 .procname = "powersave-nap",
362 .data = &powersave_nap,
363 .maxlen = sizeof(int),
365 .proc_handler = &proc_dointvec,
368 .ctl_name = KERN_PPC_L2CR,
371 .proc_handler = &proc_dol2crvec,
375 .ctl_name = KERN_CTLALTDEL,
376 .procname = "ctrl-alt-del",
378 .maxlen = sizeof(int),
380 .proc_handler = &proc_dointvec,
383 .ctl_name = KERN_PRINTK,
384 .procname = "printk",
385 .data = &console_loglevel,
386 .maxlen = 4*sizeof(int),
388 .proc_handler = &proc_dointvec,
392 .ctl_name = KERN_MODPROBE,
393 .procname = "modprobe",
394 .data = &modprobe_path,
397 .proc_handler = &proc_dostring,
398 .strategy = &sysctl_string,
401 #ifdef CONFIG_HOTPLUG
403 .ctl_name = KERN_HOTPLUG,
404 .procname = "hotplug",
405 .data = &hotplug_path,
408 .proc_handler = &proc_dostring,
409 .strategy = &sysctl_string,
412 #ifdef CONFIG_CHR_DEV_SG
414 .ctl_name = KERN_SG_BIG_BUFF,
415 .procname = "sg-big-buff",
416 .data = &sg_big_buff,
417 .maxlen = sizeof (int),
419 .proc_handler = &proc_dointvec,
422 #ifdef CONFIG_BSD_PROCESS_ACCT
424 .ctl_name = KERN_ACCT,
427 .maxlen = 3*sizeof(int),
429 .proc_handler = &proc_dointvec,
433 .ctl_name = KERN_RTSIGNR,
434 .procname = "rtsig-nr",
435 .data = &nr_queued_signals,
436 .maxlen = sizeof(int),
438 .proc_handler = &proc_dointvec,
441 .ctl_name = KERN_RTSIGMAX,
442 .procname = "rtsig-max",
443 .data = &max_queued_signals,
444 .maxlen = sizeof(int),
446 .proc_handler = &proc_dointvec,
448 #ifdef CONFIG_SYSVIPC
450 .ctl_name = KERN_SHMMAX,
451 .procname = "shmmax",
453 .maxlen = sizeof (size_t),
455 .proc_handler = &proc_doulongvec_minmax,
458 .ctl_name = KERN_SHMALL,
459 .procname = "shmall",
461 .maxlen = sizeof (size_t),
463 .proc_handler = &proc_doulongvec_minmax,
466 .ctl_name = KERN_SHMMNI,
467 .procname = "shmmni",
469 .maxlen = sizeof (int),
471 .proc_handler = &proc_dointvec,
474 .ctl_name = KERN_MSGMAX,
475 .procname = "msgmax",
477 .maxlen = sizeof (int),
479 .proc_handler = &proc_dointvec,
482 .ctl_name = KERN_MSGMNI,
483 .procname = "msgmni",
485 .maxlen = sizeof (int),
487 .proc_handler = &proc_dointvec,
490 .ctl_name = KERN_MSGMNB,
491 .procname = "msgmnb",
493 .maxlen = sizeof (int),
495 .proc_handler = &proc_dointvec,
498 .ctl_name = KERN_SEM,
501 .maxlen = 4*sizeof (int),
503 .proc_handler = &proc_dointvec,
506 #ifdef CONFIG_MAGIC_SYSRQ
508 .ctl_name = KERN_SYSRQ,
510 .data = &sysrq_enabled,
511 .maxlen = sizeof (int),
513 .proc_handler = &proc_dointvec,
517 .ctl_name = KERN_CADPID,
518 .procname = "cad_pid",
520 .maxlen = sizeof (int),
522 .proc_handler = &proc_dointvec,
525 .ctl_name = KERN_MAX_THREADS,
526 .procname = "threads-max",
527 .data = &max_threads,
528 .maxlen = sizeof(int),
530 .proc_handler = &proc_dointvec,
533 .ctl_name = KERN_RANDOM,
534 .procname = "random",
536 .child = random_table,
538 #ifdef CONFIG_UNIX98_PTYS
540 .ctl_name = KERN_PTY,
547 .ctl_name = KERN_OVERFLOWUID,
548 .procname = "overflowuid",
549 .data = &overflowuid,
550 .maxlen = sizeof(int),
552 .proc_handler = &proc_dointvec_minmax,
553 .strategy = &sysctl_intvec,
554 .extra1 = &minolduid,
555 .extra2 = &maxolduid,
558 .ctl_name = KERN_OVERFLOWGID,
559 .procname = "overflowgid",
560 .data = &overflowgid,
561 .maxlen = sizeof(int),
563 .proc_handler = &proc_dointvec_minmax,
564 .strategy = &sysctl_intvec,
565 .extra1 = &minolduid,
566 .extra2 = &maxolduid,
568 #ifdef CONFIG_ARCH_S390
569 #ifdef CONFIG_MATHEMU
571 .ctl_name = KERN_IEEE_EMULATION_WARNINGS,
572 .procname = "ieee_emulation_warnings",
573 .data = &sysctl_ieee_emulation_warnings,
574 .maxlen = sizeof(int),
576 .proc_handler = &proc_dointvec,
579 #ifdef CONFIG_NO_IDLE_HZ
581 .ctl_name = KERN_HZ_TIMER,
582 .procname = "hz_timer",
583 .data = &sysctl_hz_timer,
584 .maxlen = sizeof(int),
586 .proc_handler = &proc_dointvec,
590 .ctl_name = KERN_S390_USER_DEBUG_LOGGING,
591 .procname = "userprocess_debug",
592 .data = &sysctl_userprocess_debug,
593 .maxlen = sizeof(int),
595 .proc_handler = &proc_dointvec,
599 .ctl_name = KERN_PIDMAX,
600 .procname = "pid_max",
602 .maxlen = sizeof (int),
604 .proc_handler = &proc_dointvec,
607 .ctl_name = KERN_PANIC_ON_OOPS,
608 .procname = "panic_on_oops",
609 .data = &panic_on_oops,
610 .maxlen = sizeof(int),
612 .proc_handler = &proc_dointvec,
615 .ctl_name = KERN_PRINTK_RATELIMIT,
616 .procname = "printk_ratelimit",
617 .data = &printk_ratelimit_jiffies,
618 .maxlen = sizeof(int),
620 .proc_handler = &proc_dointvec_jiffies,
621 .strategy = &sysctl_jiffies,
624 .ctl_name = KERN_PRINTK_RATELIMIT_BURST,
625 .procname = "printk_ratelimit_burst",
626 .data = &printk_ratelimit_burst,
627 .maxlen = sizeof(int),
629 .proc_handler = &proc_dointvec,
632 .ctl_name = KERN_NGROUPS_MAX,
633 .procname = "ngroups_max",
634 .data = &ngroups_max,
635 .maxlen = sizeof (int),
637 .proc_handler = &proc_dointvec,
642 /* Constants for minimum and maximum testing in vm_table.
643 We use these as one-element integer vectors. */
645 static int one_hundred = 100;
648 static ctl_table vm_table[] = {
650 .ctl_name = VM_OVERCOMMIT_MEMORY,
651 .procname = "overcommit_memory",
652 .data = &sysctl_overcommit_memory,
653 .maxlen = sizeof(sysctl_overcommit_memory),
655 .proc_handler = &proc_dointvec,
658 .ctl_name = VM_OVERCOMMIT_RATIO,
659 .procname = "overcommit_ratio",
660 .data = &sysctl_overcommit_ratio,
661 .maxlen = sizeof(sysctl_overcommit_ratio),
663 .proc_handler = &proc_dointvec,
666 .ctl_name = VM_PAGE_CLUSTER,
667 .procname = "page-cluster",
668 .data = &page_cluster,
669 .maxlen = sizeof(int),
671 .proc_handler = &proc_dointvec,
674 .ctl_name = VM_DIRTY_BACKGROUND,
675 .procname = "dirty_background_ratio",
676 .data = &dirty_background_ratio,
677 .maxlen = sizeof(dirty_background_ratio),
679 .proc_handler = &proc_dointvec_minmax,
680 .strategy = &sysctl_intvec,
682 .extra2 = &one_hundred,
685 .ctl_name = VM_DIRTY_RATIO,
686 .procname = "dirty_ratio",
687 .data = &vm_dirty_ratio,
688 .maxlen = sizeof(vm_dirty_ratio),
690 .proc_handler = &proc_dointvec_minmax,
691 .strategy = &sysctl_intvec,
693 .extra2 = &one_hundred,
696 .ctl_name = VM_DIRTY_WB_CS,
697 .procname = "dirty_writeback_centisecs",
698 .data = &dirty_writeback_centisecs,
699 .maxlen = sizeof(dirty_writeback_centisecs),
701 .proc_handler = &dirty_writeback_centisecs_handler,
704 .ctl_name = VM_DIRTY_EXPIRE_CS,
705 .procname = "dirty_expire_centisecs",
706 .data = &dirty_expire_centisecs,
707 .maxlen = sizeof(dirty_expire_centisecs),
709 .proc_handler = &proc_dointvec,
712 .ctl_name = VM_NR_PDFLUSH_THREADS,
713 .procname = "nr_pdflush_threads",
714 .data = &nr_pdflush_threads,
715 .maxlen = sizeof nr_pdflush_threads,
716 .mode = 0444 /* read-only*/,
717 .proc_handler = &proc_dointvec,
720 .ctl_name = VM_SWAPPINESS,
721 .procname = "swappiness",
722 .data = &vm_swappiness,
723 .maxlen = sizeof(vm_swappiness),
725 .proc_handler = &proc_dointvec_minmax,
726 .strategy = &sysctl_intvec,
728 .extra2 = &one_hundred,
730 #ifdef CONFIG_HUGETLB_PAGE
732 .ctl_name = VM_HUGETLB_PAGES,
733 .procname = "nr_hugepages",
734 .data = &max_huge_pages,
735 .maxlen = sizeof(unsigned long),
737 .proc_handler = &hugetlb_sysctl_handler,
738 .extra1 = (void *)&hugetlb_zero,
739 .extra2 = (void *)&hugetlb_infinity,
743 .ctl_name = VM_LOWER_ZONE_PROTECTION,
744 .procname = "lower_zone_protection",
745 .data = &sysctl_lower_zone_protection,
746 .maxlen = sizeof(sysctl_lower_zone_protection),
748 .proc_handler = &lower_zone_protection_sysctl_handler,
749 .strategy = &sysctl_intvec,
753 .ctl_name = VM_MIN_FREE_KBYTES,
754 .procname = "min_free_kbytes",
755 .data = &min_free_kbytes,
756 .maxlen = sizeof(min_free_kbytes),
758 .proc_handler = &min_free_kbytes_sysctl_handler,
759 .strategy = &sysctl_intvec,
763 .ctl_name = VM_MAX_MAP_COUNT,
764 .procname = "max_map_count",
765 .data = &sysctl_max_map_count,
766 .maxlen = sizeof(sysctl_max_map_count),
768 .proc_handler = &proc_dointvec
771 .ctl_name = VM_LAPTOP_MODE,
772 .procname = "laptop_mode",
773 .data = &laptop_mode,
774 .maxlen = sizeof(laptop_mode),
776 .proc_handler = &proc_dointvec,
777 .strategy = &sysctl_intvec,
781 .ctl_name = VM_BLOCK_DUMP,
782 .procname = "block_dump",
784 .maxlen = sizeof(block_dump),
786 .proc_handler = &proc_dointvec,
787 .strategy = &sysctl_intvec,
793 static ctl_table proc_table[] = {
797 static ctl_table fs_table[] = {
799 .ctl_name = FS_NRINODE,
800 .procname = "inode-nr",
801 .data = &inodes_stat,
802 .maxlen = 2*sizeof(int),
804 .proc_handler = &proc_dointvec,
807 .ctl_name = FS_STATINODE,
808 .procname = "inode-state",
809 .data = &inodes_stat,
810 .maxlen = 7*sizeof(int),
812 .proc_handler = &proc_dointvec,
815 .ctl_name = FS_NRFILE,
816 .procname = "file-nr",
818 .maxlen = 3*sizeof(int),
820 .proc_handler = &proc_dointvec,
823 .ctl_name = FS_MAXFILE,
824 .procname = "file-max",
825 .data = &files_stat.max_files,
826 .maxlen = sizeof(int),
828 .proc_handler = &proc_dointvec,
831 .ctl_name = FS_DENTRY,
832 .procname = "dentry-state",
833 .data = &dentry_stat,
834 .maxlen = 6*sizeof(int),
836 .proc_handler = &proc_dointvec,
839 .ctl_name = FS_OVERFLOWUID,
840 .procname = "overflowuid",
841 .data = &fs_overflowuid,
842 .maxlen = sizeof(int),
844 .proc_handler = &proc_dointvec_minmax,
845 .strategy = &sysctl_intvec,
846 .extra1 = &minolduid,
847 .extra2 = &maxolduid,
850 .ctl_name = FS_OVERFLOWGID,
851 .procname = "overflowgid",
852 .data = &fs_overflowgid,
853 .maxlen = sizeof(int),
855 .proc_handler = &proc_dointvec_minmax,
856 .strategy = &sysctl_intvec,
857 .extra1 = &minolduid,
858 .extra2 = &maxolduid,
861 .ctl_name = FS_LEASES,
862 .procname = "leases-enable",
863 .data = &leases_enable,
864 .maxlen = sizeof(int),
866 .proc_handler = &proc_dointvec,
869 .ctl_name = FS_DIR_NOTIFY,
870 .procname = "dir-notify-enable",
871 .data = &dir_notify_enable,
872 .maxlen = sizeof(int),
874 .proc_handler = &proc_dointvec,
877 .ctl_name = FS_LEASE_TIME,
878 .procname = "lease-break-time",
879 .data = &lease_break_time,
880 .maxlen = sizeof(int),
882 .proc_handler = &proc_dointvec,
885 .ctl_name = FS_AIO_NR,
886 .procname = "aio-nr",
888 .maxlen = sizeof(aio_nr),
890 .proc_handler = &proc_dointvec,
893 .ctl_name = FS_AIO_MAX_NR,
894 .procname = "aio-max-nr",
896 .maxlen = sizeof(aio_max_nr),
898 .proc_handler = &proc_dointvec,
903 static ctl_table debug_table[] = {
907 static ctl_table dev_table[] = {
911 extern void init_irq_proc (void);
913 void __init sysctl_init(void)
915 #ifdef CONFIG_PROC_FS
916 register_proc_table(root_table, proc_sys_root);
921 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
922 void __user *newval, size_t newlen)
924 struct list_head *tmp;
926 if (nlen <= 0 || nlen >= CTL_MAXNAME)
930 if (!oldlenp || get_user(old_len, oldlenp))
933 tmp = &root_table_header.ctl_entry;
935 struct ctl_table_header *head =
936 list_entry(tmp, struct ctl_table_header, ctl_entry);
937 void *context = NULL;
938 int error = parse_table(name, nlen, oldval, oldlenp,
939 newval, newlen, head->ctl_table,
943 if (error != -ENOTDIR)
946 } while (tmp != &root_table_header.ctl_entry);
950 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
952 struct __sysctl_args tmp;
955 if (copy_from_user(&tmp, args, sizeof(tmp)))
959 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
960 tmp.newval, tmp.newlen);
966 * ctl_perm does NOT grant the superuser all rights automatically, because
967 * some sysctl variables are readonly even to root.
970 static int test_perm(int mode, int op)
974 else if (in_egroup_p(0))
976 if ((mode & op & 0007) == op)
981 static inline int ctl_perm(ctl_table *table, int op)
984 error = security_sysctl(table, op);
987 return test_perm(table->mode, op);
990 static int parse_table(int __user *name, int nlen,
991 void __user *oldval, size_t __user *oldlenp,
992 void __user *newval, size_t newlen,
993 ctl_table *table, void **context)
999 if (get_user(n, name))
1001 for ( ; table->ctl_name; table++) {
1002 if (n == table->ctl_name || table->ctl_name == CTL_ANY) {
1005 if (ctl_perm(table, 001))
1007 if (table->strategy) {
1008 error = table->strategy(
1011 newval, newlen, context);
1017 table = table->child;
1020 error = do_sysctl_strategy(table, name, nlen,
1022 newval, newlen, context);
1029 /* Perform the actual read/write of a sysctl table entry. */
1030 int do_sysctl_strategy (ctl_table *table,
1031 int __user *name, int nlen,
1032 void __user *oldval, size_t __user *oldlenp,
1033 void __user *newval, size_t newlen, void **context)
1042 if (ctl_perm(table, op))
1045 if (table->strategy) {
1046 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1047 newval, newlen, context);
1054 /* If there is no strategy routine, or if the strategy returns
1055 * zero, proceed with automatic r/w */
1056 if (table->data && table->maxlen) {
1057 if (oldval && oldlenp) {
1058 if (get_user(len, oldlenp))
1061 if (len > table->maxlen)
1062 len = table->maxlen;
1063 if(copy_to_user(oldval, table->data, len))
1065 if(put_user(len, oldlenp))
1069 if (newval && newlen) {
1071 if (len > table->maxlen)
1072 len = table->maxlen;
1073 if(copy_from_user(table->data, newval, len))
1081 * register_sysctl_table - register a sysctl hierarchy
1082 * @table: the top-level table structure
1083 * @insert_at_head: whether the entry should be inserted in front or at the end
1085 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1086 * array. An entry with a ctl_name of 0 terminates the table.
1088 * The members of the &ctl_table structure are used as follows:
1090 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1091 * must be unique within that level of sysctl
1093 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1094 * enter a sysctl file
1096 * data - a pointer to data for use by proc_handler
1098 * maxlen - the maximum size in bytes of the data
1100 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1102 * child - a pointer to the child sysctl table if this entry is a directory, or
1105 * proc_handler - the text handler routine (described below)
1107 * strategy - the strategy routine (described below)
1109 * de - for internal use by the sysctl routines
1111 * extra1, extra2 - extra pointers usable by the proc handler routines
1113 * Leaf nodes in the sysctl tree will be represented by a single file
1114 * under /proc; non-leaf nodes will be represented by directories.
1116 * sysctl(2) can automatically manage read and write requests through
1117 * the sysctl table. The data and maxlen fields of the ctl_table
1118 * struct enable minimal validation of the values being written to be
1119 * performed, and the mode field allows minimal authentication.
1121 * More sophisticated management can be enabled by the provision of a
1122 * strategy routine with the table entry. This will be called before
1123 * any automatic read or write of the data is performed.
1125 * The strategy routine may return
1127 * < 0 - Error occurred (error is passed to user process)
1129 * 0 - OK - proceed with automatic read or write.
1131 * > 0 - OK - read or write has been done by the strategy routine, so
1132 * return immediately.
1134 * There must be a proc_handler routine for any terminal nodes
1135 * mirrored under /proc/sys (non-terminals are handled by a built-in
1136 * directory handler). Several default handlers are available to
1137 * cover common cases -
1139 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1140 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1141 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1143 * It is the handler's job to read the input buffer from user memory
1144 * and process it. The handler should return 0 on success.
1146 * This routine returns %NULL on a failure to register, and a pointer
1147 * to the table header on success.
1149 struct ctl_table_header *register_sysctl_table(ctl_table * table,
1152 struct ctl_table_header *tmp;
1153 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
1156 tmp->ctl_table = table;
1157 INIT_LIST_HEAD(&tmp->ctl_entry);
1159 list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
1161 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1162 #ifdef CONFIG_PROC_FS
1163 register_proc_table(table, proc_sys_root);
1169 * unregister_sysctl_table - unregister a sysctl table hierarchy
1170 * @header: the header returned from register_sysctl_table
1172 * Unregisters the sysctl table and all children. proc entries may not
1173 * actually be removed until they are no longer used by anyone.
1175 void unregister_sysctl_table(struct ctl_table_header * header)
1177 list_del(&header->ctl_entry);
1178 #ifdef CONFIG_PROC_FS
1179 unregister_proc_table(header->ctl_table, proc_sys_root);
1188 #ifdef CONFIG_PROC_FS
1190 /* Scan the sysctl entries in table and add them all into /proc */
1191 static void register_proc_table(ctl_table * table, struct proc_dir_entry *root)
1193 struct proc_dir_entry *de;
1197 for (; table->ctl_name; table++) {
1198 /* Can't do anything without a proc name. */
1199 if (!table->procname)
1201 /* Maybe we can't do anything with it... */
1202 if (!table->proc_handler && !table->child) {
1203 printk(KERN_WARNING "SYSCTL: Can't register %s\n",
1208 len = strlen(table->procname);
1212 if (table->proc_handler)
1216 for (de = root->subdir; de; de = de->next) {
1217 if (proc_match(len, table->procname, de))
1220 /* If the subdir exists already, de is non-NULL */
1224 de = create_proc_entry(table->procname, mode, root);
1227 de->data = (void *) table;
1228 if (table->proc_handler)
1229 de->proc_fops = &proc_sys_file_operations;
1232 if (de->mode & S_IFDIR)
1233 register_proc_table(table->child, de);
1238 * Unregister a /proc sysctl table and any subdirectories.
1240 static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root)
1242 struct proc_dir_entry *de;
1243 for (; table->ctl_name; table++) {
1244 if (!(de = table->de))
1246 if (de->mode & S_IFDIR) {
1247 if (!table->child) {
1248 printk (KERN_ALERT "Help - malformed sysctl tree on free\n");
1251 unregister_proc_table(table->child, de);
1253 /* Don't unregister directories which still have entries.. */
1258 /* Don't unregister proc entries that are still being used.. */
1259 if (atomic_read(&de->count))
1263 remove_proc_entry(table->procname, root);
1267 static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
1268 size_t count, loff_t *ppos)
1271 struct proc_dir_entry *de;
1272 struct ctl_table *table;
1276 de = PDE(file->f_dentry->d_inode);
1277 if (!de || !de->data)
1279 table = (struct ctl_table *) de->data;
1280 if (!table || !table->proc_handler)
1282 op = (write ? 002 : 004);
1283 if (ctl_perm(table, op))
1289 * FIXME: we need to pass on ppos to the handler.
1292 error = (*table->proc_handler) (table, write, file, buf, &res);
1298 static int proc_opensys(struct inode *inode, struct file *file)
1300 if (file->f_mode & FMODE_WRITE) {
1302 * sysctl entries that are not writable,
1303 * are _NOT_ writable, capabilities or not.
1305 if (!(inode->i_mode & S_IWUSR))
1312 static ssize_t proc_readsys(struct file * file, char __user * buf,
1313 size_t count, loff_t *ppos)
1315 return do_rw_proc(0, file, buf, count, ppos);
1318 static ssize_t proc_writesys(struct file * file, const char __user * buf,
1319 size_t count, loff_t *ppos)
1321 return do_rw_proc(1, file, (char __user *) buf, count, ppos);
1325 * proc_dostring - read a string sysctl
1326 * @table: the sysctl table
1327 * @write: %TRUE if this is a write to the sysctl file
1328 * @filp: the file structure
1329 * @buffer: the user buffer
1330 * @lenp: the size of the user buffer
1332 * Reads/writes a string from/to the user buffer. If the kernel
1333 * buffer provided is not large enough to hold the string, the
1334 * string is truncated. The copied string is %NULL-terminated.
1335 * If the string is being read by the user process, it is copied
1336 * and a newline '\n' is added. It is truncated if the buffer is
1339 * Returns 0 on success.
1341 int proc_dostring(ctl_table *table, int write, struct file *filp,
1342 void __user *buffer, size_t *lenp)
1348 if (!table->data || !table->maxlen || !*lenp ||
1349 (filp->f_pos && !write)) {
1357 while (len < *lenp) {
1358 if (get_user(c, p++))
1360 if (c == 0 || c == '\n')
1364 if (len >= table->maxlen)
1365 len = table->maxlen-1;
1366 if(copy_from_user(table->data, buffer, len))
1368 ((char *) table->data)[len] = 0;
1369 filp->f_pos += *lenp;
1371 len = strlen(table->data);
1372 if (len > table->maxlen)
1373 len = table->maxlen;
1377 if(copy_to_user(buffer, table->data, len))
1380 if(put_user('\n', ((char *) buffer) + len))
1391 * Special case of dostring for the UTS structure. This has locks
1392 * to observe. Should this be in kernel/sys.c ????
1395 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1396 void __user *buffer, size_t *lenp)
1401 down_read(&uts_sem);
1402 r=proc_dostring(table,0,filp,buffer,lenp);
1405 down_write(&uts_sem);
1406 r=proc_dostring(table,1,filp,buffer,lenp);
1412 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1414 int write, void *data)
1417 *valp = *negp ? -*lvalp : *lvalp;
1422 *lvalp = (unsigned long)-val;
1425 *lvalp = (unsigned long)val;
1431 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
1432 void __user *buffer, size_t *lenp,
1433 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1434 int write, void *data),
1437 #define TMPBUFLEN 20
1438 int *i, vleft, first=1, neg, val;
1442 char buf[TMPBUFLEN], *p;
1444 if (!table->data || !table->maxlen || !*lenp ||
1445 (filp->f_pos && !write)) {
1450 i = (int *) table->data;
1451 vleft = table->maxlen / sizeof(*i);
1455 conv = do_proc_dointvec_conv;
1457 for (; left && vleft--; i++, first=0) {
1461 if (get_user(c,(char __user *) buffer))
1472 if (len > sizeof(buf) - 1)
1473 len = sizeof(buf) - 1;
1474 if(copy_from_user(buf, buffer, len))
1478 if (*p == '-' && left > 1) {
1482 if (*p < '0' || *p > '9')
1485 lval = simple_strtoul(p, &p, 0);
1488 if ((len < left) && *p && !isspace(*p))
1495 if (conv(&neg, &lval, i, 1, data))
1502 if (conv(&neg, &lval, i, 0, data))
1505 sprintf(p, "%s%lu", neg ? "-" : "", lval);
1509 if(copy_to_user(buffer, buf, len))
1516 if (!write && !first && left) {
1517 if(put_user('\n', (char *) buffer))
1522 p = (char *) buffer;
1525 if (get_user(c, p++))
1535 filp->f_pos += *lenp;
1541 * proc_dointvec - read a vector of integers
1542 * @table: the sysctl table
1543 * @write: %TRUE if this is a write to the sysctl file
1544 * @filp: the file structure
1545 * @buffer: the user buffer
1546 * @lenp: the size of the user buffer
1548 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1549 * values from/to the user buffer, treated as an ASCII string.
1551 * Returns 0 on success.
1553 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1554 void __user *buffer, size_t *lenp)
1556 return do_proc_dointvec(table,write,filp,buffer,lenp,
1566 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1568 int write, void *data)
1570 int op = *(int *)data;
1572 int val = *negp ? -*lvalp : *lvalp;
1574 case OP_SET: *valp = val; break;
1575 case OP_AND: *valp &= val; break;
1576 case OP_OR: *valp |= val; break;
1577 case OP_MAX: if(*valp < val)
1580 case OP_MIN: if(*valp > val)
1588 *lvalp = (unsigned long)-val;
1591 *lvalp = (unsigned long)val;
1598 * init may raise the set.
1601 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1602 void __user *buffer, size_t *lenp)
1606 if (!capable(CAP_SYS_MODULE)) {
1610 op = (current->pid == 1) ? OP_SET : OP_AND;
1611 return do_proc_dointvec(table,write,filp,buffer,lenp,
1612 do_proc_dointvec_bset_conv,&op);
1615 struct do_proc_dointvec_minmax_conv_param {
1620 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1622 int write, void *data)
1624 struct do_proc_dointvec_minmax_conv_param *param = data;
1626 int val = *negp ? -*lvalp : *lvalp;
1627 if ((param->min && *param->min > val) ||
1628 (param->max && *param->max < val))
1635 *lvalp = (unsigned long)-val;
1638 *lvalp = (unsigned long)val;
1645 * proc_dointvec_minmax - read a vector of integers with min/max values
1646 * @table: the sysctl table
1647 * @write: %TRUE if this is a write to the sysctl file
1648 * @filp: the file structure
1649 * @buffer: the user buffer
1650 * @lenp: the size of the user buffer
1652 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1653 * values from/to the user buffer, treated as an ASCII string.
1655 * This routine will ensure the values are within the range specified by
1656 * table->extra1 (min) and table->extra2 (max).
1658 * Returns 0 on success.
1660 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1661 void __user *buffer, size_t *lenp)
1663 struct do_proc_dointvec_minmax_conv_param param = {
1664 .min = (int *) table->extra1,
1665 .max = (int *) table->extra2,
1667 return do_proc_dointvec(table, write, filp, buffer, lenp,
1668 do_proc_dointvec_minmax_conv, ¶m);
1671 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
1673 void __user *buffer, size_t *lenp,
1674 unsigned long convmul,
1675 unsigned long convdiv)
1677 #define TMPBUFLEN 20
1678 unsigned long *i, *min, *max, val;
1679 int vleft, first=1, neg;
1681 char buf[TMPBUFLEN], *p;
1683 if (!table->data || !table->maxlen || !*lenp ||
1684 (filp->f_pos && !write)) {
1689 i = (unsigned long *) table->data;
1690 min = (unsigned long *) table->extra1;
1691 max = (unsigned long *) table->extra2;
1692 vleft = table->maxlen / sizeof(unsigned long);
1695 for (; left && vleft--; i++, min++, max++, first=0) {
1699 if (get_user(c, (char __user *) buffer))
1710 if (len > TMPBUFLEN-1)
1712 if (copy_from_user(buf, buffer, len))
1716 if (*p == '-' && left > 1) {
1720 if (*p < '0' || *p > '9')
1722 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
1724 if ((len < left) && *p && !isspace(*p))
1733 if ((min && val < *min) || (max && val > *max))
1740 sprintf(p, "%lu", convdiv * (*i) / convmul);
1744 if(copy_to_user(buffer, buf, len))
1751 if (!write && !first && left) {
1752 if(put_user('\n', (char *) buffer))
1757 p = (char *) buffer;
1760 if (get_user(c, p++))
1770 filp->f_pos += *lenp;
1776 * proc_doulongvec_minmax - read a vector of long integers with min/max values
1777 * @table: the sysctl table
1778 * @write: %TRUE if this is a write to the sysctl file
1779 * @filp: the file structure
1780 * @buffer: the user buffer
1781 * @lenp: the size of the user buffer
1783 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1784 * values from/to the user buffer, treated as an ASCII string.
1786 * This routine will ensure the values are within the range specified by
1787 * table->extra1 (min) and table->extra2 (max).
1789 * Returns 0 on success.
1791 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1792 void __user *buffer, size_t *lenp)
1794 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, 1l, 1l);
1798 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
1799 * @table: the sysctl table
1800 * @write: %TRUE if this is a write to the sysctl file
1801 * @filp: the file structure
1802 * @buffer: the user buffer
1803 * @lenp: the size of the user buffer
1805 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1806 * values from/to the user buffer, treated as an ASCII string. The values
1807 * are treated as milliseconds, and converted to jiffies when they are stored.
1809 * This routine will ensure the values are within the range specified by
1810 * table->extra1 (min) and table->extra2 (max).
1812 * Returns 0 on success.
1814 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1816 void __user *buffer, size_t *lenp)
1818 return do_proc_doulongvec_minmax(table, write, filp, buffer,
1823 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
1825 int write, void *data)
1828 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
1834 lval = (unsigned long)-val;
1837 lval = (unsigned long)val;
1844 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
1846 int write, void *data)
1849 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
1855 lval = (unsigned long)-val;
1858 lval = (unsigned long)val;
1860 *lvalp = jiffies_to_clock_t(lval);
1866 * proc_dointvec_jiffies - read a vector of integers as seconds
1867 * @table: the sysctl table
1868 * @write: %TRUE if this is a write to the sysctl file
1869 * @filp: the file structure
1870 * @buffer: the user buffer
1871 * @lenp: the size of the user buffer
1873 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1874 * values from/to the user buffer, treated as an ASCII string.
1875 * The values read are assumed to be in seconds, and are converted into
1878 * Returns 0 on success.
1880 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
1881 void __user *buffer, size_t *lenp)
1883 return do_proc_dointvec(table,write,filp,buffer,lenp,
1884 do_proc_dointvec_jiffies_conv,NULL);
1888 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
1889 * @table: the sysctl table
1890 * @write: %TRUE if this is a write to the sysctl file
1891 * @filp: the file structure
1892 * @buffer: the user buffer
1893 * @lenp: the size of the user buffer
1895 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1896 * values from/to the user buffer, treated as an ASCII string.
1897 * The values read are assumed to be in 1/USER_HZ seconds, and
1898 * are converted into jiffies.
1900 * Returns 0 on success.
1902 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
1903 void __user *buffer, size_t *lenp)
1905 return do_proc_dointvec(table,write,filp,buffer,lenp,
1906 do_proc_dointvec_userhz_jiffies_conv,NULL);
1909 #else /* CONFIG_PROC_FS */
1911 int proc_dostring(ctl_table *table, int write, struct file *filp,
1912 void *buffer, size_t *lenp)
1917 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1918 void *buffer, size_t *lenp)
1923 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1924 void *buffer, size_t *lenp)
1929 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1930 void *buffer, size_t *lenp)
1935 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1936 void *buffer, size_t *lenp)
1941 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
1942 void *buffer, size_t *lenp)
1947 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
1948 void *buffer, size_t *lenp)
1953 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1954 void *buffer, size_t *lenp)
1959 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1961 void *buffer, size_t *lenp)
1967 #endif /* CONFIG_PROC_FS */
1971 * General sysctl support routines
1974 /* The generic string strategy routine: */
1975 int sysctl_string(ctl_table *table, int __user *name, int nlen,
1976 void __user *oldval, size_t __user *oldlenp,
1977 void __user *newval, size_t newlen, void **context)
1981 if (!table->data || !table->maxlen)
1984 if (oldval && oldlenp) {
1985 if (get_user(len, oldlenp))
1988 l = strlen(table->data);
1989 if (len > l) len = l;
1990 if (len >= table->maxlen)
1991 len = table->maxlen;
1992 if(copy_to_user(oldval, table->data, len))
1994 if(put_user(0, ((char *) oldval) + len))
1996 if(put_user(len, oldlenp))
2000 if (newval && newlen) {
2002 if (len > table->maxlen)
2003 len = table->maxlen;
2004 if(copy_from_user(table->data, newval, len))
2006 if (len == table->maxlen)
2008 ((char *) table->data)[len] = 0;
2014 * This function makes sure that all of the integers in the vector
2015 * are between the minimum and maximum values given in the arrays
2016 * table->extra1 and table->extra2, respectively.
2018 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2019 void __user *oldval, size_t __user *oldlenp,
2020 void __user *newval, size_t newlen, void **context)
2022 int i, *vec, *min, *max;
2025 if (newval && newlen) {
2026 if (newlen % sizeof(int) != 0)
2029 if (!table->extra1 && !table->extra2)
2032 if (newlen > table->maxlen)
2033 newlen = table->maxlen;
2034 length = newlen / sizeof(int);
2036 vec = (int *) newval;
2037 min = (int *) table->extra1;
2038 max = (int *) table->extra2;
2040 for (i = 0; i < length; i++) {
2042 if (get_user(value, vec + i))
2044 if (min && value < min[i])
2046 if (max && value > max[i])
2053 /* Strategy function to convert jiffies to seconds */
2054 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2055 void __user *oldval, size_t __user *oldlenp,
2056 void __user *newval, size_t newlen, void **context)
2061 if (get_user(olen, oldlenp))
2063 if (olen!=sizeof(int))
2066 if (put_user(*(int *)(table->data) / HZ, (int *)oldval) ||
2067 (oldlenp && put_user(sizeof(int),oldlenp)))
2070 if (newval && newlen) {
2072 if (newlen != sizeof(int))
2074 if (get_user(new, (int *)newval))
2076 *(int *)(table->data) = new*HZ;
2082 #else /* CONFIG_SYSCTL */
2085 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2090 int sysctl_string(ctl_table *table, int __user *name, int nlen,
2091 void __user *oldval, size_t __user *oldlenp,
2092 void __user *newval, size_t newlen, void **context)
2097 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2098 void __user *oldval, size_t __user *oldlenp,
2099 void __user *newval, size_t newlen, void **context)
2104 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2105 void __user *oldval, size_t __user *oldlenp,
2106 void __user *newval, size_t newlen, void **context)
2111 int proc_dostring(ctl_table *table, int write, struct file *filp,
2112 void __user *buffer, size_t *lenp)
2117 int proc_dointvec(ctl_table *table, int write, struct file *filp,
2118 void __user *buffer, size_t *lenp)
2123 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2124 void __user *buffer, size_t *lenp)
2129 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2130 void __user *buffer, size_t *lenp)
2135 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2136 void *buffer, size_t *lenp)
2141 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2142 void *buffer, size_t *lenp)
2147 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2148 void __user *buffer, size_t *lenp)
2153 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2155 void __user *buffer, size_t *lenp)
2160 struct ctl_table_header * register_sysctl_table(ctl_table * table,
2166 void unregister_sysctl_table(struct ctl_table_header * table)
2170 #endif /* CONFIG_SYSCTL */
2173 * No sense putting this after each symbol definition, twice,
2174 * exception granted :-)
2176 EXPORT_SYMBOL(proc_dointvec);
2177 EXPORT_SYMBOL(proc_dointvec_jiffies);
2178 EXPORT_SYMBOL(proc_dointvec_minmax);
2179 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2180 EXPORT_SYMBOL(proc_dostring);
2181 EXPORT_SYMBOL(proc_doulongvec_minmax);
2182 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2183 EXPORT_SYMBOL(register_sysctl_table);
2184 EXPORT_SYMBOL(sysctl_intvec);
2185 EXPORT_SYMBOL(sysctl_jiffies);
2186 EXPORT_SYMBOL(sysctl_string);
2187 EXPORT_SYMBOL(unregister_sysctl_table);