blob: b69314289aef8fb77c760a25a673f416cd78af70 [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;
Arve Hjønnevågcde89492009-02-17 14:51:02 -0800105extern int min_free_order_shift;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800107extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800108extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200109extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100110extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400111extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000112#ifndef CONFIG_MMU
113extern int sysctl_nr_trim_pages;
114#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200115#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200116extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200117#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700119/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400120#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700121static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200122static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700123#endif
124
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700125static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700126static int __maybe_unused one = 1;
127static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700128static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800129static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700130static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700131#ifdef CONFIG_PRINTK
132static int ten_thousand = 10000;
133#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700134
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700135/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
136static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
139static int maxolduid = 65535;
140static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800141static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
143static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700144static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
Dave Youngd14f1722010-02-25 20:28:57 -0500146#ifdef CONFIG_INOTIFY_USER
147#include <linux/inotify.h>
148#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700149#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150#endif
151
David S. Miller08714202008-11-16 23:49:24 -0800152#ifdef CONFIG_SPARC64
153extern int sysctl_tsb_ratio;
154#endif
155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#ifdef __hppa__
157extern int pwrsw_enabled;
158extern int unaligned_enabled;
159#endif
160
Jes Sorensend2b176e2006-02-28 09:42:23 -0800161#ifdef CONFIG_IA64
162extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800163extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800164#endif
165
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700166#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700167static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700168 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700169static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800170 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700171#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700172
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700173#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700174static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700175 void __user *buffer, size_t *lenp, loff_t *ppos);
176#endif
177
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700178#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800179/* Note: sysrq code uses it's own private copy */
180static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700181
182static int sysrq_sysctl_handler(ctl_table *table, int write,
183 void __user *buffer, size_t *lenp,
184 loff_t *ppos)
185{
186 int error;
187
188 error = proc_dointvec(table, write, buffer, lenp, ppos);
189 if (error)
190 return error;
191
192 if (write)
193 sysrq_toggle_support(__sysrq_enabled);
194
195 return 0;
196}
197
198#endif
199
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700200static struct ctl_table kern_table[];
201static struct ctl_table vm_table[];
202static struct ctl_table fs_table[];
203static struct ctl_table debug_table[];
204static struct ctl_table dev_table[];
205extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800206#ifdef CONFIG_EPOLL
207extern struct ctl_table epoll_table[];
208#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
211int sysctl_legacy_va_layout;
212#endif
213
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214/* The default sysctl tables: */
215
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800216static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 .procname = "kernel",
219 .mode = 0555,
220 .child = kern_table,
221 },
222 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 .procname = "vm",
224 .mode = 0555,
225 .child = vm_table,
226 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 .procname = "fs",
229 .mode = 0555,
230 .child = fs_table,
231 },
232 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 .procname = "debug",
234 .mode = 0555,
235 .child = debug_table,
236 },
237 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 .procname = "dev",
239 .mode = 0555,
240 .child = dev_table,
241 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700242 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243};
244
Ingo Molnar77e54a12007-07-09 18:52:00 +0200245#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100246static int min_sched_granularity_ns = 100000; /* 100 usecs */
247static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
248static int min_wakeup_granularity_ns; /* 0 usecs */
249static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100250static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
251static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200252#endif
253
Mel Gorman5e771902010-05-24 14:32:31 -0700254#ifdef CONFIG_COMPACTION
255static int min_extfrag_threshold;
256static int max_extfrag_threshold = 1000;
257#endif
258
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700259static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200260 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200261 .procname = "sched_child_runs_first",
262 .data = &sysctl_sched_child_runs_first,
263 .maxlen = sizeof(unsigned int),
264 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800265 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200266 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200267#ifdef CONFIG_SCHED_DEBUG
268 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100269 .procname = "sched_min_granularity_ns",
270 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200271 .maxlen = sizeof(unsigned int),
272 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800273 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100274 .extra1 = &min_sched_granularity_ns,
275 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200276 },
277 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200278 .procname = "sched_latency_ns",
279 .data = &sysctl_sched_latency,
280 .maxlen = sizeof(unsigned int),
281 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800282 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200283 .extra1 = &min_sched_granularity_ns,
284 .extra2 = &max_sched_granularity_ns,
285 },
286 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200287 .procname = "sched_wakeup_granularity_ns",
288 .data = &sysctl_sched_wakeup_granularity,
289 .maxlen = sizeof(unsigned int),
290 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800291 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200292 .extra1 = &min_wakeup_granularity_ns,
293 .extra2 = &max_wakeup_granularity_ns,
294 },
295 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100296 .procname = "sched_tunable_scaling",
297 .data = &sysctl_sched_tunable_scaling,
298 .maxlen = sizeof(enum sched_tunable_scaling),
299 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800300 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100301 .extra1 = &min_sched_tunable_scaling,
302 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200303 },
304 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200305 .procname = "sched_migration_cost",
306 .data = &sysctl_sched_migration_cost,
307 .maxlen = sizeof(unsigned int),
308 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800309 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200310 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100311 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100312 .procname = "sched_nr_migrate",
313 .data = &sysctl_sched_nr_migrate,
314 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100315 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800316 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100317 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530318 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200319 .procname = "sched_time_avg",
320 .data = &sysctl_sched_time_avg,
321 .maxlen = sizeof(unsigned int),
322 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800323 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200324 },
325 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800326 .procname = "sched_shares_window",
327 .data = &sysctl_sched_shares_window,
328 .maxlen = sizeof(unsigned int),
329 .mode = 0644,
330 .proc_handler = proc_dointvec,
331 },
332 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530333 .procname = "timer_migration",
334 .data = &sysctl_timer_migration,
335 .maxlen = sizeof(unsigned int),
336 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800337 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530338 .extra1 = &zero,
339 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530340 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200341#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200342 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100343 .procname = "sched_rt_period_us",
344 .data = &sysctl_sched_rt_period,
345 .maxlen = sizeof(unsigned int),
346 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800347 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100348 },
349 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100350 .procname = "sched_rt_runtime_us",
351 .data = &sysctl_sched_rt_runtime,
352 .maxlen = sizeof(int),
353 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800354 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100355 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100356#ifdef CONFIG_SCHED_AUTOGROUP
357 {
358 .procname = "sched_autogroup_enabled",
359 .data = &sysctl_sched_autogroup_enabled,
360 .maxlen = sizeof(unsigned int),
361 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800362 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100363 .extra1 = &zero,
364 .extra2 = &one,
365 },
366#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700367#ifdef CONFIG_CFS_BANDWIDTH
368 {
369 .procname = "sched_cfs_bandwidth_slice_us",
370 .data = &sysctl_sched_cfs_bandwidth_slice,
371 .maxlen = sizeof(unsigned int),
372 .mode = 0644,
373 .proc_handler = proc_dointvec_minmax,
374 .extra1 = &one,
375 },
376#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700377#ifdef CONFIG_PROVE_LOCKING
378 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700379 .procname = "prove_locking",
380 .data = &prove_locking,
381 .maxlen = sizeof(int),
382 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800383 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700384 },
385#endif
386#ifdef CONFIG_LOCK_STAT
387 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700388 .procname = "lock_stat",
389 .data = &lock_stat,
390 .maxlen = sizeof(int),
391 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800392 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700393 },
394#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200395 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 .procname = "panic",
397 .data = &panic_timeout,
398 .maxlen = sizeof(int),
399 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800400 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 },
402 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 .procname = "core_uses_pid",
404 .data = &core_uses_pid,
405 .maxlen = sizeof(int),
406 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800407 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 },
409 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410 .procname = "core_pattern",
411 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700412 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800414 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 },
Neil Hormana2939802009-09-23 15:56:56 -0700416 {
Neil Hormana2939802009-09-23 15:56:56 -0700417 .procname = "core_pipe_limit",
418 .data = &core_pipe_limit,
419 .maxlen = sizeof(unsigned int),
420 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800421 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700422 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800423#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700426 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800427 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800428 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800430#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100431#ifdef CONFIG_LATENCYTOP
432 {
433 .procname = "latencytop",
434 .data = &latencytop_enabled,
435 .maxlen = sizeof(int),
436 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800437 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100438 },
439#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440#ifdef CONFIG_BLK_DEV_INITRD
441 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 .procname = "real-root-dev",
443 .data = &real_root_dev,
444 .maxlen = sizeof(int),
445 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800446 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 },
448#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700449 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700450 .procname = "print-fatal-signals",
451 .data = &print_fatal_signals,
452 .maxlen = sizeof(int),
453 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800454 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700455 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700456#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 .procname = "reboot-cmd",
459 .data = reboot_command,
460 .maxlen = 256,
461 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800462 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 },
464 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 .procname = "stop-a",
466 .data = &stop_a_enabled,
467 .maxlen = sizeof (int),
468 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800469 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 },
471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 .procname = "scons-poweroff",
473 .data = &scons_pwroff,
474 .maxlen = sizeof (int),
475 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800476 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 },
478#endif
David S. Miller08714202008-11-16 23:49:24 -0800479#ifdef CONFIG_SPARC64
480 {
David S. Miller08714202008-11-16 23:49:24 -0800481 .procname = "tsb-ratio",
482 .data = &sysctl_tsb_ratio,
483 .maxlen = sizeof (int),
484 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800485 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800486 },
487#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488#ifdef __hppa__
489 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 .procname = "soft-power",
491 .data = &pwrsw_enabled,
492 .maxlen = sizeof (int),
493 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800494 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 },
496 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700497 .procname = "unaligned-trap",
498 .data = &unaligned_enabled,
499 .maxlen = sizeof (int),
500 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800501 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 },
503#endif
504 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 .procname = "ctrl-alt-del",
506 .data = &C_A_D,
507 .maxlen = sizeof(int),
508 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800509 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400511#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200512 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200513 .procname = "ftrace_enabled",
514 .data = &ftrace_enabled,
515 .maxlen = sizeof(int),
516 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800517 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200518 },
519#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500520#ifdef CONFIG_STACK_TRACER
521 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500522 .procname = "stack_tracer_enabled",
523 .data = &stack_tracer_enabled,
524 .maxlen = sizeof(int),
525 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800526 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500527 },
528#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400529#ifdef CONFIG_TRACING
530 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100531 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400532 .data = &ftrace_dump_on_oops,
533 .maxlen = sizeof(int),
534 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800535 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400536 },
537#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200538#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 .procname = "modprobe",
541 .data = &modprobe_path,
542 .maxlen = KMOD_PATH_LEN,
543 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800544 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 },
Kees Cook3d433212009-04-02 15:49:29 -0700546 {
Kees Cook3d433212009-04-02 15:49:29 -0700547 .procname = "modules_disabled",
548 .data = &modules_disabled,
549 .maxlen = sizeof(int),
550 .mode = 0644,
551 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800552 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700553 .extra1 = &one,
554 .extra2 = &one,
555 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100557#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100560 .data = &uevent_helper,
561 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800563 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 },
565#endif
566#ifdef CONFIG_CHR_DEV_SG
567 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 .procname = "sg-big-buff",
569 .data = &sg_big_buff,
570 .maxlen = sizeof (int),
571 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800572 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 },
574#endif
575#ifdef CONFIG_BSD_PROCESS_ACCT
576 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 .procname = "acct",
578 .data = &acct_parm,
579 .maxlen = 3*sizeof(int),
580 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800581 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 },
583#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584#ifdef CONFIG_MAGIC_SYSRQ
585 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800587 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 .maxlen = sizeof (int),
589 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700590 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 },
592#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700593#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700596 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 .maxlen = sizeof (int),
598 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800599 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700601#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 .procname = "threads-max",
604 .data = &max_threads,
605 .maxlen = sizeof(int),
606 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800607 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 },
609 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 .procname = "random",
611 .mode = 0555,
612 .child = random_table,
613 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614 {
Eric Paris17f60a72011-04-01 17:07:50 -0400615 .procname = "usermodehelper",
616 .mode = 0555,
617 .child = usermodehelper_table,
618 },
619 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620 .procname = "overflowuid",
621 .data = &overflowuid,
622 .maxlen = sizeof(int),
623 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800624 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 .extra1 = &minolduid,
626 .extra2 = &maxolduid,
627 },
628 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .procname = "overflowgid",
630 .data = &overflowgid,
631 .maxlen = sizeof(int),
632 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800633 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 .extra1 = &minolduid,
635 .extra2 = &maxolduid,
636 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800637#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638#ifdef CONFIG_MATHEMU
639 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 .procname = "ieee_emulation_warnings",
641 .data = &sysctl_ieee_emulation_warnings,
642 .maxlen = sizeof(int),
643 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800644 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 },
646#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200649 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 .maxlen = sizeof(int),
651 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800652 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 },
654#endif
655 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 .procname = "pid_max",
657 .data = &pid_max,
658 .maxlen = sizeof (int),
659 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800660 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 .extra1 = &pid_max_min,
662 .extra2 = &pid_max_max,
663 },
664 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 .procname = "panic_on_oops",
666 .data = &panic_on_oops,
667 .maxlen = sizeof(int),
668 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800669 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800671#if defined CONFIG_PRINTK
672 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800673 .procname = "printk",
674 .data = &console_loglevel,
675 .maxlen = 4*sizeof(int),
676 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800677 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800678 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700681 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682 .maxlen = sizeof(int),
683 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800684 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 },
686 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700688 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 .maxlen = sizeof(int),
690 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800691 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 },
Dave Youngaf913222009-09-22 16:43:33 -0700693 {
Dave Youngaf913222009-09-22 16:43:33 -0700694 .procname = "printk_delay",
695 .data = &printk_delay_msec,
696 .maxlen = sizeof(int),
697 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800698 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700699 .extra1 = &zero,
700 .extra2 = &ten_thousand,
701 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800703 .procname = "dmesg_restrict",
704 .data = &dmesg_restrict,
705 .maxlen = sizeof(int),
706 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700707 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800708 .extra1 = &zero,
709 .extra2 = &one,
710 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800711 {
712 .procname = "kptr_restrict",
713 .data = &kptr_restrict,
714 .maxlen = sizeof(int),
715 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700716 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800717 .extra1 = &zero,
718 .extra2 = &two,
719 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800720#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800721 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 .procname = "ngroups_max",
723 .data = &ngroups_max,
724 .maxlen = sizeof (int),
725 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800726 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 },
Dan Ballard73efc032011-10-31 17:11:20 -0700728 {
729 .procname = "cap_last_cap",
730 .data = (void *)&cap_last_cap,
731 .maxlen = sizeof(int),
732 .mode = 0444,
733 .proc_handler = proc_dointvec,
734 },
Don Zickus58687ac2010-05-07 17:11:44 -0400735#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500736 {
Don Zickus58687ac2010-05-07 17:11:44 -0400737 .procname = "watchdog",
738 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500739 .maxlen = sizeof (int),
740 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700741 .proc_handler = proc_dowatchdog,
742 .extra1 = &zero,
743 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400744 },
745 {
746 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700747 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400748 .maxlen = sizeof(int),
749 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700750 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400751 .extra1 = &neg_one,
752 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500753 },
Don Zickus2508ce12010-05-07 17:11:46 -0400754 {
755 .procname = "softlockup_panic",
756 .data = &softlockup_panic,
757 .maxlen = sizeof(int),
758 .mode = 0644,
759 .proc_handler = proc_dointvec_minmax,
760 .extra1 = &zero,
761 .extra2 = &one,
762 },
Don Zickus5dc30552010-11-29 17:07:17 -0500763 {
764 .procname = "nmi_watchdog",
765 .data = &watchdog_enabled,
766 .maxlen = sizeof (int),
767 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700768 .proc_handler = proc_dowatchdog,
769 .extra1 = &zero,
770 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500771 },
772#endif
773#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
774 {
775 .procname = "unknown_nmi_panic",
776 .data = &unknown_nmi_panic,
777 .maxlen = sizeof (int),
778 .mode = 0644,
779 .proc_handler = proc_dointvec,
780 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500781#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782#if defined(CONFIG_X86)
783 {
Don Zickus8da5add2006-09-26 10:52:27 +0200784 .procname = "panic_on_unrecovered_nmi",
785 .data = &panic_on_unrecovered_nmi,
786 .maxlen = sizeof(int),
787 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800788 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200789 },
790 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700791 .procname = "panic_on_io_nmi",
792 .data = &panic_on_io_nmi,
793 .maxlen = sizeof(int),
794 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800795 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700796 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900797#ifdef CONFIG_DEBUG_STACKOVERFLOW
798 {
799 .procname = "panic_on_stackoverflow",
800 .data = &sysctl_panic_on_stackoverflow,
801 .maxlen = sizeof(int),
802 .mode = 0644,
803 .proc_handler = proc_dointvec,
804 },
805#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700806 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 .procname = "bootloader_type",
808 .data = &bootloader_type,
809 .maxlen = sizeof (int),
810 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800811 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100813 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700814 .procname = "bootloader_version",
815 .data = &bootloader_version,
816 .maxlen = sizeof (int),
817 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800818 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700819 },
820 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100821 .procname = "kstack_depth_to_print",
822 .data = &kstack_depth_to_print,
823 .maxlen = sizeof(int),
824 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800825 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100826 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100827 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100828 .procname = "io_delay_type",
829 .data = &io_delay_type,
830 .maxlen = sizeof(int),
831 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800832 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100833 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800835#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837 .procname = "randomize_va_space",
838 .data = &randomize_va_space,
839 .maxlen = sizeof(int),
840 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800841 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800843#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800844#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700845 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700846 .procname = "spin_retry",
847 .data = &spin_retry,
848 .maxlen = sizeof (int),
849 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800850 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700851 },
852#endif
Len Brown673d5b42007-07-28 03:33:16 -0400853#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800854 {
Pavel Machekc255d842006-02-20 18:27:58 -0800855 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700856 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800857 .maxlen = sizeof (unsigned long),
858 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800859 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800860 },
861#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800862#ifdef CONFIG_IA64
863 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800864 .procname = "ignore-unaligned-usertrap",
865 .data = &no_unaligned_warning,
866 .maxlen = sizeof (int),
867 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800868 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800869 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800870 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800871 .procname = "unaligned-dump-stack",
872 .data = &unaligned_dump_stack,
873 .maxlen = sizeof (int),
874 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800875 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800876 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800877#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800878#ifdef CONFIG_DETECT_HUNG_TASK
879 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800880 .procname = "hung_task_panic",
881 .data = &sysctl_hung_task_panic,
882 .maxlen = sizeof(int),
883 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800884 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800885 .extra1 = &zero,
886 .extra2 = &one,
887 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100888 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100889 .procname = "hung_task_check_count",
890 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100891 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100892 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800893 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100894 },
895 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100896 .procname = "hung_task_timeout_secs",
897 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100898 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100899 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800900 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 },
902 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100903 .procname = "hung_task_warnings",
904 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100905 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100906 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800907 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100908 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700909#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200910#ifdef CONFIG_COMPAT
911 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200912 .procname = "compat-log",
913 .data = &compat_log,
914 .maxlen = sizeof (int),
915 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800916 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200917 },
918#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700919#ifdef CONFIG_RT_MUTEXES
920 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700921 .procname = "max_lock_depth",
922 .data = &max_lock_depth,
923 .maxlen = sizeof(int),
924 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800925 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700926 },
927#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700928 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700929 .procname = "poweroff_cmd",
930 .data = &poweroff_cmd,
931 .maxlen = POWEROFF_CMD_PATH_LEN,
932 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800933 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700934 },
David Howells0b77f5b2008-04-29 01:01:32 -0700935#ifdef CONFIG_KEYS
936 {
David Howells0b77f5b2008-04-29 01:01:32 -0700937 .procname = "keys",
938 .mode = 0555,
939 .child = key_sysctls,
940 },
941#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700942#ifdef CONFIG_RCU_TORTURE_TEST
943 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700944 .procname = "rcutorture_runnable",
945 .data = &rcutorture_runnable,
946 .maxlen = sizeof(int),
947 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800948 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700949 },
950#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200951#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400952 /*
953 * User-space scripts rely on the existence of this file
954 * as a feature check for perf_events being enabled.
955 *
956 * So it's an ABI, do not remove!
957 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200958 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200959 .procname = "perf_event_paranoid",
960 .data = &sysctl_perf_event_paranoid,
961 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200962 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800963 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200964 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200965 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200966 .procname = "perf_event_mlock_kb",
967 .data = &sysctl_perf_event_mlock,
968 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200969 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800970 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200971 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200972 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200973 .procname = "perf_event_max_sample_rate",
974 .data = &sysctl_perf_event_sample_rate,
975 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200976 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100977 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200978 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200979#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200980#ifdef CONFIG_KMEMCHECK
981 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200982 .procname = "kmemcheck",
983 .data = &kmemcheck_enabled,
984 .maxlen = sizeof(int),
985 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800986 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200987 },
988#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200989#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200990 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200991 .procname = "blk_iopoll",
992 .data = &blk_iopoll_enabled,
993 .maxlen = sizeof(int),
994 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800995 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +0200996 },
Jens Axboecb684b52009-09-15 21:53:11 +0200997#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998#ifdef CONFIG_ARM
999 {
1000 .procname = "boot_reason",
1001 .data = &boot_reason,
1002 .maxlen = sizeof(int),
1003 .mode = 0444,
1004 .proc_handler = proc_dointvec,
1005},
1006#endif
1007/*
1008 * NOTE: do not add new entries to this table unless you have read
1009 * Documentation/sysctl/ctl_unnumbered.txt
1010 */
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001011 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001012};
1013
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001014static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001015 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001016 .procname = "overcommit_memory",
1017 .data = &sysctl_overcommit_memory,
1018 .maxlen = sizeof(sysctl_overcommit_memory),
1019 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001020 .proc_handler = proc_dointvec_minmax,
1021 .extra1 = &zero,
1022 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001023 },
1024 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001025 .procname = "panic_on_oom",
1026 .data = &sysctl_panic_on_oom,
1027 .maxlen = sizeof(sysctl_panic_on_oom),
1028 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001029 .proc_handler = proc_dointvec_minmax,
1030 .extra1 = &zero,
1031 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001032 },
1033 {
David Rientjesfe071d72007-10-16 23:25:56 -07001034 .procname = "oom_kill_allocating_task",
1035 .data = &sysctl_oom_kill_allocating_task,
1036 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1037 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001038 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001039 },
1040 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001041 .procname = "oom_dump_tasks",
1042 .data = &sysctl_oom_dump_tasks,
1043 .maxlen = sizeof(sysctl_oom_dump_tasks),
1044 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001045 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001046 },
1047 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001048 .procname = "overcommit_ratio",
1049 .data = &sysctl_overcommit_ratio,
1050 .maxlen = sizeof(sysctl_overcommit_ratio),
1051 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001052 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053 },
1054 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 .procname = "page-cluster",
1056 .data = &page_cluster,
1057 .maxlen = sizeof(int),
1058 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001059 .proc_handler = proc_dointvec_minmax,
1060 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001061 },
1062 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001063 .procname = "dirty_background_ratio",
1064 .data = &dirty_background_ratio,
1065 .maxlen = sizeof(dirty_background_ratio),
1066 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001067 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001068 .extra1 = &zero,
1069 .extra2 = &one_hundred,
1070 },
1071 {
David Rientjes2da02992009-01-06 14:39:31 -08001072 .procname = "dirty_background_bytes",
1073 .data = &dirty_background_bytes,
1074 .maxlen = sizeof(dirty_background_bytes),
1075 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001076 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001077 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001078 },
1079 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001080 .procname = "dirty_ratio",
1081 .data = &vm_dirty_ratio,
1082 .maxlen = sizeof(vm_dirty_ratio),
1083 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001084 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001085 .extra1 = &zero,
1086 .extra2 = &one_hundred,
1087 },
1088 {
David Rientjes2da02992009-01-06 14:39:31 -08001089 .procname = "dirty_bytes",
1090 .data = &vm_dirty_bytes,
1091 .maxlen = sizeof(vm_dirty_bytes),
1092 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001093 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001094 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001095 },
1096 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001097 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001098 .data = &dirty_writeback_interval,
1099 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001100 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001101 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001102 },
1103 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001105 .data = &dirty_expire_interval,
1106 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001107 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001108 .proc_handler = proc_dointvec_minmax,
1109 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110 },
1111 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001112 .procname = "nr_pdflush_threads",
1113 .data = &nr_pdflush_threads,
1114 .maxlen = sizeof nr_pdflush_threads,
1115 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001116 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001117 },
1118 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001119 .procname = "swappiness",
1120 .data = &vm_swappiness,
1121 .maxlen = sizeof(vm_swappiness),
1122 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001123 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 .extra1 = &zero,
1125 .extra2 = &one_hundred,
1126 },
1127#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001128 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001129 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001130 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131 .maxlen = sizeof(unsigned long),
1132 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001133 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001134 .extra1 = (void *)&hugetlb_zero,
1135 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001136 },
1137#ifdef CONFIG_NUMA
1138 {
1139 .procname = "nr_hugepages_mempolicy",
1140 .data = NULL,
1141 .maxlen = sizeof(unsigned long),
1142 .mode = 0644,
1143 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1144 .extra1 = (void *)&hugetlb_zero,
1145 .extra2 = (void *)&hugetlb_infinity,
1146 },
1147#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001148 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001149 .procname = "hugetlb_shm_group",
1150 .data = &sysctl_hugetlb_shm_group,
1151 .maxlen = sizeof(gid_t),
1152 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001153 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001154 },
Mel Gorman396faf02007-07-17 04:03:13 -07001155 {
Mel Gorman396faf02007-07-17 04:03:13 -07001156 .procname = "hugepages_treat_as_movable",
1157 .data = &hugepages_treat_as_movable,
1158 .maxlen = sizeof(int),
1159 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001160 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001161 },
Adam Litke54f9f802007-10-16 01:26:20 -07001162 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001163 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001164 .data = NULL,
1165 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001166 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001167 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001168 .extra1 = (void *)&hugetlb_zero,
1169 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001170 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001171#endif
1172 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001173 .procname = "lowmem_reserve_ratio",
1174 .data = &sysctl_lowmem_reserve_ratio,
1175 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1176 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001177 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001178 },
1179 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001180 .procname = "drop_caches",
1181 .data = &sysctl_drop_caches,
1182 .maxlen = sizeof(int),
1183 .mode = 0644,
1184 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001185 .extra1 = &one,
1186 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001187 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001188#ifdef CONFIG_COMPACTION
1189 {
1190 .procname = "compact_memory",
1191 .data = &sysctl_compact_memory,
1192 .maxlen = sizeof(int),
1193 .mode = 0200,
1194 .proc_handler = sysctl_compaction_handler,
1195 },
Mel Gorman5e771902010-05-24 14:32:31 -07001196 {
1197 .procname = "extfrag_threshold",
1198 .data = &sysctl_extfrag_threshold,
1199 .maxlen = sizeof(int),
1200 .mode = 0644,
1201 .proc_handler = sysctl_extfrag_handler,
1202 .extra1 = &min_extfrag_threshold,
1203 .extra2 = &max_extfrag_threshold,
1204 },
1205
Mel Gorman76ab0f52010-05-24 14:32:28 -07001206#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001207 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001208 .procname = "min_free_kbytes",
1209 .data = &min_free_kbytes,
1210 .maxlen = sizeof(min_free_kbytes),
1211 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001212 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001213 .extra1 = &zero,
1214 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001215 {
Arve Hjønnevågcde89492009-02-17 14:51:02 -08001216 .procname = "min_free_order_shift",
1217 .data = &min_free_order_shift,
1218 .maxlen = sizeof(min_free_order_shift),
1219 .mode = 0644,
1220 .proc_handler = &proc_dointvec
1221 },
1222 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001223 .procname = "percpu_pagelist_fraction",
1224 .data = &percpu_pagelist_fraction,
1225 .maxlen = sizeof(percpu_pagelist_fraction),
1226 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001227 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001228 .extra1 = &min_percpu_pagelist_fract,
1229 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001230#ifdef CONFIG_MMU
1231 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001232 .procname = "max_map_count",
1233 .data = &sysctl_max_map_count,
1234 .maxlen = sizeof(sysctl_max_map_count),
1235 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001236 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001237 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001238 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001239#else
1240 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001241 .procname = "nr_trim_pages",
1242 .data = &sysctl_nr_trim_pages,
1243 .maxlen = sizeof(sysctl_nr_trim_pages),
1244 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001245 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001246 .extra1 = &zero,
1247 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001248#endif
1249 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001250 .procname = "laptop_mode",
1251 .data = &laptop_mode,
1252 .maxlen = sizeof(laptop_mode),
1253 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001254 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001255 },
1256 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001257 .procname = "block_dump",
1258 .data = &block_dump,
1259 .maxlen = sizeof(block_dump),
1260 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001261 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262 .extra1 = &zero,
1263 },
1264 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001265 .procname = "vfs_cache_pressure",
1266 .data = &sysctl_vfs_cache_pressure,
1267 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1268 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001269 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001270 .extra1 = &zero,
1271 },
1272#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1273 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001274 .procname = "legacy_va_layout",
1275 .data = &sysctl_legacy_va_layout,
1276 .maxlen = sizeof(sysctl_legacy_va_layout),
1277 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001278 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001279 .extra1 = &zero,
1280 },
1281#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001282#ifdef CONFIG_NUMA
1283 {
Christoph Lameter17436602006-01-18 17:42:32 -08001284 .procname = "zone_reclaim_mode",
1285 .data = &zone_reclaim_mode,
1286 .maxlen = sizeof(zone_reclaim_mode),
1287 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001288 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001289 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001290 },
Christoph Lameter96146342006-07-03 00:24:13 -07001291 {
Christoph Lameter96146342006-07-03 00:24:13 -07001292 .procname = "min_unmapped_ratio",
1293 .data = &sysctl_min_unmapped_ratio,
1294 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1295 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001296 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001297 .extra1 = &zero,
1298 .extra2 = &one_hundred,
1299 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001300 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001301 .procname = "min_slab_ratio",
1302 .data = &sysctl_min_slab_ratio,
1303 .maxlen = sizeof(sysctl_min_slab_ratio),
1304 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001305 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001306 .extra1 = &zero,
1307 .extra2 = &one_hundred,
1308 },
Christoph Lameter17436602006-01-18 17:42:32 -08001309#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001310#ifdef CONFIG_SMP
1311 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001312 .procname = "stat_interval",
1313 .data = &sysctl_stat_interval,
1314 .maxlen = sizeof(sysctl_stat_interval),
1315 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001316 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001317 },
1318#endif
David Howells6e141542009-12-15 19:27:45 +00001319#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001320 {
Eric Parised032182007-06-28 15:55:21 -04001321 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001322 .data = &dac_mmap_min_addr,
1323 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001324 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001325 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001326 },
David Howells6e141542009-12-15 19:27:45 +00001327#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001328#ifdef CONFIG_NUMA
1329 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001330 .procname = "numa_zonelist_order",
1331 .data = &numa_zonelist_order,
1332 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1333 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001334 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001335 },
1336#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001337#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001338 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001339 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001340 .procname = "vdso_enabled",
1341 .data = &vdso_enabled,
1342 .maxlen = sizeof(vdso_enabled),
1343 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001344 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001345 .extra1 = &zero,
1346 },
1347#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001348#ifdef CONFIG_HIGHMEM
1349 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001350 .procname = "highmem_is_dirtyable",
1351 .data = &vm_highmem_is_dirtyable,
1352 .maxlen = sizeof(vm_highmem_is_dirtyable),
1353 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001354 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001355 .extra1 = &zero,
1356 .extra2 = &one,
1357 },
1358#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001359 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001360 .procname = "scan_unevictable_pages",
1361 .data = &scan_unevictable_pages,
1362 .maxlen = sizeof(scan_unevictable_pages),
1363 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001364 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001365 },
Andi Kleen6a460792009-09-16 11:50:15 +02001366#ifdef CONFIG_MEMORY_FAILURE
1367 {
Andi Kleen6a460792009-09-16 11:50:15 +02001368 .procname = "memory_failure_early_kill",
1369 .data = &sysctl_memory_failure_early_kill,
1370 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1371 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001372 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001373 .extra1 = &zero,
1374 .extra2 = &one,
1375 },
1376 {
Andi Kleen6a460792009-09-16 11:50:15 +02001377 .procname = "memory_failure_recovery",
1378 .data = &sysctl_memory_failure_recovery,
1379 .maxlen = sizeof(sysctl_memory_failure_recovery),
1380 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001381 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001382 .extra1 = &zero,
1383 .extra2 = &one,
1384 },
1385#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001386 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387};
1388
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001389#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001390static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001391 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001392};
1393#endif
1394
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001395static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001396 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397 .procname = "inode-nr",
1398 .data = &inodes_stat,
1399 .maxlen = 2*sizeof(int),
1400 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001401 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001402 },
1403 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001404 .procname = "inode-state",
1405 .data = &inodes_stat,
1406 .maxlen = 7*sizeof(int),
1407 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001408 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001409 },
1410 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001411 .procname = "file-nr",
1412 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001413 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001414 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001415 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001416 },
1417 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 .procname = "file-max",
1419 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001420 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001421 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001422 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001423 },
1424 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001425 .procname = "nr_open",
1426 .data = &sysctl_nr_open,
1427 .maxlen = sizeof(int),
1428 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001429 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001430 .extra1 = &sysctl_nr_open_min,
1431 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001432 },
1433 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001434 .procname = "dentry-state",
1435 .data = &dentry_stat,
1436 .maxlen = 6*sizeof(int),
1437 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001438 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001439 },
1440 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001441 .procname = "overflowuid",
1442 .data = &fs_overflowuid,
1443 .maxlen = sizeof(int),
1444 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001445 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001446 .extra1 = &minolduid,
1447 .extra2 = &maxolduid,
1448 },
1449 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450 .procname = "overflowgid",
1451 .data = &fs_overflowgid,
1452 .maxlen = sizeof(int),
1453 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001454 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001455 .extra1 = &minolduid,
1456 .extra2 = &maxolduid,
1457 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001458#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001459 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001460 .procname = "leases-enable",
1461 .data = &leases_enable,
1462 .maxlen = sizeof(int),
1463 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001464 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001465 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001466#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467#ifdef CONFIG_DNOTIFY
1468 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001469 .procname = "dir-notify-enable",
1470 .data = &dir_notify_enable,
1471 .maxlen = sizeof(int),
1472 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001473 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474 },
1475#endif
1476#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001477#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001478 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001479 .procname = "lease-break-time",
1480 .data = &lease_break_time,
1481 .maxlen = sizeof(int),
1482 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001483 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001485#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001486#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001487 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001488 .procname = "aio-nr",
1489 .data = &aio_nr,
1490 .maxlen = sizeof(aio_nr),
1491 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001492 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001493 },
1494 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001495 .procname = "aio-max-nr",
1496 .data = &aio_max_nr,
1497 .maxlen = sizeof(aio_max_nr),
1498 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001499 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001500 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001501#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001502#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001503 {
Robert Love0399cb02005-07-13 12:38:18 -04001504 .procname = "inotify",
1505 .mode = 0555,
1506 .child = inotify_table,
1507 },
1508#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001509#ifdef CONFIG_EPOLL
1510 {
1511 .procname = "epoll",
1512 .mode = 0555,
1513 .child = epoll_table,
1514 },
1515#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001516#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001517 {
Alan Coxd6e71142005-06-23 00:09:43 -07001518 .procname = "suid_dumpable",
1519 .data = &suid_dumpable,
1520 .maxlen = sizeof(int),
1521 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001522 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001523 .extra1 = &zero,
1524 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001525 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001526#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1527 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001528 .procname = "binfmt_misc",
1529 .mode = 0555,
1530 .child = binfmt_misc_table,
1531 },
1532#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001533 {
Jens Axboeff9da692010-06-03 14:54:39 +02001534 .procname = "pipe-max-size",
1535 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001536 .maxlen = sizeof(int),
1537 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001538 .proc_handler = &pipe_proc_fn,
1539 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001540 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001541 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001542};
1543
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001544static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001545#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001546 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001547 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001548 .procname = "exception-trace",
1549 .data = &show_unhandled_signals,
1550 .maxlen = sizeof(int),
1551 .mode = 0644,
1552 .proc_handler = proc_dointvec
1553 },
1554#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001555#if defined(CONFIG_OPTPROBES)
1556 {
1557 .procname = "kprobes-optimization",
1558 .data = &sysctl_kprobes_optimization,
1559 .maxlen = sizeof(int),
1560 .mode = 0644,
1561 .proc_handler = proc_kprobes_optimization_handler,
1562 .extra1 = &zero,
1563 .extra2 = &one,
1564 },
1565#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001566 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001567};
1568
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001569static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001570 { }
Robert Love0eeca282005-07-12 17:06:03 -04001571};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001572
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001573int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001574{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001575 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001576 return 0;
1577}
1578
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001579#endif /* CONFIG_SYSCTL */
1580
Linus Torvalds1da177e2005-04-16 15:20:36 -07001581/*
1582 * /proc/sys support
1583 */
1584
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001585#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001586
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001587static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001588 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001589 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001590{
1591 size_t len;
1592 char __user *p;
1593 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001594
1595 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001596 *lenp = 0;
1597 return 0;
1598 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001599
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001600 if (write) {
1601 len = 0;
1602 p = buffer;
1603 while (len < *lenp) {
1604 if (get_user(c, p++))
1605 return -EFAULT;
1606 if (c == 0 || c == '\n')
1607 break;
1608 len++;
1609 }
1610 if (len >= maxlen)
1611 len = maxlen-1;
1612 if(copy_from_user(data, buffer, len))
1613 return -EFAULT;
1614 ((char *) data)[len] = 0;
1615 *ppos += *lenp;
1616 } else {
1617 len = strlen(data);
1618 if (len > maxlen)
1619 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001620
1621 if (*ppos > len) {
1622 *lenp = 0;
1623 return 0;
1624 }
1625
1626 data += *ppos;
1627 len -= *ppos;
1628
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001629 if (len > *lenp)
1630 len = *lenp;
1631 if (len)
1632 if(copy_to_user(buffer, data, len))
1633 return -EFAULT;
1634 if (len < *lenp) {
1635 if(put_user('\n', ((char __user *) buffer) + len))
1636 return -EFAULT;
1637 len++;
1638 }
1639 *lenp = len;
1640 *ppos += len;
1641 }
1642 return 0;
1643}
1644
Linus Torvalds1da177e2005-04-16 15:20:36 -07001645/**
1646 * proc_dostring - read a string sysctl
1647 * @table: the sysctl table
1648 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001649 * @buffer: the user buffer
1650 * @lenp: the size of the user buffer
1651 * @ppos: file position
1652 *
1653 * Reads/writes a string from/to the user buffer. If the kernel
1654 * buffer provided is not large enough to hold the string, the
1655 * string is truncated. The copied string is %NULL-terminated.
1656 * If the string is being read by the user process, it is copied
1657 * and a newline '\n' is added. It is truncated if the buffer is
1658 * not large enough.
1659 *
1660 * Returns 0 on success.
1661 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001662int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001663 void __user *buffer, size_t *lenp, loff_t *ppos)
1664{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001665 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001666 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001667}
1668
Amerigo Wang00b7c332010-05-05 00:26:45 +00001669static size_t proc_skip_spaces(char **buf)
1670{
1671 size_t ret;
1672 char *tmp = skip_spaces(*buf);
1673 ret = tmp - *buf;
1674 *buf = tmp;
1675 return ret;
1676}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001677
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001678static void proc_skip_char(char **buf, size_t *size, const char v)
1679{
1680 while (*size) {
1681 if (**buf != v)
1682 break;
1683 (*size)--;
1684 (*buf)++;
1685 }
1686}
1687
Amerigo Wang00b7c332010-05-05 00:26:45 +00001688#define TMPBUFLEN 22
1689/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001690 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001691 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001692 * @buf: a kernel buffer
1693 * @size: size of the kernel buffer
1694 * @val: this is where the number will be stored
1695 * @neg: set to %TRUE if number is negative
1696 * @perm_tr: a vector which contains the allowed trailers
1697 * @perm_tr_len: size of the perm_tr vector
1698 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001699 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001700 * In case of success %0 is returned and @buf and @size are updated with
1701 * the amount of bytes read. If @tr is non-NULL and a trailing
1702 * character exists (size is non-zero after returning from this
1703 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001704 */
1705static int proc_get_long(char **buf, size_t *size,
1706 unsigned long *val, bool *neg,
1707 const char *perm_tr, unsigned perm_tr_len, char *tr)
1708{
1709 int len;
1710 char *p, tmp[TMPBUFLEN];
1711
1712 if (!*size)
1713 return -EINVAL;
1714
1715 len = *size;
1716 if (len > TMPBUFLEN - 1)
1717 len = TMPBUFLEN - 1;
1718
1719 memcpy(tmp, *buf, len);
1720
1721 tmp[len] = 0;
1722 p = tmp;
1723 if (*p == '-' && *size > 1) {
1724 *neg = true;
1725 p++;
1726 } else
1727 *neg = false;
1728 if (!isdigit(*p))
1729 return -EINVAL;
1730
1731 *val = simple_strtoul(p, &p, 0);
1732
1733 len = p - tmp;
1734
1735 /* We don't know if the next char is whitespace thus we may accept
1736 * invalid integers (e.g. 1234...a) or two integers instead of one
1737 * (e.g. 123...1). So lets not allow such large numbers. */
1738 if (len == TMPBUFLEN - 1)
1739 return -EINVAL;
1740
1741 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1742 return -EINVAL;
1743
1744 if (tr && (len < *size))
1745 *tr = *p;
1746
1747 *buf += len;
1748 *size -= len;
1749
1750 return 0;
1751}
1752
1753/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001754 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001755 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001756 * @buf: the user buffer
1757 * @size: the size of the user buffer
1758 * @val: the integer to be converted
1759 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001760 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001761 * In case of success %0 is returned and @buf and @size are updated with
1762 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001763 */
1764static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1765 bool neg)
1766{
1767 int len;
1768 char tmp[TMPBUFLEN], *p = tmp;
1769
1770 sprintf(p, "%s%lu", neg ? "-" : "", val);
1771 len = strlen(tmp);
1772 if (len > *size)
1773 len = *size;
1774 if (copy_to_user(*buf, tmp, len))
1775 return -EFAULT;
1776 *size -= len;
1777 *buf += len;
1778 return 0;
1779}
1780#undef TMPBUFLEN
1781
1782static int proc_put_char(void __user **buf, size_t *size, char c)
1783{
1784 if (*size) {
1785 char __user **buffer = (char __user **)buf;
1786 if (put_user(c, *buffer))
1787 return -EFAULT;
1788 (*size)--, (*buffer)++;
1789 *buf = *buffer;
1790 }
1791 return 0;
1792}
1793
1794static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001795 int *valp,
1796 int write, void *data)
1797{
1798 if (write) {
1799 *valp = *negp ? -*lvalp : *lvalp;
1800 } else {
1801 int val = *valp;
1802 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001803 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001804 *lvalp = (unsigned long)-val;
1805 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001806 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001807 *lvalp = (unsigned long)val;
1808 }
1809 }
1810 return 0;
1811}
1812
Amerigo Wang00b7c332010-05-05 00:26:45 +00001813static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1814
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001815static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001816 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001817 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001818 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001819 int write, void *data),
1820 void *data)
1821{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001822 int *i, vleft, first = 1, err = 0;
1823 unsigned long page = 0;
1824 size_t left;
1825 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826
Amerigo Wang00b7c332010-05-05 00:26:45 +00001827 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001828 *lenp = 0;
1829 return 0;
1830 }
1831
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001832 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001833 vleft = table->maxlen / sizeof(*i);
1834 left = *lenp;
1835
1836 if (!conv)
1837 conv = do_proc_dointvec_conv;
1838
Linus Torvalds1da177e2005-04-16 15:20:36 -07001839 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001840 if (left > PAGE_SIZE - 1)
1841 left = PAGE_SIZE - 1;
1842 page = __get_free_page(GFP_TEMPORARY);
1843 kbuf = (char *) page;
1844 if (!kbuf)
1845 return -ENOMEM;
1846 if (copy_from_user(kbuf, buffer, left)) {
1847 err = -EFAULT;
1848 goto free;
1849 }
1850 kbuf[left] = 0;
1851 }
1852
1853 for (; left && vleft--; i++, first=0) {
1854 unsigned long lval;
1855 bool neg;
1856
1857 if (write) {
1858 left -= proc_skip_spaces(&kbuf);
1859
J. R. Okajima563b0462010-05-25 16:10:14 -07001860 if (!left)
1861 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001862 err = proc_get_long(&kbuf, &left, &lval, &neg,
1863 proc_wspace_sep,
1864 sizeof(proc_wspace_sep), NULL);
1865 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001866 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001867 if (conv(&neg, &lval, i, 1, data)) {
1868 err = -EINVAL;
1869 break;
1870 }
1871 } else {
1872 if (conv(&neg, &lval, i, 0, data)) {
1873 err = -EINVAL;
1874 break;
1875 }
1876 if (!first)
1877 err = proc_put_char(&buffer, &left, '\t');
1878 if (err)
1879 break;
1880 err = proc_put_long(&buffer, &left, lval, neg);
1881 if (err)
1882 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001883 }
1884 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001885
1886 if (!write && !first && left && !err)
1887 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001888 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001889 left -= proc_skip_spaces(&kbuf);
1890free:
1891 if (write) {
1892 free_page(page);
1893 if (first)
1894 return err ? : -EINVAL;
1895 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001896 *lenp -= left;
1897 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001898 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001899}
1900
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001901static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001902 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001903 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001904 int write, void *data),
1905 void *data)
1906{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001907 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001908 buffer, lenp, ppos, conv, data);
1909}
1910
Linus Torvalds1da177e2005-04-16 15:20:36 -07001911/**
1912 * proc_dointvec - read a vector of integers
1913 * @table: the sysctl table
1914 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001915 * @buffer: the user buffer
1916 * @lenp: the size of the user buffer
1917 * @ppos: file position
1918 *
1919 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1920 * values from/to the user buffer, treated as an ASCII string.
1921 *
1922 * Returns 0 on success.
1923 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001924int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001925 void __user *buffer, size_t *lenp, loff_t *ppos)
1926{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001927 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001928 NULL,NULL);
1929}
1930
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001931/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001932 * Taint values can only be increased
1933 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001934 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001935static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001936 void __user *buffer, size_t *lenp, loff_t *ppos)
1937{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001938 struct ctl_table t;
1939 unsigned long tmptaint = get_taint();
1940 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001941
Bastian Blank91fcd412007-04-23 14:41:14 -07001942 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001943 return -EPERM;
1944
Andi Kleen25ddbb12008-10-15 22:01:41 -07001945 t = *table;
1946 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001947 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001948 if (err < 0)
1949 return err;
1950
1951 if (write) {
1952 /*
1953 * Poor man's atomic or. Not worth adding a primitive
1954 * to everyone's atomic.h for this
1955 */
1956 int i;
1957 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1958 if ((tmptaint >> i) & 1)
1959 add_taint(i);
1960 }
1961 }
1962
1963 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001964}
1965
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001966#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001967static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001968 void __user *buffer, size_t *lenp, loff_t *ppos)
1969{
1970 if (write && !capable(CAP_SYS_ADMIN))
1971 return -EPERM;
1972
1973 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1974}
1975#endif
1976
Linus Torvalds1da177e2005-04-16 15:20:36 -07001977struct do_proc_dointvec_minmax_conv_param {
1978 int *min;
1979 int *max;
1980};
1981
Amerigo Wang00b7c332010-05-05 00:26:45 +00001982static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1983 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001984 int write, void *data)
1985{
1986 struct do_proc_dointvec_minmax_conv_param *param = data;
1987 if (write) {
1988 int val = *negp ? -*lvalp : *lvalp;
1989 if ((param->min && *param->min > val) ||
1990 (param->max && *param->max < val))
1991 return -EINVAL;
1992 *valp = val;
1993 } else {
1994 int val = *valp;
1995 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001996 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001997 *lvalp = (unsigned long)-val;
1998 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001999 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002000 *lvalp = (unsigned long)val;
2001 }
2002 }
2003 return 0;
2004}
2005
2006/**
2007 * proc_dointvec_minmax - read a vector of integers with min/max values
2008 * @table: the sysctl table
2009 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002010 * @buffer: the user buffer
2011 * @lenp: the size of the user buffer
2012 * @ppos: file position
2013 *
2014 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2015 * values from/to the user buffer, treated as an ASCII string.
2016 *
2017 * This routine will ensure the values are within the range specified by
2018 * table->extra1 (min) and table->extra2 (max).
2019 *
2020 * Returns 0 on success.
2021 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002022int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002023 void __user *buffer, size_t *lenp, loff_t *ppos)
2024{
2025 struct do_proc_dointvec_minmax_conv_param param = {
2026 .min = (int *) table->extra1,
2027 .max = (int *) table->extra2,
2028 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002029 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002030 do_proc_dointvec_minmax_conv, &param);
2031}
2032
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002033static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002034 void __user *buffer,
2035 size_t *lenp, loff_t *ppos,
2036 unsigned long convmul,
2037 unsigned long convdiv)
2038{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002039 unsigned long *i, *min, *max;
2040 int vleft, first = 1, err = 0;
2041 unsigned long page = 0;
2042 size_t left;
2043 char *kbuf;
2044
2045 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002046 *lenp = 0;
2047 return 0;
2048 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002049
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002050 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002051 min = (unsigned long *) table->extra1;
2052 max = (unsigned long *) table->extra2;
2053 vleft = table->maxlen / sizeof(unsigned long);
2054 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002055
2056 if (write) {
2057 if (left > PAGE_SIZE - 1)
2058 left = PAGE_SIZE - 1;
2059 page = __get_free_page(GFP_TEMPORARY);
2060 kbuf = (char *) page;
2061 if (!kbuf)
2062 return -ENOMEM;
2063 if (copy_from_user(kbuf, buffer, left)) {
2064 err = -EFAULT;
2065 goto free;
2066 }
2067 kbuf[left] = 0;
2068 }
2069
Eric Dumazet27b3d802010-10-07 12:59:29 -07002070 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002071 unsigned long val;
2072
Linus Torvalds1da177e2005-04-16 15:20:36 -07002073 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002074 bool neg;
2075
2076 left -= proc_skip_spaces(&kbuf);
2077
2078 err = proc_get_long(&kbuf, &left, &val, &neg,
2079 proc_wspace_sep,
2080 sizeof(proc_wspace_sep), NULL);
2081 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082 break;
2083 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002084 continue;
2085 if ((min && val < *min) || (max && val > *max))
2086 continue;
2087 *i = val;
2088 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002089 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002090 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002091 err = proc_put_char(&buffer, &left, '\t');
2092 err = proc_put_long(&buffer, &left, val, false);
2093 if (err)
2094 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002095 }
2096 }
2097
Amerigo Wang00b7c332010-05-05 00:26:45 +00002098 if (!write && !first && left && !err)
2099 err = proc_put_char(&buffer, &left, '\n');
2100 if (write && !err)
2101 left -= proc_skip_spaces(&kbuf);
2102free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002103 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002104 free_page(page);
2105 if (first)
2106 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002107 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002108 *lenp -= left;
2109 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002110 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002111}
2112
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002113static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002114 void __user *buffer,
2115 size_t *lenp, loff_t *ppos,
2116 unsigned long convmul,
2117 unsigned long convdiv)
2118{
2119 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002120 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002121}
2122
Linus Torvalds1da177e2005-04-16 15:20:36 -07002123/**
2124 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2125 * @table: the sysctl table
2126 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002127 * @buffer: the user buffer
2128 * @lenp: the size of the user buffer
2129 * @ppos: file position
2130 *
2131 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2132 * values from/to the user buffer, treated as an ASCII string.
2133 *
2134 * This routine will ensure the values are within the range specified by
2135 * table->extra1 (min) and table->extra2 (max).
2136 *
2137 * Returns 0 on success.
2138 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002139int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002140 void __user *buffer, size_t *lenp, loff_t *ppos)
2141{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002142 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002143}
2144
2145/**
2146 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2147 * @table: the sysctl table
2148 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002149 * @buffer: the user buffer
2150 * @lenp: the size of the user buffer
2151 * @ppos: file position
2152 *
2153 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2154 * values from/to the user buffer, treated as an ASCII string. The values
2155 * are treated as milliseconds, and converted to jiffies when they are stored.
2156 *
2157 * This routine will ensure the values are within the range specified by
2158 * table->extra1 (min) and table->extra2 (max).
2159 *
2160 * Returns 0 on success.
2161 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002162int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002163 void __user *buffer,
2164 size_t *lenp, loff_t *ppos)
2165{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002166 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002167 lenp, ppos, HZ, 1000l);
2168}
2169
2170
Amerigo Wang00b7c332010-05-05 00:26:45 +00002171static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002172 int *valp,
2173 int write, void *data)
2174{
2175 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002176 if (*lvalp > LONG_MAX / HZ)
2177 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002178 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2179 } else {
2180 int val = *valp;
2181 unsigned long lval;
2182 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002183 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002184 lval = (unsigned long)-val;
2185 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002186 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002187 lval = (unsigned long)val;
2188 }
2189 *lvalp = lval / HZ;
2190 }
2191 return 0;
2192}
2193
Amerigo Wang00b7c332010-05-05 00:26:45 +00002194static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002195 int *valp,
2196 int write, void *data)
2197{
2198 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002199 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2200 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002201 *valp = clock_t_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_clock_t(lval);
2213 }
2214 return 0;
2215}
2216
Amerigo Wang00b7c332010-05-05 00:26:45 +00002217static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002218 int *valp,
2219 int write, void *data)
2220{
2221 if (write) {
2222 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2223 } else {
2224 int val = *valp;
2225 unsigned long lval;
2226 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002227 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002228 lval = (unsigned long)-val;
2229 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002230 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002231 lval = (unsigned long)val;
2232 }
2233 *lvalp = jiffies_to_msecs(lval);
2234 }
2235 return 0;
2236}
2237
2238/**
2239 * proc_dointvec_jiffies - read a vector of integers as seconds
2240 * @table: the sysctl table
2241 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002242 * @buffer: the user buffer
2243 * @lenp: the size of the user buffer
2244 * @ppos: file position
2245 *
2246 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2247 * values from/to the user buffer, treated as an ASCII string.
2248 * The values read are assumed to be in seconds, and are converted into
2249 * jiffies.
2250 *
2251 * Returns 0 on success.
2252 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002253int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254 void __user *buffer, size_t *lenp, loff_t *ppos)
2255{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002256 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002257 do_proc_dointvec_jiffies_conv,NULL);
2258}
2259
2260/**
2261 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2262 * @table: the sysctl table
2263 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002264 * @buffer: the user buffer
2265 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002266 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002267 *
2268 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2269 * values from/to the user buffer, treated as an ASCII string.
2270 * The values read are assumed to be in 1/USER_HZ seconds, and
2271 * are converted into jiffies.
2272 *
2273 * Returns 0 on success.
2274 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002275int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002276 void __user *buffer, size_t *lenp, loff_t *ppos)
2277{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002278 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002279 do_proc_dointvec_userhz_jiffies_conv,NULL);
2280}
2281
2282/**
2283 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2284 * @table: the sysctl table
2285 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002286 * @buffer: the user buffer
2287 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002288 * @ppos: file position
2289 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002290 *
2291 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2292 * values from/to the user buffer, treated as an ASCII string.
2293 * The values read are assumed to be in 1/1000 seconds, and
2294 * are converted into jiffies.
2295 *
2296 * Returns 0 on success.
2297 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002298int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002299 void __user *buffer, size_t *lenp, loff_t *ppos)
2300{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002301 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002302 do_proc_dointvec_ms_jiffies_conv, NULL);
2303}
2304
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002305static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002306 void __user *buffer, size_t *lenp, loff_t *ppos)
2307{
2308 struct pid *new_pid;
2309 pid_t tmp;
2310 int r;
2311
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002312 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002313
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002314 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002315 lenp, ppos, NULL, NULL);
2316 if (r || !write)
2317 return r;
2318
2319 new_pid = find_get_pid(tmp);
2320 if (!new_pid)
2321 return -ESRCH;
2322
2323 put_pid(xchg(&cad_pid, new_pid));
2324 return 0;
2325}
2326
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002327/**
2328 * proc_do_large_bitmap - read/write from/to a large bitmap
2329 * @table: the sysctl table
2330 * @write: %TRUE if this is a write to the sysctl file
2331 * @buffer: the user buffer
2332 * @lenp: the size of the user buffer
2333 * @ppos: file position
2334 *
2335 * The bitmap is stored at table->data and the bitmap length (in bits)
2336 * in table->maxlen.
2337 *
2338 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2339 * large bitmaps may be represented in a compact manner. Writing into
2340 * the file will clear the bitmap then update it with the given input.
2341 *
2342 * Returns 0 on success.
2343 */
2344int proc_do_large_bitmap(struct ctl_table *table, int write,
2345 void __user *buffer, size_t *lenp, loff_t *ppos)
2346{
2347 int err = 0;
2348 bool first = 1;
2349 size_t left = *lenp;
2350 unsigned long bitmap_len = table->maxlen;
2351 unsigned long *bitmap = (unsigned long *) table->data;
2352 unsigned long *tmp_bitmap = NULL;
2353 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2354
2355 if (!bitmap_len || !left || (*ppos && !write)) {
2356 *lenp = 0;
2357 return 0;
2358 }
2359
2360 if (write) {
2361 unsigned long page = 0;
2362 char *kbuf;
2363
2364 if (left > PAGE_SIZE - 1)
2365 left = PAGE_SIZE - 1;
2366
2367 page = __get_free_page(GFP_TEMPORARY);
2368 kbuf = (char *) page;
2369 if (!kbuf)
2370 return -ENOMEM;
2371 if (copy_from_user(kbuf, buffer, left)) {
2372 free_page(page);
2373 return -EFAULT;
2374 }
2375 kbuf[left] = 0;
2376
2377 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2378 GFP_KERNEL);
2379 if (!tmp_bitmap) {
2380 free_page(page);
2381 return -ENOMEM;
2382 }
2383 proc_skip_char(&kbuf, &left, '\n');
2384 while (!err && left) {
2385 unsigned long val_a, val_b;
2386 bool neg;
2387
2388 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2389 sizeof(tr_a), &c);
2390 if (err)
2391 break;
2392 if (val_a >= bitmap_len || neg) {
2393 err = -EINVAL;
2394 break;
2395 }
2396
2397 val_b = val_a;
2398 if (left) {
2399 kbuf++;
2400 left--;
2401 }
2402
2403 if (c == '-') {
2404 err = proc_get_long(&kbuf, &left, &val_b,
2405 &neg, tr_b, sizeof(tr_b),
2406 &c);
2407 if (err)
2408 break;
2409 if (val_b >= bitmap_len || neg ||
2410 val_a > val_b) {
2411 err = -EINVAL;
2412 break;
2413 }
2414 if (left) {
2415 kbuf++;
2416 left--;
2417 }
2418 }
2419
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002420 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002421 first = 0;
2422 proc_skip_char(&kbuf, &left, '\n');
2423 }
2424 free_page(page);
2425 } else {
2426 unsigned long bit_a, bit_b = 0;
2427
2428 while (left) {
2429 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2430 if (bit_a >= bitmap_len)
2431 break;
2432 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2433 bit_a + 1) - 1;
2434
2435 if (!first) {
2436 err = proc_put_char(&buffer, &left, ',');
2437 if (err)
2438 break;
2439 }
2440 err = proc_put_long(&buffer, &left, bit_a, false);
2441 if (err)
2442 break;
2443 if (bit_a != bit_b) {
2444 err = proc_put_char(&buffer, &left, '-');
2445 if (err)
2446 break;
2447 err = proc_put_long(&buffer, &left, bit_b, false);
2448 if (err)
2449 break;
2450 }
2451
2452 first = 0; bit_b++;
2453 }
2454 if (!err)
2455 err = proc_put_char(&buffer, &left, '\n');
2456 }
2457
2458 if (!err) {
2459 if (write) {
2460 if (*ppos)
2461 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2462 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002463 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002464 }
2465 kfree(tmp_bitmap);
2466 *lenp -= left;
2467 *ppos += *lenp;
2468 return 0;
2469 } else {
2470 kfree(tmp_bitmap);
2471 return err;
2472 }
2473}
2474
Jovi Zhang55610502011-01-12 17:00:45 -08002475#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002476
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002477int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002478 void __user *buffer, size_t *lenp, loff_t *ppos)
2479{
2480 return -ENOSYS;
2481}
2482
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002483int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002484 void __user *buffer, size_t *lenp, loff_t *ppos)
2485{
2486 return -ENOSYS;
2487}
2488
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002489int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002490 void __user *buffer, size_t *lenp, loff_t *ppos)
2491{
2492 return -ENOSYS;
2493}
2494
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002495int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002496 void __user *buffer, size_t *lenp, loff_t *ppos)
2497{
2498 return -ENOSYS;
2499}
2500
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002501int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002502 void __user *buffer, size_t *lenp, loff_t *ppos)
2503{
2504 return -ENOSYS;
2505}
2506
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002507int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002508 void __user *buffer, size_t *lenp, loff_t *ppos)
2509{
2510 return -ENOSYS;
2511}
2512
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002513int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002514 void __user *buffer, size_t *lenp, loff_t *ppos)
2515{
2516 return -ENOSYS;
2517}
2518
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002519int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002520 void __user *buffer,
2521 size_t *lenp, loff_t *ppos)
2522{
2523 return -ENOSYS;
2524}
2525
2526
Jovi Zhang55610502011-01-12 17:00:45 -08002527#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002528
Linus Torvalds1da177e2005-04-16 15:20:36 -07002529/*
2530 * No sense putting this after each symbol definition, twice,
2531 * exception granted :-)
2532 */
2533EXPORT_SYMBOL(proc_dointvec);
2534EXPORT_SYMBOL(proc_dointvec_jiffies);
2535EXPORT_SYMBOL(proc_dointvec_minmax);
2536EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2537EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2538EXPORT_SYMBOL(proc_dostring);
2539EXPORT_SYMBOL(proc_doulongvec_minmax);
2540EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);