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/module.h>
23 #include <linux/swap.h>
24 #include <linux/slab.h>
25 #include <linux/sysctl.h>
26 #include <linux/proc_fs.h>
27 #include <linux/capability.h>
28 #include <linux/ctype.h>
29 #include <linux/utsname.h>
30 #include <linux/capability.h>
31 #include <linux/smp_lock.h>
32 #include <linux/init.h>
33 #include <linux/kernel.h>
34 #include <linux/kobject.h>
35 #include <linux/net.h>
36 #include <linux/sysrq.h>
37 #include <linux/highuid.h>
38 #include <linux/writeback.h>
39 #include <linux/hugetlb.h>
40 #include <linux/security.h>
41 #include <linux/initrd.h>
42 #include <linux/times.h>
43 #include <linux/limits.h>
44 #include <linux/dcache.h>
45 #include <linux/syscalls.h>
46 #include <linux/nfs_fs.h>
47 #include <linux/acpi.h>
49 #include <asm/uaccess.h>
50 #include <asm/processor.h>
52 extern int proc_nr_files(ctl_table
*table
, int write
, struct file
*filp
,
53 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
57 #include <asm/stacktrace.h>
60 #if defined(CONFIG_SYSCTL)
62 /* External variables not in a header file. */
64 extern int sysctl_overcommit_memory
;
65 extern int sysctl_overcommit_ratio
;
66 extern int sysctl_panic_on_oom
;
67 extern int max_threads
;
68 extern int sysrq_enabled
;
69 extern int core_uses_pid
;
70 extern int suid_dumpable
;
71 extern char core_pattern
[];
73 extern int min_free_kbytes
;
74 extern int printk_ratelimit_jiffies
;
75 extern int printk_ratelimit_burst
;
76 extern int pid_max_min
, pid_max_max
;
77 extern int sysctl_drop_caches
;
78 extern int percpu_pagelist_fraction
;
79 extern int compat_log
;
81 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
82 static int maxolduid
= 65535;
84 static int min_percpu_pagelist_fract
= 8;
86 static int ngroups_max
= NGROUPS_MAX
;
89 extern char modprobe_path
[];
91 #ifdef CONFIG_CHR_DEV_SG
92 extern int sg_big_buff
;
95 static int proc_ipc_dointvec(ctl_table
*table
, int write
, struct file
*filp
,
96 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
97 static int proc_ipc_doulongvec_minmax(ctl_table
*table
, int write
, struct file
*filp
,
98 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
102 extern char reboot_command
[];
103 extern int stop_a_enabled
;
104 extern int scons_pwroff
;
108 extern int pwrsw_enabled
;
109 extern int unaligned_enabled
;
113 #ifdef CONFIG_MATHEMU
114 extern int sysctl_ieee_emulation_warnings
;
116 extern int sysctl_userprocess_debug
;
117 extern int spin_retry
;
120 extern int sysctl_hz_timer
;
122 #ifdef CONFIG_BSD_PROCESS_ACCT
123 extern int acct_parm
[];
127 extern int no_unaligned_warning
;
130 #ifdef CONFIG_RT_MUTEXES
131 extern int max_lock_depth
;
134 #ifdef CONFIG_SYSCTL_SYSCALL
135 static int parse_table(int __user
*, int, void __user
*, size_t __user
*,
136 void __user
*, size_t, ctl_table
*, void **);
139 static int proc_do_uts_string(ctl_table
*table
, int write
, struct file
*filp
,
140 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
142 static int sysctl_uts_string(ctl_table
*table
, int __user
*name
, int nlen
,
143 void __user
*oldval
, size_t __user
*oldlenp
,
144 void __user
*newval
, size_t newlen
, void **context
);
146 #ifdef CONFIG_PROC_SYSCTL
147 static int proc_do_cad_pid(ctl_table
*table
, int write
, struct file
*filp
,
148 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
151 static ctl_table root_table
[];
152 static struct ctl_table_header root_table_header
=
153 { root_table
, LIST_HEAD_INIT(root_table_header
.ctl_entry
) };
155 static ctl_table kern_table
[];
156 static ctl_table vm_table
[];
157 static ctl_table fs_table
[];
158 static ctl_table debug_table
[];
159 static ctl_table dev_table
[];
160 extern ctl_table random_table
[];
161 #ifdef CONFIG_UNIX98_PTYS
162 extern ctl_table pty_table
[];
164 #ifdef CONFIG_INOTIFY_USER
165 extern ctl_table inotify_table
[];
168 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
169 int sysctl_legacy_va_layout
;
172 static void *get_uts(ctl_table
*table
, int write
)
174 char *which
= table
->data
;
176 struct uts_namespace
*uts_ns
= current
->nsproxy
->uts_ns
;
177 which
= (which
- (char *)&init_uts_ns
) + (char *)uts_ns
;
182 down_write(&uts_sem
);
186 static void put_uts(ctl_table
*table
, int write
, void *which
)
194 #ifdef CONFIG_SYSVIPC
195 static void *get_ipc(ctl_table
*table
, int write
)
197 char *which
= table
->data
;
198 struct ipc_namespace
*ipc_ns
= current
->nsproxy
->ipc_ns
;
199 which
= (which
- (char *)&init_ipc_ns
) + (char *)ipc_ns
;
203 #define get_ipc(T,W) ((T)->data)
206 /* /proc declarations: */
208 #ifdef CONFIG_PROC_SYSCTL
210 static ssize_t
proc_readsys(struct file
*, char __user
*, size_t, loff_t
*);
211 static ssize_t
proc_writesys(struct file
*, const char __user
*, size_t, loff_t
*);
212 static int proc_opensys(struct inode
*, struct file
*);
214 const struct file_operations proc_sys_file_operations
= {
215 .open
= proc_opensys
,
216 .read
= proc_readsys
,
217 .write
= proc_writesys
,
220 extern struct proc_dir_entry
*proc_sys_root
;
222 static void register_proc_table(ctl_table
*, struct proc_dir_entry
*, void *);
223 static void unregister_proc_table(ctl_table
*, struct proc_dir_entry
*);
226 /* The default sysctl tables: */
228 static ctl_table root_table
[] = {
230 .ctl_name
= CTL_KERN
,
231 .procname
= "kernel",
256 .ctl_name
= CTL_DEBUG
,
259 .child
= debug_table
,
271 static ctl_table kern_table
[] = {
273 .ctl_name
= KERN_OSTYPE
,
274 .procname
= "ostype",
275 .data
= init_uts_ns
.name
.sysname
,
276 .maxlen
= sizeof(init_uts_ns
.name
.sysname
),
278 .proc_handler
= &proc_do_uts_string
,
279 .strategy
= &sysctl_uts_string
,
282 .ctl_name
= KERN_OSRELEASE
,
283 .procname
= "osrelease",
284 .data
= init_uts_ns
.name
.release
,
285 .maxlen
= sizeof(init_uts_ns
.name
.release
),
287 .proc_handler
= &proc_do_uts_string
,
288 .strategy
= &sysctl_uts_string
,
291 .ctl_name
= KERN_VERSION
,
292 .procname
= "version",
293 .data
= init_uts_ns
.name
.version
,
294 .maxlen
= sizeof(init_uts_ns
.name
.version
),
296 .proc_handler
= &proc_do_uts_string
,
297 .strategy
= &sysctl_uts_string
,
300 .ctl_name
= KERN_NODENAME
,
301 .procname
= "hostname",
302 .data
= init_uts_ns
.name
.nodename
,
303 .maxlen
= sizeof(init_uts_ns
.name
.nodename
),
305 .proc_handler
= &proc_do_uts_string
,
306 .strategy
= &sysctl_uts_string
,
309 .ctl_name
= KERN_DOMAINNAME
,
310 .procname
= "domainname",
311 .data
= init_uts_ns
.name
.domainname
,
312 .maxlen
= sizeof(init_uts_ns
.name
.domainname
),
314 .proc_handler
= &proc_do_uts_string
,
315 .strategy
= &sysctl_uts_string
,
318 .ctl_name
= KERN_PANIC
,
320 .data
= &panic_timeout
,
321 .maxlen
= sizeof(int),
323 .proc_handler
= &proc_dointvec
,
326 .ctl_name
= KERN_CORE_USES_PID
,
327 .procname
= "core_uses_pid",
328 .data
= &core_uses_pid
,
329 .maxlen
= sizeof(int),
331 .proc_handler
= &proc_dointvec
,
334 .ctl_name
= KERN_CORE_PATTERN
,
335 .procname
= "core_pattern",
336 .data
= core_pattern
,
339 .proc_handler
= &proc_dostring
,
340 .strategy
= &sysctl_string
,
343 .ctl_name
= KERN_TAINTED
,
344 .procname
= "tainted",
346 .maxlen
= sizeof(int),
348 .proc_handler
= &proc_dointvec
,
351 .ctl_name
= KERN_CAP_BSET
,
352 .procname
= "cap-bound",
354 .maxlen
= sizeof(kernel_cap_t
),
356 .proc_handler
= &proc_dointvec_bset
,
358 #ifdef CONFIG_BLK_DEV_INITRD
360 .ctl_name
= KERN_REALROOTDEV
,
361 .procname
= "real-root-dev",
362 .data
= &real_root_dev
,
363 .maxlen
= sizeof(int),
365 .proc_handler
= &proc_dointvec
,
370 .ctl_name
= KERN_SPARC_REBOOT
,
371 .procname
= "reboot-cmd",
372 .data
= reboot_command
,
375 .proc_handler
= &proc_dostring
,
376 .strategy
= &sysctl_string
,
379 .ctl_name
= KERN_SPARC_STOP_A
,
380 .procname
= "stop-a",
381 .data
= &stop_a_enabled
,
382 .maxlen
= sizeof (int),
384 .proc_handler
= &proc_dointvec
,
387 .ctl_name
= KERN_SPARC_SCONS_PWROFF
,
388 .procname
= "scons-poweroff",
389 .data
= &scons_pwroff
,
390 .maxlen
= sizeof (int),
392 .proc_handler
= &proc_dointvec
,
397 .ctl_name
= KERN_HPPA_PWRSW
,
398 .procname
= "soft-power",
399 .data
= &pwrsw_enabled
,
400 .maxlen
= sizeof (int),
402 .proc_handler
= &proc_dointvec
,
405 .ctl_name
= KERN_HPPA_UNALIGNED
,
406 .procname
= "unaligned-trap",
407 .data
= &unaligned_enabled
,
408 .maxlen
= sizeof (int),
410 .proc_handler
= &proc_dointvec
,
414 .ctl_name
= KERN_CTLALTDEL
,
415 .procname
= "ctrl-alt-del",
417 .maxlen
= sizeof(int),
419 .proc_handler
= &proc_dointvec
,
422 .ctl_name
= KERN_PRINTK
,
423 .procname
= "printk",
424 .data
= &console_loglevel
,
425 .maxlen
= 4*sizeof(int),
427 .proc_handler
= &proc_dointvec
,
431 .ctl_name
= KERN_MODPROBE
,
432 .procname
= "modprobe",
433 .data
= &modprobe_path
,
434 .maxlen
= KMOD_PATH_LEN
,
436 .proc_handler
= &proc_dostring
,
437 .strategy
= &sysctl_string
,
440 #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
442 .ctl_name
= KERN_HOTPLUG
,
443 .procname
= "hotplug",
444 .data
= &uevent_helper
,
445 .maxlen
= UEVENT_HELPER_PATH_LEN
,
447 .proc_handler
= &proc_dostring
,
448 .strategy
= &sysctl_string
,
451 #ifdef CONFIG_CHR_DEV_SG
453 .ctl_name
= KERN_SG_BIG_BUFF
,
454 .procname
= "sg-big-buff",
455 .data
= &sg_big_buff
,
456 .maxlen
= sizeof (int),
458 .proc_handler
= &proc_dointvec
,
461 #ifdef CONFIG_BSD_PROCESS_ACCT
463 .ctl_name
= KERN_ACCT
,
466 .maxlen
= 3*sizeof(int),
468 .proc_handler
= &proc_dointvec
,
471 #ifdef CONFIG_SYSVIPC
473 .ctl_name
= KERN_SHMMAX
,
474 .procname
= "shmmax",
475 .data
= &init_ipc_ns
.shm_ctlmax
,
476 .maxlen
= sizeof (init_ipc_ns
.shm_ctlmax
),
478 .proc_handler
= &proc_ipc_doulongvec_minmax
,
481 .ctl_name
= KERN_SHMALL
,
482 .procname
= "shmall",
483 .data
= &init_ipc_ns
.shm_ctlall
,
484 .maxlen
= sizeof (init_ipc_ns
.shm_ctlall
),
486 .proc_handler
= &proc_ipc_doulongvec_minmax
,
489 .ctl_name
= KERN_SHMMNI
,
490 .procname
= "shmmni",
491 .data
= &init_ipc_ns
.shm_ctlmni
,
492 .maxlen
= sizeof (init_ipc_ns
.shm_ctlmni
),
494 .proc_handler
= &proc_ipc_dointvec
,
497 .ctl_name
= KERN_MSGMAX
,
498 .procname
= "msgmax",
499 .data
= &init_ipc_ns
.msg_ctlmax
,
500 .maxlen
= sizeof (init_ipc_ns
.msg_ctlmax
),
502 .proc_handler
= &proc_ipc_dointvec
,
505 .ctl_name
= KERN_MSGMNI
,
506 .procname
= "msgmni",
507 .data
= &init_ipc_ns
.msg_ctlmni
,
508 .maxlen
= sizeof (init_ipc_ns
.msg_ctlmni
),
510 .proc_handler
= &proc_ipc_dointvec
,
513 .ctl_name
= KERN_MSGMNB
,
514 .procname
= "msgmnb",
515 .data
= &init_ipc_ns
.msg_ctlmnb
,
516 .maxlen
= sizeof (init_ipc_ns
.msg_ctlmnb
),
518 .proc_handler
= &proc_ipc_dointvec
,
521 .ctl_name
= KERN_SEM
,
523 .data
= &init_ipc_ns
.sem_ctls
,
524 .maxlen
= 4*sizeof (int),
526 .proc_handler
= &proc_ipc_dointvec
,
529 #ifdef CONFIG_MAGIC_SYSRQ
531 .ctl_name
= KERN_SYSRQ
,
533 .data
= &sysrq_enabled
,
534 .maxlen
= sizeof (int),
536 .proc_handler
= &proc_dointvec
,
539 #ifdef CONFIG_PROC_SYSCTL
541 .ctl_name
= KERN_CADPID
,
542 .procname
= "cad_pid",
544 .maxlen
= sizeof (int),
546 .proc_handler
= &proc_do_cad_pid
,
550 .ctl_name
= KERN_MAX_THREADS
,
551 .procname
= "threads-max",
552 .data
= &max_threads
,
553 .maxlen
= sizeof(int),
555 .proc_handler
= &proc_dointvec
,
558 .ctl_name
= KERN_RANDOM
,
559 .procname
= "random",
561 .child
= random_table
,
563 #ifdef CONFIG_UNIX98_PTYS
565 .ctl_name
= KERN_PTY
,
572 .ctl_name
= KERN_OVERFLOWUID
,
573 .procname
= "overflowuid",
574 .data
= &overflowuid
,
575 .maxlen
= sizeof(int),
577 .proc_handler
= &proc_dointvec_minmax
,
578 .strategy
= &sysctl_intvec
,
579 .extra1
= &minolduid
,
580 .extra2
= &maxolduid
,
583 .ctl_name
= KERN_OVERFLOWGID
,
584 .procname
= "overflowgid",
585 .data
= &overflowgid
,
586 .maxlen
= sizeof(int),
588 .proc_handler
= &proc_dointvec_minmax
,
589 .strategy
= &sysctl_intvec
,
590 .extra1
= &minolduid
,
591 .extra2
= &maxolduid
,
594 #ifdef CONFIG_MATHEMU
596 .ctl_name
= KERN_IEEE_EMULATION_WARNINGS
,
597 .procname
= "ieee_emulation_warnings",
598 .data
= &sysctl_ieee_emulation_warnings
,
599 .maxlen
= sizeof(int),
601 .proc_handler
= &proc_dointvec
,
604 #ifdef CONFIG_NO_IDLE_HZ
606 .ctl_name
= KERN_HZ_TIMER
,
607 .procname
= "hz_timer",
608 .data
= &sysctl_hz_timer
,
609 .maxlen
= sizeof(int),
611 .proc_handler
= &proc_dointvec
,
615 .ctl_name
= KERN_S390_USER_DEBUG_LOGGING
,
616 .procname
= "userprocess_debug",
617 .data
= &sysctl_userprocess_debug
,
618 .maxlen
= sizeof(int),
620 .proc_handler
= &proc_dointvec
,
624 .ctl_name
= KERN_PIDMAX
,
625 .procname
= "pid_max",
627 .maxlen
= sizeof (int),
629 .proc_handler
= &proc_dointvec_minmax
,
630 .strategy
= sysctl_intvec
,
631 .extra1
= &pid_max_min
,
632 .extra2
= &pid_max_max
,
635 .ctl_name
= KERN_PANIC_ON_OOPS
,
636 .procname
= "panic_on_oops",
637 .data
= &panic_on_oops
,
638 .maxlen
= sizeof(int),
640 .proc_handler
= &proc_dointvec
,
643 .ctl_name
= KERN_PRINTK_RATELIMIT
,
644 .procname
= "printk_ratelimit",
645 .data
= &printk_ratelimit_jiffies
,
646 .maxlen
= sizeof(int),
648 .proc_handler
= &proc_dointvec_jiffies
,
649 .strategy
= &sysctl_jiffies
,
652 .ctl_name
= KERN_PRINTK_RATELIMIT_BURST
,
653 .procname
= "printk_ratelimit_burst",
654 .data
= &printk_ratelimit_burst
,
655 .maxlen
= sizeof(int),
657 .proc_handler
= &proc_dointvec
,
660 .ctl_name
= KERN_NGROUPS_MAX
,
661 .procname
= "ngroups_max",
662 .data
= &ngroups_max
,
663 .maxlen
= sizeof (int),
665 .proc_handler
= &proc_dointvec
,
667 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
669 .ctl_name
= KERN_UNKNOWN_NMI_PANIC
,
670 .procname
= "unknown_nmi_panic",
671 .data
= &unknown_nmi_panic
,
672 .maxlen
= sizeof (int),
674 .proc_handler
= &proc_dointvec
,
677 .ctl_name
= KERN_NMI_WATCHDOG
,
678 .procname
= "nmi_watchdog",
679 .data
= &nmi_watchdog_enabled
,
680 .maxlen
= sizeof (int),
682 .proc_handler
= &proc_nmi_enabled
,
685 #if defined(CONFIG_X86)
687 .ctl_name
= KERN_PANIC_ON_NMI
,
688 .procname
= "panic_on_unrecovered_nmi",
689 .data
= &panic_on_unrecovered_nmi
,
690 .maxlen
= sizeof(int),
692 .proc_handler
= &proc_dointvec
,
695 .ctl_name
= KERN_BOOTLOADER_TYPE
,
696 .procname
= "bootloader_type",
697 .data
= &bootloader_type
,
698 .maxlen
= sizeof (int),
700 .proc_handler
= &proc_dointvec
,
703 .ctl_name
= CTL_UNNUMBERED
,
704 .procname
= "kstack_depth_to_print",
705 .data
= &kstack_depth_to_print
,
706 .maxlen
= sizeof(int),
708 .proc_handler
= &proc_dointvec
,
711 #if defined(CONFIG_MMU)
713 .ctl_name
= KERN_RANDOMIZE
,
714 .procname
= "randomize_va_space",
715 .data
= &randomize_va_space
,
716 .maxlen
= sizeof(int),
718 .proc_handler
= &proc_dointvec
,
721 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
723 .ctl_name
= KERN_SPIN_RETRY
,
724 .procname
= "spin_retry",
726 .maxlen
= sizeof (int),
728 .proc_handler
= &proc_dointvec
,
731 #ifdef CONFIG_ACPI_SLEEP
733 .ctl_name
= KERN_ACPI_VIDEO_FLAGS
,
734 .procname
= "acpi_video_flags",
735 .data
= &acpi_video_flags
,
736 .maxlen
= sizeof (unsigned long),
738 .proc_handler
= &proc_doulongvec_minmax
,
743 .ctl_name
= KERN_IA64_UNALIGNED
,
744 .procname
= "ignore-unaligned-usertrap",
745 .data
= &no_unaligned_warning
,
746 .maxlen
= sizeof (int),
748 .proc_handler
= &proc_dointvec
,
753 .ctl_name
= KERN_COMPAT_LOG
,
754 .procname
= "compat-log",
756 .maxlen
= sizeof (int),
758 .proc_handler
= &proc_dointvec
,
761 #ifdef CONFIG_RT_MUTEXES
763 .ctl_name
= KERN_MAX_LOCK_DEPTH
,
764 .procname
= "max_lock_depth",
765 .data
= &max_lock_depth
,
766 .maxlen
= sizeof(int),
768 .proc_handler
= &proc_dointvec
,
775 /* Constants for minimum and maximum testing in vm_table.
776 We use these as one-element integer vectors. */
778 static int one_hundred
= 100;
781 static ctl_table vm_table
[] = {
783 .ctl_name
= VM_OVERCOMMIT_MEMORY
,
784 .procname
= "overcommit_memory",
785 .data
= &sysctl_overcommit_memory
,
786 .maxlen
= sizeof(sysctl_overcommit_memory
),
788 .proc_handler
= &proc_dointvec
,
791 .ctl_name
= VM_PANIC_ON_OOM
,
792 .procname
= "panic_on_oom",
793 .data
= &sysctl_panic_on_oom
,
794 .maxlen
= sizeof(sysctl_panic_on_oom
),
796 .proc_handler
= &proc_dointvec
,
799 .ctl_name
= VM_OVERCOMMIT_RATIO
,
800 .procname
= "overcommit_ratio",
801 .data
= &sysctl_overcommit_ratio
,
802 .maxlen
= sizeof(sysctl_overcommit_ratio
),
804 .proc_handler
= &proc_dointvec
,
807 .ctl_name
= VM_PAGE_CLUSTER
,
808 .procname
= "page-cluster",
809 .data
= &page_cluster
,
810 .maxlen
= sizeof(int),
812 .proc_handler
= &proc_dointvec
,
815 .ctl_name
= VM_DIRTY_BACKGROUND
,
816 .procname
= "dirty_background_ratio",
817 .data
= &dirty_background_ratio
,
818 .maxlen
= sizeof(dirty_background_ratio
),
820 .proc_handler
= &proc_dointvec_minmax
,
821 .strategy
= &sysctl_intvec
,
823 .extra2
= &one_hundred
,
826 .ctl_name
= VM_DIRTY_RATIO
,
827 .procname
= "dirty_ratio",
828 .data
= &vm_dirty_ratio
,
829 .maxlen
= sizeof(vm_dirty_ratio
),
831 .proc_handler
= &proc_dointvec_minmax
,
832 .strategy
= &sysctl_intvec
,
834 .extra2
= &one_hundred
,
837 .ctl_name
= VM_DIRTY_WB_CS
,
838 .procname
= "dirty_writeback_centisecs",
839 .data
= &dirty_writeback_interval
,
840 .maxlen
= sizeof(dirty_writeback_interval
),
842 .proc_handler
= &dirty_writeback_centisecs_handler
,
845 .ctl_name
= VM_DIRTY_EXPIRE_CS
,
846 .procname
= "dirty_expire_centisecs",
847 .data
= &dirty_expire_interval
,
848 .maxlen
= sizeof(dirty_expire_interval
),
850 .proc_handler
= &proc_dointvec_userhz_jiffies
,
853 .ctl_name
= VM_NR_PDFLUSH_THREADS
,
854 .procname
= "nr_pdflush_threads",
855 .data
= &nr_pdflush_threads
,
856 .maxlen
= sizeof nr_pdflush_threads
,
857 .mode
= 0444 /* read-only*/,
858 .proc_handler
= &proc_dointvec
,
861 .ctl_name
= VM_SWAPPINESS
,
862 .procname
= "swappiness",
863 .data
= &vm_swappiness
,
864 .maxlen
= sizeof(vm_swappiness
),
866 .proc_handler
= &proc_dointvec_minmax
,
867 .strategy
= &sysctl_intvec
,
869 .extra2
= &one_hundred
,
871 #ifdef CONFIG_HUGETLB_PAGE
873 .ctl_name
= VM_HUGETLB_PAGES
,
874 .procname
= "nr_hugepages",
875 .data
= &max_huge_pages
,
876 .maxlen
= sizeof(unsigned long),
878 .proc_handler
= &hugetlb_sysctl_handler
,
879 .extra1
= (void *)&hugetlb_zero
,
880 .extra2
= (void *)&hugetlb_infinity
,
883 .ctl_name
= VM_HUGETLB_GROUP
,
884 .procname
= "hugetlb_shm_group",
885 .data
= &sysctl_hugetlb_shm_group
,
886 .maxlen
= sizeof(gid_t
),
888 .proc_handler
= &proc_dointvec
,
892 .ctl_name
= VM_LOWMEM_RESERVE_RATIO
,
893 .procname
= "lowmem_reserve_ratio",
894 .data
= &sysctl_lowmem_reserve_ratio
,
895 .maxlen
= sizeof(sysctl_lowmem_reserve_ratio
),
897 .proc_handler
= &lowmem_reserve_ratio_sysctl_handler
,
898 .strategy
= &sysctl_intvec
,
901 .ctl_name
= VM_DROP_PAGECACHE
,
902 .procname
= "drop_caches",
903 .data
= &sysctl_drop_caches
,
904 .maxlen
= sizeof(int),
906 .proc_handler
= drop_caches_sysctl_handler
,
907 .strategy
= &sysctl_intvec
,
910 .ctl_name
= VM_MIN_FREE_KBYTES
,
911 .procname
= "min_free_kbytes",
912 .data
= &min_free_kbytes
,
913 .maxlen
= sizeof(min_free_kbytes
),
915 .proc_handler
= &min_free_kbytes_sysctl_handler
,
916 .strategy
= &sysctl_intvec
,
920 .ctl_name
= VM_PERCPU_PAGELIST_FRACTION
,
921 .procname
= "percpu_pagelist_fraction",
922 .data
= &percpu_pagelist_fraction
,
923 .maxlen
= sizeof(percpu_pagelist_fraction
),
925 .proc_handler
= &percpu_pagelist_fraction_sysctl_handler
,
926 .strategy
= &sysctl_intvec
,
927 .extra1
= &min_percpu_pagelist_fract
,
931 .ctl_name
= VM_MAX_MAP_COUNT
,
932 .procname
= "max_map_count",
933 .data
= &sysctl_max_map_count
,
934 .maxlen
= sizeof(sysctl_max_map_count
),
936 .proc_handler
= &proc_dointvec
940 .ctl_name
= VM_LAPTOP_MODE
,
941 .procname
= "laptop_mode",
942 .data
= &laptop_mode
,
943 .maxlen
= sizeof(laptop_mode
),
945 .proc_handler
= &proc_dointvec_jiffies
,
946 .strategy
= &sysctl_jiffies
,
949 .ctl_name
= VM_BLOCK_DUMP
,
950 .procname
= "block_dump",
952 .maxlen
= sizeof(block_dump
),
954 .proc_handler
= &proc_dointvec
,
955 .strategy
= &sysctl_intvec
,
959 .ctl_name
= VM_VFS_CACHE_PRESSURE
,
960 .procname
= "vfs_cache_pressure",
961 .data
= &sysctl_vfs_cache_pressure
,
962 .maxlen
= sizeof(sysctl_vfs_cache_pressure
),
964 .proc_handler
= &proc_dointvec
,
965 .strategy
= &sysctl_intvec
,
968 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
970 .ctl_name
= VM_LEGACY_VA_LAYOUT
,
971 .procname
= "legacy_va_layout",
972 .data
= &sysctl_legacy_va_layout
,
973 .maxlen
= sizeof(sysctl_legacy_va_layout
),
975 .proc_handler
= &proc_dointvec
,
976 .strategy
= &sysctl_intvec
,
982 .ctl_name
= VM_ZONE_RECLAIM_MODE
,
983 .procname
= "zone_reclaim_mode",
984 .data
= &zone_reclaim_mode
,
985 .maxlen
= sizeof(zone_reclaim_mode
),
987 .proc_handler
= &proc_dointvec
,
988 .strategy
= &sysctl_intvec
,
992 .ctl_name
= VM_MIN_UNMAPPED
,
993 .procname
= "min_unmapped_ratio",
994 .data
= &sysctl_min_unmapped_ratio
,
995 .maxlen
= sizeof(sysctl_min_unmapped_ratio
),
997 .proc_handler
= &sysctl_min_unmapped_ratio_sysctl_handler
,
998 .strategy
= &sysctl_intvec
,
1000 .extra2
= &one_hundred
,
1003 .ctl_name
= VM_MIN_SLAB
,
1004 .procname
= "min_slab_ratio",
1005 .data
= &sysctl_min_slab_ratio
,
1006 .maxlen
= sizeof(sysctl_min_slab_ratio
),
1008 .proc_handler
= &sysctl_min_slab_ratio_sysctl_handler
,
1009 .strategy
= &sysctl_intvec
,
1011 .extra2
= &one_hundred
,
1014 #ifdef CONFIG_X86_32
1016 .ctl_name
= VM_VDSO_ENABLED
,
1017 .procname
= "vdso_enabled",
1018 .data
= &vdso_enabled
,
1019 .maxlen
= sizeof(vdso_enabled
),
1021 .proc_handler
= &proc_dointvec
,
1022 .strategy
= &sysctl_intvec
,
1029 static ctl_table fs_table
[] = {
1031 .ctl_name
= FS_NRINODE
,
1032 .procname
= "inode-nr",
1033 .data
= &inodes_stat
,
1034 .maxlen
= 2*sizeof(int),
1036 .proc_handler
= &proc_dointvec
,
1039 .ctl_name
= FS_STATINODE
,
1040 .procname
= "inode-state",
1041 .data
= &inodes_stat
,
1042 .maxlen
= 7*sizeof(int),
1044 .proc_handler
= &proc_dointvec
,
1047 .ctl_name
= FS_NRFILE
,
1048 .procname
= "file-nr",
1049 .data
= &files_stat
,
1050 .maxlen
= 3*sizeof(int),
1052 .proc_handler
= &proc_nr_files
,
1055 .ctl_name
= FS_MAXFILE
,
1056 .procname
= "file-max",
1057 .data
= &files_stat
.max_files
,
1058 .maxlen
= sizeof(int),
1060 .proc_handler
= &proc_dointvec
,
1063 .ctl_name
= FS_DENTRY
,
1064 .procname
= "dentry-state",
1065 .data
= &dentry_stat
,
1066 .maxlen
= 6*sizeof(int),
1068 .proc_handler
= &proc_dointvec
,
1071 .ctl_name
= FS_OVERFLOWUID
,
1072 .procname
= "overflowuid",
1073 .data
= &fs_overflowuid
,
1074 .maxlen
= sizeof(int),
1076 .proc_handler
= &proc_dointvec_minmax
,
1077 .strategy
= &sysctl_intvec
,
1078 .extra1
= &minolduid
,
1079 .extra2
= &maxolduid
,
1082 .ctl_name
= FS_OVERFLOWGID
,
1083 .procname
= "overflowgid",
1084 .data
= &fs_overflowgid
,
1085 .maxlen
= sizeof(int),
1087 .proc_handler
= &proc_dointvec_minmax
,
1088 .strategy
= &sysctl_intvec
,
1089 .extra1
= &minolduid
,
1090 .extra2
= &maxolduid
,
1093 .ctl_name
= FS_LEASES
,
1094 .procname
= "leases-enable",
1095 .data
= &leases_enable
,
1096 .maxlen
= sizeof(int),
1098 .proc_handler
= &proc_dointvec
,
1100 #ifdef CONFIG_DNOTIFY
1102 .ctl_name
= FS_DIR_NOTIFY
,
1103 .procname
= "dir-notify-enable",
1104 .data
= &dir_notify_enable
,
1105 .maxlen
= sizeof(int),
1107 .proc_handler
= &proc_dointvec
,
1112 .ctl_name
= FS_LEASE_TIME
,
1113 .procname
= "lease-break-time",
1114 .data
= &lease_break_time
,
1115 .maxlen
= sizeof(int),
1117 .proc_handler
= &proc_dointvec
,
1120 .ctl_name
= FS_AIO_NR
,
1121 .procname
= "aio-nr",
1123 .maxlen
= sizeof(aio_nr
),
1125 .proc_handler
= &proc_doulongvec_minmax
,
1128 .ctl_name
= FS_AIO_MAX_NR
,
1129 .procname
= "aio-max-nr",
1130 .data
= &aio_max_nr
,
1131 .maxlen
= sizeof(aio_max_nr
),
1133 .proc_handler
= &proc_doulongvec_minmax
,
1135 #ifdef CONFIG_INOTIFY_USER
1137 .ctl_name
= FS_INOTIFY
,
1138 .procname
= "inotify",
1140 .child
= inotify_table
,
1145 .ctl_name
= KERN_SETUID_DUMPABLE
,
1146 .procname
= "suid_dumpable",
1147 .data
= &suid_dumpable
,
1148 .maxlen
= sizeof(int),
1150 .proc_handler
= &proc_dointvec
,
1155 static ctl_table debug_table
[] = {
1159 static ctl_table dev_table
[] = {
1163 extern void init_irq_proc (void);
1165 static DEFINE_SPINLOCK(sysctl_lock
);
1167 /* called under sysctl_lock */
1168 static int use_table(struct ctl_table_header
*p
)
1170 if (unlikely(p
->unregistering
))
1176 /* called under sysctl_lock */
1177 static void unuse_table(struct ctl_table_header
*p
)
1180 if (unlikely(p
->unregistering
))
1181 complete(p
->unregistering
);
1184 /* called under sysctl_lock, will reacquire if has to wait */
1185 static void start_unregistering(struct ctl_table_header
*p
)
1188 * if p->used is 0, nobody will ever touch that entry again;
1189 * we'll eliminate all paths to it before dropping sysctl_lock
1191 if (unlikely(p
->used
)) {
1192 struct completion wait
;
1193 init_completion(&wait
);
1194 p
->unregistering
= &wait
;
1195 spin_unlock(&sysctl_lock
);
1196 wait_for_completion(&wait
);
1197 spin_lock(&sysctl_lock
);
1200 * do not remove from the list until nobody holds it; walking the
1201 * list in do_sysctl() relies on that.
1203 list_del_init(&p
->ctl_entry
);
1206 void __init
sysctl_init(void)
1208 #ifdef CONFIG_PROC_SYSCTL
1209 register_proc_table(root_table
, proc_sys_root
, &root_table_header
);
1214 #ifdef CONFIG_SYSCTL_SYSCALL
1215 int do_sysctl(int __user
*name
, int nlen
, void __user
*oldval
, size_t __user
*oldlenp
,
1216 void __user
*newval
, size_t newlen
)
1218 struct list_head
*tmp
;
1219 int error
= -ENOTDIR
;
1221 if (nlen
<= 0 || nlen
>= CTL_MAXNAME
)
1225 if (!oldlenp
|| get_user(old_len
, oldlenp
))
1228 spin_lock(&sysctl_lock
);
1229 tmp
= &root_table_header
.ctl_entry
;
1231 struct ctl_table_header
*head
=
1232 list_entry(tmp
, struct ctl_table_header
, ctl_entry
);
1233 void *context
= NULL
;
1235 if (!use_table(head
))
1238 spin_unlock(&sysctl_lock
);
1240 error
= parse_table(name
, nlen
, oldval
, oldlenp
,
1241 newval
, newlen
, head
->ctl_table
,
1245 spin_lock(&sysctl_lock
);
1247 if (error
!= -ENOTDIR
)
1249 } while ((tmp
= tmp
->next
) != &root_table_header
.ctl_entry
);
1250 spin_unlock(&sysctl_lock
);
1254 asmlinkage
long sys_sysctl(struct __sysctl_args __user
*args
)
1256 struct __sysctl_args tmp
;
1259 if (copy_from_user(&tmp
, args
, sizeof(tmp
)))
1263 error
= do_sysctl(tmp
.name
, tmp
.nlen
, tmp
.oldval
, tmp
.oldlenp
,
1264 tmp
.newval
, tmp
.newlen
);
1268 #endif /* CONFIG_SYSCTL_SYSCALL */
1271 * ctl_perm does NOT grant the superuser all rights automatically, because
1272 * some sysctl variables are readonly even to root.
1275 static int test_perm(int mode
, int op
)
1279 else if (in_egroup_p(0))
1281 if ((mode
& op
& 0007) == op
)
1286 static inline int ctl_perm(ctl_table
*table
, int op
)
1289 error
= security_sysctl(table
, op
);
1292 return test_perm(table
->mode
, op
);
1295 #ifdef CONFIG_SYSCTL_SYSCALL
1296 static int parse_table(int __user
*name
, int nlen
,
1297 void __user
*oldval
, size_t __user
*oldlenp
,
1298 void __user
*newval
, size_t newlen
,
1299 ctl_table
*table
, void **context
)
1305 if (get_user(n
, name
))
1307 for ( ; table
->ctl_name
|| table
->procname
; table
++) {
1308 if (!table
->ctl_name
)
1310 if (n
== table
->ctl_name
|| table
->ctl_name
== CTL_ANY
) {
1313 if (ctl_perm(table
, 001))
1315 if (table
->strategy
) {
1316 error
= table
->strategy(
1319 newval
, newlen
, context
);
1325 table
= table
->child
;
1328 error
= do_sysctl_strategy(table
, name
, nlen
,
1330 newval
, newlen
, context
);
1337 /* Perform the actual read/write of a sysctl table entry. */
1338 int do_sysctl_strategy (ctl_table
*table
,
1339 int __user
*name
, int nlen
,
1340 void __user
*oldval
, size_t __user
*oldlenp
,
1341 void __user
*newval
, size_t newlen
, void **context
)
1350 if (ctl_perm(table
, op
))
1353 if (table
->strategy
) {
1354 rc
= table
->strategy(table
, name
, nlen
, oldval
, oldlenp
,
1355 newval
, newlen
, context
);
1362 /* If there is no strategy routine, or if the strategy returns
1363 * zero, proceed with automatic r/w */
1364 if (table
->data
&& table
->maxlen
) {
1365 if (oldval
&& oldlenp
) {
1366 if (get_user(len
, oldlenp
))
1369 if (len
> table
->maxlen
)
1370 len
= table
->maxlen
;
1371 if(copy_to_user(oldval
, table
->data
, len
))
1373 if(put_user(len
, oldlenp
))
1377 if (newval
&& newlen
) {
1379 if (len
> table
->maxlen
)
1380 len
= table
->maxlen
;
1381 if(copy_from_user(table
->data
, newval
, len
))
1387 #endif /* CONFIG_SYSCTL_SYSCALL */
1390 * register_sysctl_table - register a sysctl hierarchy
1391 * @table: the top-level table structure
1392 * @insert_at_head: whether the entry should be inserted in front or at the end
1394 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1395 * array. An entry with a ctl_name of 0 terminates the table.
1397 * The members of the &ctl_table structure are used as follows:
1399 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1400 * must be unique within that level of sysctl
1402 * procname - the name of the sysctl file under /proc/sys. Set to %NULL to not
1403 * enter a sysctl file
1405 * data - a pointer to data for use by proc_handler
1407 * maxlen - the maximum size in bytes of the data
1409 * mode - the file permissions for the /proc/sys file, and for sysctl(2)
1411 * child - a pointer to the child sysctl table if this entry is a directory, or
1414 * proc_handler - the text handler routine (described below)
1416 * strategy - the strategy routine (described below)
1418 * de - for internal use by the sysctl routines
1420 * extra1, extra2 - extra pointers usable by the proc handler routines
1422 * Leaf nodes in the sysctl tree will be represented by a single file
1423 * under /proc; non-leaf nodes will be represented by directories.
1425 * sysctl(2) can automatically manage read and write requests through
1426 * the sysctl table. The data and maxlen fields of the ctl_table
1427 * struct enable minimal validation of the values being written to be
1428 * performed, and the mode field allows minimal authentication.
1430 * More sophisticated management can be enabled by the provision of a
1431 * strategy routine with the table entry. This will be called before
1432 * any automatic read or write of the data is performed.
1434 * The strategy routine may return
1436 * < 0 - Error occurred (error is passed to user process)
1438 * 0 - OK - proceed with automatic read or write.
1440 * > 0 - OK - read or write has been done by the strategy routine, so
1441 * return immediately.
1443 * There must be a proc_handler routine for any terminal nodes
1444 * mirrored under /proc/sys (non-terminals are handled by a built-in
1445 * directory handler). Several default handlers are available to
1446 * cover common cases -
1448 * proc_dostring(), proc_dointvec(), proc_dointvec_jiffies(),
1449 * proc_dointvec_userhz_jiffies(), proc_dointvec_minmax(),
1450 * proc_doulongvec_ms_jiffies_minmax(), proc_doulongvec_minmax()
1452 * It is the handler's job to read the input buffer from user memory
1453 * and process it. The handler should return 0 on success.
1455 * This routine returns %NULL on a failure to register, and a pointer
1456 * to the table header on success.
1458 struct ctl_table_header
*register_sysctl_table(ctl_table
* table
,
1461 struct ctl_table_header
*tmp
;
1462 tmp
= kmalloc(sizeof(struct ctl_table_header
), GFP_KERNEL
);
1465 tmp
->ctl_table
= table
;
1466 INIT_LIST_HEAD(&tmp
->ctl_entry
);
1468 tmp
->unregistering
= NULL
;
1469 spin_lock(&sysctl_lock
);
1471 list_add(&tmp
->ctl_entry
, &root_table_header
.ctl_entry
);
1473 list_add_tail(&tmp
->ctl_entry
, &root_table_header
.ctl_entry
);
1474 spin_unlock(&sysctl_lock
);
1475 #ifdef CONFIG_PROC_SYSCTL
1476 register_proc_table(table
, proc_sys_root
, tmp
);
1482 * unregister_sysctl_table - unregister a sysctl table hierarchy
1483 * @header: the header returned from register_sysctl_table
1485 * Unregisters the sysctl table and all children. proc entries may not
1486 * actually be removed until they are no longer used by anyone.
1488 void unregister_sysctl_table(struct ctl_table_header
* header
)
1491 spin_lock(&sysctl_lock
);
1492 start_unregistering(header
);
1493 #ifdef CONFIG_PROC_SYSCTL
1494 unregister_proc_table(header
->ctl_table
, proc_sys_root
);
1496 spin_unlock(&sysctl_lock
);
1500 #else /* !CONFIG_SYSCTL */
1501 struct ctl_table_header
* register_sysctl_table(ctl_table
* table
,
1507 void unregister_sysctl_table(struct ctl_table_header
* table
)
1511 #endif /* CONFIG_SYSCTL */
1517 #ifdef CONFIG_PROC_SYSCTL
1519 /* Scan the sysctl entries in table and add them all into /proc */
1520 static void register_proc_table(ctl_table
* table
, struct proc_dir_entry
*root
, void *set
)
1522 struct proc_dir_entry
*de
;
1526 for (; table
->ctl_name
|| table
->procname
; table
++) {
1527 /* Can't do anything without a proc name. */
1528 if (!table
->procname
)
1530 /* Maybe we can't do anything with it... */
1531 if (!table
->proc_handler
&& !table
->child
) {
1532 printk(KERN_WARNING
"SYSCTL: Can't register %s\n",
1537 len
= strlen(table
->procname
);
1541 if (table
->proc_handler
)
1545 for (de
= root
->subdir
; de
; de
= de
->next
) {
1546 if (proc_match(len
, table
->procname
, de
))
1549 /* If the subdir exists already, de is non-NULL */
1553 de
= create_proc_entry(table
->procname
, mode
, root
);
1557 de
->data
= (void *) table
;
1558 if (table
->proc_handler
)
1559 de
->proc_fops
= &proc_sys_file_operations
;
1562 if (de
->mode
& S_IFDIR
)
1563 register_proc_table(table
->child
, de
, set
);
1568 * Unregister a /proc sysctl table and any subdirectories.
1570 static void unregister_proc_table(ctl_table
* table
, struct proc_dir_entry
*root
)
1572 struct proc_dir_entry
*de
;
1573 for (; table
->ctl_name
|| table
->procname
; table
++) {
1574 if (!(de
= table
->de
))
1576 if (de
->mode
& S_IFDIR
) {
1577 if (!table
->child
) {
1578 printk (KERN_ALERT
"Help - malformed sysctl tree on free\n");
1581 unregister_proc_table(table
->child
, de
);
1583 /* Don't unregister directories which still have entries.. */
1589 * In any case, mark the entry as goner; we'll keep it
1590 * around if it's busy, but we'll know to do nothing with
1591 * its fields. We are under sysctl_lock here.
1595 /* Don't unregister proc entries that are still being used.. */
1596 if (atomic_read(&de
->count
))
1600 remove_proc_entry(table
->procname
, root
);
1604 static ssize_t
do_rw_proc(int write
, struct file
* file
, char __user
* buf
,
1605 size_t count
, loff_t
*ppos
)
1608 struct proc_dir_entry
*de
= PDE(file
->f_path
.dentry
->d_inode
);
1609 struct ctl_table
*table
;
1611 ssize_t error
= -ENOTDIR
;
1613 spin_lock(&sysctl_lock
);
1614 if (de
&& de
->data
&& use_table(de
->set
)) {
1616 * at that point we know that sysctl was not unregistered
1617 * and won't be until we finish
1619 spin_unlock(&sysctl_lock
);
1620 table
= (struct ctl_table
*) de
->data
;
1621 if (!table
|| !table
->proc_handler
)
1624 op
= (write
? 002 : 004);
1625 if (ctl_perm(table
, op
))
1628 /* careful: calling conventions are nasty here */
1630 error
= (*table
->proc_handler
)(table
, write
, file
,
1635 spin_lock(&sysctl_lock
);
1636 unuse_table(de
->set
);
1638 spin_unlock(&sysctl_lock
);
1642 static int proc_opensys(struct inode
*inode
, struct file
*file
)
1644 if (file
->f_mode
& FMODE_WRITE
) {
1646 * sysctl entries that are not writable,
1647 * are _NOT_ writable, capabilities or not.
1649 if (!(inode
->i_mode
& S_IWUSR
))
1656 static ssize_t
proc_readsys(struct file
* file
, char __user
* buf
,
1657 size_t count
, loff_t
*ppos
)
1659 return do_rw_proc(0, file
, buf
, count
, ppos
);
1662 static ssize_t
proc_writesys(struct file
* file
, const char __user
* buf
,
1663 size_t count
, loff_t
*ppos
)
1665 return do_rw_proc(1, file
, (char __user
*) buf
, count
, ppos
);
1668 static int _proc_do_string(void* data
, int maxlen
, int write
,
1669 struct file
*filp
, void __user
*buffer
,
1670 size_t *lenp
, loff_t
*ppos
)
1676 if (!data
|| !maxlen
|| !*lenp
||
1677 (*ppos
&& !write
)) {
1685 while (len
< *lenp
) {
1686 if (get_user(c
, p
++))
1688 if (c
== 0 || c
== '\n')
1694 if(copy_from_user(data
, buffer
, len
))
1696 ((char *) data
)[len
] = 0;
1705 if(copy_to_user(buffer
, data
, len
))
1708 if(put_user('\n', ((char __user
*) buffer
) + len
))
1719 * proc_dostring - read a string sysctl
1720 * @table: the sysctl table
1721 * @write: %TRUE if this is a write to the sysctl file
1722 * @filp: the file structure
1723 * @buffer: the user buffer
1724 * @lenp: the size of the user buffer
1725 * @ppos: file position
1727 * Reads/writes a string from/to the user buffer. If the kernel
1728 * buffer provided is not large enough to hold the string, the
1729 * string is truncated. The copied string is %NULL-terminated.
1730 * If the string is being read by the user process, it is copied
1731 * and a newline '\n' is added. It is truncated if the buffer is
1734 * Returns 0 on success.
1736 int proc_dostring(ctl_table
*table
, int write
, struct file
*filp
,
1737 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1739 return _proc_do_string(table
->data
, table
->maxlen
, write
, filp
,
1740 buffer
, lenp
, ppos
);
1744 * Special case of dostring for the UTS structure. This has locks
1745 * to observe. Should this be in kernel/sys.c ????
1748 static int proc_do_uts_string(ctl_table
*table
, int write
, struct file
*filp
,
1749 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1753 which
= get_uts(table
, write
);
1754 r
= _proc_do_string(which
, table
->maxlen
,write
,filp
,buffer
,lenp
, ppos
);
1755 put_uts(table
, write
, which
);
1759 static int do_proc_dointvec_conv(int *negp
, unsigned long *lvalp
,
1761 int write
, void *data
)
1764 *valp
= *negp
? -*lvalp
: *lvalp
;
1769 *lvalp
= (unsigned long)-val
;
1772 *lvalp
= (unsigned long)val
;
1778 static int __do_proc_dointvec(void *tbl_data
, ctl_table
*table
,
1779 int write
, struct file
*filp
, void __user
*buffer
,
1780 size_t *lenp
, loff_t
*ppos
,
1781 int (*conv
)(int *negp
, unsigned long *lvalp
, int *valp
,
1782 int write
, void *data
),
1785 #define TMPBUFLEN 21
1786 int *i
, vleft
, first
=1, neg
, val
;
1790 char buf
[TMPBUFLEN
], *p
;
1791 char __user
*s
= buffer
;
1793 if (!tbl_data
|| !table
->maxlen
|| !*lenp
||
1794 (*ppos
&& !write
)) {
1799 i
= (int *) tbl_data
;
1800 vleft
= table
->maxlen
/ sizeof(*i
);
1804 conv
= do_proc_dointvec_conv
;
1806 for (; left
&& vleft
--; i
++, first
=0) {
1821 if (len
> sizeof(buf
) - 1)
1822 len
= sizeof(buf
) - 1;
1823 if (copy_from_user(buf
, s
, len
))
1827 if (*p
== '-' && left
> 1) {
1831 if (*p
< '0' || *p
> '9')
1834 lval
= simple_strtoul(p
, &p
, 0);
1837 if ((len
< left
) && *p
&& !isspace(*p
))
1844 if (conv(&neg
, &lval
, i
, 1, data
))
1851 if (conv(&neg
, &lval
, i
, 0, data
))
1854 sprintf(p
, "%s%lu", neg
? "-" : "", lval
);
1858 if(copy_to_user(s
, buf
, len
))
1865 if (!write
&& !first
&& left
) {
1866 if(put_user('\n', s
))
1873 if (get_user(c
, s
++))
1888 static int do_proc_dointvec(ctl_table
*table
, int write
, struct file
*filp
,
1889 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
,
1890 int (*conv
)(int *negp
, unsigned long *lvalp
, int *valp
,
1891 int write
, void *data
),
1894 return __do_proc_dointvec(table
->data
, table
, write
, filp
,
1895 buffer
, lenp
, ppos
, conv
, data
);
1899 * proc_dointvec - read a vector of integers
1900 * @table: the sysctl table
1901 * @write: %TRUE if this is a write to the sysctl file
1902 * @filp: the file structure
1903 * @buffer: the user buffer
1904 * @lenp: the size of the user buffer
1905 * @ppos: file position
1907 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1908 * values from/to the user buffer, treated as an ASCII string.
1910 * Returns 0 on success.
1912 int proc_dointvec(ctl_table
*table
, int write
, struct file
*filp
,
1913 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1915 return do_proc_dointvec(table
,write
,filp
,buffer
,lenp
,ppos
,
1925 static int do_proc_dointvec_bset_conv(int *negp
, unsigned long *lvalp
,
1927 int write
, void *data
)
1929 int op
= *(int *)data
;
1931 int val
= *negp
? -*lvalp
: *lvalp
;
1933 case OP_SET
: *valp
= val
; break;
1934 case OP_AND
: *valp
&= val
; break;
1935 case OP_OR
: *valp
|= val
; break;
1936 case OP_MAX
: if(*valp
< val
)
1939 case OP_MIN
: if(*valp
> val
)
1947 *lvalp
= (unsigned long)-val
;
1950 *lvalp
= (unsigned long)val
;
1957 * init may raise the set.
1960 int proc_dointvec_bset(ctl_table
*table
, int write
, struct file
*filp
,
1961 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1965 if (!capable(CAP_SYS_MODULE
)) {
1969 op
= is_init(current
) ? OP_SET
: OP_AND
;
1970 return do_proc_dointvec(table
,write
,filp
,buffer
,lenp
,ppos
,
1971 do_proc_dointvec_bset_conv
,&op
);
1974 struct do_proc_dointvec_minmax_conv_param
{
1979 static int do_proc_dointvec_minmax_conv(int *negp
, unsigned long *lvalp
,
1981 int write
, void *data
)
1983 struct do_proc_dointvec_minmax_conv_param
*param
= data
;
1985 int val
= *negp
? -*lvalp
: *lvalp
;
1986 if ((param
->min
&& *param
->min
> val
) ||
1987 (param
->max
&& *param
->max
< val
))
1994 *lvalp
= (unsigned long)-val
;
1997 *lvalp
= (unsigned long)val
;
2004 * proc_dointvec_minmax - read a vector of integers with min/max values
2005 * @table: the sysctl table
2006 * @write: %TRUE if this is a write to the sysctl file
2007 * @filp: the file structure
2008 * @buffer: the user buffer
2009 * @lenp: the size of the user buffer
2010 * @ppos: file position
2012 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2013 * values from/to the user buffer, treated as an ASCII string.
2015 * This routine will ensure the values are within the range specified by
2016 * table->extra1 (min) and table->extra2 (max).
2018 * Returns 0 on success.
2020 int proc_dointvec_minmax(ctl_table
*table
, int write
, struct file
*filp
,
2021 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2023 struct do_proc_dointvec_minmax_conv_param param
= {
2024 .min
= (int *) table
->extra1
,
2025 .max
= (int *) table
->extra2
,
2027 return do_proc_dointvec(table
, write
, filp
, buffer
, lenp
, ppos
,
2028 do_proc_dointvec_minmax_conv
, ¶m
);
2031 static int __do_proc_doulongvec_minmax(void *data
, ctl_table
*table
, int write
,
2033 void __user
*buffer
,
2034 size_t *lenp
, loff_t
*ppos
,
2035 unsigned long convmul
,
2036 unsigned long convdiv
)
2038 #define TMPBUFLEN 21
2039 unsigned long *i
, *min
, *max
, val
;
2040 int vleft
, first
=1, neg
;
2042 char buf
[TMPBUFLEN
], *p
;
2043 char __user
*s
= buffer
;
2045 if (!data
|| !table
->maxlen
|| !*lenp
||
2046 (*ppos
&& !write
)) {
2051 i
= (unsigned long *) data
;
2052 min
= (unsigned long *) table
->extra1
;
2053 max
= (unsigned long *) table
->extra2
;
2054 vleft
= table
->maxlen
/ sizeof(unsigned long);
2057 for (; left
&& vleft
--; i
++, min
++, max
++, first
=0) {
2072 if (len
> TMPBUFLEN
-1)
2074 if (copy_from_user(buf
, s
, len
))
2078 if (*p
== '-' && left
> 1) {
2082 if (*p
< '0' || *p
> '9')
2084 val
= simple_strtoul(p
, &p
, 0) * convmul
/ convdiv
;
2086 if ((len
< left
) && *p
&& !isspace(*p
))
2095 if ((min
&& val
< *min
) || (max
&& val
> *max
))
2102 sprintf(p
, "%lu", convdiv
* (*i
) / convmul
);
2106 if(copy_to_user(s
, buf
, len
))
2113 if (!write
&& !first
&& left
) {
2114 if(put_user('\n', s
))
2121 if (get_user(c
, s
++))
2136 static int do_proc_doulongvec_minmax(ctl_table
*table
, int write
,
2138 void __user
*buffer
,
2139 size_t *lenp
, loff_t
*ppos
,
2140 unsigned long convmul
,
2141 unsigned long convdiv
)
2143 return __do_proc_doulongvec_minmax(table
->data
, table
, write
,
2144 filp
, buffer
, lenp
, ppos
, convmul
, convdiv
);
2148 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2149 * @table: the sysctl table
2150 * @write: %TRUE if this is a write to the sysctl file
2151 * @filp: the file structure
2152 * @buffer: the user buffer
2153 * @lenp: the size of the user buffer
2154 * @ppos: file position
2156 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2157 * values from/to the user buffer, treated as an ASCII string.
2159 * This routine will ensure the values are within the range specified by
2160 * table->extra1 (min) and table->extra2 (max).
2162 * Returns 0 on success.
2164 int proc_doulongvec_minmax(ctl_table
*table
, int write
, struct file
*filp
,
2165 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2167 return do_proc_doulongvec_minmax(table
, write
, filp
, buffer
, lenp
, ppos
, 1l, 1l);
2171 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2172 * @table: the sysctl table
2173 * @write: %TRUE if this is a write to the sysctl file
2174 * @filp: the file structure
2175 * @buffer: the user buffer
2176 * @lenp: the size of the user buffer
2177 * @ppos: file position
2179 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2180 * values from/to the user buffer, treated as an ASCII string. The values
2181 * are treated as milliseconds, and converted to jiffies when they are stored.
2183 * This routine will ensure the values are within the range specified by
2184 * table->extra1 (min) and table->extra2 (max).
2186 * Returns 0 on success.
2188 int proc_doulongvec_ms_jiffies_minmax(ctl_table
*table
, int write
,
2190 void __user
*buffer
,
2191 size_t *lenp
, loff_t
*ppos
)
2193 return do_proc_doulongvec_minmax(table
, write
, filp
, buffer
,
2194 lenp
, ppos
, HZ
, 1000l);
2198 static int do_proc_dointvec_jiffies_conv(int *negp
, unsigned long *lvalp
,
2200 int write
, void *data
)
2203 if (*lvalp
> LONG_MAX
/ HZ
)
2205 *valp
= *negp
? -(*lvalp
*HZ
) : (*lvalp
*HZ
);
2211 lval
= (unsigned long)-val
;
2214 lval
= (unsigned long)val
;
2221 static int do_proc_dointvec_userhz_jiffies_conv(int *negp
, unsigned long *lvalp
,
2223 int write
, void *data
)
2226 if (USER_HZ
< HZ
&& *lvalp
> (LONG_MAX
/ HZ
) * USER_HZ
)
2228 *valp
= clock_t_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2234 lval
= (unsigned long)-val
;
2237 lval
= (unsigned long)val
;
2239 *lvalp
= jiffies_to_clock_t(lval
);
2244 static int do_proc_dointvec_ms_jiffies_conv(int *negp
, unsigned long *lvalp
,
2246 int write
, void *data
)
2249 *valp
= msecs_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2255 lval
= (unsigned long)-val
;
2258 lval
= (unsigned long)val
;
2260 *lvalp
= jiffies_to_msecs(lval
);
2266 * proc_dointvec_jiffies - read a vector of integers as seconds
2267 * @table: the sysctl table
2268 * @write: %TRUE if this is a write to the sysctl file
2269 * @filp: the file structure
2270 * @buffer: the user buffer
2271 * @lenp: the size of the user buffer
2272 * @ppos: file position
2274 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2275 * values from/to the user buffer, treated as an ASCII string.
2276 * The values read are assumed to be in seconds, and are converted into
2279 * Returns 0 on success.
2281 int proc_dointvec_jiffies(ctl_table
*table
, int write
, struct file
*filp
,
2282 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2284 return do_proc_dointvec(table
,write
,filp
,buffer
,lenp
,ppos
,
2285 do_proc_dointvec_jiffies_conv
,NULL
);
2289 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2290 * @table: the sysctl table
2291 * @write: %TRUE if this is a write to the sysctl file
2292 * @filp: the file structure
2293 * @buffer: the user buffer
2294 * @lenp: the size of the user buffer
2295 * @ppos: pointer to the file position
2297 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2298 * values from/to the user buffer, treated as an ASCII string.
2299 * The values read are assumed to be in 1/USER_HZ seconds, and
2300 * are converted into jiffies.
2302 * Returns 0 on success.
2304 int proc_dointvec_userhz_jiffies(ctl_table
*table
, int write
, struct file
*filp
,
2305 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2307 return do_proc_dointvec(table
,write
,filp
,buffer
,lenp
,ppos
,
2308 do_proc_dointvec_userhz_jiffies_conv
,NULL
);
2312 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2313 * @table: the sysctl table
2314 * @write: %TRUE if this is a write to the sysctl file
2315 * @filp: the file structure
2316 * @buffer: the user buffer
2317 * @lenp: the size of the user buffer
2318 * @ppos: file position
2319 * @ppos: the current position in the file
2321 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2322 * values from/to the user buffer, treated as an ASCII string.
2323 * The values read are assumed to be in 1/1000 seconds, and
2324 * are converted into jiffies.
2326 * Returns 0 on success.
2328 int proc_dointvec_ms_jiffies(ctl_table
*table
, int write
, struct file
*filp
,
2329 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2331 return do_proc_dointvec(table
, write
, filp
, buffer
, lenp
, ppos
,
2332 do_proc_dointvec_ms_jiffies_conv
, NULL
);
2335 #ifdef CONFIG_SYSVIPC
2336 static int proc_ipc_dointvec(ctl_table
*table
, int write
, struct file
*filp
,
2337 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2340 which
= get_ipc(table
, write
);
2341 return __do_proc_dointvec(which
, table
, write
, filp
, buffer
,
2342 lenp
, ppos
, NULL
, NULL
);
2345 static int proc_ipc_doulongvec_minmax(ctl_table
*table
, int write
,
2346 struct file
*filp
, void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2349 which
= get_ipc(table
, write
);
2350 return __do_proc_doulongvec_minmax(which
, table
, write
, filp
, buffer
,
2351 lenp
, ppos
, 1l, 1l);
2356 static int proc_do_cad_pid(ctl_table
*table
, int write
, struct file
*filp
,
2357 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2359 struct pid
*new_pid
;
2363 tmp
= pid_nr(cad_pid
);
2365 r
= __do_proc_dointvec(&tmp
, table
, write
, filp
, buffer
,
2366 lenp
, ppos
, NULL
, NULL
);
2370 new_pid
= find_get_pid(tmp
);
2374 put_pid(xchg(&cad_pid
, new_pid
));
2378 #else /* CONFIG_PROC_FS */
2380 int proc_dostring(ctl_table
*table
, int write
, struct file
*filp
,
2381 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2386 static int proc_do_uts_string(ctl_table
*table
, int write
, struct file
*filp
,
2387 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2392 #ifdef CONFIG_SYSVIPC
2393 static int proc_do_ipc_string(ctl_table
*table
, int write
, struct file
*filp
,
2394 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2400 int proc_dointvec(ctl_table
*table
, int write
, struct file
*filp
,
2401 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2406 int proc_dointvec_bset(ctl_table
*table
, int write
, struct file
*filp
,
2407 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2412 int proc_dointvec_minmax(ctl_table
*table
, int write
, struct file
*filp
,
2413 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2418 int proc_dointvec_jiffies(ctl_table
*table
, int write
, struct file
*filp
,
2419 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2424 int proc_dointvec_userhz_jiffies(ctl_table
*table
, int write
, struct file
*filp
,
2425 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2430 int proc_dointvec_ms_jiffies(ctl_table
*table
, int write
, struct file
*filp
,
2431 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2436 int proc_doulongvec_minmax(ctl_table
*table
, int write
, struct file
*filp
,
2437 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2442 int proc_doulongvec_ms_jiffies_minmax(ctl_table
*table
, int write
,
2444 void __user
*buffer
,
2445 size_t *lenp
, loff_t
*ppos
)
2451 #endif /* CONFIG_PROC_FS */
2454 #ifdef CONFIG_SYSCTL_SYSCALL
2456 * General sysctl support routines
2459 /* The generic string strategy routine: */
2460 int sysctl_string(ctl_table
*table
, int __user
*name
, int nlen
,
2461 void __user
*oldval
, size_t __user
*oldlenp
,
2462 void __user
*newval
, size_t newlen
, void **context
)
2464 if (!table
->data
|| !table
->maxlen
)
2467 if (oldval
&& oldlenp
) {
2469 if (get_user(bufsize
, oldlenp
))
2472 size_t len
= strlen(table
->data
), copied
;
2474 /* This shouldn't trigger for a well-formed sysctl */
2475 if (len
> table
->maxlen
)
2476 len
= table
->maxlen
;
2478 /* Copy up to a max of bufsize-1 bytes of the string */
2479 copied
= (len
>= bufsize
) ? bufsize
- 1 : len
;
2481 if (copy_to_user(oldval
, table
->data
, copied
) ||
2482 put_user(0, (char __user
*)(oldval
+ copied
)))
2484 if (put_user(len
, oldlenp
))
2488 if (newval
&& newlen
) {
2489 size_t len
= newlen
;
2490 if (len
> table
->maxlen
)
2491 len
= table
->maxlen
;
2492 if(copy_from_user(table
->data
, newval
, len
))
2494 if (len
== table
->maxlen
)
2496 ((char *) table
->data
)[len
] = 0;
2502 * This function makes sure that all of the integers in the vector
2503 * are between the minimum and maximum values given in the arrays
2504 * table->extra1 and table->extra2, respectively.
2506 int sysctl_intvec(ctl_table
*table
, int __user
*name
, int nlen
,
2507 void __user
*oldval
, size_t __user
*oldlenp
,
2508 void __user
*newval
, size_t newlen
, void **context
)
2511 if (newval
&& newlen
) {
2512 int __user
*vec
= (int __user
*) newval
;
2513 int *min
= (int *) table
->extra1
;
2514 int *max
= (int *) table
->extra2
;
2518 if (newlen
% sizeof(int) != 0)
2521 if (!table
->extra1
&& !table
->extra2
)
2524 if (newlen
> table
->maxlen
)
2525 newlen
= table
->maxlen
;
2526 length
= newlen
/ sizeof(int);
2528 for (i
= 0; i
< length
; i
++) {
2530 if (get_user(value
, vec
+ i
))
2532 if (min
&& value
< min
[i
])
2534 if (max
&& value
> max
[i
])
2541 /* Strategy function to convert jiffies to seconds */
2542 int sysctl_jiffies(ctl_table
*table
, int __user
*name
, int nlen
,
2543 void __user
*oldval
, size_t __user
*oldlenp
,
2544 void __user
*newval
, size_t newlen
, void **context
)
2549 if (get_user(olen
, oldlenp
))
2551 if (olen
!=sizeof(int))
2554 if (put_user(*(int *)(table
->data
)/HZ
, (int __user
*)oldval
) ||
2555 (oldlenp
&& put_user(sizeof(int),oldlenp
)))
2558 if (newval
&& newlen
) {
2560 if (newlen
!= sizeof(int))
2562 if (get_user(new, (int __user
*)newval
))
2564 *(int *)(table
->data
) = new*HZ
;
2569 /* Strategy function to convert jiffies to seconds */
2570 int sysctl_ms_jiffies(ctl_table
*table
, int __user
*name
, int nlen
,
2571 void __user
*oldval
, size_t __user
*oldlenp
,
2572 void __user
*newval
, size_t newlen
, void **context
)
2577 if (get_user(olen
, oldlenp
))
2579 if (olen
!=sizeof(int))
2582 if (put_user(jiffies_to_msecs(*(int *)(table
->data
)), (int __user
*)oldval
) ||
2583 (oldlenp
&& put_user(sizeof(int),oldlenp
)))
2586 if (newval
&& newlen
) {
2588 if (newlen
!= sizeof(int))
2590 if (get_user(new, (int __user
*)newval
))
2592 *(int *)(table
->data
) = msecs_to_jiffies(new);
2598 /* The generic string strategy routine: */
2599 static int sysctl_uts_string(ctl_table
*table
, int __user
*name
, int nlen
,
2600 void __user
*oldval
, size_t __user
*oldlenp
,
2601 void __user
*newval
, size_t newlen
, void **context
)
2603 struct ctl_table uts_table
;
2605 write
= newval
&& newlen
;
2606 memcpy(&uts_table
, table
, sizeof(uts_table
));
2607 uts_table
.data
= get_uts(table
, write
);
2608 r
= sysctl_string(&uts_table
, name
, nlen
,
2609 oldval
, oldlenp
, newval
, newlen
, context
);
2610 put_uts(table
, write
, uts_table
.data
);
2614 #else /* CONFIG_SYSCTL_SYSCALL */
2617 asmlinkage
long sys_sysctl(struct __sysctl_args __user
*args
)
2619 static int msg_count
;
2620 struct __sysctl_args tmp
;
2621 int name
[CTL_MAXNAME
];
2624 /* Read in the sysctl name for better debug message logging */
2625 if (copy_from_user(&tmp
, args
, sizeof(tmp
)))
2627 if (tmp
.nlen
<= 0 || tmp
.nlen
>= CTL_MAXNAME
)
2629 for (i
= 0; i
< tmp
.nlen
; i
++)
2630 if (get_user(name
[i
], tmp
.name
+ i
))
2633 /* Ignore accesses to kernel.version */
2634 if ((tmp
.nlen
== 2) && (name
[0] == CTL_KERN
) && (name
[1] == KERN_VERSION
))
2637 if (msg_count
< 5) {
2640 "warning: process `%s' used the removed sysctl "
2641 "system call with ", current
->comm
);
2642 for (i
= 0; i
< tmp
.nlen
; i
++)
2643 printk("%d.", name
[i
]);
2650 int sysctl_string(ctl_table
*table
, int __user
*name
, int nlen
,
2651 void __user
*oldval
, size_t __user
*oldlenp
,
2652 void __user
*newval
, size_t newlen
, void **context
)
2657 int sysctl_intvec(ctl_table
*table
, int __user
*name
, int nlen
,
2658 void __user
*oldval
, size_t __user
*oldlenp
,
2659 void __user
*newval
, size_t newlen
, void **context
)
2664 int sysctl_jiffies(ctl_table
*table
, int __user
*name
, int nlen
,
2665 void __user
*oldval
, size_t __user
*oldlenp
,
2666 void __user
*newval
, size_t newlen
, void **context
)
2671 int sysctl_ms_jiffies(ctl_table
*table
, int __user
*name
, int nlen
,
2672 void __user
*oldval
, size_t __user
*oldlenp
,
2673 void __user
*newval
, size_t newlen
, void **context
)
2678 static int sysctl_uts_string(ctl_table
*table
, int __user
*name
, int nlen
,
2679 void __user
*oldval
, size_t __user
*oldlenp
,
2680 void __user
*newval
, size_t newlen
, void **context
)
2684 #endif /* CONFIG_SYSCTL_SYSCALL */
2687 * No sense putting this after each symbol definition, twice,
2688 * exception granted :-)
2690 EXPORT_SYMBOL(proc_dointvec
);
2691 EXPORT_SYMBOL(proc_dointvec_jiffies
);
2692 EXPORT_SYMBOL(proc_dointvec_minmax
);
2693 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies
);
2694 EXPORT_SYMBOL(proc_dointvec_ms_jiffies
);
2695 EXPORT_SYMBOL(proc_dostring
);
2696 EXPORT_SYMBOL(proc_doulongvec_minmax
);
2697 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax
);
2698 EXPORT_SYMBOL(register_sysctl_table
);
2699 EXPORT_SYMBOL(sysctl_intvec
);
2700 EXPORT_SYMBOL(sysctl_jiffies
);
2701 EXPORT_SYMBOL(sysctl_ms_jiffies
);
2702 EXPORT_SYMBOL(sysctl_string
);
2703 EXPORT_SYMBOL(unregister_sysctl_table
);