blob: 4ab11879aeb4d15baa3d8d25fa753725084ed809 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070033#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/init.h>
35#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010036#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030037#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/sysrq.h>
39#include <linux/highuid.h>
40#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020041#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070042#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070045#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/times.h>
47#include <linux/limits.h>
48#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020049#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070051#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080052#include <linux/nfs_fs.h>
53#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070054#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020055#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020056#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050057#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020058#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070059#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040060#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070061#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000062#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#include <asm/uaccess.h>
65#include <asm/processor.h>
66
Andi Kleen29cbc782006-09-30 01:47:55 +020067#ifdef CONFIG_X86
68#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010069#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010070#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020071#endif
David Howellsd550bbd2012-03-28 18:30:03 +010072#ifdef CONFIG_SPARC
73#include <asm/setup.h>
74#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080075#ifdef CONFIG_BSD_PROCESS_ACCT
76#include <linux/acct.h>
77#endif
Dave Young4f0e0562010-03-10 15:24:09 -080078#ifdef CONFIG_RT_MUTEXES
79#include <linux/rtmutex.h>
80#endif
Dave Young2edf5e42010-03-10 15:24:10 -080081#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
82#include <linux/lockdep.h>
83#endif
Dave Young15485a42010-03-10 15:24:07 -080084#ifdef CONFIG_CHR_DEV_SG
85#include <scsi/sg.h>
86#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020087
Don Zickus58687ac2010-05-07 17:11:44 -040088#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050089#include <linux/nmi.h>
90#endif
91
Eric W. Biederman7058cb02007-10-18 03:05:58 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#if defined(CONFIG_SYSCTL)
94
95/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int sysctl_overcommit_memory;
97extern int sysctl_overcommit_ratio;
98extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700100extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700102extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103extern int pid_max;
104extern int min_free_kbytes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800106extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800107extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200108extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100109extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400110extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000111#ifndef CONFIG_MMU
112extern int sysctl_nr_trim_pages;
113#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200114#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200115extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200116#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700118/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400119#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700120static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200121static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700122#endif
123
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700125static int __maybe_unused one = 1;
126static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700127static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800128static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700129static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700130#ifdef CONFIG_PRINTK
131static int ten_thousand = 10000;
132#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700133
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700134/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
135static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
138static int maxolduid = 65535;
139static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800140static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700143static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
Dave Youngd14f1722010-02-25 20:28:57 -0500145#ifdef CONFIG_INOTIFY_USER
146#include <linux/inotify.h>
147#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700148#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149#endif
150
David S. Miller08714202008-11-16 23:49:24 -0800151#ifdef CONFIG_SPARC64
152extern int sysctl_tsb_ratio;
153#endif
154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#ifdef __hppa__
156extern int pwrsw_enabled;
157extern int unaligned_enabled;
158#endif
159
Jes Sorensend2b176e2006-02-28 09:42:23 -0800160#ifdef CONFIG_IA64
161extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800162extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800163#endif
164
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700165#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700166static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700167 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700168static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800169 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700170#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700171
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700172#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700173static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700174 void __user *buffer, size_t *lenp, loff_t *ppos);
175#endif
176
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700177#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800178/* Note: sysrq code uses it's own private copy */
179static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700180
181static int sysrq_sysctl_handler(ctl_table *table, int write,
182 void __user *buffer, size_t *lenp,
183 loff_t *ppos)
184{
185 int error;
186
187 error = proc_dointvec(table, write, buffer, lenp, ppos);
188 if (error)
189 return error;
190
191 if (write)
192 sysrq_toggle_support(__sysrq_enabled);
193
194 return 0;
195}
196
197#endif
198
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700199static struct ctl_table kern_table[];
200static struct ctl_table vm_table[];
201static struct ctl_table fs_table[];
202static struct ctl_table debug_table[];
203static struct ctl_table dev_table[];
204extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800205#ifdef CONFIG_EPOLL
206extern struct ctl_table epoll_table[];
207#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
209#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
210int sysctl_legacy_va_layout;
211#endif
212
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213/* The default sysctl tables: */
214
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800215static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 .procname = "kernel",
218 .mode = 0555,
219 .child = kern_table,
220 },
221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 .procname = "vm",
223 .mode = 0555,
224 .child = vm_table,
225 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 .procname = "fs",
228 .mode = 0555,
229 .child = fs_table,
230 },
231 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 .procname = "debug",
233 .mode = 0555,
234 .child = debug_table,
235 },
236 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 .procname = "dev",
238 .mode = 0555,
239 .child = dev_table,
240 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700241 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242};
243
Ingo Molnar77e54a12007-07-09 18:52:00 +0200244#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100245static int min_sched_granularity_ns = 100000; /* 100 usecs */
246static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
247static int min_wakeup_granularity_ns; /* 0 usecs */
248static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100249static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
250static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200251#endif
252
Mel Gorman5e771902010-05-24 14:32:31 -0700253#ifdef CONFIG_COMPACTION
254static int min_extfrag_threshold;
255static int max_extfrag_threshold = 1000;
256#endif
257
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700258static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200259 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200260 .procname = "sched_child_runs_first",
261 .data = &sysctl_sched_child_runs_first,
262 .maxlen = sizeof(unsigned int),
263 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800264 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200265 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200266#ifdef CONFIG_SCHED_DEBUG
267 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100268 .procname = "sched_min_granularity_ns",
269 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200270 .maxlen = sizeof(unsigned int),
271 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800272 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100273 .extra1 = &min_sched_granularity_ns,
274 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200275 },
276 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200277 .procname = "sched_latency_ns",
278 .data = &sysctl_sched_latency,
279 .maxlen = sizeof(unsigned int),
280 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800281 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200282 .extra1 = &min_sched_granularity_ns,
283 .extra2 = &max_sched_granularity_ns,
284 },
285 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200286 .procname = "sched_wakeup_granularity_ns",
287 .data = &sysctl_sched_wakeup_granularity,
288 .maxlen = sizeof(unsigned int),
289 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800290 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200291 .extra1 = &min_wakeup_granularity_ns,
292 .extra2 = &max_wakeup_granularity_ns,
293 },
294 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100295 .procname = "sched_tunable_scaling",
296 .data = &sysctl_sched_tunable_scaling,
297 .maxlen = sizeof(enum sched_tunable_scaling),
298 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800299 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100300 .extra1 = &min_sched_tunable_scaling,
301 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200302 },
303 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200304 .procname = "sched_migration_cost",
305 .data = &sysctl_sched_migration_cost,
306 .maxlen = sizeof(unsigned int),
307 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800308 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200309 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100310 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100311 .procname = "sched_nr_migrate",
312 .data = &sysctl_sched_nr_migrate,
313 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100314 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800315 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100316 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530317 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200318 .procname = "sched_time_avg",
319 .data = &sysctl_sched_time_avg,
320 .maxlen = sizeof(unsigned int),
321 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800322 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200323 },
324 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800325 .procname = "sched_shares_window",
326 .data = &sysctl_sched_shares_window,
327 .maxlen = sizeof(unsigned int),
328 .mode = 0644,
329 .proc_handler = proc_dointvec,
330 },
331 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530332 .procname = "timer_migration",
333 .data = &sysctl_timer_migration,
334 .maxlen = sizeof(unsigned int),
335 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800336 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530337 .extra1 = &zero,
338 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530339 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200340#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200341 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100342 .procname = "sched_rt_period_us",
343 .data = &sysctl_sched_rt_period,
344 .maxlen = sizeof(unsigned int),
345 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800346 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100347 },
348 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100349 .procname = "sched_rt_runtime_us",
350 .data = &sysctl_sched_rt_runtime,
351 .maxlen = sizeof(int),
352 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800353 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100354 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100355#ifdef CONFIG_SCHED_AUTOGROUP
356 {
357 .procname = "sched_autogroup_enabled",
358 .data = &sysctl_sched_autogroup_enabled,
359 .maxlen = sizeof(unsigned int),
360 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800361 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100362 .extra1 = &zero,
363 .extra2 = &one,
364 },
365#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700366#ifdef CONFIG_CFS_BANDWIDTH
367 {
368 .procname = "sched_cfs_bandwidth_slice_us",
369 .data = &sysctl_sched_cfs_bandwidth_slice,
370 .maxlen = sizeof(unsigned int),
371 .mode = 0644,
372 .proc_handler = proc_dointvec_minmax,
373 .extra1 = &one,
374 },
375#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700376#ifdef CONFIG_PROVE_LOCKING
377 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700378 .procname = "prove_locking",
379 .data = &prove_locking,
380 .maxlen = sizeof(int),
381 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800382 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700383 },
384#endif
385#ifdef CONFIG_LOCK_STAT
386 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700387 .procname = "lock_stat",
388 .data = &lock_stat,
389 .maxlen = sizeof(int),
390 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800391 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700392 },
393#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200394 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 .procname = "panic",
396 .data = &panic_timeout,
397 .maxlen = sizeof(int),
398 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800399 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 },
401 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 .procname = "core_uses_pid",
403 .data = &core_uses_pid,
404 .maxlen = sizeof(int),
405 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800406 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 },
408 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 .procname = "core_pattern",
410 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700411 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800413 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 },
Neil Hormana2939802009-09-23 15:56:56 -0700415 {
Neil Hormana2939802009-09-23 15:56:56 -0700416 .procname = "core_pipe_limit",
417 .data = &core_pipe_limit,
418 .maxlen = sizeof(unsigned int),
419 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800420 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700421 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800422#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700425 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800426 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800427 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800429#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100430#ifdef CONFIG_LATENCYTOP
431 {
432 .procname = "latencytop",
433 .data = &latencytop_enabled,
434 .maxlen = sizeof(int),
435 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800436 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100437 },
438#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439#ifdef CONFIG_BLK_DEV_INITRD
440 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 .procname = "real-root-dev",
442 .data = &real_root_dev,
443 .maxlen = sizeof(int),
444 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800445 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 },
447#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700448 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700449 .procname = "print-fatal-signals",
450 .data = &print_fatal_signals,
451 .maxlen = sizeof(int),
452 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800453 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700454 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700455#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 .procname = "reboot-cmd",
458 .data = reboot_command,
459 .maxlen = 256,
460 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800461 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 },
463 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 .procname = "stop-a",
465 .data = &stop_a_enabled,
466 .maxlen = sizeof (int),
467 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800468 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 },
470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 .procname = "scons-poweroff",
472 .data = &scons_pwroff,
473 .maxlen = sizeof (int),
474 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800475 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 },
477#endif
David S. Miller08714202008-11-16 23:49:24 -0800478#ifdef CONFIG_SPARC64
479 {
David S. Miller08714202008-11-16 23:49:24 -0800480 .procname = "tsb-ratio",
481 .data = &sysctl_tsb_ratio,
482 .maxlen = sizeof (int),
483 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800484 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800485 },
486#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487#ifdef __hppa__
488 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 .procname = "soft-power",
490 .data = &pwrsw_enabled,
491 .maxlen = sizeof (int),
492 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800493 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 },
495 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 .procname = "unaligned-trap",
497 .data = &unaligned_enabled,
498 .maxlen = sizeof (int),
499 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800500 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 },
502#endif
503 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504 .procname = "ctrl-alt-del",
505 .data = &C_A_D,
506 .maxlen = sizeof(int),
507 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800508 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400510#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200511 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200512 .procname = "ftrace_enabled",
513 .data = &ftrace_enabled,
514 .maxlen = sizeof(int),
515 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800516 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200517 },
518#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500519#ifdef CONFIG_STACK_TRACER
520 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500521 .procname = "stack_tracer_enabled",
522 .data = &stack_tracer_enabled,
523 .maxlen = sizeof(int),
524 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800525 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500526 },
527#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400528#ifdef CONFIG_TRACING
529 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100530 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400531 .data = &ftrace_dump_on_oops,
532 .maxlen = sizeof(int),
533 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800534 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400535 },
536#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200537#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 .procname = "modprobe",
540 .data = &modprobe_path,
541 .maxlen = KMOD_PATH_LEN,
542 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800543 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 },
Kees Cook3d433212009-04-02 15:49:29 -0700545 {
Kees Cook3d433212009-04-02 15:49:29 -0700546 .procname = "modules_disabled",
547 .data = &modules_disabled,
548 .maxlen = sizeof(int),
549 .mode = 0644,
550 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800551 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700552 .extra1 = &one,
553 .extra2 = &one,
554 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100556#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100559 .data = &uevent_helper,
560 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800562 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 },
564#endif
565#ifdef CONFIG_CHR_DEV_SG
566 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .procname = "sg-big-buff",
568 .data = &sg_big_buff,
569 .maxlen = sizeof (int),
570 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800571 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 },
573#endif
574#ifdef CONFIG_BSD_PROCESS_ACCT
575 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576 .procname = "acct",
577 .data = &acct_parm,
578 .maxlen = 3*sizeof(int),
579 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800580 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 },
582#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583#ifdef CONFIG_MAGIC_SYSRQ
584 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800586 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 .maxlen = sizeof (int),
588 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700589 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 },
591#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700592#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700595 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 .maxlen = sizeof (int),
597 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800598 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700600#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .procname = "threads-max",
603 .data = &max_threads,
604 .maxlen = sizeof(int),
605 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800606 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 },
608 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 .procname = "random",
610 .mode = 0555,
611 .child = random_table,
612 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 {
Eric Paris17f60a72011-04-01 17:07:50 -0400614 .procname = "usermodehelper",
615 .mode = 0555,
616 .child = usermodehelper_table,
617 },
618 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619 .procname = "overflowuid",
620 .data = &overflowuid,
621 .maxlen = sizeof(int),
622 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800623 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 .extra1 = &minolduid,
625 .extra2 = &maxolduid,
626 },
627 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 .procname = "overflowgid",
629 .data = &overflowgid,
630 .maxlen = sizeof(int),
631 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800632 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .extra1 = &minolduid,
634 .extra2 = &maxolduid,
635 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800636#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637#ifdef CONFIG_MATHEMU
638 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 .procname = "ieee_emulation_warnings",
640 .data = &sysctl_ieee_emulation_warnings,
641 .maxlen = sizeof(int),
642 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800643 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 },
645#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200648 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 .maxlen = sizeof(int),
650 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800651 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 },
653#endif
654 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 .procname = "pid_max",
656 .data = &pid_max,
657 .maxlen = sizeof (int),
658 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800659 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 .extra1 = &pid_max_min,
661 .extra2 = &pid_max_max,
662 },
663 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 .procname = "panic_on_oops",
665 .data = &panic_on_oops,
666 .maxlen = sizeof(int),
667 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800668 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800670#if defined CONFIG_PRINTK
671 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800672 .procname = "printk",
673 .data = &console_loglevel,
674 .maxlen = 4*sizeof(int),
675 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800676 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800677 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700680 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 .maxlen = sizeof(int),
682 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800683 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 },
685 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700687 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 .maxlen = sizeof(int),
689 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800690 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 },
Dave Youngaf913222009-09-22 16:43:33 -0700692 {
Dave Youngaf913222009-09-22 16:43:33 -0700693 .procname = "printk_delay",
694 .data = &printk_delay_msec,
695 .maxlen = sizeof(int),
696 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800697 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700698 .extra1 = &zero,
699 .extra2 = &ten_thousand,
700 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800702 .procname = "dmesg_restrict",
703 .data = &dmesg_restrict,
704 .maxlen = sizeof(int),
705 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700706 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800707 .extra1 = &zero,
708 .extra2 = &one,
709 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800710 {
711 .procname = "kptr_restrict",
712 .data = &kptr_restrict,
713 .maxlen = sizeof(int),
714 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700715 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800716 .extra1 = &zero,
717 .extra2 = &two,
718 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800719#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800720 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 .procname = "ngroups_max",
722 .data = &ngroups_max,
723 .maxlen = sizeof (int),
724 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800725 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726 },
Dan Ballard73efc032011-10-31 17:11:20 -0700727 {
728 .procname = "cap_last_cap",
729 .data = (void *)&cap_last_cap,
730 .maxlen = sizeof(int),
731 .mode = 0444,
732 .proc_handler = proc_dointvec,
733 },
Don Zickus58687ac2010-05-07 17:11:44 -0400734#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500735 {
Don Zickus58687ac2010-05-07 17:11:44 -0400736 .procname = "watchdog",
737 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500738 .maxlen = sizeof (int),
739 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700740 .proc_handler = proc_dowatchdog,
741 .extra1 = &zero,
742 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400743 },
744 {
745 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700746 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400747 .maxlen = sizeof(int),
748 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700749 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400750 .extra1 = &neg_one,
751 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500752 },
Don Zickus2508ce12010-05-07 17:11:46 -0400753 {
754 .procname = "softlockup_panic",
755 .data = &softlockup_panic,
756 .maxlen = sizeof(int),
757 .mode = 0644,
758 .proc_handler = proc_dointvec_minmax,
759 .extra1 = &zero,
760 .extra2 = &one,
761 },
Don Zickus5dc30552010-11-29 17:07:17 -0500762 {
763 .procname = "nmi_watchdog",
764 .data = &watchdog_enabled,
765 .maxlen = sizeof (int),
766 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700767 .proc_handler = proc_dowatchdog,
768 .extra1 = &zero,
769 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500770 },
771#endif
772#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
773 {
774 .procname = "unknown_nmi_panic",
775 .data = &unknown_nmi_panic,
776 .maxlen = sizeof (int),
777 .mode = 0644,
778 .proc_handler = proc_dointvec,
779 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500780#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781#if defined(CONFIG_X86)
782 {
Don Zickus8da5add2006-09-26 10:52:27 +0200783 .procname = "panic_on_unrecovered_nmi",
784 .data = &panic_on_unrecovered_nmi,
785 .maxlen = sizeof(int),
786 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800787 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200788 },
789 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700790 .procname = "panic_on_io_nmi",
791 .data = &panic_on_io_nmi,
792 .maxlen = sizeof(int),
793 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800794 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700795 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900796#ifdef CONFIG_DEBUG_STACKOVERFLOW
797 {
798 .procname = "panic_on_stackoverflow",
799 .data = &sysctl_panic_on_stackoverflow,
800 .maxlen = sizeof(int),
801 .mode = 0644,
802 .proc_handler = proc_dointvec,
803 },
804#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700805 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 .procname = "bootloader_type",
807 .data = &bootloader_type,
808 .maxlen = sizeof (int),
809 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800810 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100812 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700813 .procname = "bootloader_version",
814 .data = &bootloader_version,
815 .maxlen = sizeof (int),
816 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800817 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700818 },
819 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100820 .procname = "kstack_depth_to_print",
821 .data = &kstack_depth_to_print,
822 .maxlen = sizeof(int),
823 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800824 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100825 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100826 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100827 .procname = "io_delay_type",
828 .data = &io_delay_type,
829 .maxlen = sizeof(int),
830 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800831 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100832 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800834#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 .procname = "randomize_va_space",
837 .data = &randomize_va_space,
838 .maxlen = sizeof(int),
839 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800840 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800842#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800843#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700844 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700845 .procname = "spin_retry",
846 .data = &spin_retry,
847 .maxlen = sizeof (int),
848 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800849 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700850 },
851#endif
Len Brown673d5b42007-07-28 03:33:16 -0400852#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800853 {
Pavel Machekc255d842006-02-20 18:27:58 -0800854 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700855 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800856 .maxlen = sizeof (unsigned long),
857 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800858 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800859 },
860#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800861#ifdef CONFIG_IA64
862 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800863 .procname = "ignore-unaligned-usertrap",
864 .data = &no_unaligned_warning,
865 .maxlen = sizeof (int),
866 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800867 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800868 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800869 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800870 .procname = "unaligned-dump-stack",
871 .data = &unaligned_dump_stack,
872 .maxlen = sizeof (int),
873 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800874 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800875 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800876#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800877#ifdef CONFIG_DETECT_HUNG_TASK
878 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800879 .procname = "hung_task_panic",
880 .data = &sysctl_hung_task_panic,
881 .maxlen = sizeof(int),
882 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800883 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800884 .extra1 = &zero,
885 .extra2 = &one,
886 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100887 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100888 .procname = "hung_task_check_count",
889 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100890 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100891 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800892 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100893 },
894 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100895 .procname = "hung_task_timeout_secs",
896 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100897 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100898 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800899 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100900 },
901 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100902 .procname = "hung_task_warnings",
903 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100904 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100905 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800906 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100907 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700908#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200909#ifdef CONFIG_COMPAT
910 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200911 .procname = "compat-log",
912 .data = &compat_log,
913 .maxlen = sizeof (int),
914 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800915 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200916 },
917#endif
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700918#ifdef CONFIG_RT_MUTEXES
919 {
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700920 .procname = "max_lock_depth",
921 .data = &max_lock_depth,
922 .maxlen = sizeof(int),
923 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800924 .proc_handler = proc_dointvec,
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700925 },
926#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700927 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700928 .procname = "poweroff_cmd",
929 .data = &poweroff_cmd,
930 .maxlen = POWEROFF_CMD_PATH_LEN,
931 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800932 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700933 },
David Howells0b77f5b2008-04-29 01:01:32 -0700934#ifdef CONFIG_KEYS
935 {
David Howells0b77f5b2008-04-29 01:01:32 -0700936 .procname = "keys",
937 .mode = 0555,
938 .child = key_sysctls,
939 },
940#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700941#ifdef CONFIG_RCU_TORTURE_TEST
942 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700943 .procname = "rcutorture_runnable",
944 .data = &rcutorture_runnable,
945 .maxlen = sizeof(int),
946 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800947 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700948 },
949#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200950#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400951 /*
952 * User-space scripts rely on the existence of this file
953 * as a feature check for perf_events being enabled.
954 *
955 * So it's an ABI, do not remove!
956 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200957 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200958 .procname = "perf_event_paranoid",
959 .data = &sysctl_perf_event_paranoid,
960 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200961 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800962 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200963 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200964 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200965 .procname = "perf_event_mlock_kb",
966 .data = &sysctl_perf_event_mlock,
967 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200968 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800969 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200970 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200971 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200972 .procname = "perf_event_max_sample_rate",
973 .data = &sysctl_perf_event_sample_rate,
974 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200975 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100976 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200977 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200978#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200979#ifdef CONFIG_KMEMCHECK
980 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200981 .procname = "kmemcheck",
982 .data = &kmemcheck_enabled,
983 .maxlen = sizeof(int),
984 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800985 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200986 },
987#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200988#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200989 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200990 .procname = "blk_iopoll",
991 .data = &blk_iopoll_enabled,
992 .maxlen = sizeof(int),
993 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800994 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +0200995 },
Jens Axboecb684b52009-09-15 21:53:11 +0200996#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700997 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700998};
999
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001000static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001001 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002 .procname = "overcommit_memory",
1003 .data = &sysctl_overcommit_memory,
1004 .maxlen = sizeof(sysctl_overcommit_memory),
1005 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001006 .proc_handler = proc_dointvec_minmax,
1007 .extra1 = &zero,
1008 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001009 },
1010 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001011 .procname = "panic_on_oom",
1012 .data = &sysctl_panic_on_oom,
1013 .maxlen = sizeof(sysctl_panic_on_oom),
1014 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001015 .proc_handler = proc_dointvec_minmax,
1016 .extra1 = &zero,
1017 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001018 },
1019 {
David Rientjesfe071d72007-10-16 23:25:56 -07001020 .procname = "oom_kill_allocating_task",
1021 .data = &sysctl_oom_kill_allocating_task,
1022 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1023 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001024 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001025 },
1026 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001027 .procname = "oom_dump_tasks",
1028 .data = &sysctl_oom_dump_tasks,
1029 .maxlen = sizeof(sysctl_oom_dump_tasks),
1030 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001031 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001032 },
1033 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001034 .procname = "overcommit_ratio",
1035 .data = &sysctl_overcommit_ratio,
1036 .maxlen = sizeof(sysctl_overcommit_ratio),
1037 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001038 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001039 },
1040 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001041 .procname = "page-cluster",
1042 .data = &page_cluster,
1043 .maxlen = sizeof(int),
1044 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001045 .proc_handler = proc_dointvec_minmax,
1046 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001047 },
1048 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001049 .procname = "dirty_background_ratio",
1050 .data = &dirty_background_ratio,
1051 .maxlen = sizeof(dirty_background_ratio),
1052 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001053 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054 .extra1 = &zero,
1055 .extra2 = &one_hundred,
1056 },
1057 {
David Rientjes2da02992009-01-06 14:39:31 -08001058 .procname = "dirty_background_bytes",
1059 .data = &dirty_background_bytes,
1060 .maxlen = sizeof(dirty_background_bytes),
1061 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001062 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001063 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001064 },
1065 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001066 .procname = "dirty_ratio",
1067 .data = &vm_dirty_ratio,
1068 .maxlen = sizeof(vm_dirty_ratio),
1069 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001070 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001071 .extra1 = &zero,
1072 .extra2 = &one_hundred,
1073 },
1074 {
David Rientjes2da02992009-01-06 14:39:31 -08001075 .procname = "dirty_bytes",
1076 .data = &vm_dirty_bytes,
1077 .maxlen = sizeof(vm_dirty_bytes),
1078 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001079 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001080 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001081 },
1082 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001083 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001084 .data = &dirty_writeback_interval,
1085 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001086 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001087 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001088 },
1089 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001090 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001091 .data = &dirty_expire_interval,
1092 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001093 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001094 .proc_handler = proc_dointvec_minmax,
1095 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001096 },
1097 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098 .procname = "nr_pdflush_threads",
1099 .data = &nr_pdflush_threads,
1100 .maxlen = sizeof nr_pdflush_threads,
1101 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001102 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103 },
1104 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001105 .procname = "swappiness",
1106 .data = &vm_swappiness,
1107 .maxlen = sizeof(vm_swappiness),
1108 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001109 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110 .extra1 = &zero,
1111 .extra2 = &one_hundred,
1112 },
1113#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001114 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001115 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001116 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001117 .maxlen = sizeof(unsigned long),
1118 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001119 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001120 .extra1 = (void *)&hugetlb_zero,
1121 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001122 },
1123#ifdef CONFIG_NUMA
1124 {
1125 .procname = "nr_hugepages_mempolicy",
1126 .data = NULL,
1127 .maxlen = sizeof(unsigned long),
1128 .mode = 0644,
1129 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1130 .extra1 = (void *)&hugetlb_zero,
1131 .extra2 = (void *)&hugetlb_infinity,
1132 },
1133#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001134 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001135 .procname = "hugetlb_shm_group",
1136 .data = &sysctl_hugetlb_shm_group,
1137 .maxlen = sizeof(gid_t),
1138 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001139 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001140 },
Mel Gorman396faf02007-07-17 04:03:13 -07001141 {
Mel Gorman396faf02007-07-17 04:03:13 -07001142 .procname = "hugepages_treat_as_movable",
1143 .data = &hugepages_treat_as_movable,
1144 .maxlen = sizeof(int),
1145 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001146 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001147 },
Adam Litke54f9f802007-10-16 01:26:20 -07001148 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001149 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001150 .data = NULL,
1151 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001152 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001153 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001154 .extra1 = (void *)&hugetlb_zero,
1155 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001156 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001157#endif
1158 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001159 .procname = "lowmem_reserve_ratio",
1160 .data = &sysctl_lowmem_reserve_ratio,
1161 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1162 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001163 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164 },
1165 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001166 .procname = "drop_caches",
1167 .data = &sysctl_drop_caches,
1168 .maxlen = sizeof(int),
1169 .mode = 0644,
1170 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001171 .extra1 = &one,
1172 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001173 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001174#ifdef CONFIG_COMPACTION
1175 {
1176 .procname = "compact_memory",
1177 .data = &sysctl_compact_memory,
1178 .maxlen = sizeof(int),
1179 .mode = 0200,
1180 .proc_handler = sysctl_compaction_handler,
1181 },
Mel Gorman5e771902010-05-24 14:32:31 -07001182 {
1183 .procname = "extfrag_threshold",
1184 .data = &sysctl_extfrag_threshold,
1185 .maxlen = sizeof(int),
1186 .mode = 0644,
1187 .proc_handler = sysctl_extfrag_handler,
1188 .extra1 = &min_extfrag_threshold,
1189 .extra2 = &max_extfrag_threshold,
1190 },
1191
Mel Gorman76ab0f52010-05-24 14:32:28 -07001192#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001193 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001194 .procname = "min_free_kbytes",
1195 .data = &min_free_kbytes,
1196 .maxlen = sizeof(min_free_kbytes),
1197 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001198 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001199 .extra1 = &zero,
1200 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001201 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001202 .procname = "percpu_pagelist_fraction",
1203 .data = &percpu_pagelist_fraction,
1204 .maxlen = sizeof(percpu_pagelist_fraction),
1205 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001206 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001207 .extra1 = &min_percpu_pagelist_fract,
1208 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001209#ifdef CONFIG_MMU
1210 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001211 .procname = "max_map_count",
1212 .data = &sysctl_max_map_count,
1213 .maxlen = sizeof(sysctl_max_map_count),
1214 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001215 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001216 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001217 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001218#else
1219 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001220 .procname = "nr_trim_pages",
1221 .data = &sysctl_nr_trim_pages,
1222 .maxlen = sizeof(sysctl_nr_trim_pages),
1223 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001224 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001225 .extra1 = &zero,
1226 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001227#endif
1228 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001229 .procname = "laptop_mode",
1230 .data = &laptop_mode,
1231 .maxlen = sizeof(laptop_mode),
1232 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001233 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001234 },
1235 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001236 .procname = "block_dump",
1237 .data = &block_dump,
1238 .maxlen = sizeof(block_dump),
1239 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001240 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001241 .extra1 = &zero,
1242 },
1243 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001244 .procname = "vfs_cache_pressure",
1245 .data = &sysctl_vfs_cache_pressure,
1246 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1247 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001248 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001249 .extra1 = &zero,
1250 },
1251#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1252 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001253 .procname = "legacy_va_layout",
1254 .data = &sysctl_legacy_va_layout,
1255 .maxlen = sizeof(sysctl_legacy_va_layout),
1256 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001257 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001258 .extra1 = &zero,
1259 },
1260#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001261#ifdef CONFIG_NUMA
1262 {
Christoph Lameter17436602006-01-18 17:42:32 -08001263 .procname = "zone_reclaim_mode",
1264 .data = &zone_reclaim_mode,
1265 .maxlen = sizeof(zone_reclaim_mode),
1266 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001267 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001268 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001269 },
Christoph Lameter96146342006-07-03 00:24:13 -07001270 {
Christoph Lameter96146342006-07-03 00:24:13 -07001271 .procname = "min_unmapped_ratio",
1272 .data = &sysctl_min_unmapped_ratio,
1273 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1274 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001275 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001276 .extra1 = &zero,
1277 .extra2 = &one_hundred,
1278 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001279 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001280 .procname = "min_slab_ratio",
1281 .data = &sysctl_min_slab_ratio,
1282 .maxlen = sizeof(sysctl_min_slab_ratio),
1283 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001284 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001285 .extra1 = &zero,
1286 .extra2 = &one_hundred,
1287 },
Christoph Lameter17436602006-01-18 17:42:32 -08001288#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001289#ifdef CONFIG_SMP
1290 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001291 .procname = "stat_interval",
1292 .data = &sysctl_stat_interval,
1293 .maxlen = sizeof(sysctl_stat_interval),
1294 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001295 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001296 },
1297#endif
David Howells6e141542009-12-15 19:27:45 +00001298#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001299 {
Eric Parised032182007-06-28 15:55:21 -04001300 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001301 .data = &dac_mmap_min_addr,
1302 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001303 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001304 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001305 },
David Howells6e141542009-12-15 19:27:45 +00001306#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001307#ifdef CONFIG_NUMA
1308 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001309 .procname = "numa_zonelist_order",
1310 .data = &numa_zonelist_order,
1311 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1312 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001313 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001314 },
1315#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001316#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001317 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001318 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001319 .procname = "vdso_enabled",
1320 .data = &vdso_enabled,
1321 .maxlen = sizeof(vdso_enabled),
1322 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001323 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001324 .extra1 = &zero,
1325 },
1326#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001327#ifdef CONFIG_HIGHMEM
1328 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001329 .procname = "highmem_is_dirtyable",
1330 .data = &vm_highmem_is_dirtyable,
1331 .maxlen = sizeof(vm_highmem_is_dirtyable),
1332 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001333 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001334 .extra1 = &zero,
1335 .extra2 = &one,
1336 },
1337#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001338 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001339 .procname = "scan_unevictable_pages",
1340 .data = &scan_unevictable_pages,
1341 .maxlen = sizeof(scan_unevictable_pages),
1342 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001343 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001344 },
Andi Kleen6a460792009-09-16 11:50:15 +02001345#ifdef CONFIG_MEMORY_FAILURE
1346 {
Andi Kleen6a460792009-09-16 11:50:15 +02001347 .procname = "memory_failure_early_kill",
1348 .data = &sysctl_memory_failure_early_kill,
1349 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1350 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001351 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001352 .extra1 = &zero,
1353 .extra2 = &one,
1354 },
1355 {
Andi Kleen6a460792009-09-16 11:50:15 +02001356 .procname = "memory_failure_recovery",
1357 .data = &sysctl_memory_failure_recovery,
1358 .maxlen = sizeof(sysctl_memory_failure_recovery),
1359 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001360 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001361 .extra1 = &zero,
1362 .extra2 = &one,
1363 },
1364#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001365 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366};
1367
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001368#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001369static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001370 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001371};
1372#endif
1373
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001374static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001375 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001376 .procname = "inode-nr",
1377 .data = &inodes_stat,
1378 .maxlen = 2*sizeof(int),
1379 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001380 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381 },
1382 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001383 .procname = "inode-state",
1384 .data = &inodes_stat,
1385 .maxlen = 7*sizeof(int),
1386 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001387 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388 },
1389 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001390 .procname = "file-nr",
1391 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001392 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001393 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001394 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001395 },
1396 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397 .procname = "file-max",
1398 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001399 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001400 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001401 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001402 },
1403 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001404 .procname = "nr_open",
1405 .data = &sysctl_nr_open,
1406 .maxlen = sizeof(int),
1407 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001408 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001409 .extra1 = &sysctl_nr_open_min,
1410 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001411 },
1412 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001413 .procname = "dentry-state",
1414 .data = &dentry_stat,
1415 .maxlen = 6*sizeof(int),
1416 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001417 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 },
1419 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001420 .procname = "overflowuid",
1421 .data = &fs_overflowuid,
1422 .maxlen = sizeof(int),
1423 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001424 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001425 .extra1 = &minolduid,
1426 .extra2 = &maxolduid,
1427 },
1428 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001429 .procname = "overflowgid",
1430 .data = &fs_overflowgid,
1431 .maxlen = sizeof(int),
1432 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001433 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001434 .extra1 = &minolduid,
1435 .extra2 = &maxolduid,
1436 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001437#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001439 .procname = "leases-enable",
1440 .data = &leases_enable,
1441 .maxlen = sizeof(int),
1442 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001443 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001444 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001445#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001446#ifdef CONFIG_DNOTIFY
1447 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001448 .procname = "dir-notify-enable",
1449 .data = &dir_notify_enable,
1450 .maxlen = sizeof(int),
1451 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001452 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001453 },
1454#endif
1455#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001456#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001457 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458 .procname = "lease-break-time",
1459 .data = &lease_break_time,
1460 .maxlen = sizeof(int),
1461 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001462 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001464#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001465#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001466 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467 .procname = "aio-nr",
1468 .data = &aio_nr,
1469 .maxlen = sizeof(aio_nr),
1470 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001471 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 },
1473 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474 .procname = "aio-max-nr",
1475 .data = &aio_max_nr,
1476 .maxlen = sizeof(aio_max_nr),
1477 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001478 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001479 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001480#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001481#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001482 {
Robert Love0399cb02005-07-13 12:38:18 -04001483 .procname = "inotify",
1484 .mode = 0555,
1485 .child = inotify_table,
1486 },
1487#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001488#ifdef CONFIG_EPOLL
1489 {
1490 .procname = "epoll",
1491 .mode = 0555,
1492 .child = epoll_table,
1493 },
1494#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001495#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001496 {
Alan Coxd6e71142005-06-23 00:09:43 -07001497 .procname = "suid_dumpable",
1498 .data = &suid_dumpable,
1499 .maxlen = sizeof(int),
1500 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001501 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001502 .extra1 = &zero,
1503 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001504 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001505#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1506 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001507 .procname = "binfmt_misc",
1508 .mode = 0555,
1509 .child = binfmt_misc_table,
1510 },
1511#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001512 {
Jens Axboeff9da692010-06-03 14:54:39 +02001513 .procname = "pipe-max-size",
1514 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001515 .maxlen = sizeof(int),
1516 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001517 .proc_handler = &pipe_proc_fn,
1518 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001519 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001520 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001521};
1522
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001523static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001524#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001525 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001526 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001527 .procname = "exception-trace",
1528 .data = &show_unhandled_signals,
1529 .maxlen = sizeof(int),
1530 .mode = 0644,
1531 .proc_handler = proc_dointvec
1532 },
1533#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001534#if defined(CONFIG_OPTPROBES)
1535 {
1536 .procname = "kprobes-optimization",
1537 .data = &sysctl_kprobes_optimization,
1538 .maxlen = sizeof(int),
1539 .mode = 0644,
1540 .proc_handler = proc_kprobes_optimization_handler,
1541 .extra1 = &zero,
1542 .extra2 = &one,
1543 },
1544#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001545 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001546};
1547
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001548static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001549 { }
Robert Love0eeca282005-07-12 17:06:03 -04001550};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001551
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001552int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001553{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001554 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001555 return 0;
1556}
1557
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001558#endif /* CONFIG_SYSCTL */
1559
Linus Torvalds1da177e2005-04-16 15:20:36 -07001560/*
1561 * /proc/sys support
1562 */
1563
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001564#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001565
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001566static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001567 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001568 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001569{
1570 size_t len;
1571 char __user *p;
1572 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001573
1574 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001575 *lenp = 0;
1576 return 0;
1577 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001578
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001579 if (write) {
1580 len = 0;
1581 p = buffer;
1582 while (len < *lenp) {
1583 if (get_user(c, p++))
1584 return -EFAULT;
1585 if (c == 0 || c == '\n')
1586 break;
1587 len++;
1588 }
1589 if (len >= maxlen)
1590 len = maxlen-1;
1591 if(copy_from_user(data, buffer, len))
1592 return -EFAULT;
1593 ((char *) data)[len] = 0;
1594 *ppos += *lenp;
1595 } else {
1596 len = strlen(data);
1597 if (len > maxlen)
1598 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001599
1600 if (*ppos > len) {
1601 *lenp = 0;
1602 return 0;
1603 }
1604
1605 data += *ppos;
1606 len -= *ppos;
1607
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001608 if (len > *lenp)
1609 len = *lenp;
1610 if (len)
1611 if(copy_to_user(buffer, data, len))
1612 return -EFAULT;
1613 if (len < *lenp) {
1614 if(put_user('\n', ((char __user *) buffer) + len))
1615 return -EFAULT;
1616 len++;
1617 }
1618 *lenp = len;
1619 *ppos += len;
1620 }
1621 return 0;
1622}
1623
Linus Torvalds1da177e2005-04-16 15:20:36 -07001624/**
1625 * proc_dostring - read a string sysctl
1626 * @table: the sysctl table
1627 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001628 * @buffer: the user buffer
1629 * @lenp: the size of the user buffer
1630 * @ppos: file position
1631 *
1632 * Reads/writes a string from/to the user buffer. If the kernel
1633 * buffer provided is not large enough to hold the string, the
1634 * string is truncated. The copied string is %NULL-terminated.
1635 * If the string is being read by the user process, it is copied
1636 * and a newline '\n' is added. It is truncated if the buffer is
1637 * not large enough.
1638 *
1639 * Returns 0 on success.
1640 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001641int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001642 void __user *buffer, size_t *lenp, loff_t *ppos)
1643{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001644 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001645 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001646}
1647
Amerigo Wang00b7c332010-05-05 00:26:45 +00001648static size_t proc_skip_spaces(char **buf)
1649{
1650 size_t ret;
1651 char *tmp = skip_spaces(*buf);
1652 ret = tmp - *buf;
1653 *buf = tmp;
1654 return ret;
1655}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001656
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001657static void proc_skip_char(char **buf, size_t *size, const char v)
1658{
1659 while (*size) {
1660 if (**buf != v)
1661 break;
1662 (*size)--;
1663 (*buf)++;
1664 }
1665}
1666
Amerigo Wang00b7c332010-05-05 00:26:45 +00001667#define TMPBUFLEN 22
1668/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001669 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001670 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001671 * @buf: a kernel buffer
1672 * @size: size of the kernel buffer
1673 * @val: this is where the number will be stored
1674 * @neg: set to %TRUE if number is negative
1675 * @perm_tr: a vector which contains the allowed trailers
1676 * @perm_tr_len: size of the perm_tr vector
1677 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001678 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001679 * In case of success %0 is returned and @buf and @size are updated with
1680 * the amount of bytes read. If @tr is non-NULL and a trailing
1681 * character exists (size is non-zero after returning from this
1682 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001683 */
1684static int proc_get_long(char **buf, size_t *size,
1685 unsigned long *val, bool *neg,
1686 const char *perm_tr, unsigned perm_tr_len, char *tr)
1687{
1688 int len;
1689 char *p, tmp[TMPBUFLEN];
1690
1691 if (!*size)
1692 return -EINVAL;
1693
1694 len = *size;
1695 if (len > TMPBUFLEN - 1)
1696 len = TMPBUFLEN - 1;
1697
1698 memcpy(tmp, *buf, len);
1699
1700 tmp[len] = 0;
1701 p = tmp;
1702 if (*p == '-' && *size > 1) {
1703 *neg = true;
1704 p++;
1705 } else
1706 *neg = false;
1707 if (!isdigit(*p))
1708 return -EINVAL;
1709
1710 *val = simple_strtoul(p, &p, 0);
1711
1712 len = p - tmp;
1713
1714 /* We don't know if the next char is whitespace thus we may accept
1715 * invalid integers (e.g. 1234...a) or two integers instead of one
1716 * (e.g. 123...1). So lets not allow such large numbers. */
1717 if (len == TMPBUFLEN - 1)
1718 return -EINVAL;
1719
1720 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1721 return -EINVAL;
1722
1723 if (tr && (len < *size))
1724 *tr = *p;
1725
1726 *buf += len;
1727 *size -= len;
1728
1729 return 0;
1730}
1731
1732/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001733 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001734 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001735 * @buf: the user buffer
1736 * @size: the size of the user buffer
1737 * @val: the integer to be converted
1738 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001739 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001740 * In case of success %0 is returned and @buf and @size are updated with
1741 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001742 */
1743static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1744 bool neg)
1745{
1746 int len;
1747 char tmp[TMPBUFLEN], *p = tmp;
1748
1749 sprintf(p, "%s%lu", neg ? "-" : "", val);
1750 len = strlen(tmp);
1751 if (len > *size)
1752 len = *size;
1753 if (copy_to_user(*buf, tmp, len))
1754 return -EFAULT;
1755 *size -= len;
1756 *buf += len;
1757 return 0;
1758}
1759#undef TMPBUFLEN
1760
1761static int proc_put_char(void __user **buf, size_t *size, char c)
1762{
1763 if (*size) {
1764 char __user **buffer = (char __user **)buf;
1765 if (put_user(c, *buffer))
1766 return -EFAULT;
1767 (*size)--, (*buffer)++;
1768 *buf = *buffer;
1769 }
1770 return 0;
1771}
1772
1773static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001774 int *valp,
1775 int write, void *data)
1776{
1777 if (write) {
1778 *valp = *negp ? -*lvalp : *lvalp;
1779 } else {
1780 int val = *valp;
1781 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001782 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001783 *lvalp = (unsigned long)-val;
1784 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001785 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001786 *lvalp = (unsigned long)val;
1787 }
1788 }
1789 return 0;
1790}
1791
Amerigo Wang00b7c332010-05-05 00:26:45 +00001792static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1793
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001794static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001795 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001796 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001797 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001798 int write, void *data),
1799 void *data)
1800{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001801 int *i, vleft, first = 1, err = 0;
1802 unsigned long page = 0;
1803 size_t left;
1804 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001805
Amerigo Wang00b7c332010-05-05 00:26:45 +00001806 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001807 *lenp = 0;
1808 return 0;
1809 }
1810
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001811 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001812 vleft = table->maxlen / sizeof(*i);
1813 left = *lenp;
1814
1815 if (!conv)
1816 conv = do_proc_dointvec_conv;
1817
Linus Torvalds1da177e2005-04-16 15:20:36 -07001818 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001819 if (left > PAGE_SIZE - 1)
1820 left = PAGE_SIZE - 1;
1821 page = __get_free_page(GFP_TEMPORARY);
1822 kbuf = (char *) page;
1823 if (!kbuf)
1824 return -ENOMEM;
1825 if (copy_from_user(kbuf, buffer, left)) {
1826 err = -EFAULT;
1827 goto free;
1828 }
1829 kbuf[left] = 0;
1830 }
1831
1832 for (; left && vleft--; i++, first=0) {
1833 unsigned long lval;
1834 bool neg;
1835
1836 if (write) {
1837 left -= proc_skip_spaces(&kbuf);
1838
J. R. Okajima563b0462010-05-25 16:10:14 -07001839 if (!left)
1840 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001841 err = proc_get_long(&kbuf, &left, &lval, &neg,
1842 proc_wspace_sep,
1843 sizeof(proc_wspace_sep), NULL);
1844 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001845 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001846 if (conv(&neg, &lval, i, 1, data)) {
1847 err = -EINVAL;
1848 break;
1849 }
1850 } else {
1851 if (conv(&neg, &lval, i, 0, data)) {
1852 err = -EINVAL;
1853 break;
1854 }
1855 if (!first)
1856 err = proc_put_char(&buffer, &left, '\t');
1857 if (err)
1858 break;
1859 err = proc_put_long(&buffer, &left, lval, neg);
1860 if (err)
1861 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001862 }
1863 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001864
1865 if (!write && !first && left && !err)
1866 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001867 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001868 left -= proc_skip_spaces(&kbuf);
1869free:
1870 if (write) {
1871 free_page(page);
1872 if (first)
1873 return err ? : -EINVAL;
1874 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001875 *lenp -= left;
1876 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001877 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001878}
1879
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001880static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001881 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001882 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001883 int write, void *data),
1884 void *data)
1885{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001886 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001887 buffer, lenp, ppos, conv, data);
1888}
1889
Linus Torvalds1da177e2005-04-16 15:20:36 -07001890/**
1891 * proc_dointvec - read a vector of integers
1892 * @table: the sysctl table
1893 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001894 * @buffer: the user buffer
1895 * @lenp: the size of the user buffer
1896 * @ppos: file position
1897 *
1898 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1899 * values from/to the user buffer, treated as an ASCII string.
1900 *
1901 * Returns 0 on success.
1902 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001903int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001904 void __user *buffer, size_t *lenp, loff_t *ppos)
1905{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001906 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001907 NULL,NULL);
1908}
1909
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001910/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001911 * Taint values can only be increased
1912 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001913 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001914static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001915 void __user *buffer, size_t *lenp, loff_t *ppos)
1916{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001917 struct ctl_table t;
1918 unsigned long tmptaint = get_taint();
1919 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001920
Bastian Blank91fcd412007-04-23 14:41:14 -07001921 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001922 return -EPERM;
1923
Andi Kleen25ddbb12008-10-15 22:01:41 -07001924 t = *table;
1925 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001926 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001927 if (err < 0)
1928 return err;
1929
1930 if (write) {
1931 /*
1932 * Poor man's atomic or. Not worth adding a primitive
1933 * to everyone's atomic.h for this
1934 */
1935 int i;
1936 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1937 if ((tmptaint >> i) & 1)
1938 add_taint(i);
1939 }
1940 }
1941
1942 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001943}
1944
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001945#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001946static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001947 void __user *buffer, size_t *lenp, loff_t *ppos)
1948{
1949 if (write && !capable(CAP_SYS_ADMIN))
1950 return -EPERM;
1951
1952 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1953}
1954#endif
1955
Linus Torvalds1da177e2005-04-16 15:20:36 -07001956struct do_proc_dointvec_minmax_conv_param {
1957 int *min;
1958 int *max;
1959};
1960
Amerigo Wang00b7c332010-05-05 00:26:45 +00001961static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1962 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001963 int write, void *data)
1964{
1965 struct do_proc_dointvec_minmax_conv_param *param = data;
1966 if (write) {
1967 int val = *negp ? -*lvalp : *lvalp;
1968 if ((param->min && *param->min > val) ||
1969 (param->max && *param->max < val))
1970 return -EINVAL;
1971 *valp = val;
1972 } else {
1973 int val = *valp;
1974 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001975 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001976 *lvalp = (unsigned long)-val;
1977 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001978 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001979 *lvalp = (unsigned long)val;
1980 }
1981 }
1982 return 0;
1983}
1984
1985/**
1986 * proc_dointvec_minmax - read a vector of integers with min/max values
1987 * @table: the sysctl table
1988 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001989 * @buffer: the user buffer
1990 * @lenp: the size of the user buffer
1991 * @ppos: file position
1992 *
1993 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1994 * values from/to the user buffer, treated as an ASCII string.
1995 *
1996 * This routine will ensure the values are within the range specified by
1997 * table->extra1 (min) and table->extra2 (max).
1998 *
1999 * Returns 0 on success.
2000 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002001int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002002 void __user *buffer, size_t *lenp, loff_t *ppos)
2003{
2004 struct do_proc_dointvec_minmax_conv_param param = {
2005 .min = (int *) table->extra1,
2006 .max = (int *) table->extra2,
2007 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002008 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002009 do_proc_dointvec_minmax_conv, &param);
2010}
2011
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002012static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002013 void __user *buffer,
2014 size_t *lenp, loff_t *ppos,
2015 unsigned long convmul,
2016 unsigned long convdiv)
2017{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002018 unsigned long *i, *min, *max;
2019 int vleft, first = 1, err = 0;
2020 unsigned long page = 0;
2021 size_t left;
2022 char *kbuf;
2023
2024 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002025 *lenp = 0;
2026 return 0;
2027 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002028
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002029 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002030 min = (unsigned long *) table->extra1;
2031 max = (unsigned long *) table->extra2;
2032 vleft = table->maxlen / sizeof(unsigned long);
2033 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002034
2035 if (write) {
2036 if (left > PAGE_SIZE - 1)
2037 left = PAGE_SIZE - 1;
2038 page = __get_free_page(GFP_TEMPORARY);
2039 kbuf = (char *) page;
2040 if (!kbuf)
2041 return -ENOMEM;
2042 if (copy_from_user(kbuf, buffer, left)) {
2043 err = -EFAULT;
2044 goto free;
2045 }
2046 kbuf[left] = 0;
2047 }
2048
Eric Dumazet27b3d802010-10-07 12:59:29 -07002049 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002050 unsigned long val;
2051
Linus Torvalds1da177e2005-04-16 15:20:36 -07002052 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002053 bool neg;
2054
2055 left -= proc_skip_spaces(&kbuf);
2056
2057 err = proc_get_long(&kbuf, &left, &val, &neg,
2058 proc_wspace_sep,
2059 sizeof(proc_wspace_sep), NULL);
2060 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002061 break;
2062 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002063 continue;
2064 if ((min && val < *min) || (max && val > *max))
2065 continue;
2066 *i = val;
2067 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002068 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002069 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002070 err = proc_put_char(&buffer, &left, '\t');
2071 err = proc_put_long(&buffer, &left, val, false);
2072 if (err)
2073 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002074 }
2075 }
2076
Amerigo Wang00b7c332010-05-05 00:26:45 +00002077 if (!write && !first && left && !err)
2078 err = proc_put_char(&buffer, &left, '\n');
2079 if (write && !err)
2080 left -= proc_skip_spaces(&kbuf);
2081free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002083 free_page(page);
2084 if (first)
2085 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002086 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002087 *lenp -= left;
2088 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002089 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002090}
2091
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002092static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002093 void __user *buffer,
2094 size_t *lenp, loff_t *ppos,
2095 unsigned long convmul,
2096 unsigned long convdiv)
2097{
2098 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002099 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002100}
2101
Linus Torvalds1da177e2005-04-16 15:20:36 -07002102/**
2103 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2104 * @table: the sysctl table
2105 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002106 * @buffer: the user buffer
2107 * @lenp: the size of the user buffer
2108 * @ppos: file position
2109 *
2110 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2111 * values from/to the user buffer, treated as an ASCII string.
2112 *
2113 * This routine will ensure the values are within the range specified by
2114 * table->extra1 (min) and table->extra2 (max).
2115 *
2116 * Returns 0 on success.
2117 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002118int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002119 void __user *buffer, size_t *lenp, loff_t *ppos)
2120{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002121 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002122}
2123
2124/**
2125 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2126 * @table: the sysctl table
2127 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002128 * @buffer: the user buffer
2129 * @lenp: the size of the user buffer
2130 * @ppos: file position
2131 *
2132 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2133 * values from/to the user buffer, treated as an ASCII string. The values
2134 * are treated as milliseconds, and converted to jiffies when they are stored.
2135 *
2136 * This routine will ensure the values are within the range specified by
2137 * table->extra1 (min) and table->extra2 (max).
2138 *
2139 * Returns 0 on success.
2140 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002141int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002142 void __user *buffer,
2143 size_t *lenp, loff_t *ppos)
2144{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002145 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002146 lenp, ppos, HZ, 1000l);
2147}
2148
2149
Amerigo Wang00b7c332010-05-05 00:26:45 +00002150static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002151 int *valp,
2152 int write, void *data)
2153{
2154 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002155 if (*lvalp > LONG_MAX / HZ)
2156 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002157 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2158 } else {
2159 int val = *valp;
2160 unsigned long lval;
2161 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002162 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002163 lval = (unsigned long)-val;
2164 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002165 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002166 lval = (unsigned long)val;
2167 }
2168 *lvalp = lval / HZ;
2169 }
2170 return 0;
2171}
2172
Amerigo Wang00b7c332010-05-05 00:26:45 +00002173static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002174 int *valp,
2175 int write, void *data)
2176{
2177 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002178 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2179 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002180 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2181 } else {
2182 int val = *valp;
2183 unsigned long lval;
2184 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002185 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002186 lval = (unsigned long)-val;
2187 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002188 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002189 lval = (unsigned long)val;
2190 }
2191 *lvalp = jiffies_to_clock_t(lval);
2192 }
2193 return 0;
2194}
2195
Amerigo Wang00b7c332010-05-05 00:26:45 +00002196static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002197 int *valp,
2198 int write, void *data)
2199{
2200 if (write) {
2201 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2202 } else {
2203 int val = *valp;
2204 unsigned long lval;
2205 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002206 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002207 lval = (unsigned long)-val;
2208 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002209 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002210 lval = (unsigned long)val;
2211 }
2212 *lvalp = jiffies_to_msecs(lval);
2213 }
2214 return 0;
2215}
2216
2217/**
2218 * proc_dointvec_jiffies - read a vector of integers as seconds
2219 * @table: the sysctl table
2220 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002221 * @buffer: the user buffer
2222 * @lenp: the size of the user buffer
2223 * @ppos: file position
2224 *
2225 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2226 * values from/to the user buffer, treated as an ASCII string.
2227 * The values read are assumed to be in seconds, and are converted into
2228 * jiffies.
2229 *
2230 * Returns 0 on success.
2231 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002232int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002233 void __user *buffer, size_t *lenp, loff_t *ppos)
2234{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002235 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002236 do_proc_dointvec_jiffies_conv,NULL);
2237}
2238
2239/**
2240 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2241 * @table: the sysctl table
2242 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002243 * @buffer: the user buffer
2244 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002245 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002246 *
2247 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2248 * values from/to the user buffer, treated as an ASCII string.
2249 * The values read are assumed to be in 1/USER_HZ seconds, and
2250 * are converted into jiffies.
2251 *
2252 * Returns 0 on success.
2253 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002254int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002255 void __user *buffer, size_t *lenp, loff_t *ppos)
2256{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002257 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002258 do_proc_dointvec_userhz_jiffies_conv,NULL);
2259}
2260
2261/**
2262 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2263 * @table: the sysctl table
2264 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002265 * @buffer: the user buffer
2266 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002267 * @ppos: file position
2268 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002269 *
2270 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2271 * values from/to the user buffer, treated as an ASCII string.
2272 * The values read are assumed to be in 1/1000 seconds, and
2273 * are converted into jiffies.
2274 *
2275 * Returns 0 on success.
2276 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002277int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002278 void __user *buffer, size_t *lenp, loff_t *ppos)
2279{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002280 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002281 do_proc_dointvec_ms_jiffies_conv, NULL);
2282}
2283
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002284static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002285 void __user *buffer, size_t *lenp, loff_t *ppos)
2286{
2287 struct pid *new_pid;
2288 pid_t tmp;
2289 int r;
2290
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002291 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002292
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002293 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002294 lenp, ppos, NULL, NULL);
2295 if (r || !write)
2296 return r;
2297
2298 new_pid = find_get_pid(tmp);
2299 if (!new_pid)
2300 return -ESRCH;
2301
2302 put_pid(xchg(&cad_pid, new_pid));
2303 return 0;
2304}
2305
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002306/**
2307 * proc_do_large_bitmap - read/write from/to a large bitmap
2308 * @table: the sysctl table
2309 * @write: %TRUE if this is a write to the sysctl file
2310 * @buffer: the user buffer
2311 * @lenp: the size of the user buffer
2312 * @ppos: file position
2313 *
2314 * The bitmap is stored at table->data and the bitmap length (in bits)
2315 * in table->maxlen.
2316 *
2317 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2318 * large bitmaps may be represented in a compact manner. Writing into
2319 * the file will clear the bitmap then update it with the given input.
2320 *
2321 * Returns 0 on success.
2322 */
2323int proc_do_large_bitmap(struct ctl_table *table, int write,
2324 void __user *buffer, size_t *lenp, loff_t *ppos)
2325{
2326 int err = 0;
2327 bool first = 1;
2328 size_t left = *lenp;
2329 unsigned long bitmap_len = table->maxlen;
2330 unsigned long *bitmap = (unsigned long *) table->data;
2331 unsigned long *tmp_bitmap = NULL;
2332 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2333
2334 if (!bitmap_len || !left || (*ppos && !write)) {
2335 *lenp = 0;
2336 return 0;
2337 }
2338
2339 if (write) {
2340 unsigned long page = 0;
2341 char *kbuf;
2342
2343 if (left > PAGE_SIZE - 1)
2344 left = PAGE_SIZE - 1;
2345
2346 page = __get_free_page(GFP_TEMPORARY);
2347 kbuf = (char *) page;
2348 if (!kbuf)
2349 return -ENOMEM;
2350 if (copy_from_user(kbuf, buffer, left)) {
2351 free_page(page);
2352 return -EFAULT;
2353 }
2354 kbuf[left] = 0;
2355
2356 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2357 GFP_KERNEL);
2358 if (!tmp_bitmap) {
2359 free_page(page);
2360 return -ENOMEM;
2361 }
2362 proc_skip_char(&kbuf, &left, '\n');
2363 while (!err && left) {
2364 unsigned long val_a, val_b;
2365 bool neg;
2366
2367 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2368 sizeof(tr_a), &c);
2369 if (err)
2370 break;
2371 if (val_a >= bitmap_len || neg) {
2372 err = -EINVAL;
2373 break;
2374 }
2375
2376 val_b = val_a;
2377 if (left) {
2378 kbuf++;
2379 left--;
2380 }
2381
2382 if (c == '-') {
2383 err = proc_get_long(&kbuf, &left, &val_b,
2384 &neg, tr_b, sizeof(tr_b),
2385 &c);
2386 if (err)
2387 break;
2388 if (val_b >= bitmap_len || neg ||
2389 val_a > val_b) {
2390 err = -EINVAL;
2391 break;
2392 }
2393 if (left) {
2394 kbuf++;
2395 left--;
2396 }
2397 }
2398
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002399 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002400 first = 0;
2401 proc_skip_char(&kbuf, &left, '\n');
2402 }
2403 free_page(page);
2404 } else {
2405 unsigned long bit_a, bit_b = 0;
2406
2407 while (left) {
2408 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2409 if (bit_a >= bitmap_len)
2410 break;
2411 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2412 bit_a + 1) - 1;
2413
2414 if (!first) {
2415 err = proc_put_char(&buffer, &left, ',');
2416 if (err)
2417 break;
2418 }
2419 err = proc_put_long(&buffer, &left, bit_a, false);
2420 if (err)
2421 break;
2422 if (bit_a != bit_b) {
2423 err = proc_put_char(&buffer, &left, '-');
2424 if (err)
2425 break;
2426 err = proc_put_long(&buffer, &left, bit_b, false);
2427 if (err)
2428 break;
2429 }
2430
2431 first = 0; bit_b++;
2432 }
2433 if (!err)
2434 err = proc_put_char(&buffer, &left, '\n');
2435 }
2436
2437 if (!err) {
2438 if (write) {
2439 if (*ppos)
2440 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2441 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002442 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002443 }
2444 kfree(tmp_bitmap);
2445 *lenp -= left;
2446 *ppos += *lenp;
2447 return 0;
2448 } else {
2449 kfree(tmp_bitmap);
2450 return err;
2451 }
2452}
2453
Jovi Zhang55610502011-01-12 17:00:45 -08002454#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002455
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002456int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002457 void __user *buffer, size_t *lenp, loff_t *ppos)
2458{
2459 return -ENOSYS;
2460}
2461
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002462int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002463 void __user *buffer, size_t *lenp, loff_t *ppos)
2464{
2465 return -ENOSYS;
2466}
2467
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002468int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002469 void __user *buffer, size_t *lenp, loff_t *ppos)
2470{
2471 return -ENOSYS;
2472}
2473
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002474int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002475 void __user *buffer, size_t *lenp, loff_t *ppos)
2476{
2477 return -ENOSYS;
2478}
2479
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002480int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002481 void __user *buffer, size_t *lenp, loff_t *ppos)
2482{
2483 return -ENOSYS;
2484}
2485
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002486int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002487 void __user *buffer, size_t *lenp, loff_t *ppos)
2488{
2489 return -ENOSYS;
2490}
2491
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002492int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002493 void __user *buffer, size_t *lenp, loff_t *ppos)
2494{
2495 return -ENOSYS;
2496}
2497
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002498int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002499 void __user *buffer,
2500 size_t *lenp, loff_t *ppos)
2501{
2502 return -ENOSYS;
2503}
2504
2505
Jovi Zhang55610502011-01-12 17:00:45 -08002506#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002507
Linus Torvalds1da177e2005-04-16 15:20:36 -07002508/*
2509 * No sense putting this after each symbol definition, twice,
2510 * exception granted :-)
2511 */
2512EXPORT_SYMBOL(proc_dointvec);
2513EXPORT_SYMBOL(proc_dointvec_jiffies);
2514EXPORT_SYMBOL(proc_dointvec_minmax);
2515EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2516EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2517EXPORT_SYMBOL(proc_dostring);
2518EXPORT_SYMBOL(proc_doulongvec_minmax);
2519EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);