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,
221 .maxlen = sizeof(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,
230 .maxlen = sizeof(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,
239 .maxlen = sizeof(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,
248 .maxlen = sizeof(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,
257 .maxlen = sizeof(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,
395 .maxlen = KMOD_PATH_LEN,
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,
406 .maxlen = KMOD_PATH_LEN,
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,
742 .ctl_name = VM_HUGETLB_GROUP,
743 .procname = "hugetlb_shm_group",
744 .data = &sysctl_hugetlb_shm_group,
745 .maxlen = sizeof(gid_t),
747 .proc_handler = &proc_dointvec,
751 .ctl_name = VM_LOWER_ZONE_PROTECTION,
752 .procname = "lower_zone_protection",
753 .data = &sysctl_lower_zone_protection,
754 .maxlen = sizeof(sysctl_lower_zone_protection),
756 .proc_handler = &lower_zone_protection_sysctl_handler,
757 .strategy = &sysctl_intvec,
761 .ctl_name = VM_MIN_FREE_KBYTES,
762 .procname = "min_free_kbytes",
763 .data = &min_free_kbytes,
764 .maxlen = sizeof(min_free_kbytes),
766 .proc_handler = &min_free_kbytes_sysctl_handler,
767 .strategy = &sysctl_intvec,
771 .ctl_name = VM_MAX_MAP_COUNT,
772 .procname = "max_map_count",
773 .data = &sysctl_max_map_count,
774 .maxlen = sizeof(sysctl_max_map_count),
776 .proc_handler = &proc_dointvec
779 .ctl_name = VM_LAPTOP_MODE,
780 .procname = "laptop_mode",
781 .data = &laptop_mode,
782 .maxlen = sizeof(laptop_mode),
784 .proc_handler = &proc_dointvec,
785 .strategy = &sysctl_intvec,
789 .ctl_name = VM_BLOCK_DUMP,
790 .procname = "block_dump",
792 .maxlen = sizeof(block_dump),
794 .proc_handler = &proc_dointvec,
795 .strategy = &sysctl_intvec,
801 static ctl_table proc_table[] = {
805 static ctl_table fs_table[] = {
807 .ctl_name = FS_NRINODE,
808 .procname = "inode-nr",
809 .data = &inodes_stat,
810 .maxlen = 2*sizeof(int),
812 .proc_handler = &proc_dointvec,
815 .ctl_name = FS_STATINODE,
816 .procname = "inode-state",
817 .data = &inodes_stat,
818 .maxlen = 7*sizeof(int),
820 .proc_handler = &proc_dointvec,
823 .ctl_name = FS_NRFILE,
824 .procname = "file-nr",
826 .maxlen = 3*sizeof(int),
828 .proc_handler = &proc_dointvec,
831 .ctl_name = FS_MAXFILE,
832 .procname = "file-max",
833 .data = &files_stat.max_files,
834 .maxlen = sizeof(int),
836 .proc_handler = &proc_dointvec,
839 .ctl_name = FS_DENTRY,
840 .procname = "dentry-state",
841 .data = &dentry_stat,
842 .maxlen = 6*sizeof(int),
844 .proc_handler = &proc_dointvec,
847 .ctl_name = FS_OVERFLOWUID,
848 .procname = "overflowuid",
849 .data = &fs_overflowuid,
850 .maxlen = sizeof(int),
852 .proc_handler = &proc_dointvec_minmax,
853 .strategy = &sysctl_intvec,
854 .extra1 = &minolduid,
855 .extra2 = &maxolduid,
858 .ctl_name = FS_OVERFLOWGID,
859 .procname = "overflowgid",
860 .data = &fs_overflowgid,
861 .maxlen = sizeof(int),
863 .proc_handler = &proc_dointvec_minmax,
864 .strategy = &sysctl_intvec,
865 .extra1 = &minolduid,
866 .extra2 = &maxolduid,
869 .ctl_name = FS_LEASES,
870 .procname = "leases-enable",
871 .data = &leases_enable,
872 .maxlen = sizeof(int),
874 .proc_handler = &proc_dointvec,
877 .ctl_name = FS_DIR_NOTIFY,
878 .procname = "dir-notify-enable",
879 .data = &dir_notify_enable,
880 .maxlen = sizeof(int),
882 .proc_handler = &proc_dointvec,
885 .ctl_name = FS_LEASE_TIME,
886 .procname = "lease-break-time",
887 .data = &lease_break_time,
888 .maxlen = sizeof(int),
890 .proc_handler = &proc_dointvec,
893 .ctl_name = FS_AIO_NR,
894 .procname = "aio-nr",
896 .maxlen = sizeof(aio_nr),
898 .proc_handler = &proc_dointvec,
901 .ctl_name = FS_AIO_MAX_NR,
902 .procname = "aio-max-nr",
904 .maxlen = sizeof(aio_max_nr),
906 .proc_handler = &proc_dointvec,
911 static ctl_table debug_table[] = {
915 static ctl_table dev_table[] = {
919 extern void init_irq_proc (void);
921 void __init sysctl_init(void)
923 #ifdef CONFIG_PROC_FS
924 register_proc_table(root_table, proc_sys_root);
929 int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
930 void __user *newval, size_t newlen)
932 struct list_head *tmp;
934 if (nlen <= 0 || nlen >= CTL_MAXNAME)
938 if (!oldlenp || get_user(old_len, oldlenp))
941 tmp = &root_table_header.ctl_entry;
943 struct ctl_table_header *head =
944 list_entry(tmp, struct ctl_table_header, ctl_entry);
945 void *context = NULL;
946 int error = parse_table(name, nlen, oldval, oldlenp,
947 newval, newlen, head->ctl_table,
951 if (error != -ENOTDIR)
954 } while (tmp != &root_table_header.ctl_entry);
958 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
960 struct __sysctl_args tmp;
963 if (copy_from_user(&tmp, args, sizeof(tmp)))
967 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
968 tmp.newval, tmp.newlen);
974 * ctl_perm does NOT grant the superuser all rights automatically, because
975 * some sysctl variables are readonly even to root.
978 static int test_perm(int mode, int op)
982 else if (in_egroup_p(0))
984 if ((mode & op & 0007) == op)
989 static inline int ctl_perm(ctl_table *table, int op)
992 error = security_sysctl(table, op);
995 return test_perm(table->mode, op);
998 static int parse_table(int __user *name, int nlen,
999 void __user *oldval, size_t __user *oldlenp,
1000 void __user *newval, size_t newlen,
1001 ctl_table *table, void **context)
1007 if (get_user(n, name))
1009 for ( ; table->ctl_name; table++) {
1010 if (n == table->ctl_name || table->ctl_name == CTL_ANY) {
1013 if (ctl_perm(table, 001))
1015 if (table->strategy) {
1016 error = table->strategy(
1019 newval, newlen, context);
1025 table = table->child;
1028 error = do_sysctl_strategy(table, name, nlen,
1030 newval, newlen, context);
1037 /* Perform the actual read/write of a sysctl table entry. */
1038 int do_sysctl_strategy (ctl_table *table,
1039 int __user *name, int nlen,
1040 void __user *oldval, size_t __user *oldlenp,
1041 void __user *newval, size_t newlen, void **context)
1050 if (ctl_perm(table, op))
1053 if (table->strategy) {
1054 rc = table->strategy(table, name, nlen, oldval, oldlenp,
1055 newval, newlen, context);
1062 /* If there is no strategy routine, or if the strategy returns
1063 * zero, proceed with automatic r/w */
1064 if (table->data && table->maxlen) {
1065 if (oldval && oldlenp) {
1066 if (get_user(len, oldlenp))
1069 if (len > table->maxlen)
1070 len = table->maxlen;
1071 if(copy_to_user(oldval, table->data, len))
1073 if(put_user(len, oldlenp))
1077 if (newval && newlen) {
1079 if (len > table->maxlen)
1080 len = table->maxlen;
1081 if(copy_from_user(table->data, newval, len))
1089 * register_sysctl_table - register a sysctl hierarchy
1090 * @table: the top-level table structure
1091 * @insert_at_head: whether the entry should be inserted in front or at the end
1093 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1094 * array. An entry with a ctl_name of 0 terminates the table.
1096 * The members of the &ctl_table structure are used as follows:
1098 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1099 * must be unique within that level of sysctl
1101 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1102 * enter a sysctl file
1104 * data - a pointer to data for use by proc_handler
1106 * maxlen - the maximum size in bytes of the data
1108 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1110 * child - a pointer to the child sysctl table if this entry is a directory, or
1113 * proc_handler - the text handler routine (described below)
1115 * strategy - the strategy routine (described below)
1117 * de - for internal use by the sysctl routines
1119 * extra1, extra2 - extra pointers usable by the proc handler routines
1121 * Leaf nodes in the sysctl tree will be represented by a single file
1122 * under /proc; non-leaf nodes will be represented by directories.
1124 * sysctl(2) can automatically manage read and write requests through
1125 * the sysctl table. The data and maxlen fields of the ctl_table
1126 * struct enable minimal validation of the values being written to be
1127 * performed, and the mode field allows minimal authentication.
1129 * More sophisticated management can be enabled by the provision of a
1130 * strategy routine with the table entry. This will be called before
1131 * any automatic read or write of the data is performed.
1133 * The strategy routine may return
1135 * < 0 - Error occurred (error is passed to user process)
1137 * 0 - OK - proceed with automatic read or write.
1139 * > 0 - OK - read or write has been done by the strategy routine, so
1140 * return immediately.
1142 * There must be a proc_handler routine for any terminal nodes
1143 * mirrored under /proc/sys (non-terminals are handled by a built-in
1144 * directory handler). Several default handlers are available to
1145 * cover common cases -
1147 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1148 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1149 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1151 * It is the handler's job to read the input buffer from user memory
1152 * and process it. The handler should return 0 on success.
1154 * This routine returns %NULL on a failure to register, and a pointer
1155 * to the table header on success.
1157 struct ctl_table_header *register_sysctl_table(ctl_table * table,
1160 struct ctl_table_header *tmp;
1161 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
1164 tmp->ctl_table = table;
1165 INIT_LIST_HEAD(&tmp->ctl_entry);
1167 list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
1169 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1170 #ifdef CONFIG_PROC_FS
1171 register_proc_table(table, proc_sys_root);
1177 * unregister_sysctl_table - unregister a sysctl table hierarchy
1178 * @header: the header returned from register_sysctl_table
1180 * Unregisters the sysctl table and all children. proc entries may not
1181 * actually be removed until they are no longer used by anyone.
1183 void unregister_sysctl_table(struct ctl_table_header * header)
1185 list_del(&header->ctl_entry);
1186 #ifdef CONFIG_PROC_FS
1187 unregister_proc_table(header->ctl_table, proc_sys_root);
1196 #ifdef CONFIG_PROC_FS
1198 /* Scan the sysctl entries in table and add them all into /proc */
1199 static void register_proc_table(ctl_table * table, struct proc_dir_entry *root)
1201 struct proc_dir_entry *de;
1205 for (; table->ctl_name; table++) {
1206 /* Can't do anything without a proc name. */
1207 if (!table->procname)
1209 /* Maybe we can't do anything with it... */
1210 if (!table->proc_handler && !table->child) {
1211 printk(KERN_WARNING "SYSCTL: Can't register %s\n",
1216 len = strlen(table->procname);
1220 if (table->proc_handler)
1224 for (de = root->subdir; de; de = de->next) {
1225 if (proc_match(len, table->procname, de))
1228 /* If the subdir exists already, de is non-NULL */
1232 de = create_proc_entry(table->procname, mode, root);
1235 de->data = (void *) table;
1236 if (table->proc_handler)
1237 de->proc_fops = &proc_sys_file_operations;
1240 if (de->mode & S_IFDIR)
1241 register_proc_table(table->child, de);
1246 * Unregister a /proc sysctl table and any subdirectories.
1248 static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root)
1250 struct proc_dir_entry *de;
1251 for (; table->ctl_name; table++) {
1252 if (!(de = table->de))
1254 if (de->mode & S_IFDIR) {
1255 if (!table->child) {
1256 printk (KERN_ALERT "Help - malformed sysctl tree on free\n");
1259 unregister_proc_table(table->child, de);
1261 /* Don't unregister directories which still have entries.. */
1266 /* Don't unregister proc entries that are still being used.. */
1267 if (atomic_read(&de->count))
1271 remove_proc_entry(table->procname, root);
1275 static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
1276 size_t count, loff_t *ppos)
1279 struct proc_dir_entry *de;
1280 struct ctl_table *table;
1284 de = PDE(file->f_dentry->d_inode);
1285 if (!de || !de->data)
1287 table = (struct ctl_table *) de->data;
1288 if (!table || !table->proc_handler)
1290 op = (write ? 002 : 004);
1291 if (ctl_perm(table, op))
1297 * FIXME: we need to pass on ppos to the handler.
1300 error = (*table->proc_handler) (table, write, file, buf, &res);
1306 static int proc_opensys(struct inode *inode, struct file *file)
1308 if (file->f_mode & FMODE_WRITE) {
1310 * sysctl entries that are not writable,
1311 * are _NOT_ writable, capabilities or not.
1313 if (!(inode->i_mode & S_IWUSR))
1320 static ssize_t proc_readsys(struct file * file, char __user * buf,
1321 size_t count, loff_t *ppos)
1323 return do_rw_proc(0, file, buf, count, ppos);
1326 static ssize_t proc_writesys(struct file * file, const char __user * buf,
1327 size_t count, loff_t *ppos)
1329 return do_rw_proc(1, file, (char __user *) buf, count, ppos);
1333 * proc_dostring - read a string sysctl
1334 * @table: the sysctl table
1335 * @write: %TRUE if this is a write to the sysctl file
1336 * @filp: the file structure
1337 * @buffer: the user buffer
1338 * @lenp: the size of the user buffer
1340 * Reads/writes a string from/to the user buffer. If the kernel
1341 * buffer provided is not large enough to hold the string, the
1342 * string is truncated. The copied string is %NULL-terminated.
1343 * If the string is being read by the user process, it is copied
1344 * and a newline '\n' is added. It is truncated if the buffer is
1347 * Returns 0 on success.
1349 int proc_dostring(ctl_table *table, int write, struct file *filp,
1350 void __user *buffer, size_t *lenp)
1356 if (!table->data || !table->maxlen || !*lenp ||
1357 (filp->f_pos && !write)) {
1365 while (len < *lenp) {
1366 if (get_user(c, p++))
1368 if (c == 0 || c == '\n')
1372 if (len >= table->maxlen)
1373 len = table->maxlen-1;
1374 if(copy_from_user(table->data, buffer, len))
1376 ((char *) table->data)[len] = 0;
1377 filp->f_pos += *lenp;
1379 len = strlen(table->data);
1380 if (len > table->maxlen)
1381 len = table->maxlen;
1385 if(copy_to_user(buffer, table->data, len))
1388 if(put_user('\n', ((char __user *) buffer) + len))
1399 * Special case of dostring for the UTS structure. This has locks
1400 * to observe. Should this be in kernel/sys.c ????
1403 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1404 void __user *buffer, size_t *lenp)
1409 down_read(&uts_sem);
1410 r=proc_dostring(table,0,filp,buffer,lenp);
1413 down_write(&uts_sem);
1414 r=proc_dostring(table,1,filp,buffer,lenp);
1420 static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1422 int write, void *data)
1425 *valp = *negp ? -*lvalp : *lvalp;
1430 *lvalp = (unsigned long)-val;
1433 *lvalp = (unsigned long)val;
1439 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
1440 void __user *buffer, size_t *lenp,
1441 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1442 int write, void *data),
1445 #define TMPBUFLEN 20
1446 int *i, vleft, first=1, neg, val;
1450 char buf[TMPBUFLEN], *p;
1451 char __user *s = buffer;
1453 if (!table->data || !table->maxlen || !*lenp ||
1454 (filp->f_pos && !write)) {
1459 i = (int *) table->data;
1460 vleft = table->maxlen / sizeof(*i);
1464 conv = do_proc_dointvec_conv;
1466 for (; left && vleft--; i++, first=0) {
1481 if (len > sizeof(buf) - 1)
1482 len = sizeof(buf) - 1;
1483 if (copy_from_user(buf, s, len))
1487 if (*p == '-' && left > 1) {
1491 if (*p < '0' || *p > '9')
1494 lval = simple_strtoul(p, &p, 0);
1497 if ((len < left) && *p && !isspace(*p))
1504 if (conv(&neg, &lval, i, 1, data))
1511 if (conv(&neg, &lval, i, 0, data))
1514 sprintf(p, "%s%lu", neg ? "-" : "", lval);
1518 if(copy_to_user(s, buf, len))
1525 if (!write && !first && left) {
1526 if(put_user('\n', s))
1533 if (get_user(c, s++))
1543 filp->f_pos += *lenp;
1549 * proc_dointvec - read a vector of integers
1550 * @table: the sysctl table
1551 * @write: %TRUE if this is a write to the sysctl file
1552 * @filp: the file structure
1553 * @buffer: the user buffer
1554 * @lenp: the size of the user buffer
1556 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1557 * values from/to the user buffer, treated as an ASCII string.
1559 * Returns 0 on success.
1561 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1562 void __user *buffer, size_t *lenp)
1564 return do_proc_dointvec(table,write,filp,buffer,lenp,
1574 static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1576 int write, void *data)
1578 int op = *(int *)data;
1580 int val = *negp ? -*lvalp : *lvalp;
1582 case OP_SET: *valp = val; break;
1583 case OP_AND: *valp &= val; break;
1584 case OP_OR: *valp |= val; break;
1585 case OP_MAX: if(*valp < val)
1588 case OP_MIN: if(*valp > val)
1596 *lvalp = (unsigned long)-val;
1599 *lvalp = (unsigned long)val;
1606 * init may raise the set.
1609 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1610 void __user *buffer, size_t *lenp)
1614 if (!capable(CAP_SYS_MODULE)) {
1618 op = (current->pid == 1) ? OP_SET : OP_AND;
1619 return do_proc_dointvec(table,write,filp,buffer,lenp,
1620 do_proc_dointvec_bset_conv,&op);
1623 struct do_proc_dointvec_minmax_conv_param {
1628 static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1630 int write, void *data)
1632 struct do_proc_dointvec_minmax_conv_param *param = data;
1634 int val = *negp ? -*lvalp : *lvalp;
1635 if ((param->min && *param->min > val) ||
1636 (param->max && *param->max < val))
1643 *lvalp = (unsigned long)-val;
1646 *lvalp = (unsigned long)val;
1653 * proc_dointvec_minmax - read a vector of integers with min/max values
1654 * @table: the sysctl table
1655 * @write: %TRUE if this is a write to the sysctl file
1656 * @filp: the file structure
1657 * @buffer: the user buffer
1658 * @lenp: the size of the user buffer
1660 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1661 * values from/to the user buffer, treated as an ASCII string.
1663 * This routine will ensure the values are within the range specified by
1664 * table->extra1 (min) and table->extra2 (max).
1666 * Returns 0 on success.
1668 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1669 void __user *buffer, size_t *lenp)
1671 struct do_proc_dointvec_minmax_conv_param param = {
1672 .min = (int *) table->extra1,
1673 .max = (int *) table->extra2,
1675 return do_proc_dointvec(table, write, filp, buffer, lenp,
1676 do_proc_dointvec_minmax_conv, ¶m);
1679 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
1681 void __user *buffer, size_t *lenp,
1682 unsigned long convmul,
1683 unsigned long convdiv)
1685 #define TMPBUFLEN 20
1686 unsigned long *i, *min, *max, val;
1687 int vleft, first=1, neg;
1689 char buf[TMPBUFLEN], *p;
1690 char __user *s = buffer;
1692 if (!table->data || !table->maxlen || !*lenp ||
1693 (filp->f_pos && !write)) {
1698 i = (unsigned long *) table->data;
1699 min = (unsigned long *) table->extra1;
1700 max = (unsigned long *) table->extra2;
1701 vleft = table->maxlen / sizeof(unsigned long);
1704 for (; left && vleft--; i++, min++, max++, first=0) {
1719 if (len > TMPBUFLEN-1)
1721 if (copy_from_user(buf, s, len))
1725 if (*p == '-' && left > 1) {
1729 if (*p < '0' || *p > '9')
1731 val = simple_strtoul(p, &p, 0) * convmul / convdiv ;
1733 if ((len < left) && *p && !isspace(*p))
1742 if ((min && val < *min) || (max && val > *max))
1749 sprintf(p, "%lu", convdiv * (*i) / convmul);
1753 if(copy_to_user(s, buf, len))
1760 if (!write && !first && left) {
1761 if(put_user('\n', s))
1768 if (get_user(c, s++))
1778 filp->f_pos += *lenp;
1784 * proc_doulongvec_minmax - read a vector of long integers with min/max values
1785 * @table: the sysctl table
1786 * @write: %TRUE if this is a write to the sysctl file
1787 * @filp: the file structure
1788 * @buffer: the user buffer
1789 * @lenp: the size of the user buffer
1791 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1792 * values from/to the user buffer, treated as an ASCII string.
1794 * This routine will ensure the values are within the range specified by
1795 * table->extra1 (min) and table->extra2 (max).
1797 * Returns 0 on success.
1799 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1800 void __user *buffer, size_t *lenp)
1802 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, 1l, 1l);
1806 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
1807 * @table: the sysctl table
1808 * @write: %TRUE if this is a write to the sysctl file
1809 * @filp: the file structure
1810 * @buffer: the user buffer
1811 * @lenp: the size of the user buffer
1813 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
1814 * values from/to the user buffer, treated as an ASCII string. The values
1815 * are treated as milliseconds, and converted to jiffies when they are stored.
1817 * This routine will ensure the values are within the range specified by
1818 * table->extra1 (min) and table->extra2 (max).
1820 * Returns 0 on success.
1822 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1824 void __user *buffer, size_t *lenp)
1826 return do_proc_doulongvec_minmax(table, write, filp, buffer,
1831 static int do_proc_dointvec_jiffies_conv(int *negp, unsigned long *lvalp,
1833 int write, void *data)
1836 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
1842 lval = (unsigned long)-val;
1845 lval = (unsigned long)val;
1852 static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
1854 int write, void *data)
1857 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
1863 lval = (unsigned long)-val;
1866 lval = (unsigned long)val;
1868 *lvalp = jiffies_to_clock_t(lval);
1874 * proc_dointvec_jiffies - read a vector of integers as seconds
1875 * @table: the sysctl table
1876 * @write: %TRUE if this is a write to the sysctl file
1877 * @filp: the file structure
1878 * @buffer: the user buffer
1879 * @lenp: the size of the user buffer
1881 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1882 * values from/to the user buffer, treated as an ASCII string.
1883 * The values read are assumed to be in seconds, and are converted into
1886 * Returns 0 on success.
1888 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
1889 void __user *buffer, size_t *lenp)
1891 return do_proc_dointvec(table,write,filp,buffer,lenp,
1892 do_proc_dointvec_jiffies_conv,NULL);
1896 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
1897 * @table: the sysctl table
1898 * @write: %TRUE if this is a write to the sysctl file
1899 * @filp: the file structure
1900 * @buffer: the user buffer
1901 * @lenp: the size of the user buffer
1903 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1904 * values from/to the user buffer, treated as an ASCII string.
1905 * The values read are assumed to be in 1/USER_HZ seconds, and
1906 * are converted into jiffies.
1908 * Returns 0 on success.
1910 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
1911 void __user *buffer, size_t *lenp)
1913 return do_proc_dointvec(table,write,filp,buffer,lenp,
1914 do_proc_dointvec_userhz_jiffies_conv,NULL);
1917 #else /* CONFIG_PROC_FS */
1919 int proc_dostring(ctl_table *table, int write, struct file *filp,
1920 void __user *buffer, size_t *lenp)
1925 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
1926 void __user *buffer, size_t *lenp)
1931 int proc_dointvec(ctl_table *table, int write, struct file *filp,
1932 void __user *buffer, size_t *lenp)
1937 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1938 void __user *buffer, size_t *lenp)
1943 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1944 void __user *buffer, size_t *lenp)
1949 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
1950 void __user *buffer, size_t *lenp)
1955 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
1956 void __user *buffer, size_t *lenp)
1961 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
1962 void __user *buffer, size_t *lenp)
1967 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
1969 void __user *buffer, size_t *lenp)
1975 #endif /* CONFIG_PROC_FS */
1979 * General sysctl support routines
1982 /* The generic string strategy routine: */
1983 int sysctl_string(ctl_table *table, int __user *name, int nlen,
1984 void __user *oldval, size_t __user *oldlenp,
1985 void __user *newval, size_t newlen, void **context)
1989 if (!table->data || !table->maxlen)
1992 if (oldval && oldlenp) {
1993 if (get_user(len, oldlenp))
1996 l = strlen(table->data);
1997 if (len > l) len = l;
1998 if (len >= table->maxlen)
1999 len = table->maxlen;
2000 if(copy_to_user(oldval, table->data, len))
2002 if(put_user(0, ((char __user *) oldval) + len))
2004 if(put_user(len, oldlenp))
2008 if (newval && newlen) {
2010 if (len > table->maxlen)
2011 len = table->maxlen;
2012 if(copy_from_user(table->data, newval, len))
2014 if (len == table->maxlen)
2016 ((char *) table->data)[len] = 0;
2022 * This function makes sure that all of the integers in the vector
2023 * are between the minimum and maximum values given in the arrays
2024 * table->extra1 and table->extra2, respectively.
2026 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2027 void __user *oldval, size_t __user *oldlenp,
2028 void __user *newval, size_t newlen, void **context)
2031 if (newval && newlen) {
2032 int __user *vec = (int __user *) newval;
2033 int *min = (int *) table->extra1;
2034 int *max = (int *) table->extra2;
2038 if (newlen % sizeof(int) != 0)
2041 if (!table->extra1 && !table->extra2)
2044 if (newlen > table->maxlen)
2045 newlen = table->maxlen;
2046 length = newlen / sizeof(int);
2048 for (i = 0; i < length; i++) {
2050 if (get_user(value, vec + i))
2052 if (min && value < min[i])
2054 if (max && value > max[i])
2061 /* Strategy function to convert jiffies to seconds */
2062 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2063 void __user *oldval, size_t __user *oldlenp,
2064 void __user *newval, size_t newlen, void **context)
2069 if (get_user(olen, oldlenp))
2071 if (olen!=sizeof(int))
2074 if (put_user(*(int *)(table->data)/HZ, (int __user *)oldval) ||
2075 (oldlenp && put_user(sizeof(int),oldlenp)))
2078 if (newval && newlen) {
2080 if (newlen != sizeof(int))
2082 if (get_user(new, (int __user *)newval))
2084 *(int *)(table->data) = new*HZ;
2090 #else /* CONFIG_SYSCTL */
2093 asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2098 int sysctl_string(ctl_table *table, int __user *name, int nlen,
2099 void __user *oldval, size_t __user *oldlenp,
2100 void __user *newval, size_t newlen, void **context)
2105 int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2106 void __user *oldval, size_t __user *oldlenp,
2107 void __user *newval, size_t newlen, void **context)
2112 int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2113 void __user *oldval, size_t __user *oldlenp,
2114 void __user *newval, size_t newlen, void **context)
2119 int proc_dostring(ctl_table *table, int write, struct file *filp,
2120 void __user *buffer, size_t *lenp)
2125 int proc_dointvec(ctl_table *table, int write, struct file *filp,
2126 void __user *buffer, size_t *lenp)
2131 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
2132 void __user *buffer, size_t *lenp)
2137 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
2138 void __user *buffer, size_t *lenp)
2143 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2144 void __user *buffer, size_t *lenp)
2149 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2150 void __user *buffer, size_t *lenp)
2155 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2156 void __user *buffer, size_t *lenp)
2161 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2163 void __user *buffer, size_t *lenp)
2168 struct ctl_table_header * register_sysctl_table(ctl_table * table,
2174 void unregister_sysctl_table(struct ctl_table_header * table)
2178 #endif /* CONFIG_SYSCTL */
2181 * No sense putting this after each symbol definition, twice,
2182 * exception granted :-)
2184 EXPORT_SYMBOL(proc_dointvec);
2185 EXPORT_SYMBOL(proc_dointvec_jiffies);
2186 EXPORT_SYMBOL(proc_dointvec_minmax);
2187 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2188 EXPORT_SYMBOL(proc_dostring);
2189 EXPORT_SYMBOL(proc_doulongvec_minmax);
2190 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);
2191 EXPORT_SYMBOL(register_sysctl_table);
2192 EXPORT_SYMBOL(sysctl_intvec);
2193 EXPORT_SYMBOL(sysctl_jiffies);
2194 EXPORT_SYMBOL(sysctl_string);
2195 EXPORT_SYMBOL(unregister_sysctl_table);