blob: b390dadc52cf47b498100b546397fdb1f900466c [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 },
Steve Muckled448aba2012-10-24 15:00:20 -0700267 {
268 .procname = "sched_wake_to_idle",
269 .data = &sysctl_sched_wake_to_idle,
270 .maxlen = sizeof(unsigned int),
271 .mode = 0644,
272 .proc_handler = proc_dointvec,
273 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200274#ifdef CONFIG_SCHED_DEBUG
275 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100276 .procname = "sched_min_granularity_ns",
277 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200278 .maxlen = sizeof(unsigned int),
279 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800280 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100281 .extra1 = &min_sched_granularity_ns,
282 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200283 },
284 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200285 .procname = "sched_latency_ns",
286 .data = &sysctl_sched_latency,
287 .maxlen = sizeof(unsigned int),
288 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800289 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200290 .extra1 = &min_sched_granularity_ns,
291 .extra2 = &max_sched_granularity_ns,
292 },
293 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200294 .procname = "sched_wakeup_granularity_ns",
295 .data = &sysctl_sched_wakeup_granularity,
296 .maxlen = sizeof(unsigned int),
297 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800298 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200299 .extra1 = &min_wakeup_granularity_ns,
300 .extra2 = &max_wakeup_granularity_ns,
301 },
302 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100303 .procname = "sched_tunable_scaling",
304 .data = &sysctl_sched_tunable_scaling,
305 .maxlen = sizeof(enum sched_tunable_scaling),
306 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800307 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100308 .extra1 = &min_sched_tunable_scaling,
309 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200310 },
311 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200312 .procname = "sched_migration_cost",
313 .data = &sysctl_sched_migration_cost,
314 .maxlen = sizeof(unsigned int),
315 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800316 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200317 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100318 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100319 .procname = "sched_nr_migrate",
320 .data = &sysctl_sched_nr_migrate,
321 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100322 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800323 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100324 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530325 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200326 .procname = "sched_time_avg",
327 .data = &sysctl_sched_time_avg,
328 .maxlen = sizeof(unsigned int),
329 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800330 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200331 },
332 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800333 .procname = "sched_shares_window",
334 .data = &sysctl_sched_shares_window,
335 .maxlen = sizeof(unsigned int),
336 .mode = 0644,
337 .proc_handler = proc_dointvec,
338 },
339 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530340 .procname = "timer_migration",
341 .data = &sysctl_timer_migration,
342 .maxlen = sizeof(unsigned int),
343 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800344 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530345 .extra1 = &zero,
346 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530347 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200348#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200349 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100350 .procname = "sched_rt_period_us",
351 .data = &sysctl_sched_rt_period,
352 .maxlen = sizeof(unsigned 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 },
356 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100357 .procname = "sched_rt_runtime_us",
358 .data = &sysctl_sched_rt_runtime,
359 .maxlen = sizeof(int),
360 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800361 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100362 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100363#ifdef CONFIG_SCHED_AUTOGROUP
364 {
365 .procname = "sched_autogroup_enabled",
366 .data = &sysctl_sched_autogroup_enabled,
367 .maxlen = sizeof(unsigned int),
368 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800369 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100370 .extra1 = &zero,
371 .extra2 = &one,
372 },
373#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700374#ifdef CONFIG_CFS_BANDWIDTH
375 {
376 .procname = "sched_cfs_bandwidth_slice_us",
377 .data = &sysctl_sched_cfs_bandwidth_slice,
378 .maxlen = sizeof(unsigned int),
379 .mode = 0644,
380 .proc_handler = proc_dointvec_minmax,
381 .extra1 = &one,
382 },
383#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700384#ifdef CONFIG_PROVE_LOCKING
385 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700386 .procname = "prove_locking",
387 .data = &prove_locking,
388 .maxlen = sizeof(int),
389 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800390 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700391 },
392#endif
393#ifdef CONFIG_LOCK_STAT
394 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700395 .procname = "lock_stat",
396 .data = &lock_stat,
397 .maxlen = sizeof(int),
398 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800399 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700400 },
401#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200402 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 .procname = "panic",
404 .data = &panic_timeout,
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_uses_pid",
411 .data = &core_uses_pid,
412 .maxlen = sizeof(int),
413 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800414 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 },
416 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 .procname = "core_pattern",
418 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700419 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800421 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422 },
Neil Hormana2939802009-09-23 15:56:56 -0700423 {
Neil Hormana2939802009-09-23 15:56:56 -0700424 .procname = "core_pipe_limit",
425 .data = &core_pipe_limit,
426 .maxlen = sizeof(unsigned int),
427 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800428 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700429 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800430#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700433 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800434 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800435 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800437#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100438#ifdef CONFIG_LATENCYTOP
439 {
440 .procname = "latencytop",
441 .data = &latencytop_enabled,
442 .maxlen = sizeof(int),
443 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800444 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100445 },
446#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447#ifdef CONFIG_BLK_DEV_INITRD
448 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 .procname = "real-root-dev",
450 .data = &real_root_dev,
451 .maxlen = sizeof(int),
452 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800453 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 },
455#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700456 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700457 .procname = "print-fatal-signals",
458 .data = &print_fatal_signals,
459 .maxlen = sizeof(int),
460 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800461 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700462 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700463#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 .procname = "reboot-cmd",
466 .data = reboot_command,
467 .maxlen = 256,
468 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800469 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 },
471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 .procname = "stop-a",
473 .data = &stop_a_enabled,
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 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479 .procname = "scons-poweroff",
480 .data = &scons_pwroff,
481 .maxlen = sizeof (int),
482 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800483 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484 },
485#endif
David S. Miller08714202008-11-16 23:49:24 -0800486#ifdef CONFIG_SPARC64
487 {
David S. Miller08714202008-11-16 23:49:24 -0800488 .procname = "tsb-ratio",
489 .data = &sysctl_tsb_ratio,
490 .maxlen = sizeof (int),
491 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800492 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800493 },
494#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495#ifdef __hppa__
496 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700497 .procname = "soft-power",
498 .data = &pwrsw_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 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504 .procname = "unaligned-trap",
505 .data = &unaligned_enabled,
506 .maxlen = sizeof (int),
507 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800508 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 },
510#endif
511 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 .procname = "ctrl-alt-del",
513 .data = &C_A_D,
514 .maxlen = sizeof(int),
515 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800516 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400518#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200519 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200520 .procname = "ftrace_enabled",
521 .data = &ftrace_enabled,
522 .maxlen = sizeof(int),
523 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800524 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200525 },
526#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500527#ifdef CONFIG_STACK_TRACER
528 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500529 .procname = "stack_tracer_enabled",
530 .data = &stack_tracer_enabled,
531 .maxlen = sizeof(int),
532 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800533 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500534 },
535#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400536#ifdef CONFIG_TRACING
537 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100538 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400539 .data = &ftrace_dump_on_oops,
540 .maxlen = sizeof(int),
541 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800542 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400543 },
544#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200545#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700546 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547 .procname = "modprobe",
548 .data = &modprobe_path,
549 .maxlen = KMOD_PATH_LEN,
550 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800551 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 },
Kees Cook3d433212009-04-02 15:49:29 -0700553 {
Kees Cook3d433212009-04-02 15:49:29 -0700554 .procname = "modules_disabled",
555 .data = &modules_disabled,
556 .maxlen = sizeof(int),
557 .mode = 0644,
558 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800559 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700560 .extra1 = &one,
561 .extra2 = &one,
562 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100564#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100567 .data = &uevent_helper,
568 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800570 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 },
572#endif
573#ifdef CONFIG_CHR_DEV_SG
574 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 .procname = "sg-big-buff",
576 .data = &sg_big_buff,
577 .maxlen = sizeof (int),
578 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800579 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580 },
581#endif
582#ifdef CONFIG_BSD_PROCESS_ACCT
583 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584 .procname = "acct",
585 .data = &acct_parm,
586 .maxlen = 3*sizeof(int),
587 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800588 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589 },
590#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591#ifdef CONFIG_MAGIC_SYSRQ
592 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800594 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 .maxlen = sizeof (int),
596 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700597 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 },
599#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700600#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700603 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 .maxlen = sizeof (int),
605 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800606 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700608#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 .procname = "threads-max",
611 .data = &max_threads,
612 .maxlen = sizeof(int),
613 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800614 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 },
616 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 .procname = "random",
618 .mode = 0555,
619 .child = random_table,
620 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 {
Eric Paris17f60a72011-04-01 17:07:50 -0400622 .procname = "usermodehelper",
623 .mode = 0555,
624 .child = usermodehelper_table,
625 },
626 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627 .procname = "overflowuid",
628 .data = &overflowuid,
629 .maxlen = sizeof(int),
630 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800631 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632 .extra1 = &minolduid,
633 .extra2 = &maxolduid,
634 },
635 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 .procname = "overflowgid",
637 .data = &overflowgid,
638 .maxlen = sizeof(int),
639 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800640 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641 .extra1 = &minolduid,
642 .extra2 = &maxolduid,
643 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800644#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645#ifdef CONFIG_MATHEMU
646 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 .procname = "ieee_emulation_warnings",
648 .data = &sysctl_ieee_emulation_warnings,
649 .maxlen = sizeof(int),
650 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800651 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 },
653#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200656 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657 .maxlen = sizeof(int),
658 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800659 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 },
661#endif
662 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 .procname = "pid_max",
664 .data = &pid_max,
665 .maxlen = sizeof (int),
666 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800667 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700668 .extra1 = &pid_max_min,
669 .extra2 = &pid_max_max,
670 },
671 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 .procname = "panic_on_oops",
673 .data = &panic_on_oops,
674 .maxlen = sizeof(int),
675 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800676 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800678#if defined CONFIG_PRINTK
679 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800680 .procname = "printk",
681 .data = &console_loglevel,
682 .maxlen = 4*sizeof(int),
683 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800684 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800685 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700688 .data = &printk_ratelimit_state.interval,
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_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 },
693 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700695 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 .maxlen = sizeof(int),
697 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800698 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699 },
Dave Youngaf913222009-09-22 16:43:33 -0700700 {
Dave Youngaf913222009-09-22 16:43:33 -0700701 .procname = "printk_delay",
702 .data = &printk_delay_msec,
703 .maxlen = sizeof(int),
704 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800705 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700706 .extra1 = &zero,
707 .extra2 = &ten_thousand,
708 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800710 .procname = "dmesg_restrict",
711 .data = &dmesg_restrict,
712 .maxlen = sizeof(int),
713 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700714 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800715 .extra1 = &zero,
716 .extra2 = &one,
717 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800718 {
719 .procname = "kptr_restrict",
720 .data = &kptr_restrict,
721 .maxlen = sizeof(int),
722 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700723 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800724 .extra1 = &zero,
725 .extra2 = &two,
726 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800727#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800728 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729 .procname = "ngroups_max",
730 .data = &ngroups_max,
731 .maxlen = sizeof (int),
732 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800733 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734 },
Dan Ballard73efc032011-10-31 17:11:20 -0700735 {
736 .procname = "cap_last_cap",
737 .data = (void *)&cap_last_cap,
738 .maxlen = sizeof(int),
739 .mode = 0444,
740 .proc_handler = proc_dointvec,
741 },
Don Zickus58687ac2010-05-07 17:11:44 -0400742#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500743 {
Don Zickus58687ac2010-05-07 17:11:44 -0400744 .procname = "watchdog",
745 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500746 .maxlen = sizeof (int),
747 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700748 .proc_handler = proc_dowatchdog,
749 .extra1 = &zero,
750 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400751 },
752 {
753 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700754 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400755 .maxlen = sizeof(int),
756 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700757 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400758 .extra1 = &neg_one,
759 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500760 },
Don Zickus2508ce12010-05-07 17:11:46 -0400761 {
762 .procname = "softlockup_panic",
763 .data = &softlockup_panic,
764 .maxlen = sizeof(int),
765 .mode = 0644,
766 .proc_handler = proc_dointvec_minmax,
767 .extra1 = &zero,
768 .extra2 = &one,
769 },
Don Zickus5dc30552010-11-29 17:07:17 -0500770 {
771 .procname = "nmi_watchdog",
772 .data = &watchdog_enabled,
773 .maxlen = sizeof (int),
774 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700775 .proc_handler = proc_dowatchdog,
776 .extra1 = &zero,
777 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500778 },
779#endif
780#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
781 {
782 .procname = "unknown_nmi_panic",
783 .data = &unknown_nmi_panic,
784 .maxlen = sizeof (int),
785 .mode = 0644,
786 .proc_handler = proc_dointvec,
787 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500788#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789#if defined(CONFIG_X86)
790 {
Don Zickus8da5add2006-09-26 10:52:27 +0200791 .procname = "panic_on_unrecovered_nmi",
792 .data = &panic_on_unrecovered_nmi,
793 .maxlen = sizeof(int),
794 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800795 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200796 },
797 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700798 .procname = "panic_on_io_nmi",
799 .data = &panic_on_io_nmi,
800 .maxlen = sizeof(int),
801 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800802 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700803 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900804#ifdef CONFIG_DEBUG_STACKOVERFLOW
805 {
806 .procname = "panic_on_stackoverflow",
807 .data = &sysctl_panic_on_stackoverflow,
808 .maxlen = sizeof(int),
809 .mode = 0644,
810 .proc_handler = proc_dointvec,
811 },
812#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700813 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814 .procname = "bootloader_type",
815 .data = &bootloader_type,
816 .maxlen = sizeof (int),
817 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800818 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100820 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700821 .procname = "bootloader_version",
822 .data = &bootloader_version,
823 .maxlen = sizeof (int),
824 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800825 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700826 },
827 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100828 .procname = "kstack_depth_to_print",
829 .data = &kstack_depth_to_print,
830 .maxlen = sizeof(int),
831 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800832 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100833 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100834 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100835 .procname = "io_delay_type",
836 .data = &io_delay_type,
837 .maxlen = sizeof(int),
838 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800839 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100840 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800842#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844 .procname = "randomize_va_space",
845 .data = &randomize_va_space,
846 .maxlen = sizeof(int),
847 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800848 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800850#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800851#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700852 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700853 .procname = "spin_retry",
854 .data = &spin_retry,
855 .maxlen = sizeof (int),
856 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800857 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700858 },
859#endif
Len Brown673d5b42007-07-28 03:33:16 -0400860#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800861 {
Pavel Machekc255d842006-02-20 18:27:58 -0800862 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700863 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800864 .maxlen = sizeof (unsigned long),
865 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800866 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800867 },
868#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800869#ifdef CONFIG_IA64
870 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800871 .procname = "ignore-unaligned-usertrap",
872 .data = &no_unaligned_warning,
873 .maxlen = sizeof (int),
874 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800875 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800876 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800877 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800878 .procname = "unaligned-dump-stack",
879 .data = &unaligned_dump_stack,
880 .maxlen = sizeof (int),
881 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800882 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800883 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800884#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800885#ifdef CONFIG_DETECT_HUNG_TASK
886 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800887 .procname = "hung_task_panic",
888 .data = &sysctl_hung_task_panic,
889 .maxlen = sizeof(int),
890 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800891 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800892 .extra1 = &zero,
893 .extra2 = &one,
894 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100895 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100896 .procname = "hung_task_check_count",
897 .data = &sysctl_hung_task_check_count,
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_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 },
902 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100903 .procname = "hung_task_timeout_secs",
904 .data = &sysctl_hung_task_timeout_secs,
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_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100908 },
909 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100910 .procname = "hung_task_warnings",
911 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100912 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100913 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800914 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100915 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700916#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200917#ifdef CONFIG_COMPAT
918 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200919 .procname = "compat-log",
920 .data = &compat_log,
921 .maxlen = sizeof (int),
922 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800923 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200924 },
925#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700926#ifdef CONFIG_RT_MUTEXES
927 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700928 .procname = "max_lock_depth",
929 .data = &max_lock_depth,
930 .maxlen = sizeof(int),
931 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800932 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700933 },
934#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700935 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700936 .procname = "poweroff_cmd",
937 .data = &poweroff_cmd,
938 .maxlen = POWEROFF_CMD_PATH_LEN,
939 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800940 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700941 },
David Howells0b77f5b2008-04-29 01:01:32 -0700942#ifdef CONFIG_KEYS
943 {
David Howells0b77f5b2008-04-29 01:01:32 -0700944 .procname = "keys",
945 .mode = 0555,
946 .child = key_sysctls,
947 },
948#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700949#ifdef CONFIG_RCU_TORTURE_TEST
950 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700951 .procname = "rcutorture_runnable",
952 .data = &rcutorture_runnable,
953 .maxlen = sizeof(int),
954 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800955 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700956 },
957#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200958#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400959 /*
960 * User-space scripts rely on the existence of this file
961 * as a feature check for perf_events being enabled.
962 *
963 * So it's an ABI, do not remove!
964 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200965 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200966 .procname = "perf_event_paranoid",
967 .data = &sysctl_perf_event_paranoid,
968 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200969 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800970 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200971 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200972 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200973 .procname = "perf_event_mlock_kb",
974 .data = &sysctl_perf_event_mlock,
975 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200976 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800977 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200978 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200979 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200980 .procname = "perf_event_max_sample_rate",
981 .data = &sysctl_perf_event_sample_rate,
982 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200983 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100984 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200985 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200986#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200987#ifdef CONFIG_KMEMCHECK
988 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200989 .procname = "kmemcheck",
990 .data = &kmemcheck_enabled,
991 .maxlen = sizeof(int),
992 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800993 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200994 },
995#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200996#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200997 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200998 .procname = "blk_iopoll",
999 .data = &blk_iopoll_enabled,
1000 .maxlen = sizeof(int),
1001 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001002 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001003 },
Jens Axboecb684b52009-09-15 21:53:11 +02001004#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001005#ifdef CONFIG_ARM
1006 {
1007 .procname = "boot_reason",
1008 .data = &boot_reason,
1009 .maxlen = sizeof(int),
1010 .mode = 0444,
1011 .proc_handler = proc_dointvec,
1012},
1013#endif
1014/*
1015 * NOTE: do not add new entries to this table unless you have read
1016 * Documentation/sysctl/ctl_unnumbered.txt
1017 */
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001018 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001019};
1020
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001021static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001022 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001023 .procname = "overcommit_memory",
1024 .data = &sysctl_overcommit_memory,
1025 .maxlen = sizeof(sysctl_overcommit_memory),
1026 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001027 .proc_handler = proc_dointvec_minmax,
1028 .extra1 = &zero,
1029 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001030 },
1031 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001032 .procname = "panic_on_oom",
1033 .data = &sysctl_panic_on_oom,
1034 .maxlen = sizeof(sysctl_panic_on_oom),
1035 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001036 .proc_handler = proc_dointvec_minmax,
1037 .extra1 = &zero,
1038 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001039 },
1040 {
David Rientjesfe071d72007-10-16 23:25:56 -07001041 .procname = "oom_kill_allocating_task",
1042 .data = &sysctl_oom_kill_allocating_task,
1043 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1044 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001045 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001046 },
1047 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001048 .procname = "oom_dump_tasks",
1049 .data = &sysctl_oom_dump_tasks,
1050 .maxlen = sizeof(sysctl_oom_dump_tasks),
1051 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001052 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001053 },
1054 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 .procname = "overcommit_ratio",
1056 .data = &sysctl_overcommit_ratio,
1057 .maxlen = sizeof(sysctl_overcommit_ratio),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 },
1061 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001062 .procname = "page-cluster",
1063 .data = &page_cluster,
1064 .maxlen = sizeof(int),
1065 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001066 .proc_handler = proc_dointvec_minmax,
1067 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001068 },
1069 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070 .procname = "dirty_background_ratio",
1071 .data = &dirty_background_ratio,
1072 .maxlen = sizeof(dirty_background_ratio),
1073 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001074 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001075 .extra1 = &zero,
1076 .extra2 = &one_hundred,
1077 },
1078 {
David Rientjes2da02992009-01-06 14:39:31 -08001079 .procname = "dirty_background_bytes",
1080 .data = &dirty_background_bytes,
1081 .maxlen = sizeof(dirty_background_bytes),
1082 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001083 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001084 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001085 },
1086 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001087 .procname = "dirty_ratio",
1088 .data = &vm_dirty_ratio,
1089 .maxlen = sizeof(vm_dirty_ratio),
1090 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001091 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092 .extra1 = &zero,
1093 .extra2 = &one_hundred,
1094 },
1095 {
David Rientjes2da02992009-01-06 14:39:31 -08001096 .procname = "dirty_bytes",
1097 .data = &vm_dirty_bytes,
1098 .maxlen = sizeof(vm_dirty_bytes),
1099 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001100 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001101 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001102 },
1103 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001105 .data = &dirty_writeback_interval,
1106 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001107 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001108 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 },
1110 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001112 .data = &dirty_expire_interval,
1113 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001115 .proc_handler = proc_dointvec_minmax,
1116 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001117 },
1118 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001119 .procname = "nr_pdflush_threads",
1120 .data = &nr_pdflush_threads,
1121 .maxlen = sizeof nr_pdflush_threads,
1122 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001123 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 },
1125 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001126 .procname = "swappiness",
1127 .data = &vm_swappiness,
1128 .maxlen = sizeof(vm_swappiness),
1129 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001130 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131 .extra1 = &zero,
1132 .extra2 = &one_hundred,
1133 },
1134#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001135 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001136 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001137 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 .maxlen = sizeof(unsigned long),
1139 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001140 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001141 .extra1 = (void *)&hugetlb_zero,
1142 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001143 },
1144#ifdef CONFIG_NUMA
1145 {
1146 .procname = "nr_hugepages_mempolicy",
1147 .data = NULL,
1148 .maxlen = sizeof(unsigned long),
1149 .mode = 0644,
1150 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1151 .extra1 = (void *)&hugetlb_zero,
1152 .extra2 = (void *)&hugetlb_infinity,
1153 },
1154#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001155 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001156 .procname = "hugetlb_shm_group",
1157 .data = &sysctl_hugetlb_shm_group,
1158 .maxlen = sizeof(gid_t),
1159 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001160 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001161 },
Mel Gorman396faf02007-07-17 04:03:13 -07001162 {
Mel Gorman396faf02007-07-17 04:03:13 -07001163 .procname = "hugepages_treat_as_movable",
1164 .data = &hugepages_treat_as_movable,
1165 .maxlen = sizeof(int),
1166 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001167 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001168 },
Adam Litke54f9f802007-10-16 01:26:20 -07001169 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001170 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001171 .data = NULL,
1172 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001173 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001174 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001175 .extra1 = (void *)&hugetlb_zero,
1176 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001177 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001178#endif
1179 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001180 .procname = "lowmem_reserve_ratio",
1181 .data = &sysctl_lowmem_reserve_ratio,
1182 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1183 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001184 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001185 },
1186 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001187 .procname = "drop_caches",
1188 .data = &sysctl_drop_caches,
1189 .maxlen = sizeof(int),
1190 .mode = 0644,
1191 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001192 .extra1 = &one,
1193 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001194 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001195#ifdef CONFIG_COMPACTION
1196 {
1197 .procname = "compact_memory",
1198 .data = &sysctl_compact_memory,
1199 .maxlen = sizeof(int),
1200 .mode = 0200,
1201 .proc_handler = sysctl_compaction_handler,
1202 },
Mel Gorman5e771902010-05-24 14:32:31 -07001203 {
1204 .procname = "extfrag_threshold",
1205 .data = &sysctl_extfrag_threshold,
1206 .maxlen = sizeof(int),
1207 .mode = 0644,
1208 .proc_handler = sysctl_extfrag_handler,
1209 .extra1 = &min_extfrag_threshold,
1210 .extra2 = &max_extfrag_threshold,
1211 },
1212
Mel Gorman76ab0f52010-05-24 14:32:28 -07001213#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001214 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215 .procname = "min_free_kbytes",
1216 .data = &min_free_kbytes,
1217 .maxlen = sizeof(min_free_kbytes),
1218 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001219 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001220 .extra1 = &zero,
1221 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001222 {
Arve Hjønnevågcde89492009-02-17 14:51:02 -08001223 .procname = "min_free_order_shift",
1224 .data = &min_free_order_shift,
1225 .maxlen = sizeof(min_free_order_shift),
1226 .mode = 0644,
1227 .proc_handler = &proc_dointvec
1228 },
1229 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001230 .procname = "percpu_pagelist_fraction",
1231 .data = &percpu_pagelist_fraction,
1232 .maxlen = sizeof(percpu_pagelist_fraction),
1233 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001234 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001235 .extra1 = &min_percpu_pagelist_fract,
1236 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001237#ifdef CONFIG_MMU
1238 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001239 .procname = "max_map_count",
1240 .data = &sysctl_max_map_count,
1241 .maxlen = sizeof(sysctl_max_map_count),
1242 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001243 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001244 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001245 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001246#else
1247 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001248 .procname = "nr_trim_pages",
1249 .data = &sysctl_nr_trim_pages,
1250 .maxlen = sizeof(sysctl_nr_trim_pages),
1251 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001252 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001253 .extra1 = &zero,
1254 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001255#endif
1256 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001257 .procname = "laptop_mode",
1258 .data = &laptop_mode,
1259 .maxlen = sizeof(laptop_mode),
1260 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001261 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262 },
1263 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001264 .procname = "block_dump",
1265 .data = &block_dump,
1266 .maxlen = sizeof(block_dump),
1267 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001268 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001269 .extra1 = &zero,
1270 },
1271 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001272 .procname = "vfs_cache_pressure",
1273 .data = &sysctl_vfs_cache_pressure,
1274 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1275 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001276 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001277 .extra1 = &zero,
1278 },
1279#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1280 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001281 .procname = "legacy_va_layout",
1282 .data = &sysctl_legacy_va_layout,
1283 .maxlen = sizeof(sysctl_legacy_va_layout),
1284 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001285 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001286 .extra1 = &zero,
1287 },
1288#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001289#ifdef CONFIG_NUMA
1290 {
Christoph Lameter17436602006-01-18 17:42:32 -08001291 .procname = "zone_reclaim_mode",
1292 .data = &zone_reclaim_mode,
1293 .maxlen = sizeof(zone_reclaim_mode),
1294 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001295 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001296 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001297 },
Christoph Lameter96146342006-07-03 00:24:13 -07001298 {
Christoph Lameter96146342006-07-03 00:24:13 -07001299 .procname = "min_unmapped_ratio",
1300 .data = &sysctl_min_unmapped_ratio,
1301 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1302 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001303 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001304 .extra1 = &zero,
1305 .extra2 = &one_hundred,
1306 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001307 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001308 .procname = "min_slab_ratio",
1309 .data = &sysctl_min_slab_ratio,
1310 .maxlen = sizeof(sysctl_min_slab_ratio),
1311 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001312 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001313 .extra1 = &zero,
1314 .extra2 = &one_hundred,
1315 },
Christoph Lameter17436602006-01-18 17:42:32 -08001316#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001317#ifdef CONFIG_SMP
1318 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001319 .procname = "stat_interval",
1320 .data = &sysctl_stat_interval,
1321 .maxlen = sizeof(sysctl_stat_interval),
1322 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001323 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001324 },
1325#endif
David Howells6e141542009-12-15 19:27:45 +00001326#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001327 {
Eric Parised032182007-06-28 15:55:21 -04001328 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001329 .data = &dac_mmap_min_addr,
1330 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001331 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001332 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001333 },
David Howells6e141542009-12-15 19:27:45 +00001334#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001335#ifdef CONFIG_NUMA
1336 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001337 .procname = "numa_zonelist_order",
1338 .data = &numa_zonelist_order,
1339 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1340 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001341 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001342 },
1343#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001344#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001345 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001346 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001347 .procname = "vdso_enabled",
1348 .data = &vdso_enabled,
1349 .maxlen = sizeof(vdso_enabled),
1350 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001351 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001352 .extra1 = &zero,
1353 },
1354#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001355#ifdef CONFIG_HIGHMEM
1356 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001357 .procname = "highmem_is_dirtyable",
1358 .data = &vm_highmem_is_dirtyable,
1359 .maxlen = sizeof(vm_highmem_is_dirtyable),
1360 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001361 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001362 .extra1 = &zero,
1363 .extra2 = &one,
1364 },
1365#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001366 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001367 .procname = "scan_unevictable_pages",
1368 .data = &scan_unevictable_pages,
1369 .maxlen = sizeof(scan_unevictable_pages),
1370 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001371 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001372 },
Andi Kleen6a460792009-09-16 11:50:15 +02001373#ifdef CONFIG_MEMORY_FAILURE
1374 {
Andi Kleen6a460792009-09-16 11:50:15 +02001375 .procname = "memory_failure_early_kill",
1376 .data = &sysctl_memory_failure_early_kill,
1377 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1378 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001379 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001380 .extra1 = &zero,
1381 .extra2 = &one,
1382 },
1383 {
Andi Kleen6a460792009-09-16 11:50:15 +02001384 .procname = "memory_failure_recovery",
1385 .data = &sysctl_memory_failure_recovery,
1386 .maxlen = sizeof(sysctl_memory_failure_recovery),
1387 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001388 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001389 .extra1 = &zero,
1390 .extra2 = &one,
1391 },
1392#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001393 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394};
1395
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001396#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001397static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001398 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001399};
1400#endif
1401
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001402static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001403 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001404 .procname = "inode-nr",
1405 .data = &inodes_stat,
1406 .maxlen = 2*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 = "inode-state",
1412 .data = &inodes_stat,
1413 .maxlen = 7*sizeof(int),
1414 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001415 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001416 },
1417 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 .procname = "file-nr",
1419 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001420 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001421 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001422 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001423 },
1424 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001425 .procname = "file-max",
1426 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001427 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001428 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001429 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001430 },
1431 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001432 .procname = "nr_open",
1433 .data = &sysctl_nr_open,
1434 .maxlen = sizeof(int),
1435 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001436 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001437 .extra1 = &sysctl_nr_open_min,
1438 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001439 },
1440 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001441 .procname = "dentry-state",
1442 .data = &dentry_stat,
1443 .maxlen = 6*sizeof(int),
1444 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001445 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001446 },
1447 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001448 .procname = "overflowuid",
1449 .data = &fs_overflowuid,
1450 .maxlen = sizeof(int),
1451 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001452 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001453 .extra1 = &minolduid,
1454 .extra2 = &maxolduid,
1455 },
1456 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001457 .procname = "overflowgid",
1458 .data = &fs_overflowgid,
1459 .maxlen = sizeof(int),
1460 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001461 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001462 .extra1 = &minolduid,
1463 .extra2 = &maxolduid,
1464 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001465#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001466 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467 .procname = "leases-enable",
1468 .data = &leases_enable,
1469 .maxlen = sizeof(int),
1470 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001471 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001473#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474#ifdef CONFIG_DNOTIFY
1475 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001476 .procname = "dir-notify-enable",
1477 .data = &dir_notify_enable,
1478 .maxlen = sizeof(int),
1479 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001480 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001481 },
1482#endif
1483#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001484#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001485 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001486 .procname = "lease-break-time",
1487 .data = &lease_break_time,
1488 .maxlen = sizeof(int),
1489 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001490 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001491 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001492#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001493#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001494 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001495 .procname = "aio-nr",
1496 .data = &aio_nr,
1497 .maxlen = sizeof(aio_nr),
1498 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001499 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001500 },
1501 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001502 .procname = "aio-max-nr",
1503 .data = &aio_max_nr,
1504 .maxlen = sizeof(aio_max_nr),
1505 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001506 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001507 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001508#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001509#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001510 {
Robert Love0399cb02005-07-13 12:38:18 -04001511 .procname = "inotify",
1512 .mode = 0555,
1513 .child = inotify_table,
1514 },
1515#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001516#ifdef CONFIG_EPOLL
1517 {
1518 .procname = "epoll",
1519 .mode = 0555,
1520 .child = epoll_table,
1521 },
1522#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001523#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001524 {
Alan Coxd6e71142005-06-23 00:09:43 -07001525 .procname = "suid_dumpable",
1526 .data = &suid_dumpable,
1527 .maxlen = sizeof(int),
1528 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001529 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001530 .extra1 = &zero,
1531 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001532 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001533#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1534 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001535 .procname = "binfmt_misc",
1536 .mode = 0555,
1537 .child = binfmt_misc_table,
1538 },
1539#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001540 {
Jens Axboeff9da692010-06-03 14:54:39 +02001541 .procname = "pipe-max-size",
1542 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001543 .maxlen = sizeof(int),
1544 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001545 .proc_handler = &pipe_proc_fn,
1546 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001547 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001548 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001549};
1550
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001551static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001552#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001553 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001554 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001555 .procname = "exception-trace",
1556 .data = &show_unhandled_signals,
1557 .maxlen = sizeof(int),
1558 .mode = 0644,
1559 .proc_handler = proc_dointvec
1560 },
1561#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001562#if defined(CONFIG_OPTPROBES)
1563 {
1564 .procname = "kprobes-optimization",
1565 .data = &sysctl_kprobes_optimization,
1566 .maxlen = sizeof(int),
1567 .mode = 0644,
1568 .proc_handler = proc_kprobes_optimization_handler,
1569 .extra1 = &zero,
1570 .extra2 = &one,
1571 },
1572#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001573 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001574};
1575
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001576static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001577 { }
Robert Love0eeca282005-07-12 17:06:03 -04001578};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001579
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001580int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001581{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001582 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001583 return 0;
1584}
1585
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001586#endif /* CONFIG_SYSCTL */
1587
Linus Torvalds1da177e2005-04-16 15:20:36 -07001588/*
1589 * /proc/sys support
1590 */
1591
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001592#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001593
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001594static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001595 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001596 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001597{
1598 size_t len;
1599 char __user *p;
1600 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001601
1602 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001603 *lenp = 0;
1604 return 0;
1605 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001606
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001607 if (write) {
1608 len = 0;
1609 p = buffer;
1610 while (len < *lenp) {
1611 if (get_user(c, p++))
1612 return -EFAULT;
1613 if (c == 0 || c == '\n')
1614 break;
1615 len++;
1616 }
1617 if (len >= maxlen)
1618 len = maxlen-1;
1619 if(copy_from_user(data, buffer, len))
1620 return -EFAULT;
1621 ((char *) data)[len] = 0;
1622 *ppos += *lenp;
1623 } else {
1624 len = strlen(data);
1625 if (len > maxlen)
1626 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001627
1628 if (*ppos > len) {
1629 *lenp = 0;
1630 return 0;
1631 }
1632
1633 data += *ppos;
1634 len -= *ppos;
1635
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001636 if (len > *lenp)
1637 len = *lenp;
1638 if (len)
1639 if(copy_to_user(buffer, data, len))
1640 return -EFAULT;
1641 if (len < *lenp) {
1642 if(put_user('\n', ((char __user *) buffer) + len))
1643 return -EFAULT;
1644 len++;
1645 }
1646 *lenp = len;
1647 *ppos += len;
1648 }
1649 return 0;
1650}
1651
Linus Torvalds1da177e2005-04-16 15:20:36 -07001652/**
1653 * proc_dostring - read a string sysctl
1654 * @table: the sysctl table
1655 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001656 * @buffer: the user buffer
1657 * @lenp: the size of the user buffer
1658 * @ppos: file position
1659 *
1660 * Reads/writes a string from/to the user buffer. If the kernel
1661 * buffer provided is not large enough to hold the string, the
1662 * string is truncated. The copied string is %NULL-terminated.
1663 * If the string is being read by the user process, it is copied
1664 * and a newline '\n' is added. It is truncated if the buffer is
1665 * not large enough.
1666 *
1667 * Returns 0 on success.
1668 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001669int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001670 void __user *buffer, size_t *lenp, loff_t *ppos)
1671{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001672 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001673 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001674}
1675
Amerigo Wang00b7c332010-05-05 00:26:45 +00001676static size_t proc_skip_spaces(char **buf)
1677{
1678 size_t ret;
1679 char *tmp = skip_spaces(*buf);
1680 ret = tmp - *buf;
1681 *buf = tmp;
1682 return ret;
1683}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001684
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001685static void proc_skip_char(char **buf, size_t *size, const char v)
1686{
1687 while (*size) {
1688 if (**buf != v)
1689 break;
1690 (*size)--;
1691 (*buf)++;
1692 }
1693}
1694
Amerigo Wang00b7c332010-05-05 00:26:45 +00001695#define TMPBUFLEN 22
1696/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001697 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001698 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001699 * @buf: a kernel buffer
1700 * @size: size of the kernel buffer
1701 * @val: this is where the number will be stored
1702 * @neg: set to %TRUE if number is negative
1703 * @perm_tr: a vector which contains the allowed trailers
1704 * @perm_tr_len: size of the perm_tr vector
1705 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001706 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001707 * In case of success %0 is returned and @buf and @size are updated with
1708 * the amount of bytes read. If @tr is non-NULL and a trailing
1709 * character exists (size is non-zero after returning from this
1710 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001711 */
1712static int proc_get_long(char **buf, size_t *size,
1713 unsigned long *val, bool *neg,
1714 const char *perm_tr, unsigned perm_tr_len, char *tr)
1715{
1716 int len;
1717 char *p, tmp[TMPBUFLEN];
1718
1719 if (!*size)
1720 return -EINVAL;
1721
1722 len = *size;
1723 if (len > TMPBUFLEN - 1)
1724 len = TMPBUFLEN - 1;
1725
1726 memcpy(tmp, *buf, len);
1727
1728 tmp[len] = 0;
1729 p = tmp;
1730 if (*p == '-' && *size > 1) {
1731 *neg = true;
1732 p++;
1733 } else
1734 *neg = false;
1735 if (!isdigit(*p))
1736 return -EINVAL;
1737
1738 *val = simple_strtoul(p, &p, 0);
1739
1740 len = p - tmp;
1741
1742 /* We don't know if the next char is whitespace thus we may accept
1743 * invalid integers (e.g. 1234...a) or two integers instead of one
1744 * (e.g. 123...1). So lets not allow such large numbers. */
1745 if (len == TMPBUFLEN - 1)
1746 return -EINVAL;
1747
1748 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1749 return -EINVAL;
1750
1751 if (tr && (len < *size))
1752 *tr = *p;
1753
1754 *buf += len;
1755 *size -= len;
1756
1757 return 0;
1758}
1759
1760/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001761 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001762 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001763 * @buf: the user buffer
1764 * @size: the size of the user buffer
1765 * @val: the integer to be converted
1766 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001767 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001768 * In case of success %0 is returned and @buf and @size are updated with
1769 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001770 */
1771static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1772 bool neg)
1773{
1774 int len;
1775 char tmp[TMPBUFLEN], *p = tmp;
1776
1777 sprintf(p, "%s%lu", neg ? "-" : "", val);
1778 len = strlen(tmp);
1779 if (len > *size)
1780 len = *size;
1781 if (copy_to_user(*buf, tmp, len))
1782 return -EFAULT;
1783 *size -= len;
1784 *buf += len;
1785 return 0;
1786}
1787#undef TMPBUFLEN
1788
1789static int proc_put_char(void __user **buf, size_t *size, char c)
1790{
1791 if (*size) {
1792 char __user **buffer = (char __user **)buf;
1793 if (put_user(c, *buffer))
1794 return -EFAULT;
1795 (*size)--, (*buffer)++;
1796 *buf = *buffer;
1797 }
1798 return 0;
1799}
1800
1801static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001802 int *valp,
1803 int write, void *data)
1804{
1805 if (write) {
1806 *valp = *negp ? -*lvalp : *lvalp;
1807 } else {
1808 int val = *valp;
1809 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001810 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001811 *lvalp = (unsigned long)-val;
1812 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001813 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001814 *lvalp = (unsigned long)val;
1815 }
1816 }
1817 return 0;
1818}
1819
Amerigo Wang00b7c332010-05-05 00:26:45 +00001820static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1821
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001822static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001823 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001824 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001825 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826 int write, void *data),
1827 void *data)
1828{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001829 int *i, vleft, first = 1, err = 0;
1830 unsigned long page = 0;
1831 size_t left;
1832 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001833
Amerigo Wang00b7c332010-05-05 00:26:45 +00001834 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001835 *lenp = 0;
1836 return 0;
1837 }
1838
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001839 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001840 vleft = table->maxlen / sizeof(*i);
1841 left = *lenp;
1842
1843 if (!conv)
1844 conv = do_proc_dointvec_conv;
1845
Linus Torvalds1da177e2005-04-16 15:20:36 -07001846 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001847 if (left > PAGE_SIZE - 1)
1848 left = PAGE_SIZE - 1;
1849 page = __get_free_page(GFP_TEMPORARY);
1850 kbuf = (char *) page;
1851 if (!kbuf)
1852 return -ENOMEM;
1853 if (copy_from_user(kbuf, buffer, left)) {
1854 err = -EFAULT;
1855 goto free;
1856 }
1857 kbuf[left] = 0;
1858 }
1859
1860 for (; left && vleft--; i++, first=0) {
1861 unsigned long lval;
1862 bool neg;
1863
1864 if (write) {
1865 left -= proc_skip_spaces(&kbuf);
1866
J. R. Okajima563b0462010-05-25 16:10:14 -07001867 if (!left)
1868 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001869 err = proc_get_long(&kbuf, &left, &lval, &neg,
1870 proc_wspace_sep,
1871 sizeof(proc_wspace_sep), NULL);
1872 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001873 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001874 if (conv(&neg, &lval, i, 1, data)) {
1875 err = -EINVAL;
1876 break;
1877 }
1878 } else {
1879 if (conv(&neg, &lval, i, 0, data)) {
1880 err = -EINVAL;
1881 break;
1882 }
1883 if (!first)
1884 err = proc_put_char(&buffer, &left, '\t');
1885 if (err)
1886 break;
1887 err = proc_put_long(&buffer, &left, lval, neg);
1888 if (err)
1889 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001890 }
1891 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001892
1893 if (!write && !first && left && !err)
1894 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001895 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001896 left -= proc_skip_spaces(&kbuf);
1897free:
1898 if (write) {
1899 free_page(page);
1900 if (first)
1901 return err ? : -EINVAL;
1902 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001903 *lenp -= left;
1904 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001905 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001906}
1907
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001908static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001909 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001910 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001911 int write, void *data),
1912 void *data)
1913{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001914 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001915 buffer, lenp, ppos, conv, data);
1916}
1917
Linus Torvalds1da177e2005-04-16 15:20:36 -07001918/**
1919 * proc_dointvec - read a vector of integers
1920 * @table: the sysctl table
1921 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001922 * @buffer: the user buffer
1923 * @lenp: the size of the user buffer
1924 * @ppos: file position
1925 *
1926 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1927 * values from/to the user buffer, treated as an ASCII string.
1928 *
1929 * Returns 0 on success.
1930 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001931int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001932 void __user *buffer, size_t *lenp, loff_t *ppos)
1933{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001934 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001935 NULL,NULL);
1936}
1937
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001938/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001939 * Taint values can only be increased
1940 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001941 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001942static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001943 void __user *buffer, size_t *lenp, loff_t *ppos)
1944{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001945 struct ctl_table t;
1946 unsigned long tmptaint = get_taint();
1947 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001948
Bastian Blank91fcd412007-04-23 14:41:14 -07001949 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001950 return -EPERM;
1951
Andi Kleen25ddbb12008-10-15 22:01:41 -07001952 t = *table;
1953 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001954 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001955 if (err < 0)
1956 return err;
1957
1958 if (write) {
1959 /*
1960 * Poor man's atomic or. Not worth adding a primitive
1961 * to everyone's atomic.h for this
1962 */
1963 int i;
1964 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1965 if ((tmptaint >> i) & 1)
1966 add_taint(i);
1967 }
1968 }
1969
1970 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001971}
1972
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001973#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001974static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001975 void __user *buffer, size_t *lenp, loff_t *ppos)
1976{
1977 if (write && !capable(CAP_SYS_ADMIN))
1978 return -EPERM;
1979
1980 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1981}
1982#endif
1983
Linus Torvalds1da177e2005-04-16 15:20:36 -07001984struct do_proc_dointvec_minmax_conv_param {
1985 int *min;
1986 int *max;
1987};
1988
Amerigo Wang00b7c332010-05-05 00:26:45 +00001989static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1990 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001991 int write, void *data)
1992{
1993 struct do_proc_dointvec_minmax_conv_param *param = data;
1994 if (write) {
1995 int val = *negp ? -*lvalp : *lvalp;
1996 if ((param->min && *param->min > val) ||
1997 (param->max && *param->max < val))
1998 return -EINVAL;
1999 *valp = val;
2000 } else {
2001 int val = *valp;
2002 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002003 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002004 *lvalp = (unsigned long)-val;
2005 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002006 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002007 *lvalp = (unsigned long)val;
2008 }
2009 }
2010 return 0;
2011}
2012
2013/**
2014 * proc_dointvec_minmax - read a vector of integers with min/max values
2015 * @table: the sysctl table
2016 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002017 * @buffer: the user buffer
2018 * @lenp: the size of the user buffer
2019 * @ppos: file position
2020 *
2021 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2022 * values from/to the user buffer, treated as an ASCII string.
2023 *
2024 * This routine will ensure the values are within the range specified by
2025 * table->extra1 (min) and table->extra2 (max).
2026 *
2027 * Returns 0 on success.
2028 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002029int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002030 void __user *buffer, size_t *lenp, loff_t *ppos)
2031{
2032 struct do_proc_dointvec_minmax_conv_param param = {
2033 .min = (int *) table->extra1,
2034 .max = (int *) table->extra2,
2035 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002036 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002037 do_proc_dointvec_minmax_conv, &param);
2038}
2039
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002040static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002041 void __user *buffer,
2042 size_t *lenp, loff_t *ppos,
2043 unsigned long convmul,
2044 unsigned long convdiv)
2045{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002046 unsigned long *i, *min, *max;
2047 int vleft, first = 1, err = 0;
2048 unsigned long page = 0;
2049 size_t left;
2050 char *kbuf;
2051
2052 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002053 *lenp = 0;
2054 return 0;
2055 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002056
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002057 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002058 min = (unsigned long *) table->extra1;
2059 max = (unsigned long *) table->extra2;
2060 vleft = table->maxlen / sizeof(unsigned long);
2061 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002062
2063 if (write) {
2064 if (left > PAGE_SIZE - 1)
2065 left = PAGE_SIZE - 1;
2066 page = __get_free_page(GFP_TEMPORARY);
2067 kbuf = (char *) page;
2068 if (!kbuf)
2069 return -ENOMEM;
2070 if (copy_from_user(kbuf, buffer, left)) {
2071 err = -EFAULT;
2072 goto free;
2073 }
2074 kbuf[left] = 0;
2075 }
2076
Eric Dumazet27b3d802010-10-07 12:59:29 -07002077 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002078 unsigned long val;
2079
Linus Torvalds1da177e2005-04-16 15:20:36 -07002080 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002081 bool neg;
2082
2083 left -= proc_skip_spaces(&kbuf);
2084
2085 err = proc_get_long(&kbuf, &left, &val, &neg,
2086 proc_wspace_sep,
2087 sizeof(proc_wspace_sep), NULL);
2088 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002089 break;
2090 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002091 continue;
2092 if ((min && val < *min) || (max && val > *max))
2093 continue;
2094 *i = val;
2095 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002096 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002097 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002098 err = proc_put_char(&buffer, &left, '\t');
2099 err = proc_put_long(&buffer, &left, val, false);
2100 if (err)
2101 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002102 }
2103 }
2104
Amerigo Wang00b7c332010-05-05 00:26:45 +00002105 if (!write && !first && left && !err)
2106 err = proc_put_char(&buffer, &left, '\n');
2107 if (write && !err)
2108 left -= proc_skip_spaces(&kbuf);
2109free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002110 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002111 free_page(page);
2112 if (first)
2113 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002114 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002115 *lenp -= left;
2116 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002117 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002118}
2119
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002120static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002121 void __user *buffer,
2122 size_t *lenp, loff_t *ppos,
2123 unsigned long convmul,
2124 unsigned long convdiv)
2125{
2126 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002127 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002128}
2129
Linus Torvalds1da177e2005-04-16 15:20:36 -07002130/**
2131 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2132 * @table: the sysctl table
2133 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002134 * @buffer: the user buffer
2135 * @lenp: the size of the user buffer
2136 * @ppos: file position
2137 *
2138 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2139 * values from/to the user buffer, treated as an ASCII string.
2140 *
2141 * This routine will ensure the values are within the range specified by
2142 * table->extra1 (min) and table->extra2 (max).
2143 *
2144 * Returns 0 on success.
2145 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002146int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002147 void __user *buffer, size_t *lenp, loff_t *ppos)
2148{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002149 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002150}
2151
2152/**
2153 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2154 * @table: the sysctl table
2155 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002156 * @buffer: the user buffer
2157 * @lenp: the size of the user buffer
2158 * @ppos: file position
2159 *
2160 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2161 * values from/to the user buffer, treated as an ASCII string. The values
2162 * are treated as milliseconds, and converted to jiffies when they are stored.
2163 *
2164 * This routine will ensure the values are within the range specified by
2165 * table->extra1 (min) and table->extra2 (max).
2166 *
2167 * Returns 0 on success.
2168 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002169int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002170 void __user *buffer,
2171 size_t *lenp, loff_t *ppos)
2172{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002173 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002174 lenp, ppos, HZ, 1000l);
2175}
2176
2177
Amerigo Wang00b7c332010-05-05 00:26:45 +00002178static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002179 int *valp,
2180 int write, void *data)
2181{
2182 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002183 if (*lvalp > LONG_MAX / HZ)
2184 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002185 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2186 } else {
2187 int val = *valp;
2188 unsigned long lval;
2189 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002190 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002191 lval = (unsigned long)-val;
2192 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002193 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002194 lval = (unsigned long)val;
2195 }
2196 *lvalp = lval / HZ;
2197 }
2198 return 0;
2199}
2200
Amerigo Wang00b7c332010-05-05 00:26:45 +00002201static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002202 int *valp,
2203 int write, void *data)
2204{
2205 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002206 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2207 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002208 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2209 } else {
2210 int val = *valp;
2211 unsigned long lval;
2212 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002213 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002214 lval = (unsigned long)-val;
2215 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002216 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002217 lval = (unsigned long)val;
2218 }
2219 *lvalp = jiffies_to_clock_t(lval);
2220 }
2221 return 0;
2222}
2223
Amerigo Wang00b7c332010-05-05 00:26:45 +00002224static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002225 int *valp,
2226 int write, void *data)
2227{
2228 if (write) {
2229 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2230 } else {
2231 int val = *valp;
2232 unsigned long lval;
2233 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002234 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002235 lval = (unsigned long)-val;
2236 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002237 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002238 lval = (unsigned long)val;
2239 }
2240 *lvalp = jiffies_to_msecs(lval);
2241 }
2242 return 0;
2243}
2244
2245/**
2246 * proc_dointvec_jiffies - read a vector of integers as seconds
2247 * @table: the sysctl table
2248 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002249 * @buffer: the user buffer
2250 * @lenp: the size of the user buffer
2251 * @ppos: file position
2252 *
2253 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2254 * values from/to the user buffer, treated as an ASCII string.
2255 * The values read are assumed to be in seconds, and are converted into
2256 * jiffies.
2257 *
2258 * Returns 0 on success.
2259 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002260int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002261 void __user *buffer, size_t *lenp, loff_t *ppos)
2262{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002263 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002264 do_proc_dointvec_jiffies_conv,NULL);
2265}
2266
2267/**
2268 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2269 * @table: the sysctl table
2270 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002271 * @buffer: the user buffer
2272 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002273 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002274 *
2275 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2276 * values from/to the user buffer, treated as an ASCII string.
2277 * The values read are assumed to be in 1/USER_HZ seconds, and
2278 * are converted into jiffies.
2279 *
2280 * Returns 0 on success.
2281 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002282int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002283 void __user *buffer, size_t *lenp, loff_t *ppos)
2284{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002285 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002286 do_proc_dointvec_userhz_jiffies_conv,NULL);
2287}
2288
2289/**
2290 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2291 * @table: the sysctl table
2292 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002293 * @buffer: the user buffer
2294 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002295 * @ppos: file position
2296 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002297 *
2298 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2299 * values from/to the user buffer, treated as an ASCII string.
2300 * The values read are assumed to be in 1/1000 seconds, and
2301 * are converted into jiffies.
2302 *
2303 * Returns 0 on success.
2304 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002305int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002306 void __user *buffer, size_t *lenp, loff_t *ppos)
2307{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002308 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002309 do_proc_dointvec_ms_jiffies_conv, NULL);
2310}
2311
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002312static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002313 void __user *buffer, size_t *lenp, loff_t *ppos)
2314{
2315 struct pid *new_pid;
2316 pid_t tmp;
2317 int r;
2318
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002319 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002320
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002321 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002322 lenp, ppos, NULL, NULL);
2323 if (r || !write)
2324 return r;
2325
2326 new_pid = find_get_pid(tmp);
2327 if (!new_pid)
2328 return -ESRCH;
2329
2330 put_pid(xchg(&cad_pid, new_pid));
2331 return 0;
2332}
2333
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002334/**
2335 * proc_do_large_bitmap - read/write from/to a large bitmap
2336 * @table: the sysctl table
2337 * @write: %TRUE if this is a write to the sysctl file
2338 * @buffer: the user buffer
2339 * @lenp: the size of the user buffer
2340 * @ppos: file position
2341 *
2342 * The bitmap is stored at table->data and the bitmap length (in bits)
2343 * in table->maxlen.
2344 *
2345 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2346 * large bitmaps may be represented in a compact manner. Writing into
2347 * the file will clear the bitmap then update it with the given input.
2348 *
2349 * Returns 0 on success.
2350 */
2351int proc_do_large_bitmap(struct ctl_table *table, int write,
2352 void __user *buffer, size_t *lenp, loff_t *ppos)
2353{
2354 int err = 0;
2355 bool first = 1;
2356 size_t left = *lenp;
2357 unsigned long bitmap_len = table->maxlen;
2358 unsigned long *bitmap = (unsigned long *) table->data;
2359 unsigned long *tmp_bitmap = NULL;
2360 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2361
2362 if (!bitmap_len || !left || (*ppos && !write)) {
2363 *lenp = 0;
2364 return 0;
2365 }
2366
2367 if (write) {
2368 unsigned long page = 0;
2369 char *kbuf;
2370
2371 if (left > PAGE_SIZE - 1)
2372 left = PAGE_SIZE - 1;
2373
2374 page = __get_free_page(GFP_TEMPORARY);
2375 kbuf = (char *) page;
2376 if (!kbuf)
2377 return -ENOMEM;
2378 if (copy_from_user(kbuf, buffer, left)) {
2379 free_page(page);
2380 return -EFAULT;
2381 }
2382 kbuf[left] = 0;
2383
2384 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2385 GFP_KERNEL);
2386 if (!tmp_bitmap) {
2387 free_page(page);
2388 return -ENOMEM;
2389 }
2390 proc_skip_char(&kbuf, &left, '\n');
2391 while (!err && left) {
2392 unsigned long val_a, val_b;
2393 bool neg;
2394
2395 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2396 sizeof(tr_a), &c);
2397 if (err)
2398 break;
2399 if (val_a >= bitmap_len || neg) {
2400 err = -EINVAL;
2401 break;
2402 }
2403
2404 val_b = val_a;
2405 if (left) {
2406 kbuf++;
2407 left--;
2408 }
2409
2410 if (c == '-') {
2411 err = proc_get_long(&kbuf, &left, &val_b,
2412 &neg, tr_b, sizeof(tr_b),
2413 &c);
2414 if (err)
2415 break;
2416 if (val_b >= bitmap_len || neg ||
2417 val_a > val_b) {
2418 err = -EINVAL;
2419 break;
2420 }
2421 if (left) {
2422 kbuf++;
2423 left--;
2424 }
2425 }
2426
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002427 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002428 first = 0;
2429 proc_skip_char(&kbuf, &left, '\n');
2430 }
2431 free_page(page);
2432 } else {
2433 unsigned long bit_a, bit_b = 0;
2434
2435 while (left) {
2436 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2437 if (bit_a >= bitmap_len)
2438 break;
2439 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2440 bit_a + 1) - 1;
2441
2442 if (!first) {
2443 err = proc_put_char(&buffer, &left, ',');
2444 if (err)
2445 break;
2446 }
2447 err = proc_put_long(&buffer, &left, bit_a, false);
2448 if (err)
2449 break;
2450 if (bit_a != bit_b) {
2451 err = proc_put_char(&buffer, &left, '-');
2452 if (err)
2453 break;
2454 err = proc_put_long(&buffer, &left, bit_b, false);
2455 if (err)
2456 break;
2457 }
2458
2459 first = 0; bit_b++;
2460 }
2461 if (!err)
2462 err = proc_put_char(&buffer, &left, '\n');
2463 }
2464
2465 if (!err) {
2466 if (write) {
2467 if (*ppos)
2468 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2469 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002470 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002471 }
2472 kfree(tmp_bitmap);
2473 *lenp -= left;
2474 *ppos += *lenp;
2475 return 0;
2476 } else {
2477 kfree(tmp_bitmap);
2478 return err;
2479 }
2480}
2481
Jovi Zhang55610502011-01-12 17:00:45 -08002482#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002483
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002484int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002485 void __user *buffer, size_t *lenp, loff_t *ppos)
2486{
2487 return -ENOSYS;
2488}
2489
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002490int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002491 void __user *buffer, size_t *lenp, loff_t *ppos)
2492{
2493 return -ENOSYS;
2494}
2495
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002496int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002497 void __user *buffer, size_t *lenp, loff_t *ppos)
2498{
2499 return -ENOSYS;
2500}
2501
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002502int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002503 void __user *buffer, size_t *lenp, loff_t *ppos)
2504{
2505 return -ENOSYS;
2506}
2507
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002508int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002509 void __user *buffer, size_t *lenp, loff_t *ppos)
2510{
2511 return -ENOSYS;
2512}
2513
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002514int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002515 void __user *buffer, size_t *lenp, loff_t *ppos)
2516{
2517 return -ENOSYS;
2518}
2519
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002520int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002521 void __user *buffer, size_t *lenp, loff_t *ppos)
2522{
2523 return -ENOSYS;
2524}
2525
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002526int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002527 void __user *buffer,
2528 size_t *lenp, loff_t *ppos)
2529{
2530 return -ENOSYS;
2531}
2532
2533
Jovi Zhang55610502011-01-12 17:00:45 -08002534#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002535
Linus Torvalds1da177e2005-04-16 15:20:36 -07002536/*
2537 * No sense putting this after each symbol definition, twice,
2538 * exception granted :-)
2539 */
2540EXPORT_SYMBOL(proc_dointvec);
2541EXPORT_SYMBOL(proc_dointvec_jiffies);
2542EXPORT_SYMBOL(proc_dointvec_minmax);
2543EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2544EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2545EXPORT_SYMBOL(proc_dostring);
2546EXPORT_SYMBOL(proc_doulongvec_minmax);
2547EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);