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>
22 #include <linux/aio.h>
24 #include <linux/swap.h>
25 #include <linux/slab.h>
26 #include <linux/sysctl.h>
27 #include <linux/bitmap.h>
28 #include <linux/signal.h>
29 #include <linux/printk.h>
30 #include <linux/proc_fs.h>
31 #include <linux/security.h>
32 #include <linux/ctype.h>
33 #include <linux/kmemcheck.h>
34 #include <linux/kmemleak.h>
36 #include <linux/init.h>
37 #include <linux/kernel.h>
38 #include <linux/kobject.h>
39 #include <linux/net.h>
40 #include <linux/sysrq.h>
41 #include <linux/highuid.h>
42 #include <linux/writeback.h>
43 #include <linux/ratelimit.h>
44 #include <linux/compaction.h>
45 #include <linux/hugetlb.h>
46 #include <linux/initrd.h>
47 #include <linux/key.h>
48 #include <linux/times.h>
49 #include <linux/limits.h>
50 #include <linux/dcache.h>
51 #include <linux/dnotify.h>
52 #include <linux/syscalls.h>
53 #include <linux/vmstat.h>
54 #include <linux/nfs_fs.h>
55 #include <linux/acpi.h>
56 #include <linux/reboot.h>
57 #include <linux/ftrace.h>
58 #include <linux/perf_event.h>
59 #include <linux/kprobes.h>
60 #include <linux/pipe_fs_i.h>
61 #include <linux/oom.h>
62 #include <linux/kmod.h>
63 #include <linux/capability.h>
64 #include <linux/binfmts.h>
65 #include <linux/sched/sysctl.h>
66 #include <linux/kexec.h>
67 #include <linux/bpf.h>
68 #include <linux/mount.h>
70 #include <asm/uaccess.h>
71 #include <asm/processor.h>
75 #include <asm/stacktrace.h>
79 #include <asm/setup.h>
81 #ifdef CONFIG_BSD_PROCESS_ACCT
82 #include <linux/acct.h>
84 #ifdef CONFIG_RT_MUTEXES
85 #include <linux/rtmutex.h>
87 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
88 #include <linux/lockdep.h>
90 #ifdef CONFIG_CHR_DEV_SG
94 #ifdef CONFIG_LOCKUP_DETECTOR
95 #include <linux/nmi.h>
98 #if defined(CONFIG_SYSCTL)
100 /* External variables not in a header file. */
101 extern int suid_dumpable
;
102 #ifdef CONFIG_COREDUMP
103 extern int core_uses_pid
;
104 extern char core_pattern
[];
105 extern unsigned int core_pipe_limit
;
108 extern int pid_max_min
, pid_max_max
;
109 extern int percpu_pagelist_fraction
;
110 extern int compat_log
;
111 extern int latencytop_enabled
;
112 extern int sysctl_nr_open_min
, sysctl_nr_open_max
;
114 extern int sysctl_nr_trim_pages
;
117 /* Constants used for minimum and maximum */
118 #ifdef CONFIG_LOCKUP_DETECTOR
119 static int sixty
= 60;
122 static int __maybe_unused neg_one
= -1;
125 static int __maybe_unused one
= 1;
126 static int __maybe_unused two
= 2;
127 static int __maybe_unused four
= 4;
128 static unsigned long one_ul
= 1;
129 static int one_hundred
= 100;
131 static int ten_thousand
= 10000;
134 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
135 static unsigned long dirty_bytes_min
= 2 * PAGE_SIZE
;
137 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
138 static int maxolduid
= 65535;
139 static int minolduid
;
141 static int ngroups_max
= NGROUPS_MAX
;
142 static const int cap_last_cap
= CAP_LAST_CAP
;
144 /*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
145 #ifdef CONFIG_DETECT_HUNG_TASK
146 static unsigned long hung_task_timeout_max
= (LONG_MAX
/HZ
);
149 #ifdef CONFIG_INOTIFY_USER
150 #include <linux/inotify.h>
156 extern int pwrsw_enabled
;
159 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
160 extern int unaligned_enabled
;
164 extern int unaligned_dump_stack
;
167 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
168 extern int no_unaligned_warning
;
171 #ifdef CONFIG_PROC_SYSCTL
173 #define SYSCTL_WRITES_LEGACY -1
174 #define SYSCTL_WRITES_WARN 0
175 #define SYSCTL_WRITES_STRICT 1
177 static int sysctl_writes_strict
= SYSCTL_WRITES_STRICT
;
179 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
180 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
181 static int proc_taint(struct ctl_table
*table
, int write
,
182 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
186 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
187 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
190 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
191 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
192 #ifdef CONFIG_COREDUMP
193 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
194 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
);
197 #ifdef CONFIG_MAGIC_SYSRQ
198 /* Note: sysrq code uses it's own private copy */
199 static int __sysrq_enabled
= CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE
;
201 static int sysrq_sysctl_handler(struct ctl_table
*table
, int write
,
202 void __user
*buffer
, size_t *lenp
,
207 error
= proc_dointvec(table
, write
, buffer
, lenp
, ppos
);
212 sysrq_toggle_support(__sysrq_enabled
);
219 static struct ctl_table kern_table
[];
220 static struct ctl_table vm_table
[];
221 static struct ctl_table fs_table
[];
222 static struct ctl_table debug_table
[];
223 static struct ctl_table dev_table
[];
224 extern struct ctl_table random_table
[];
226 extern struct ctl_table epoll_table
[];
229 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
230 int sysctl_legacy_va_layout
;
233 /* The default sysctl tables: */
235 static struct ctl_table sysctl_base_table
[] = {
237 .procname
= "kernel",
254 .child
= debug_table
,
264 #ifdef CONFIG_SCHED_DEBUG
265 static int min_sched_granularity_ns
= 100000; /* 100 usecs */
266 static int max_sched_granularity_ns
= NSEC_PER_SEC
; /* 1 second */
267 static int min_wakeup_granularity_ns
; /* 0 usecs */
268 static int max_wakeup_granularity_ns
= NSEC_PER_SEC
; /* 1 second */
270 static int min_sched_tunable_scaling
= SCHED_TUNABLESCALING_NONE
;
271 static int max_sched_tunable_scaling
= SCHED_TUNABLESCALING_END
-1;
272 #endif /* CONFIG_SMP */
273 #endif /* CONFIG_SCHED_DEBUG */
275 #ifdef CONFIG_COMPACTION
276 static int min_extfrag_threshold
;
277 static int max_extfrag_threshold
= 1000;
280 static struct ctl_table kern_table
[] = {
282 .procname
= "sched_child_runs_first",
283 .data
= &sysctl_sched_child_runs_first
,
284 .maxlen
= sizeof(unsigned int),
286 .proc_handler
= proc_dointvec
,
288 #ifdef CONFIG_SCHED_DEBUG
290 .procname
= "sched_min_granularity_ns",
291 .data
= &sysctl_sched_min_granularity
,
292 .maxlen
= sizeof(unsigned int),
294 .proc_handler
= sched_proc_update_handler
,
295 .extra1
= &min_sched_granularity_ns
,
296 .extra2
= &max_sched_granularity_ns
,
299 .procname
= "sched_latency_ns",
300 .data
= &sysctl_sched_latency
,
301 .maxlen
= sizeof(unsigned int),
303 .proc_handler
= sched_proc_update_handler
,
304 .extra1
= &min_sched_granularity_ns
,
305 .extra2
= &max_sched_granularity_ns
,
308 .procname
= "sched_wakeup_granularity_ns",
309 .data
= &sysctl_sched_wakeup_granularity
,
310 .maxlen
= sizeof(unsigned int),
312 .proc_handler
= sched_proc_update_handler
,
313 .extra1
= &min_wakeup_granularity_ns
,
314 .extra2
= &max_wakeup_granularity_ns
,
318 .procname
= "sched_tunable_scaling",
319 .data
= &sysctl_sched_tunable_scaling
,
320 .maxlen
= sizeof(enum sched_tunable_scaling
),
322 .proc_handler
= sched_proc_update_handler
,
323 .extra1
= &min_sched_tunable_scaling
,
324 .extra2
= &max_sched_tunable_scaling
,
327 .procname
= "sched_migration_cost_ns",
328 .data
= &sysctl_sched_migration_cost
,
329 .maxlen
= sizeof(unsigned int),
331 .proc_handler
= proc_dointvec
,
334 .procname
= "sched_nr_migrate",
335 .data
= &sysctl_sched_nr_migrate
,
336 .maxlen
= sizeof(unsigned int),
338 .proc_handler
= proc_dointvec
,
341 .procname
= "sched_time_avg_ms",
342 .data
= &sysctl_sched_time_avg
,
343 .maxlen
= sizeof(unsigned int),
345 .proc_handler
= proc_dointvec_minmax
,
349 .procname
= "sched_shares_window_ns",
350 .data
= &sysctl_sched_shares_window
,
351 .maxlen
= sizeof(unsigned int),
353 .proc_handler
= proc_dointvec
,
355 #endif /* CONFIG_SMP */
356 #ifdef CONFIG_NUMA_BALANCING
358 .procname
= "numa_balancing_scan_delay_ms",
359 .data
= &sysctl_numa_balancing_scan_delay
,
360 .maxlen
= sizeof(unsigned int),
362 .proc_handler
= proc_dointvec
,
365 .procname
= "numa_balancing_scan_period_min_ms",
366 .data
= &sysctl_numa_balancing_scan_period_min
,
367 .maxlen
= sizeof(unsigned int),
369 .proc_handler
= proc_dointvec
,
372 .procname
= "numa_balancing_scan_period_max_ms",
373 .data
= &sysctl_numa_balancing_scan_period_max
,
374 .maxlen
= sizeof(unsigned int),
376 .proc_handler
= proc_dointvec
,
379 .procname
= "numa_balancing_scan_size_mb",
380 .data
= &sysctl_numa_balancing_scan_size
,
381 .maxlen
= sizeof(unsigned int),
383 .proc_handler
= proc_dointvec_minmax
,
387 .procname
= "numa_balancing",
388 .data
= NULL
, /* filled in by handler */
389 .maxlen
= sizeof(unsigned int),
391 .proc_handler
= sysctl_numa_balancing
,
395 #endif /* CONFIG_NUMA_BALANCING */
396 #endif /* CONFIG_SCHED_DEBUG */
398 .procname
= "sched_rt_period_us",
399 .data
= &sysctl_sched_rt_period
,
400 .maxlen
= sizeof(unsigned int),
402 .proc_handler
= sched_rt_handler
,
405 .procname
= "sched_rt_runtime_us",
406 .data
= &sysctl_sched_rt_runtime
,
407 .maxlen
= sizeof(int),
409 .proc_handler
= sched_rt_handler
,
412 .procname
= "sched_rr_timeslice_ms",
413 .data
= &sched_rr_timeslice
,
414 .maxlen
= sizeof(int),
416 .proc_handler
= sched_rr_handler
,
418 #ifdef CONFIG_SCHED_AUTOGROUP
420 .procname
= "sched_autogroup_enabled",
421 .data
= &sysctl_sched_autogroup_enabled
,
422 .maxlen
= sizeof(unsigned int),
424 .proc_handler
= proc_dointvec_minmax
,
429 #ifdef CONFIG_CFS_BANDWIDTH
431 .procname
= "sched_cfs_bandwidth_slice_us",
432 .data
= &sysctl_sched_cfs_bandwidth_slice
,
433 .maxlen
= sizeof(unsigned int),
435 .proc_handler
= proc_dointvec_minmax
,
439 #ifdef CONFIG_PROVE_LOCKING
441 .procname
= "prove_locking",
442 .data
= &prove_locking
,
443 .maxlen
= sizeof(int),
445 .proc_handler
= proc_dointvec
,
448 #ifdef CONFIG_LOCK_STAT
450 .procname
= "lock_stat",
452 .maxlen
= sizeof(int),
454 .proc_handler
= proc_dointvec
,
459 .data
= &panic_timeout
,
460 .maxlen
= sizeof(int),
462 .proc_handler
= proc_dointvec
,
464 #ifdef CONFIG_COREDUMP
466 .procname
= "core_uses_pid",
467 .data
= &core_uses_pid
,
468 .maxlen
= sizeof(int),
470 .proc_handler
= proc_dointvec
,
473 .procname
= "core_pattern",
474 .data
= core_pattern
,
475 .maxlen
= CORENAME_MAX_SIZE
,
477 .proc_handler
= proc_dostring_coredump
,
480 .procname
= "core_pipe_limit",
481 .data
= &core_pipe_limit
,
482 .maxlen
= sizeof(unsigned int),
484 .proc_handler
= proc_dointvec
,
487 #ifdef CONFIG_PROC_SYSCTL
489 .procname
= "tainted",
490 .maxlen
= sizeof(long),
492 .proc_handler
= proc_taint
,
495 .procname
= "sysctl_writes_strict",
496 .data
= &sysctl_writes_strict
,
497 .maxlen
= sizeof(int),
499 .proc_handler
= proc_dointvec_minmax
,
504 #ifdef CONFIG_LATENCYTOP
506 .procname
= "latencytop",
507 .data
= &latencytop_enabled
,
508 .maxlen
= sizeof(int),
510 .proc_handler
= proc_dointvec
,
513 #ifdef CONFIG_BLK_DEV_INITRD
515 .procname
= "real-root-dev",
516 .data
= &real_root_dev
,
517 .maxlen
= sizeof(int),
519 .proc_handler
= proc_dointvec
,
523 .procname
= "print-fatal-signals",
524 .data
= &print_fatal_signals
,
525 .maxlen
= sizeof(int),
527 .proc_handler
= proc_dointvec
,
531 .procname
= "reboot-cmd",
532 .data
= reboot_command
,
535 .proc_handler
= proc_dostring
,
538 .procname
= "stop-a",
539 .data
= &stop_a_enabled
,
540 .maxlen
= sizeof (int),
542 .proc_handler
= proc_dointvec
,
545 .procname
= "scons-poweroff",
546 .data
= &scons_pwroff
,
547 .maxlen
= sizeof (int),
549 .proc_handler
= proc_dointvec
,
552 #ifdef CONFIG_SPARC64
554 .procname
= "tsb-ratio",
555 .data
= &sysctl_tsb_ratio
,
556 .maxlen
= sizeof (int),
558 .proc_handler
= proc_dointvec
,
563 .procname
= "soft-power",
564 .data
= &pwrsw_enabled
,
565 .maxlen
= sizeof (int),
567 .proc_handler
= proc_dointvec
,
570 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
572 .procname
= "unaligned-trap",
573 .data
= &unaligned_enabled
,
574 .maxlen
= sizeof (int),
576 .proc_handler
= proc_dointvec
,
580 .procname
= "ctrl-alt-del",
582 .maxlen
= sizeof(int),
584 .proc_handler
= proc_dointvec
,
586 #ifdef CONFIG_FUNCTION_TRACER
588 .procname
= "ftrace_enabled",
589 .data
= &ftrace_enabled
,
590 .maxlen
= sizeof(int),
592 .proc_handler
= ftrace_enable_sysctl
,
595 #ifdef CONFIG_STACK_TRACER
597 .procname
= "stack_tracer_enabled",
598 .data
= &stack_tracer_enabled
,
599 .maxlen
= sizeof(int),
601 .proc_handler
= stack_trace_sysctl
,
604 #ifdef CONFIG_TRACING
606 .procname
= "ftrace_dump_on_oops",
607 .data
= &ftrace_dump_on_oops
,
608 .maxlen
= sizeof(int),
610 .proc_handler
= proc_dointvec
,
613 .procname
= "traceoff_on_warning",
614 .data
= &__disable_trace_on_warning
,
615 .maxlen
= sizeof(__disable_trace_on_warning
),
617 .proc_handler
= proc_dointvec
,
620 .procname
= "tracepoint_printk",
621 .data
= &tracepoint_printk
,
622 .maxlen
= sizeof(tracepoint_printk
),
624 .proc_handler
= proc_dointvec
,
627 #ifdef CONFIG_KEXEC_CORE
629 .procname
= "kexec_load_disabled",
630 .data
= &kexec_load_disabled
,
631 .maxlen
= sizeof(int),
633 /* only handle a transition from default "0" to "1" */
634 .proc_handler
= proc_dointvec_minmax
,
639 #ifdef CONFIG_MODULES
641 .procname
= "modprobe",
642 .data
= &modprobe_path
,
643 .maxlen
= KMOD_PATH_LEN
,
645 .proc_handler
= proc_dostring
,
648 .procname
= "modules_disabled",
649 .data
= &modules_disabled
,
650 .maxlen
= sizeof(int),
652 /* only handle a transition from default "0" to "1" */
653 .proc_handler
= proc_dointvec_minmax
,
658 #ifdef CONFIG_UEVENT_HELPER
660 .procname
= "hotplug",
661 .data
= &uevent_helper
,
662 .maxlen
= UEVENT_HELPER_PATH_LEN
,
664 .proc_handler
= proc_dostring
,
667 #ifdef CONFIG_CHR_DEV_SG
669 .procname
= "sg-big-buff",
670 .data
= &sg_big_buff
,
671 .maxlen
= sizeof (int),
673 .proc_handler
= proc_dointvec
,
676 #ifdef CONFIG_BSD_PROCESS_ACCT
680 .maxlen
= 3*sizeof(int),
682 .proc_handler
= proc_dointvec
,
685 #ifdef CONFIG_MAGIC_SYSRQ
688 .data
= &__sysrq_enabled
,
689 .maxlen
= sizeof (int),
691 .proc_handler
= sysrq_sysctl_handler
,
694 #ifdef CONFIG_PROC_SYSCTL
696 .procname
= "cad_pid",
698 .maxlen
= sizeof (int),
700 .proc_handler
= proc_do_cad_pid
,
704 .procname
= "threads-max",
706 .maxlen
= sizeof(int),
708 .proc_handler
= sysctl_max_threads
,
711 .procname
= "random",
713 .child
= random_table
,
716 .procname
= "usermodehelper",
718 .child
= usermodehelper_table
,
721 .procname
= "overflowuid",
722 .data
= &overflowuid
,
723 .maxlen
= sizeof(int),
725 .proc_handler
= proc_dointvec_minmax
,
726 .extra1
= &minolduid
,
727 .extra2
= &maxolduid
,
730 .procname
= "overflowgid",
731 .data
= &overflowgid
,
732 .maxlen
= sizeof(int),
734 .proc_handler
= proc_dointvec_minmax
,
735 .extra1
= &minolduid
,
736 .extra2
= &maxolduid
,
739 #ifdef CONFIG_MATHEMU
741 .procname
= "ieee_emulation_warnings",
742 .data
= &sysctl_ieee_emulation_warnings
,
743 .maxlen
= sizeof(int),
745 .proc_handler
= proc_dointvec
,
749 .procname
= "userprocess_debug",
750 .data
= &show_unhandled_signals
,
751 .maxlen
= sizeof(int),
753 .proc_handler
= proc_dointvec
,
757 .procname
= "pid_max",
759 .maxlen
= sizeof (int),
761 .proc_handler
= proc_dointvec_minmax
,
762 .extra1
= &pid_max_min
,
763 .extra2
= &pid_max_max
,
766 .procname
= "panic_on_oops",
767 .data
= &panic_on_oops
,
768 .maxlen
= sizeof(int),
770 .proc_handler
= proc_dointvec
,
772 #if defined CONFIG_PRINTK
774 .procname
= "printk",
775 .data
= &console_loglevel
,
776 .maxlen
= 4*sizeof(int),
778 .proc_handler
= proc_dointvec
,
781 .procname
= "printk_ratelimit",
782 .data
= &printk_ratelimit_state
.interval
,
783 .maxlen
= sizeof(int),
785 .proc_handler
= proc_dointvec_jiffies
,
788 .procname
= "printk_ratelimit_burst",
789 .data
= &printk_ratelimit_state
.burst
,
790 .maxlen
= sizeof(int),
792 .proc_handler
= proc_dointvec
,
795 .procname
= "printk_delay",
796 .data
= &printk_delay_msec
,
797 .maxlen
= sizeof(int),
799 .proc_handler
= proc_dointvec_minmax
,
801 .extra2
= &ten_thousand
,
804 .procname
= "dmesg_restrict",
805 .data
= &dmesg_restrict
,
806 .maxlen
= sizeof(int),
808 .proc_handler
= proc_dointvec_minmax_sysadmin
,
813 .procname
= "kptr_restrict",
814 .data
= &kptr_restrict
,
815 .maxlen
= sizeof(int),
817 .proc_handler
= proc_dointvec_minmax_sysadmin
,
823 .procname
= "ngroups_max",
824 .data
= &ngroups_max
,
825 .maxlen
= sizeof (int),
827 .proc_handler
= proc_dointvec
,
830 .procname
= "cap_last_cap",
831 .data
= (void *)&cap_last_cap
,
832 .maxlen
= sizeof(int),
834 .proc_handler
= proc_dointvec
,
836 #if defined(CONFIG_LOCKUP_DETECTOR)
838 .procname
= "watchdog",
839 .data
= &watchdog_user_enabled
,
840 .maxlen
= sizeof (int),
842 .proc_handler
= proc_watchdog
,
847 .procname
= "watchdog_thresh",
848 .data
= &watchdog_thresh
,
849 .maxlen
= sizeof(int),
851 .proc_handler
= proc_watchdog_thresh
,
856 .procname
= "nmi_watchdog",
857 .data
= &nmi_watchdog_enabled
,
858 .maxlen
= sizeof (int),
860 .proc_handler
= proc_nmi_watchdog
,
862 #if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
869 .procname
= "soft_watchdog",
870 .data
= &soft_watchdog_enabled
,
871 .maxlen
= sizeof (int),
873 .proc_handler
= proc_soft_watchdog
,
878 .procname
= "watchdog_cpumask",
879 .data
= &watchdog_cpumask_bits
,
882 .proc_handler
= proc_watchdog_cpumask
,
885 .procname
= "softlockup_panic",
886 .data
= &softlockup_panic
,
887 .maxlen
= sizeof(int),
889 .proc_handler
= proc_dointvec_minmax
,
893 #ifdef CONFIG_HARDLOCKUP_DETECTOR
895 .procname
= "hardlockup_panic",
896 .data
= &hardlockup_panic
,
897 .maxlen
= sizeof(int),
899 .proc_handler
= proc_dointvec_minmax
,
906 .procname
= "softlockup_all_cpu_backtrace",
907 .data
= &sysctl_softlockup_all_cpu_backtrace
,
908 .maxlen
= sizeof(int),
910 .proc_handler
= proc_dointvec_minmax
,
915 .procname
= "hardlockup_all_cpu_backtrace",
916 .data
= &sysctl_hardlockup_all_cpu_backtrace
,
917 .maxlen
= sizeof(int),
919 .proc_handler
= proc_dointvec_minmax
,
923 #endif /* CONFIG_SMP */
925 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
927 .procname
= "unknown_nmi_panic",
928 .data
= &unknown_nmi_panic
,
929 .maxlen
= sizeof (int),
931 .proc_handler
= proc_dointvec
,
934 #if defined(CONFIG_X86)
936 .procname
= "panic_on_unrecovered_nmi",
937 .data
= &panic_on_unrecovered_nmi
,
938 .maxlen
= sizeof(int),
940 .proc_handler
= proc_dointvec
,
943 .procname
= "panic_on_io_nmi",
944 .data
= &panic_on_io_nmi
,
945 .maxlen
= sizeof(int),
947 .proc_handler
= proc_dointvec
,
949 #ifdef CONFIG_DEBUG_STACKOVERFLOW
951 .procname
= "panic_on_stackoverflow",
952 .data
= &sysctl_panic_on_stackoverflow
,
953 .maxlen
= sizeof(int),
955 .proc_handler
= proc_dointvec
,
959 .procname
= "bootloader_type",
960 .data
= &bootloader_type
,
961 .maxlen
= sizeof (int),
963 .proc_handler
= proc_dointvec
,
966 .procname
= "bootloader_version",
967 .data
= &bootloader_version
,
968 .maxlen
= sizeof (int),
970 .proc_handler
= proc_dointvec
,
973 .procname
= "kstack_depth_to_print",
974 .data
= &kstack_depth_to_print
,
975 .maxlen
= sizeof(int),
977 .proc_handler
= proc_dointvec
,
980 .procname
= "io_delay_type",
981 .data
= &io_delay_type
,
982 .maxlen
= sizeof(int),
984 .proc_handler
= proc_dointvec
,
987 #if defined(CONFIG_MMU)
989 .procname
= "randomize_va_space",
990 .data
= &randomize_va_space
,
991 .maxlen
= sizeof(int),
993 .proc_handler
= proc_dointvec
,
996 #if defined(CONFIG_S390) && defined(CONFIG_SMP)
998 .procname
= "spin_retry",
1000 .maxlen
= sizeof (int),
1002 .proc_handler
= proc_dointvec
,
1005 #if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
1007 .procname
= "acpi_video_flags",
1008 .data
= &acpi_realmode_flags
,
1009 .maxlen
= sizeof (unsigned long),
1011 .proc_handler
= proc_doulongvec_minmax
,
1014 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
1016 .procname
= "ignore-unaligned-usertrap",
1017 .data
= &no_unaligned_warning
,
1018 .maxlen
= sizeof (int),
1020 .proc_handler
= proc_dointvec
,
1025 .procname
= "unaligned-dump-stack",
1026 .data
= &unaligned_dump_stack
,
1027 .maxlen
= sizeof (int),
1029 .proc_handler
= proc_dointvec
,
1032 #ifdef CONFIG_DETECT_HUNG_TASK
1034 .procname
= "hung_task_panic",
1035 .data
= &sysctl_hung_task_panic
,
1036 .maxlen
= sizeof(int),
1038 .proc_handler
= proc_dointvec_minmax
,
1043 .procname
= "hung_task_check_count",
1044 .data
= &sysctl_hung_task_check_count
,
1045 .maxlen
= sizeof(int),
1047 .proc_handler
= proc_dointvec_minmax
,
1051 .procname
= "hung_task_timeout_secs",
1052 .data
= &sysctl_hung_task_timeout_secs
,
1053 .maxlen
= sizeof(unsigned long),
1055 .proc_handler
= proc_dohung_task_timeout_secs
,
1056 .extra2
= &hung_task_timeout_max
,
1059 .procname
= "hung_task_warnings",
1060 .data
= &sysctl_hung_task_warnings
,
1061 .maxlen
= sizeof(int),
1063 .proc_handler
= proc_dointvec_minmax
,
1067 #ifdef CONFIG_COMPAT
1069 .procname
= "compat-log",
1070 .data
= &compat_log
,
1071 .maxlen
= sizeof (int),
1073 .proc_handler
= proc_dointvec
,
1076 #ifdef CONFIG_RT_MUTEXES
1078 .procname
= "max_lock_depth",
1079 .data
= &max_lock_depth
,
1080 .maxlen
= sizeof(int),
1082 .proc_handler
= proc_dointvec
,
1086 .procname
= "poweroff_cmd",
1087 .data
= &poweroff_cmd
,
1088 .maxlen
= POWEROFF_CMD_PATH_LEN
,
1090 .proc_handler
= proc_dostring
,
1096 .child
= key_sysctls
,
1099 #ifdef CONFIG_PERF_EVENTS
1101 * User-space scripts rely on the existence of this file
1102 * as a feature check for perf_events being enabled.
1104 * So it's an ABI, do not remove!
1107 .procname
= "perf_event_paranoid",
1108 .data
= &sysctl_perf_event_paranoid
,
1109 .maxlen
= sizeof(sysctl_perf_event_paranoid
),
1111 .proc_handler
= proc_dointvec
,
1114 .procname
= "perf_event_mlock_kb",
1115 .data
= &sysctl_perf_event_mlock
,
1116 .maxlen
= sizeof(sysctl_perf_event_mlock
),
1118 .proc_handler
= proc_dointvec
,
1121 .procname
= "perf_event_max_sample_rate",
1122 .data
= &sysctl_perf_event_sample_rate
,
1123 .maxlen
= sizeof(sysctl_perf_event_sample_rate
),
1125 .proc_handler
= perf_proc_update_handler
,
1129 .procname
= "perf_cpu_time_max_percent",
1130 .data
= &sysctl_perf_cpu_time_max_percent
,
1131 .maxlen
= sizeof(sysctl_perf_cpu_time_max_percent
),
1133 .proc_handler
= perf_cpu_time_max_percent_handler
,
1135 .extra2
= &one_hundred
,
1138 #ifdef CONFIG_KMEMCHECK
1140 .procname
= "kmemcheck",
1141 .data
= &kmemcheck_enabled
,
1142 .maxlen
= sizeof(int),
1144 .proc_handler
= proc_dointvec
,
1148 .procname
= "panic_on_warn",
1149 .data
= &panic_on_warn
,
1150 .maxlen
= sizeof(int),
1152 .proc_handler
= proc_dointvec_minmax
,
1156 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
1158 .procname
= "timer_migration",
1159 .data
= &sysctl_timer_migration
,
1160 .maxlen
= sizeof(unsigned int),
1162 .proc_handler
= timer_migration_handler
,
1167 #ifdef CONFIG_BPF_SYSCALL
1169 .procname
= "unprivileged_bpf_disabled",
1170 .data
= &sysctl_unprivileged_bpf_disabled
,
1171 .maxlen
= sizeof(sysctl_unprivileged_bpf_disabled
),
1173 /* only handle a transition from default "0" to "1" */
1174 .proc_handler
= proc_dointvec_minmax
,
1182 static struct ctl_table vm_table
[] = {
1184 .procname
= "overcommit_memory",
1185 .data
= &sysctl_overcommit_memory
,
1186 .maxlen
= sizeof(sysctl_overcommit_memory
),
1188 .proc_handler
= proc_dointvec_minmax
,
1193 .procname
= "panic_on_oom",
1194 .data
= &sysctl_panic_on_oom
,
1195 .maxlen
= sizeof(sysctl_panic_on_oom
),
1197 .proc_handler
= proc_dointvec_minmax
,
1202 .procname
= "oom_kill_allocating_task",
1203 .data
= &sysctl_oom_kill_allocating_task
,
1204 .maxlen
= sizeof(sysctl_oom_kill_allocating_task
),
1206 .proc_handler
= proc_dointvec
,
1209 .procname
= "oom_dump_tasks",
1210 .data
= &sysctl_oom_dump_tasks
,
1211 .maxlen
= sizeof(sysctl_oom_dump_tasks
),
1213 .proc_handler
= proc_dointvec
,
1216 .procname
= "overcommit_ratio",
1217 .data
= &sysctl_overcommit_ratio
,
1218 .maxlen
= sizeof(sysctl_overcommit_ratio
),
1220 .proc_handler
= overcommit_ratio_handler
,
1223 .procname
= "overcommit_kbytes",
1224 .data
= &sysctl_overcommit_kbytes
,
1225 .maxlen
= sizeof(sysctl_overcommit_kbytes
),
1227 .proc_handler
= overcommit_kbytes_handler
,
1230 .procname
= "page-cluster",
1231 .data
= &page_cluster
,
1232 .maxlen
= sizeof(int),
1234 .proc_handler
= proc_dointvec_minmax
,
1238 .procname
= "dirty_background_ratio",
1239 .data
= &dirty_background_ratio
,
1240 .maxlen
= sizeof(dirty_background_ratio
),
1242 .proc_handler
= dirty_background_ratio_handler
,
1244 .extra2
= &one_hundred
,
1247 .procname
= "dirty_background_bytes",
1248 .data
= &dirty_background_bytes
,
1249 .maxlen
= sizeof(dirty_background_bytes
),
1251 .proc_handler
= dirty_background_bytes_handler
,
1255 .procname
= "dirty_ratio",
1256 .data
= &vm_dirty_ratio
,
1257 .maxlen
= sizeof(vm_dirty_ratio
),
1259 .proc_handler
= dirty_ratio_handler
,
1261 .extra2
= &one_hundred
,
1264 .procname
= "dirty_bytes",
1265 .data
= &vm_dirty_bytes
,
1266 .maxlen
= sizeof(vm_dirty_bytes
),
1268 .proc_handler
= dirty_bytes_handler
,
1269 .extra1
= &dirty_bytes_min
,
1272 .procname
= "dirty_writeback_centisecs",
1273 .data
= &dirty_writeback_interval
,
1274 .maxlen
= sizeof(dirty_writeback_interval
),
1276 .proc_handler
= dirty_writeback_centisecs_handler
,
1279 .procname
= "dirty_expire_centisecs",
1280 .data
= &dirty_expire_interval
,
1281 .maxlen
= sizeof(dirty_expire_interval
),
1283 .proc_handler
= proc_dointvec_minmax
,
1287 .procname
= "dirtytime_expire_seconds",
1288 .data
= &dirtytime_expire_interval
,
1289 .maxlen
= sizeof(dirty_expire_interval
),
1291 .proc_handler
= dirtytime_interval_handler
,
1295 .procname
= "nr_pdflush_threads",
1296 .mode
= 0444 /* read-only */,
1297 .proc_handler
= pdflush_proc_obsolete
,
1300 .procname
= "swappiness",
1301 .data
= &vm_swappiness
,
1302 .maxlen
= sizeof(vm_swappiness
),
1304 .proc_handler
= proc_dointvec_minmax
,
1306 .extra2
= &one_hundred
,
1308 #ifdef CONFIG_HUGETLB_PAGE
1310 .procname
= "nr_hugepages",
1312 .maxlen
= sizeof(unsigned long),
1314 .proc_handler
= hugetlb_sysctl_handler
,
1318 .procname
= "nr_hugepages_mempolicy",
1320 .maxlen
= sizeof(unsigned long),
1322 .proc_handler
= &hugetlb_mempolicy_sysctl_handler
,
1326 .procname
= "hugetlb_shm_group",
1327 .data
= &sysctl_hugetlb_shm_group
,
1328 .maxlen
= sizeof(gid_t
),
1330 .proc_handler
= proc_dointvec
,
1333 .procname
= "hugepages_treat_as_movable",
1334 .data
= &hugepages_treat_as_movable
,
1335 .maxlen
= sizeof(int),
1337 .proc_handler
= proc_dointvec
,
1340 .procname
= "nr_overcommit_hugepages",
1342 .maxlen
= sizeof(unsigned long),
1344 .proc_handler
= hugetlb_overcommit_handler
,
1348 .procname
= "lowmem_reserve_ratio",
1349 .data
= &sysctl_lowmem_reserve_ratio
,
1350 .maxlen
= sizeof(sysctl_lowmem_reserve_ratio
),
1352 .proc_handler
= lowmem_reserve_ratio_sysctl_handler
,
1355 .procname
= "drop_caches",
1356 .data
= &sysctl_drop_caches
,
1357 .maxlen
= sizeof(int),
1359 .proc_handler
= drop_caches_sysctl_handler
,
1363 #ifdef CONFIG_COMPACTION
1365 .procname
= "compact_memory",
1366 .data
= &sysctl_compact_memory
,
1367 .maxlen
= sizeof(int),
1369 .proc_handler
= sysctl_compaction_handler
,
1372 .procname
= "extfrag_threshold",
1373 .data
= &sysctl_extfrag_threshold
,
1374 .maxlen
= sizeof(int),
1376 .proc_handler
= sysctl_extfrag_handler
,
1377 .extra1
= &min_extfrag_threshold
,
1378 .extra2
= &max_extfrag_threshold
,
1381 .procname
= "compact_unevictable_allowed",
1382 .data
= &sysctl_compact_unevictable_allowed
,
1383 .maxlen
= sizeof(int),
1385 .proc_handler
= proc_dointvec
,
1390 #endif /* CONFIG_COMPACTION */
1392 .procname
= "min_free_kbytes",
1393 .data
= &min_free_kbytes
,
1394 .maxlen
= sizeof(min_free_kbytes
),
1396 .proc_handler
= min_free_kbytes_sysctl_handler
,
1400 .procname
= "percpu_pagelist_fraction",
1401 .data
= &percpu_pagelist_fraction
,
1402 .maxlen
= sizeof(percpu_pagelist_fraction
),
1404 .proc_handler
= percpu_pagelist_fraction_sysctl_handler
,
1409 .procname
= "max_map_count",
1410 .data
= &sysctl_max_map_count
,
1411 .maxlen
= sizeof(sysctl_max_map_count
),
1413 .proc_handler
= proc_dointvec_minmax
,
1418 .procname
= "nr_trim_pages",
1419 .data
= &sysctl_nr_trim_pages
,
1420 .maxlen
= sizeof(sysctl_nr_trim_pages
),
1422 .proc_handler
= proc_dointvec_minmax
,
1427 .procname
= "laptop_mode",
1428 .data
= &laptop_mode
,
1429 .maxlen
= sizeof(laptop_mode
),
1431 .proc_handler
= proc_dointvec_jiffies
,
1434 .procname
= "block_dump",
1435 .data
= &block_dump
,
1436 .maxlen
= sizeof(block_dump
),
1438 .proc_handler
= proc_dointvec
,
1442 .procname
= "vfs_cache_pressure",
1443 .data
= &sysctl_vfs_cache_pressure
,
1444 .maxlen
= sizeof(sysctl_vfs_cache_pressure
),
1446 .proc_handler
= proc_dointvec
,
1449 #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1451 .procname
= "legacy_va_layout",
1452 .data
= &sysctl_legacy_va_layout
,
1453 .maxlen
= sizeof(sysctl_legacy_va_layout
),
1455 .proc_handler
= proc_dointvec
,
1461 .procname
= "zone_reclaim_mode",
1462 .data
= &zone_reclaim_mode
,
1463 .maxlen
= sizeof(zone_reclaim_mode
),
1465 .proc_handler
= proc_dointvec
,
1469 .procname
= "min_unmapped_ratio",
1470 .data
= &sysctl_min_unmapped_ratio
,
1471 .maxlen
= sizeof(sysctl_min_unmapped_ratio
),
1473 .proc_handler
= sysctl_min_unmapped_ratio_sysctl_handler
,
1475 .extra2
= &one_hundred
,
1478 .procname
= "min_slab_ratio",
1479 .data
= &sysctl_min_slab_ratio
,
1480 .maxlen
= sizeof(sysctl_min_slab_ratio
),
1482 .proc_handler
= sysctl_min_slab_ratio_sysctl_handler
,
1484 .extra2
= &one_hundred
,
1489 .procname
= "stat_interval",
1490 .data
= &sysctl_stat_interval
,
1491 .maxlen
= sizeof(sysctl_stat_interval
),
1493 .proc_handler
= proc_dointvec_jiffies
,
1498 .procname
= "mmap_min_addr",
1499 .data
= &dac_mmap_min_addr
,
1500 .maxlen
= sizeof(unsigned long),
1502 .proc_handler
= mmap_min_addr_handler
,
1507 .procname
= "numa_zonelist_order",
1508 .data
= &numa_zonelist_order
,
1509 .maxlen
= NUMA_ZONELIST_ORDER_LEN
,
1511 .proc_handler
= numa_zonelist_order_handler
,
1514 #if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
1515 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
1517 .procname
= "vdso_enabled",
1518 #ifdef CONFIG_X86_32
1519 .data
= &vdso32_enabled
,
1520 .maxlen
= sizeof(vdso32_enabled
),
1522 .data
= &vdso_enabled
,
1523 .maxlen
= sizeof(vdso_enabled
),
1526 .proc_handler
= proc_dointvec
,
1530 #ifdef CONFIG_HIGHMEM
1532 .procname
= "highmem_is_dirtyable",
1533 .data
= &vm_highmem_is_dirtyable
,
1534 .maxlen
= sizeof(vm_highmem_is_dirtyable
),
1536 .proc_handler
= proc_dointvec_minmax
,
1541 #ifdef CONFIG_MEMORY_FAILURE
1543 .procname
= "memory_failure_early_kill",
1544 .data
= &sysctl_memory_failure_early_kill
,
1545 .maxlen
= sizeof(sysctl_memory_failure_early_kill
),
1547 .proc_handler
= proc_dointvec_minmax
,
1552 .procname
= "memory_failure_recovery",
1553 .data
= &sysctl_memory_failure_recovery
,
1554 .maxlen
= sizeof(sysctl_memory_failure_recovery
),
1556 .proc_handler
= proc_dointvec_minmax
,
1562 .procname
= "user_reserve_kbytes",
1563 .data
= &sysctl_user_reserve_kbytes
,
1564 .maxlen
= sizeof(sysctl_user_reserve_kbytes
),
1566 .proc_handler
= proc_doulongvec_minmax
,
1569 .procname
= "admin_reserve_kbytes",
1570 .data
= &sysctl_admin_reserve_kbytes
,
1571 .maxlen
= sizeof(sysctl_admin_reserve_kbytes
),
1573 .proc_handler
= proc_doulongvec_minmax
,
1578 static struct ctl_table fs_table
[] = {
1580 .procname
= "inode-nr",
1581 .data
= &inodes_stat
,
1582 .maxlen
= 2*sizeof(long),
1584 .proc_handler
= proc_nr_inodes
,
1587 .procname
= "inode-state",
1588 .data
= &inodes_stat
,
1589 .maxlen
= 7*sizeof(long),
1591 .proc_handler
= proc_nr_inodes
,
1594 .procname
= "file-nr",
1595 .data
= &files_stat
,
1596 .maxlen
= sizeof(files_stat
),
1598 .proc_handler
= proc_nr_files
,
1601 .procname
= "file-max",
1602 .data
= &files_stat
.max_files
,
1603 .maxlen
= sizeof(files_stat
.max_files
),
1605 .proc_handler
= proc_doulongvec_minmax
,
1608 .procname
= "nr_open",
1609 .data
= &sysctl_nr_open
,
1610 .maxlen
= sizeof(int),
1612 .proc_handler
= proc_dointvec_minmax
,
1613 .extra1
= &sysctl_nr_open_min
,
1614 .extra2
= &sysctl_nr_open_max
,
1617 .procname
= "dentry-state",
1618 .data
= &dentry_stat
,
1619 .maxlen
= 6*sizeof(long),
1621 .proc_handler
= proc_nr_dentry
,
1624 .procname
= "overflowuid",
1625 .data
= &fs_overflowuid
,
1626 .maxlen
= sizeof(int),
1628 .proc_handler
= proc_dointvec_minmax
,
1629 .extra1
= &minolduid
,
1630 .extra2
= &maxolduid
,
1633 .procname
= "overflowgid",
1634 .data
= &fs_overflowgid
,
1635 .maxlen
= sizeof(int),
1637 .proc_handler
= proc_dointvec_minmax
,
1638 .extra1
= &minolduid
,
1639 .extra2
= &maxolduid
,
1641 #ifdef CONFIG_FILE_LOCKING
1643 .procname
= "leases-enable",
1644 .data
= &leases_enable
,
1645 .maxlen
= sizeof(int),
1647 .proc_handler
= proc_dointvec
,
1650 #ifdef CONFIG_DNOTIFY
1652 .procname
= "dir-notify-enable",
1653 .data
= &dir_notify_enable
,
1654 .maxlen
= sizeof(int),
1656 .proc_handler
= proc_dointvec
,
1660 #ifdef CONFIG_FILE_LOCKING
1662 .procname
= "lease-break-time",
1663 .data
= &lease_break_time
,
1664 .maxlen
= sizeof(int),
1666 .proc_handler
= proc_dointvec
,
1671 .procname
= "aio-nr",
1673 .maxlen
= sizeof(aio_nr
),
1675 .proc_handler
= proc_doulongvec_minmax
,
1678 .procname
= "aio-max-nr",
1679 .data
= &aio_max_nr
,
1680 .maxlen
= sizeof(aio_max_nr
),
1682 .proc_handler
= proc_doulongvec_minmax
,
1684 #endif /* CONFIG_AIO */
1685 #ifdef CONFIG_INOTIFY_USER
1687 .procname
= "inotify",
1689 .child
= inotify_table
,
1694 .procname
= "epoll",
1696 .child
= epoll_table
,
1701 .procname
= "protected_symlinks",
1702 .data
= &sysctl_protected_symlinks
,
1703 .maxlen
= sizeof(int),
1705 .proc_handler
= proc_dointvec_minmax
,
1710 .procname
= "protected_hardlinks",
1711 .data
= &sysctl_protected_hardlinks
,
1712 .maxlen
= sizeof(int),
1714 .proc_handler
= proc_dointvec_minmax
,
1719 .procname
= "suid_dumpable",
1720 .data
= &suid_dumpable
,
1721 .maxlen
= sizeof(int),
1723 .proc_handler
= proc_dointvec_minmax_coredump
,
1727 #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1729 .procname
= "binfmt_misc",
1731 .child
= sysctl_mount_point
,
1735 .procname
= "pipe-max-size",
1736 .data
= &pipe_max_size
,
1737 .maxlen
= sizeof(int),
1739 .proc_handler
= &pipe_proc_fn
,
1740 .extra1
= &pipe_min_size
,
1743 .procname
= "pipe-user-pages-hard",
1744 .data
= &pipe_user_pages_hard
,
1745 .maxlen
= sizeof(pipe_user_pages_hard
),
1747 .proc_handler
= proc_doulongvec_minmax
,
1750 .procname
= "pipe-user-pages-soft",
1751 .data
= &pipe_user_pages_soft
,
1752 .maxlen
= sizeof(pipe_user_pages_soft
),
1754 .proc_handler
= proc_doulongvec_minmax
,
1757 .procname
= "mount-max",
1758 .data
= &sysctl_mount_max
,
1759 .maxlen
= sizeof(unsigned int),
1761 .proc_handler
= proc_dointvec_minmax
,
1767 static struct ctl_table debug_table
[] = {
1768 #ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1770 .procname
= "exception-trace",
1771 .data
= &show_unhandled_signals
,
1772 .maxlen
= sizeof(int),
1774 .proc_handler
= proc_dointvec
1777 #if defined(CONFIG_OPTPROBES)
1779 .procname
= "kprobes-optimization",
1780 .data
= &sysctl_kprobes_optimization
,
1781 .maxlen
= sizeof(int),
1783 .proc_handler
= proc_kprobes_optimization_handler
,
1791 static struct ctl_table dev_table
[] = {
1795 int __init
sysctl_init(void)
1797 struct ctl_table_header
*hdr
;
1799 hdr
= register_sysctl_table(sysctl_base_table
);
1800 kmemleak_not_leak(hdr
);
1804 #endif /* CONFIG_SYSCTL */
1810 #ifdef CONFIG_PROC_SYSCTL
1812 static int _proc_do_string(char *data
, int maxlen
, int write
,
1813 char __user
*buffer
,
1814 size_t *lenp
, loff_t
*ppos
)
1820 if (!data
|| !maxlen
|| !*lenp
) {
1826 if (sysctl_writes_strict
== SYSCTL_WRITES_STRICT
) {
1827 /* Only continue writes not past the end of buffer. */
1829 if (len
> maxlen
- 1)
1836 /* Start writing from beginning of buffer. */
1842 while ((p
- buffer
) < *lenp
&& len
< maxlen
- 1) {
1843 if (get_user(c
, p
++))
1845 if (c
== 0 || c
== '\n')
1866 if (copy_to_user(buffer
, data
, len
))
1869 if (put_user('\n', buffer
+ len
))
1879 static void warn_sysctl_write(struct ctl_table
*table
)
1881 pr_warn_once("%s wrote to %s when file position was not 0!\n"
1882 "This will not be supported in the future. To silence this\n"
1883 "warning, set kernel.sysctl_writes_strict = -1\n",
1884 current
->comm
, table
->procname
);
1888 * proc_dostring - read a string sysctl
1889 * @table: the sysctl table
1890 * @write: %TRUE if this is a write to the sysctl file
1891 * @buffer: the user buffer
1892 * @lenp: the size of the user buffer
1893 * @ppos: file position
1895 * Reads/writes a string from/to the user buffer. If the kernel
1896 * buffer provided is not large enough to hold the string, the
1897 * string is truncated. The copied string is %NULL-terminated.
1898 * If the string is being read by the user process, it is copied
1899 * and a newline '\n' is added. It is truncated if the buffer is
1902 * Returns 0 on success.
1904 int proc_dostring(struct ctl_table
*table
, int write
,
1905 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
1907 if (write
&& *ppos
&& sysctl_writes_strict
== SYSCTL_WRITES_WARN
)
1908 warn_sysctl_write(table
);
1910 return _proc_do_string((char *)(table
->data
), table
->maxlen
, write
,
1911 (char __user
*)buffer
, lenp
, ppos
);
1914 static size_t proc_skip_spaces(char **buf
)
1917 char *tmp
= skip_spaces(*buf
);
1923 static void proc_skip_char(char **buf
, size_t *size
, const char v
)
1933 #define TMPBUFLEN 22
1935 * proc_get_long - reads an ASCII formatted integer from a user buffer
1937 * @buf: a kernel buffer
1938 * @size: size of the kernel buffer
1939 * @val: this is where the number will be stored
1940 * @neg: set to %TRUE if number is negative
1941 * @perm_tr: a vector which contains the allowed trailers
1942 * @perm_tr_len: size of the perm_tr vector
1943 * @tr: pointer to store the trailer character
1945 * In case of success %0 is returned and @buf and @size are updated with
1946 * the amount of bytes read. If @tr is non-NULL and a trailing
1947 * character exists (size is non-zero after returning from this
1948 * function), @tr is updated with the trailing character.
1950 static int proc_get_long(char **buf
, size_t *size
,
1951 unsigned long *val
, bool *neg
,
1952 const char *perm_tr
, unsigned perm_tr_len
, char *tr
)
1955 char *p
, tmp
[TMPBUFLEN
];
1961 if (len
> TMPBUFLEN
- 1)
1962 len
= TMPBUFLEN
- 1;
1964 memcpy(tmp
, *buf
, len
);
1968 if (*p
== '-' && *size
> 1) {
1976 *val
= simple_strtoul(p
, &p
, 0);
1980 /* We don't know if the next char is whitespace thus we may accept
1981 * invalid integers (e.g. 1234...a) or two integers instead of one
1982 * (e.g. 123...1). So lets not allow such large numbers. */
1983 if (len
== TMPBUFLEN
- 1)
1986 if (len
< *size
&& perm_tr_len
&& !memchr(perm_tr
, *p
, perm_tr_len
))
1989 if (tr
&& (len
< *size
))
1999 * proc_put_long - converts an integer to a decimal ASCII formatted string
2001 * @buf: the user buffer
2002 * @size: the size of the user buffer
2003 * @val: the integer to be converted
2004 * @neg: sign of the number, %TRUE for negative
2006 * In case of success %0 is returned and @buf and @size are updated with
2007 * the amount of bytes written.
2009 static int proc_put_long(void __user
**buf
, size_t *size
, unsigned long val
,
2013 char tmp
[TMPBUFLEN
], *p
= tmp
;
2015 sprintf(p
, "%s%lu", neg
? "-" : "", val
);
2019 if (copy_to_user(*buf
, tmp
, len
))
2027 static int proc_put_char(void __user
**buf
, size_t *size
, char c
)
2030 char __user
**buffer
= (char __user
**)buf
;
2031 if (put_user(c
, *buffer
))
2033 (*size
)--, (*buffer
)++;
2039 static int do_proc_dointvec_conv(bool *negp
, unsigned long *lvalp
,
2041 int write
, void *data
)
2045 if (*lvalp
> (unsigned long) INT_MAX
+ 1)
2049 if (*lvalp
> (unsigned long) INT_MAX
)
2057 *lvalp
= -(unsigned long)val
;
2060 *lvalp
= (unsigned long)val
;
2066 static int do_proc_douintvec_conv(bool *negp
, unsigned long *lvalp
,
2068 int write
, void *data
)
2073 if (*lvalp
> UINT_MAX
)
2077 unsigned int val
= *valp
;
2079 *lvalp
= (unsigned long)val
;
2084 static const char proc_wspace_sep
[] = { ' ', '\t', '\n' };
2086 static int __do_proc_dointvec(void *tbl_data
, struct ctl_table
*table
,
2087 int write
, void __user
*buffer
,
2088 size_t *lenp
, loff_t
*ppos
,
2089 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2090 int write
, void *data
),
2093 int *i
, vleft
, first
= 1, err
= 0;
2094 unsigned long page
= 0;
2098 if (!tbl_data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2103 i
= (int *) tbl_data
;
2104 vleft
= table
->maxlen
/ sizeof(*i
);
2108 conv
= do_proc_dointvec_conv
;
2112 switch (sysctl_writes_strict
) {
2113 case SYSCTL_WRITES_STRICT
:
2115 case SYSCTL_WRITES_WARN
:
2116 warn_sysctl_write(table
);
2123 if (left
> PAGE_SIZE
- 1)
2124 left
= PAGE_SIZE
- 1;
2125 page
= __get_free_page(GFP_TEMPORARY
);
2126 kbuf
= (char *) page
;
2129 if (copy_from_user(kbuf
, buffer
, left
)) {
2136 for (; left
&& vleft
--; i
++, first
=0) {
2141 left
-= proc_skip_spaces(&kbuf
);
2145 err
= proc_get_long(&kbuf
, &left
, &lval
, &neg
,
2147 sizeof(proc_wspace_sep
), NULL
);
2150 if (conv(&neg
, &lval
, i
, 1, data
)) {
2155 if (conv(&neg
, &lval
, i
, 0, data
)) {
2160 err
= proc_put_char(&buffer
, &left
, '\t');
2163 err
= proc_put_long(&buffer
, &left
, lval
, neg
);
2169 if (!write
&& !first
&& left
&& !err
)
2170 err
= proc_put_char(&buffer
, &left
, '\n');
2171 if (write
&& !err
&& left
)
2172 left
-= proc_skip_spaces(&kbuf
);
2177 return err
? : -EINVAL
;
2185 static int do_proc_dointvec(struct ctl_table
*table
, int write
,
2186 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
,
2187 int (*conv
)(bool *negp
, unsigned long *lvalp
, int *valp
,
2188 int write
, void *data
),
2191 return __do_proc_dointvec(table
->data
, table
, write
,
2192 buffer
, lenp
, ppos
, conv
, data
);
2196 * proc_dointvec - read a vector of integers
2197 * @table: the sysctl table
2198 * @write: %TRUE if this is a write to the sysctl file
2199 * @buffer: the user buffer
2200 * @lenp: the size of the user buffer
2201 * @ppos: file position
2203 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2204 * values from/to the user buffer, treated as an ASCII string.
2206 * Returns 0 on success.
2208 int proc_dointvec(struct ctl_table
*table
, int write
,
2209 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2211 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
, NULL
, NULL
);
2215 * proc_douintvec - read a vector of unsigned integers
2216 * @table: the sysctl table
2217 * @write: %TRUE if this is a write to the sysctl file
2218 * @buffer: the user buffer
2219 * @lenp: the size of the user buffer
2220 * @ppos: file position
2222 * Reads/writes up to table->maxlen/sizeof(unsigned int) unsigned integer
2223 * values from/to the user buffer, treated as an ASCII string.
2225 * Returns 0 on success.
2227 int proc_douintvec(struct ctl_table
*table
, int write
,
2228 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2230 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2231 do_proc_douintvec_conv
, NULL
);
2235 * Taint values can only be increased
2236 * This means we can safely use a temporary.
2238 static int proc_taint(struct ctl_table
*table
, int write
,
2239 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2242 unsigned long tmptaint
= get_taint();
2245 if (write
&& !capable(CAP_SYS_ADMIN
))
2250 err
= proc_doulongvec_minmax(&t
, write
, buffer
, lenp
, ppos
);
2256 * Poor man's atomic or. Not worth adding a primitive
2257 * to everyone's atomic.h for this
2260 for (i
= 0; i
< BITS_PER_LONG
&& tmptaint
>> i
; i
++) {
2261 if ((tmptaint
>> i
) & 1)
2262 add_taint(i
, LOCKDEP_STILL_OK
);
2269 #ifdef CONFIG_PRINTK
2270 static int proc_dointvec_minmax_sysadmin(struct ctl_table
*table
, int write
,
2271 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2273 if (write
&& !capable(CAP_SYS_ADMIN
))
2276 return proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2280 struct do_proc_dointvec_minmax_conv_param
{
2285 static int do_proc_dointvec_minmax_conv(bool *negp
, unsigned long *lvalp
,
2287 int write
, void *data
)
2289 struct do_proc_dointvec_minmax_conv_param
*param
= data
;
2291 int val
= *negp
? -*lvalp
: *lvalp
;
2292 if ((param
->min
&& *param
->min
> val
) ||
2293 (param
->max
&& *param
->max
< val
))
2300 *lvalp
= -(unsigned long)val
;
2303 *lvalp
= (unsigned long)val
;
2310 * proc_dointvec_minmax - read a vector of integers with min/max values
2311 * @table: the sysctl table
2312 * @write: %TRUE if this is a write to the sysctl file
2313 * @buffer: the user buffer
2314 * @lenp: the size of the user buffer
2315 * @ppos: file position
2317 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2318 * values from/to the user buffer, treated as an ASCII string.
2320 * This routine will ensure the values are within the range specified by
2321 * table->extra1 (min) and table->extra2 (max).
2323 * Returns 0 on success.
2325 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2326 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2328 struct do_proc_dointvec_minmax_conv_param param
= {
2329 .min
= (int *) table
->extra1
,
2330 .max
= (int *) table
->extra2
,
2332 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2333 do_proc_dointvec_minmax_conv
, ¶m
);
2336 static void validate_coredump_safety(void)
2338 #ifdef CONFIG_COREDUMP
2339 if (suid_dumpable
== SUID_DUMP_ROOT
&&
2340 core_pattern
[0] != '/' && core_pattern
[0] != '|') {
2341 printk(KERN_WARNING
"Unsafe core_pattern used with "\
2342 "suid_dumpable=2. Pipe handler or fully qualified "\
2343 "core dump path required.\n");
2348 static int proc_dointvec_minmax_coredump(struct ctl_table
*table
, int write
,
2349 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2351 int error
= proc_dointvec_minmax(table
, write
, buffer
, lenp
, ppos
);
2353 validate_coredump_safety();
2357 #ifdef CONFIG_COREDUMP
2358 static int proc_dostring_coredump(struct ctl_table
*table
, int write
,
2359 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2361 int error
= proc_dostring(table
, write
, buffer
, lenp
, ppos
);
2363 validate_coredump_safety();
2368 static int __do_proc_doulongvec_minmax(void *data
, struct ctl_table
*table
, int write
,
2369 void __user
*buffer
,
2370 size_t *lenp
, loff_t
*ppos
,
2371 unsigned long convmul
,
2372 unsigned long convdiv
)
2374 unsigned long *i
, *min
, *max
;
2375 int vleft
, first
= 1, err
= 0;
2376 unsigned long page
= 0;
2380 if (!data
|| !table
->maxlen
|| !*lenp
|| (*ppos
&& !write
)) {
2385 i
= (unsigned long *) data
;
2386 min
= (unsigned long *) table
->extra1
;
2387 max
= (unsigned long *) table
->extra2
;
2388 vleft
= table
->maxlen
/ sizeof(unsigned long);
2393 switch (sysctl_writes_strict
) {
2394 case SYSCTL_WRITES_STRICT
:
2396 case SYSCTL_WRITES_WARN
:
2397 warn_sysctl_write(table
);
2404 if (left
> PAGE_SIZE
- 1)
2405 left
= PAGE_SIZE
- 1;
2406 page
= __get_free_page(GFP_TEMPORARY
);
2407 kbuf
= (char *) page
;
2410 if (copy_from_user(kbuf
, buffer
, left
)) {
2417 for (; left
&& vleft
--; i
++, first
= 0) {
2423 left
-= proc_skip_spaces(&kbuf
);
2425 err
= proc_get_long(&kbuf
, &left
, &val
, &neg
,
2427 sizeof(proc_wspace_sep
), NULL
);
2432 val
= convmul
* val
/ convdiv
;
2433 if ((min
&& val
< *min
) || (max
&& val
> *max
))
2437 val
= convdiv
* (*i
) / convmul
;
2439 err
= proc_put_char(&buffer
, &left
, '\t');
2443 err
= proc_put_long(&buffer
, &left
, val
, false);
2449 if (!write
&& !first
&& left
&& !err
)
2450 err
= proc_put_char(&buffer
, &left
, '\n');
2452 left
-= proc_skip_spaces(&kbuf
);
2457 return err
? : -EINVAL
;
2465 static int do_proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2466 void __user
*buffer
,
2467 size_t *lenp
, loff_t
*ppos
,
2468 unsigned long convmul
,
2469 unsigned long convdiv
)
2471 return __do_proc_doulongvec_minmax(table
->data
, table
, write
,
2472 buffer
, lenp
, ppos
, convmul
, convdiv
);
2476 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2477 * @table: the sysctl table
2478 * @write: %TRUE if this is a write to the sysctl file
2479 * @buffer: the user buffer
2480 * @lenp: the size of the user buffer
2481 * @ppos: file position
2483 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2484 * values from/to the user buffer, treated as an ASCII string.
2486 * This routine will ensure the values are within the range specified by
2487 * table->extra1 (min) and table->extra2 (max).
2489 * Returns 0 on success.
2491 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2492 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2494 return do_proc_doulongvec_minmax(table
, write
, buffer
, lenp
, ppos
, 1l, 1l);
2498 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2499 * @table: the sysctl table
2500 * @write: %TRUE if this is a write to the sysctl file
2501 * @buffer: the user buffer
2502 * @lenp: the size of the user buffer
2503 * @ppos: file position
2505 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2506 * values from/to the user buffer, treated as an ASCII string. The values
2507 * are treated as milliseconds, and converted to jiffies when they are stored.
2509 * This routine will ensure the values are within the range specified by
2510 * table->extra1 (min) and table->extra2 (max).
2512 * Returns 0 on success.
2514 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2515 void __user
*buffer
,
2516 size_t *lenp
, loff_t
*ppos
)
2518 return do_proc_doulongvec_minmax(table
, write
, buffer
,
2519 lenp
, ppos
, HZ
, 1000l);
2523 static int do_proc_dointvec_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2525 int write
, void *data
)
2528 if (*lvalp
> LONG_MAX
/ HZ
)
2530 *valp
= *negp
? -(*lvalp
*HZ
) : (*lvalp
*HZ
);
2536 lval
= -(unsigned long)val
;
2539 lval
= (unsigned long)val
;
2546 static int do_proc_dointvec_userhz_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2548 int write
, void *data
)
2551 if (USER_HZ
< HZ
&& *lvalp
> (LONG_MAX
/ HZ
) * USER_HZ
)
2553 *valp
= clock_t_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2559 lval
= -(unsigned long)val
;
2562 lval
= (unsigned long)val
;
2564 *lvalp
= jiffies_to_clock_t(lval
);
2569 static int do_proc_dointvec_ms_jiffies_conv(bool *negp
, unsigned long *lvalp
,
2571 int write
, void *data
)
2574 unsigned long jif
= msecs_to_jiffies(*negp
? -*lvalp
: *lvalp
);
2584 lval
= -(unsigned long)val
;
2587 lval
= (unsigned long)val
;
2589 *lvalp
= jiffies_to_msecs(lval
);
2595 * proc_dointvec_jiffies - read a vector of integers as seconds
2596 * @table: the sysctl table
2597 * @write: %TRUE if this is a write to the sysctl file
2598 * @buffer: the user buffer
2599 * @lenp: the size of the user buffer
2600 * @ppos: file position
2602 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2603 * values from/to the user buffer, treated as an ASCII string.
2604 * The values read are assumed to be in seconds, and are converted into
2607 * Returns 0 on success.
2609 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2610 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2612 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2613 do_proc_dointvec_jiffies_conv
,NULL
);
2617 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2618 * @table: the sysctl table
2619 * @write: %TRUE if this is a write to the sysctl file
2620 * @buffer: the user buffer
2621 * @lenp: the size of the user buffer
2622 * @ppos: pointer to the file position
2624 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2625 * values from/to the user buffer, treated as an ASCII string.
2626 * The values read are assumed to be in 1/USER_HZ seconds, and
2627 * are converted into jiffies.
2629 * Returns 0 on success.
2631 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2632 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2634 return do_proc_dointvec(table
,write
,buffer
,lenp
,ppos
,
2635 do_proc_dointvec_userhz_jiffies_conv
,NULL
);
2639 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2640 * @table: the sysctl table
2641 * @write: %TRUE if this is a write to the sysctl file
2642 * @buffer: the user buffer
2643 * @lenp: the size of the user buffer
2644 * @ppos: file position
2645 * @ppos: the current position in the file
2647 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2648 * values from/to the user buffer, treated as an ASCII string.
2649 * The values read are assumed to be in 1/1000 seconds, and
2650 * are converted into jiffies.
2652 * Returns 0 on success.
2654 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2655 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2657 return do_proc_dointvec(table
, write
, buffer
, lenp
, ppos
,
2658 do_proc_dointvec_ms_jiffies_conv
, NULL
);
2661 static int proc_do_cad_pid(struct ctl_table
*table
, int write
,
2662 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2664 struct pid
*new_pid
;
2668 tmp
= pid_vnr(cad_pid
);
2670 r
= __do_proc_dointvec(&tmp
, table
, write
, buffer
,
2671 lenp
, ppos
, NULL
, NULL
);
2675 new_pid
= find_get_pid(tmp
);
2679 put_pid(xchg(&cad_pid
, new_pid
));
2684 * proc_do_large_bitmap - read/write from/to a large bitmap
2685 * @table: the sysctl table
2686 * @write: %TRUE if this is a write to the sysctl file
2687 * @buffer: the user buffer
2688 * @lenp: the size of the user buffer
2689 * @ppos: file position
2691 * The bitmap is stored at table->data and the bitmap length (in bits)
2694 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2695 * large bitmaps may be represented in a compact manner. Writing into
2696 * the file will clear the bitmap then update it with the given input.
2698 * Returns 0 on success.
2700 int proc_do_large_bitmap(struct ctl_table
*table
, int write
,
2701 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2705 size_t left
= *lenp
;
2706 unsigned long bitmap_len
= table
->maxlen
;
2707 unsigned long *bitmap
= *(unsigned long **) table
->data
;
2708 unsigned long *tmp_bitmap
= NULL
;
2709 char tr_a
[] = { '-', ',', '\n' }, tr_b
[] = { ',', '\n', 0 }, c
;
2711 if (!bitmap
|| !bitmap_len
|| !left
|| (*ppos
&& !write
)) {
2717 unsigned long page
= 0;
2720 if (left
> PAGE_SIZE
- 1)
2721 left
= PAGE_SIZE
- 1;
2723 page
= __get_free_page(GFP_TEMPORARY
);
2724 kbuf
= (char *) page
;
2727 if (copy_from_user(kbuf
, buffer
, left
)) {
2733 tmp_bitmap
= kzalloc(BITS_TO_LONGS(bitmap_len
) * sizeof(unsigned long),
2739 proc_skip_char(&kbuf
, &left
, '\n');
2740 while (!err
&& left
) {
2741 unsigned long val_a
, val_b
;
2744 err
= proc_get_long(&kbuf
, &left
, &val_a
, &neg
, tr_a
,
2748 if (val_a
>= bitmap_len
|| neg
) {
2760 err
= proc_get_long(&kbuf
, &left
, &val_b
,
2761 &neg
, tr_b
, sizeof(tr_b
),
2765 if (val_b
>= bitmap_len
|| neg
||
2776 bitmap_set(tmp_bitmap
, val_a
, val_b
- val_a
+ 1);
2778 proc_skip_char(&kbuf
, &left
, '\n');
2782 unsigned long bit_a
, bit_b
= 0;
2785 bit_a
= find_next_bit(bitmap
, bitmap_len
, bit_b
);
2786 if (bit_a
>= bitmap_len
)
2788 bit_b
= find_next_zero_bit(bitmap
, bitmap_len
,
2792 err
= proc_put_char(&buffer
, &left
, ',');
2796 err
= proc_put_long(&buffer
, &left
, bit_a
, false);
2799 if (bit_a
!= bit_b
) {
2800 err
= proc_put_char(&buffer
, &left
, '-');
2803 err
= proc_put_long(&buffer
, &left
, bit_b
, false);
2811 err
= proc_put_char(&buffer
, &left
, '\n');
2817 bitmap_or(bitmap
, bitmap
, tmp_bitmap
, bitmap_len
);
2819 bitmap_copy(bitmap
, tmp_bitmap
, bitmap_len
);
2831 #else /* CONFIG_PROC_SYSCTL */
2833 int proc_dostring(struct ctl_table
*table
, int write
,
2834 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2839 int proc_dointvec(struct ctl_table
*table
, int write
,
2840 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2845 int proc_douintvec(struct ctl_table
*table
, int write
,
2846 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2851 int proc_dointvec_minmax(struct ctl_table
*table
, int write
,
2852 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2857 int proc_dointvec_jiffies(struct ctl_table
*table
, int write
,
2858 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2863 int proc_dointvec_userhz_jiffies(struct ctl_table
*table
, int write
,
2864 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2869 int proc_dointvec_ms_jiffies(struct ctl_table
*table
, int write
,
2870 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2875 int proc_doulongvec_minmax(struct ctl_table
*table
, int write
,
2876 void __user
*buffer
, size_t *lenp
, loff_t
*ppos
)
2881 int proc_doulongvec_ms_jiffies_minmax(struct ctl_table
*table
, int write
,
2882 void __user
*buffer
,
2883 size_t *lenp
, loff_t
*ppos
)
2889 #endif /* CONFIG_PROC_SYSCTL */
2892 * No sense putting this after each symbol definition, twice,
2893 * exception granted :-)
2895 EXPORT_SYMBOL(proc_dointvec
);
2896 EXPORT_SYMBOL(proc_douintvec
);
2897 EXPORT_SYMBOL(proc_dointvec_jiffies
);
2898 EXPORT_SYMBOL(proc_dointvec_minmax
);
2899 EXPORT_SYMBOL(proc_dointvec_userhz_jiffies
);
2900 EXPORT_SYMBOL(proc_dointvec_ms_jiffies
);
2901 EXPORT_SYMBOL(proc_dostring
);
2902 EXPORT_SYMBOL(proc_doulongvec_minmax
);
2903 EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax
);