blob: b628d2c1db8f05d10b0eec3a1a22a4a7a7c5e596 [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;
Rik van Riele13c80f2011-09-01 15:26:50 -0400105extern int extra_free_kbytes;
Arve Hjønnevågcde89492009-02-17 14:51:02 -0800106extern int min_free_order_shift;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800108extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800109extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200110extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100111extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400112extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000113#ifndef CONFIG_MMU
114extern int sysctl_nr_trim_pages;
115#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200116#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200117extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200118#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700120/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400121#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700122static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200123static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124#endif
125
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700126static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700127static int __maybe_unused one = 1;
128static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700129static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800130static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700131static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700132#ifdef CONFIG_PRINTK
133static int ten_thousand = 10000;
134#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700135
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700136/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
137static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
138
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
140static int maxolduid = 65535;
141static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800142static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
144static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700145static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Liu Hua96f6aea2014-04-07 15:38:57 -0700147/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
148#ifdef CONFIG_DETECT_HUNG_TASK
149static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
150#endif
151
Dave Youngd14f1722010-02-25 20:28:57 -0500152#ifdef CONFIG_INOTIFY_USER
153#include <linux/inotify.h>
154#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700155#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#endif
157
David S. Miller08714202008-11-16 23:49:24 -0800158#ifdef CONFIG_SPARC64
159extern int sysctl_tsb_ratio;
160#endif
161
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162#ifdef __hppa__
163extern int pwrsw_enabled;
164extern int unaligned_enabled;
165#endif
166
Jes Sorensend2b176e2006-02-28 09:42:23 -0800167#ifdef CONFIG_IA64
168extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800169extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800170#endif
171
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700172#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700173static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700174 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700175static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800176 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700177#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700178
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700179#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700180static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700181 void __user *buffer, size_t *lenp, loff_t *ppos);
182#endif
183
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700184#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800185/* Note: sysrq code uses it's own private copy */
186static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700187
188static int sysrq_sysctl_handler(ctl_table *table, int write,
189 void __user *buffer, size_t *lenp,
190 loff_t *ppos)
191{
192 int error;
193
194 error = proc_dointvec(table, write, buffer, lenp, ppos);
195 if (error)
196 return error;
197
198 if (write)
199 sysrq_toggle_support(__sysrq_enabled);
200
201 return 0;
202}
203
204#endif
205
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700206static struct ctl_table kern_table[];
207static struct ctl_table vm_table[];
208static struct ctl_table fs_table[];
209static struct ctl_table debug_table[];
210static struct ctl_table dev_table[];
211extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800212#ifdef CONFIG_EPOLL
213extern struct ctl_table epoll_table[];
214#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215
216#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
217int sysctl_legacy_va_layout;
218#endif
219
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220/* The default sysctl tables: */
221
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800222static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 .procname = "kernel",
225 .mode = 0555,
226 .child = kern_table,
227 },
228 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 .procname = "vm",
230 .mode = 0555,
231 .child = vm_table,
232 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 .procname = "fs",
235 .mode = 0555,
236 .child = fs_table,
237 },
238 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 .procname = "debug",
240 .mode = 0555,
241 .child = debug_table,
242 },
243 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 .procname = "dev",
245 .mode = 0555,
246 .child = dev_table,
247 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700248 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249};
250
Ingo Molnar77e54a12007-07-09 18:52:00 +0200251#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100252static int min_sched_granularity_ns = 100000; /* 100 usecs */
253static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
254static int min_wakeup_granularity_ns; /* 0 usecs */
255static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100256static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
257static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200258#endif
259
Mel Gorman5e771902010-05-24 14:32:31 -0700260#ifdef CONFIG_COMPACTION
261static int min_extfrag_threshold;
262static int max_extfrag_threshold = 1000;
263#endif
264
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700265static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200266 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200267 .procname = "sched_child_runs_first",
268 .data = &sysctl_sched_child_runs_first,
269 .maxlen = sizeof(unsigned int),
270 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800271 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200272 },
Steve Muckled448aba2012-10-24 15:00:20 -0700273 {
274 .procname = "sched_wake_to_idle",
275 .data = &sysctl_sched_wake_to_idle,
276 .maxlen = sizeof(unsigned int),
277 .mode = 0644,
278 .proc_handler = proc_dointvec,
279 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200280#ifdef CONFIG_SCHED_DEBUG
281 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100282 .procname = "sched_min_granularity_ns",
283 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200284 .maxlen = sizeof(unsigned int),
285 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800286 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100287 .extra1 = &min_sched_granularity_ns,
288 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200289 },
290 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200291 .procname = "sched_latency_ns",
292 .data = &sysctl_sched_latency,
293 .maxlen = sizeof(unsigned int),
294 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800295 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200296 .extra1 = &min_sched_granularity_ns,
297 .extra2 = &max_sched_granularity_ns,
298 },
299 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200300 .procname = "sched_wakeup_granularity_ns",
301 .data = &sysctl_sched_wakeup_granularity,
302 .maxlen = sizeof(unsigned int),
303 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800304 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200305 .extra1 = &min_wakeup_granularity_ns,
306 .extra2 = &max_wakeup_granularity_ns,
307 },
308 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100309 .procname = "sched_tunable_scaling",
310 .data = &sysctl_sched_tunable_scaling,
311 .maxlen = sizeof(enum sched_tunable_scaling),
312 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800313 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100314 .extra1 = &min_sched_tunable_scaling,
315 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200316 },
317 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200318 .procname = "sched_migration_cost",
319 .data = &sysctl_sched_migration_cost,
320 .maxlen = sizeof(unsigned int),
321 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800322 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200323 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100324 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100325 .procname = "sched_nr_migrate",
326 .data = &sysctl_sched_nr_migrate,
327 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100328 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800329 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100330 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530331 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200332 .procname = "sched_time_avg",
333 .data = &sysctl_sched_time_avg,
334 .maxlen = sizeof(unsigned int),
335 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800336 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200337 },
338 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800339 .procname = "sched_shares_window",
340 .data = &sysctl_sched_shares_window,
341 .maxlen = sizeof(unsigned int),
342 .mode = 0644,
343 .proc_handler = proc_dointvec,
344 },
345 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530346 .procname = "timer_migration",
347 .data = &sysctl_timer_migration,
348 .maxlen = sizeof(unsigned int),
349 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800350 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530351 .extra1 = &zero,
352 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530353 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200354#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200355 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100356 .procname = "sched_rt_period_us",
357 .data = &sysctl_sched_rt_period,
358 .maxlen = sizeof(unsigned int),
359 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800360 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100361 },
362 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100363 .procname = "sched_rt_runtime_us",
364 .data = &sysctl_sched_rt_runtime,
365 .maxlen = sizeof(int),
366 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800367 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100368 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100369#ifdef CONFIG_SCHED_AUTOGROUP
370 {
371 .procname = "sched_autogroup_enabled",
372 .data = &sysctl_sched_autogroup_enabled,
373 .maxlen = sizeof(unsigned int),
374 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800375 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100376 .extra1 = &zero,
377 .extra2 = &one,
378 },
379#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700380#ifdef CONFIG_CFS_BANDWIDTH
381 {
382 .procname = "sched_cfs_bandwidth_slice_us",
383 .data = &sysctl_sched_cfs_bandwidth_slice,
384 .maxlen = sizeof(unsigned int),
385 .mode = 0644,
386 .proc_handler = proc_dointvec_minmax,
387 .extra1 = &one,
388 },
389#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700390#ifdef CONFIG_PROVE_LOCKING
391 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700392 .procname = "prove_locking",
393 .data = &prove_locking,
394 .maxlen = sizeof(int),
395 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800396 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700397 },
398#endif
399#ifdef CONFIG_LOCK_STAT
400 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700401 .procname = "lock_stat",
402 .data = &lock_stat,
403 .maxlen = sizeof(int),
404 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800405 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700406 },
407#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200408 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 .procname = "panic",
410 .data = &panic_timeout,
411 .maxlen = sizeof(int),
412 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800413 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 },
415 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 .procname = "core_uses_pid",
417 .data = &core_uses_pid,
418 .maxlen = sizeof(int),
419 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800420 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 },
422 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 .procname = "core_pattern",
424 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700425 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800427 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 },
Neil Hormana2939802009-09-23 15:56:56 -0700429 {
Neil Hormana2939802009-09-23 15:56:56 -0700430 .procname = "core_pipe_limit",
431 .data = &core_pipe_limit,
432 .maxlen = sizeof(unsigned int),
433 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800434 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700435 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800436#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700439 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800440 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800441 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800443#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100444#ifdef CONFIG_LATENCYTOP
445 {
446 .procname = "latencytop",
447 .data = &latencytop_enabled,
448 .maxlen = sizeof(int),
449 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800450 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100451 },
452#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453#ifdef CONFIG_BLK_DEV_INITRD
454 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 .procname = "real-root-dev",
456 .data = &real_root_dev,
457 .maxlen = sizeof(int),
458 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800459 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 },
461#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700462 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700463 .procname = "print-fatal-signals",
464 .data = &print_fatal_signals,
465 .maxlen = sizeof(int),
466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800467 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700468 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700469#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 .procname = "reboot-cmd",
472 .data = reboot_command,
473 .maxlen = 256,
474 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800475 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 },
477 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 .procname = "stop-a",
479 .data = &stop_a_enabled,
480 .maxlen = sizeof (int),
481 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800482 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 },
484 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 .procname = "scons-poweroff",
486 .data = &scons_pwroff,
487 .maxlen = sizeof (int),
488 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800489 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 },
491#endif
David S. Miller08714202008-11-16 23:49:24 -0800492#ifdef CONFIG_SPARC64
493 {
David S. Miller08714202008-11-16 23:49:24 -0800494 .procname = "tsb-ratio",
495 .data = &sysctl_tsb_ratio,
496 .maxlen = sizeof (int),
497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800499 },
500#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501#ifdef __hppa__
502 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503 .procname = "soft-power",
504 .data = &pwrsw_enabled,
505 .maxlen = sizeof (int),
506 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800507 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 },
509 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 .procname = "unaligned-trap",
511 .data = &unaligned_enabled,
512 .maxlen = sizeof (int),
513 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800514 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 },
516#endif
517 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 .procname = "ctrl-alt-del",
519 .data = &C_A_D,
520 .maxlen = sizeof(int),
521 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800522 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400524#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200525 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200526 .procname = "ftrace_enabled",
527 .data = &ftrace_enabled,
528 .maxlen = sizeof(int),
529 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800530 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200531 },
532#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500533#ifdef CONFIG_STACK_TRACER
534 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500535 .procname = "stack_tracer_enabled",
536 .data = &stack_tracer_enabled,
537 .maxlen = sizeof(int),
538 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800539 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500540 },
541#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400542#ifdef CONFIG_TRACING
543 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100544 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400545 .data = &ftrace_dump_on_oops,
546 .maxlen = sizeof(int),
547 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800548 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400549 },
550#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200551#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 .procname = "modprobe",
554 .data = &modprobe_path,
555 .maxlen = KMOD_PATH_LEN,
556 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800557 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 },
Kees Cook3d433212009-04-02 15:49:29 -0700559 {
Kees Cook3d433212009-04-02 15:49:29 -0700560 .procname = "modules_disabled",
561 .data = &modules_disabled,
562 .maxlen = sizeof(int),
563 .mode = 0644,
564 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800565 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700566 .extra1 = &one,
567 .extra2 = &one,
568 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100570#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100573 .data = &uevent_helper,
574 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800576 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 },
578#endif
579#ifdef CONFIG_CHR_DEV_SG
580 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 .procname = "sg-big-buff",
582 .data = &sg_big_buff,
583 .maxlen = sizeof (int),
584 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800585 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 },
587#endif
588#ifdef CONFIG_BSD_PROCESS_ACCT
589 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 .procname = "acct",
591 .data = &acct_parm,
592 .maxlen = 3*sizeof(int),
593 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800594 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 },
596#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597#ifdef CONFIG_MAGIC_SYSRQ
598 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800600 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 .maxlen = sizeof (int),
602 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700603 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 },
605#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700606#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700609 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 .maxlen = sizeof (int),
611 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800612 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700614#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 .procname = "threads-max",
617 .data = &max_threads,
618 .maxlen = sizeof(int),
619 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800620 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 },
622 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 .procname = "random",
624 .mode = 0555,
625 .child = random_table,
626 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627 {
Eric Paris17f60a72011-04-01 17:07:50 -0400628 .procname = "usermodehelper",
629 .mode = 0555,
630 .child = usermodehelper_table,
631 },
632 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .procname = "overflowuid",
634 .data = &overflowuid,
635 .maxlen = sizeof(int),
636 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800637 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 .extra1 = &minolduid,
639 .extra2 = &maxolduid,
640 },
641 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 .procname = "overflowgid",
643 .data = &overflowgid,
644 .maxlen = sizeof(int),
645 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800646 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 .extra1 = &minolduid,
648 .extra2 = &maxolduid,
649 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800650#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651#ifdef CONFIG_MATHEMU
652 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 .procname = "ieee_emulation_warnings",
654 .data = &sysctl_ieee_emulation_warnings,
655 .maxlen = sizeof(int),
656 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800657 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 },
659#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200662 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 .maxlen = sizeof(int),
664 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800665 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 },
667#endif
668 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .procname = "pid_max",
670 .data = &pid_max,
671 .maxlen = sizeof (int),
672 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800673 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 .extra1 = &pid_max_min,
675 .extra2 = &pid_max_max,
676 },
677 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 .procname = "panic_on_oops",
679 .data = &panic_on_oops,
680 .maxlen = sizeof(int),
681 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800682 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800684#if defined CONFIG_PRINTK
685 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800686 .procname = "printk",
687 .data = &console_loglevel,
688 .maxlen = 4*sizeof(int),
689 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800690 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800691 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700694 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 .maxlen = sizeof(int),
696 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800697 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 },
699 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700701 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 .maxlen = sizeof(int),
703 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800704 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705 },
Dave Youngaf913222009-09-22 16:43:33 -0700706 {
Dave Youngaf913222009-09-22 16:43:33 -0700707 .procname = "printk_delay",
708 .data = &printk_delay_msec,
709 .maxlen = sizeof(int),
710 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800711 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700712 .extra1 = &zero,
713 .extra2 = &ten_thousand,
714 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800716 .procname = "dmesg_restrict",
717 .data = &dmesg_restrict,
718 .maxlen = sizeof(int),
719 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700720 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800721 .extra1 = &zero,
722 .extra2 = &one,
723 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800724 {
725 .procname = "kptr_restrict",
726 .data = &kptr_restrict,
727 .maxlen = sizeof(int),
728 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700729 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800730 .extra1 = &zero,
731 .extra2 = &two,
732 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800733#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800734 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735 .procname = "ngroups_max",
736 .data = &ngroups_max,
737 .maxlen = sizeof (int),
738 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800739 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 },
Dan Ballard73efc032011-10-31 17:11:20 -0700741 {
742 .procname = "cap_last_cap",
743 .data = (void *)&cap_last_cap,
744 .maxlen = sizeof(int),
745 .mode = 0444,
746 .proc_handler = proc_dointvec,
747 },
Don Zickus58687ac2010-05-07 17:11:44 -0400748#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500749 {
Don Zickus58687ac2010-05-07 17:11:44 -0400750 .procname = "watchdog",
751 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500752 .maxlen = sizeof (int),
753 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700754 .proc_handler = proc_dowatchdog,
755 .extra1 = &zero,
756 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400757 },
758 {
759 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700760 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400761 .maxlen = sizeof(int),
762 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700763 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400764 .extra1 = &neg_one,
765 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500766 },
Don Zickus2508ce12010-05-07 17:11:46 -0400767 {
768 .procname = "softlockup_panic",
769 .data = &softlockup_panic,
770 .maxlen = sizeof(int),
771 .mode = 0644,
772 .proc_handler = proc_dointvec_minmax,
773 .extra1 = &zero,
774 .extra2 = &one,
775 },
Don Zickus5dc30552010-11-29 17:07:17 -0500776 {
777 .procname = "nmi_watchdog",
778 .data = &watchdog_enabled,
779 .maxlen = sizeof (int),
780 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700781 .proc_handler = proc_dowatchdog,
782 .extra1 = &zero,
783 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500784 },
785#endif
786#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
787 {
788 .procname = "unknown_nmi_panic",
789 .data = &unknown_nmi_panic,
790 .maxlen = sizeof (int),
791 .mode = 0644,
792 .proc_handler = proc_dointvec,
793 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500794#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795#if defined(CONFIG_X86)
796 {
Don Zickus8da5add2006-09-26 10:52:27 +0200797 .procname = "panic_on_unrecovered_nmi",
798 .data = &panic_on_unrecovered_nmi,
799 .maxlen = sizeof(int),
800 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800801 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200802 },
803 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700804 .procname = "panic_on_io_nmi",
805 .data = &panic_on_io_nmi,
806 .maxlen = sizeof(int),
807 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800808 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700809 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900810#ifdef CONFIG_DEBUG_STACKOVERFLOW
811 {
812 .procname = "panic_on_stackoverflow",
813 .data = &sysctl_panic_on_stackoverflow,
814 .maxlen = sizeof(int),
815 .mode = 0644,
816 .proc_handler = proc_dointvec,
817 },
818#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700819 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820 .procname = "bootloader_type",
821 .data = &bootloader_type,
822 .maxlen = sizeof (int),
823 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800824 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100826 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700827 .procname = "bootloader_version",
828 .data = &bootloader_version,
829 .maxlen = sizeof (int),
830 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800831 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700832 },
833 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100834 .procname = "kstack_depth_to_print",
835 .data = &kstack_depth_to_print,
836 .maxlen = sizeof(int),
837 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800838 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100839 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100840 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100841 .procname = "io_delay_type",
842 .data = &io_delay_type,
843 .maxlen = sizeof(int),
844 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800845 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100846 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800848#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850 .procname = "randomize_va_space",
851 .data = &randomize_va_space,
852 .maxlen = sizeof(int),
853 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800854 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800856#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800857#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700858 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700859 .procname = "spin_retry",
860 .data = &spin_retry,
861 .maxlen = sizeof (int),
862 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800863 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700864 },
865#endif
Len Brown673d5b42007-07-28 03:33:16 -0400866#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800867 {
Pavel Machekc255d842006-02-20 18:27:58 -0800868 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700869 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800870 .maxlen = sizeof (unsigned long),
871 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800872 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800873 },
874#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800875#ifdef CONFIG_IA64
876 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800877 .procname = "ignore-unaligned-usertrap",
878 .data = &no_unaligned_warning,
879 .maxlen = sizeof (int),
880 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800881 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800882 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800883 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800884 .procname = "unaligned-dump-stack",
885 .data = &unaligned_dump_stack,
886 .maxlen = sizeof (int),
887 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800888 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800889 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800890#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800891#ifdef CONFIG_DETECT_HUNG_TASK
892 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800893 .procname = "hung_task_panic",
894 .data = &sysctl_hung_task_panic,
895 .maxlen = sizeof(int),
896 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800897 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800898 .extra1 = &zero,
899 .extra2 = &one,
900 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100902 .procname = "hung_task_check_count",
903 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100904 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100905 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800906 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100907 },
908 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100909 .procname = "hung_task_timeout_secs",
910 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100911 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100912 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800913 .proc_handler = proc_dohung_task_timeout_secs,
Liu Hua96f6aea2014-04-07 15:38:57 -0700914 .extra2 = &hung_task_timeout_max,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100915 },
916 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100917 .procname = "hung_task_warnings",
918 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100919 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100920 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800921 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100922 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700923#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200924#ifdef CONFIG_COMPAT
925 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200926 .procname = "compat-log",
927 .data = &compat_log,
928 .maxlen = sizeof (int),
929 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800930 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200931 },
932#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700933#ifdef CONFIG_RT_MUTEXES
934 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700935 .procname = "max_lock_depth",
936 .data = &max_lock_depth,
937 .maxlen = sizeof(int),
938 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800939 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700940 },
941#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700942 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700943 .procname = "poweroff_cmd",
944 .data = &poweroff_cmd,
945 .maxlen = POWEROFF_CMD_PATH_LEN,
946 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800947 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700948 },
David Howells0b77f5b2008-04-29 01:01:32 -0700949#ifdef CONFIG_KEYS
950 {
David Howells0b77f5b2008-04-29 01:01:32 -0700951 .procname = "keys",
952 .mode = 0555,
953 .child = key_sysctls,
954 },
955#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700956#ifdef CONFIG_RCU_TORTURE_TEST
957 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700958 .procname = "rcutorture_runnable",
959 .data = &rcutorture_runnable,
960 .maxlen = sizeof(int),
961 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800962 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700963 },
964#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200965#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400966 /*
967 * User-space scripts rely on the existence of this file
968 * as a feature check for perf_events being enabled.
969 *
970 * So it's an ABI, do not remove!
971 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200972 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200973 .procname = "perf_event_paranoid",
974 .data = &sysctl_perf_event_paranoid,
975 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200976 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800977 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200978 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200979 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200980 .procname = "perf_event_mlock_kb",
981 .data = &sysctl_perf_event_mlock,
982 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200983 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800984 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200985 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200986 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200987 .procname = "perf_event_max_sample_rate",
988 .data = &sysctl_perf_event_sample_rate,
989 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200990 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100991 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200992 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200993#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200994#ifdef CONFIG_KMEMCHECK
995 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200996 .procname = "kmemcheck",
997 .data = &kmemcheck_enabled,
998 .maxlen = sizeof(int),
999 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001000 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +02001001 },
1002#endif
Jens Axboecb684b52009-09-15 21:53:11 +02001003#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +02001004 {
Jens Axboe5e605b62009-08-05 09:07:21 +02001005 .procname = "blk_iopoll",
1006 .data = &blk_iopoll_enabled,
1007 .maxlen = sizeof(int),
1008 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001009 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001010 },
Jens Axboecb684b52009-09-15 21:53:11 +02001011#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012#ifdef CONFIG_ARM
1013 {
1014 .procname = "boot_reason",
1015 .data = &boot_reason,
1016 .maxlen = sizeof(int),
1017 .mode = 0444,
1018 .proc_handler = proc_dointvec,
1019},
1020#endif
1021/*
1022 * NOTE: do not add new entries to this table unless you have read
1023 * Documentation/sysctl/ctl_unnumbered.txt
1024 */
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001025 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001026};
1027
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001028static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001030 .procname = "overcommit_memory",
1031 .data = &sysctl_overcommit_memory,
1032 .maxlen = sizeof(sysctl_overcommit_memory),
1033 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001034 .proc_handler = proc_dointvec_minmax,
1035 .extra1 = &zero,
1036 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001037 },
1038 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001039 .procname = "panic_on_oom",
1040 .data = &sysctl_panic_on_oom,
1041 .maxlen = sizeof(sysctl_panic_on_oom),
1042 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001043 .proc_handler = proc_dointvec_minmax,
1044 .extra1 = &zero,
1045 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001046 },
1047 {
David Rientjesfe071d72007-10-16 23:25:56 -07001048 .procname = "oom_kill_allocating_task",
1049 .data = &sysctl_oom_kill_allocating_task,
1050 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1051 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001052 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001053 },
1054 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001055 .procname = "oom_dump_tasks",
1056 .data = &sysctl_oom_dump_tasks,
1057 .maxlen = sizeof(sysctl_oom_dump_tasks),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001060 },
1061 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001062 .procname = "overcommit_ratio",
1063 .data = &sysctl_overcommit_ratio,
1064 .maxlen = sizeof(sysctl_overcommit_ratio),
1065 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001066 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001067 },
1068 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001069 .procname = "page-cluster",
1070 .data = &page_cluster,
1071 .maxlen = sizeof(int),
1072 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001073 .proc_handler = proc_dointvec_minmax,
1074 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001075 },
1076 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 .procname = "dirty_background_ratio",
1078 .data = &dirty_background_ratio,
1079 .maxlen = sizeof(dirty_background_ratio),
1080 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001081 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001082 .extra1 = &zero,
1083 .extra2 = &one_hundred,
1084 },
1085 {
David Rientjes2da02992009-01-06 14:39:31 -08001086 .procname = "dirty_background_bytes",
1087 .data = &dirty_background_bytes,
1088 .maxlen = sizeof(dirty_background_bytes),
1089 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001090 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001091 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001092 },
1093 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001094 .procname = "dirty_ratio",
1095 .data = &vm_dirty_ratio,
1096 .maxlen = sizeof(vm_dirty_ratio),
1097 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001098 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099 .extra1 = &zero,
1100 .extra2 = &one_hundred,
1101 },
1102 {
David Rientjes2da02992009-01-06 14:39:31 -08001103 .procname = "dirty_bytes",
1104 .data = &vm_dirty_bytes,
1105 .maxlen = sizeof(vm_dirty_bytes),
1106 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001107 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001108 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001109 },
1110 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001112 .data = &dirty_writeback_interval,
1113 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001115 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 },
1117 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001119 .data = &dirty_expire_interval,
1120 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001122 .proc_handler = proc_dointvec_minmax,
1123 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 },
1125 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001126 .procname = "nr_pdflush_threads",
1127 .data = &nr_pdflush_threads,
1128 .maxlen = sizeof nr_pdflush_threads,
1129 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001130 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131 },
1132 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001133 .procname = "swappiness",
1134 .data = &vm_swappiness,
1135 .maxlen = sizeof(vm_swappiness),
1136 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001137 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 .extra1 = &zero,
1139 .extra2 = &one_hundred,
1140 },
1141#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001142 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001143 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001144 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001145 .maxlen = sizeof(unsigned long),
1146 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001147 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001148 .extra1 = (void *)&hugetlb_zero,
1149 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001150 },
1151#ifdef CONFIG_NUMA
1152 {
1153 .procname = "nr_hugepages_mempolicy",
1154 .data = NULL,
1155 .maxlen = sizeof(unsigned long),
1156 .mode = 0644,
1157 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1158 .extra1 = (void *)&hugetlb_zero,
1159 .extra2 = (void *)&hugetlb_infinity,
1160 },
1161#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163 .procname = "hugetlb_shm_group",
1164 .data = &sysctl_hugetlb_shm_group,
1165 .maxlen = sizeof(gid_t),
1166 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001167 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001168 },
Mel Gorman396faf02007-07-17 04:03:13 -07001169 {
Mel Gorman396faf02007-07-17 04:03:13 -07001170 .procname = "hugepages_treat_as_movable",
1171 .data = &hugepages_treat_as_movable,
1172 .maxlen = sizeof(int),
1173 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001174 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001175 },
Adam Litke54f9f802007-10-16 01:26:20 -07001176 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001177 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001178 .data = NULL,
1179 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001180 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001181 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001182 .extra1 = (void *)&hugetlb_zero,
1183 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001184 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001185#endif
1186 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001187 .procname = "lowmem_reserve_ratio",
1188 .data = &sysctl_lowmem_reserve_ratio,
1189 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1190 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001191 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001192 },
1193 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001194 .procname = "drop_caches",
1195 .data = &sysctl_drop_caches,
1196 .maxlen = sizeof(int),
1197 .mode = 0644,
1198 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001199 .extra1 = &one,
1200 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001201 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001202#ifdef CONFIG_COMPACTION
1203 {
1204 .procname = "compact_memory",
1205 .data = &sysctl_compact_memory,
1206 .maxlen = sizeof(int),
1207 .mode = 0200,
1208 .proc_handler = sysctl_compaction_handler,
1209 },
Mel Gorman5e771902010-05-24 14:32:31 -07001210 {
1211 .procname = "extfrag_threshold",
1212 .data = &sysctl_extfrag_threshold,
1213 .maxlen = sizeof(int),
1214 .mode = 0644,
1215 .proc_handler = sysctl_extfrag_handler,
1216 .extra1 = &min_extfrag_threshold,
1217 .extra2 = &max_extfrag_threshold,
1218 },
1219
Mel Gorman76ab0f52010-05-24 14:32:28 -07001220#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001222 .procname = "min_free_kbytes",
1223 .data = &min_free_kbytes,
1224 .maxlen = sizeof(min_free_kbytes),
1225 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001226 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001227 .extra1 = &zero,
1228 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001229 {
Rik van Riele13c80f2011-09-01 15:26:50 -04001230 .procname = "extra_free_kbytes",
1231 .data = &extra_free_kbytes,
1232 .maxlen = sizeof(extra_free_kbytes),
1233 .mode = 0644,
1234 .proc_handler = min_free_kbytes_sysctl_handler,
1235 .extra1 = &zero,
1236 },
1237 {
Arve Hjønnevågcde89492009-02-17 14:51:02 -08001238 .procname = "min_free_order_shift",
1239 .data = &min_free_order_shift,
1240 .maxlen = sizeof(min_free_order_shift),
1241 .mode = 0644,
1242 .proc_handler = &proc_dointvec
1243 },
1244 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001245 .procname = "percpu_pagelist_fraction",
1246 .data = &percpu_pagelist_fraction,
1247 .maxlen = sizeof(percpu_pagelist_fraction),
1248 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001249 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001250 .extra1 = &min_percpu_pagelist_fract,
1251 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001252#ifdef CONFIG_MMU
1253 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001254 .procname = "max_map_count",
1255 .data = &sysctl_max_map_count,
1256 .maxlen = sizeof(sysctl_max_map_count),
1257 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001258 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001259 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001260 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001261#else
1262 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001263 .procname = "nr_trim_pages",
1264 .data = &sysctl_nr_trim_pages,
1265 .maxlen = sizeof(sysctl_nr_trim_pages),
1266 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001267 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001268 .extra1 = &zero,
1269 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001270#endif
1271 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001272 .procname = "laptop_mode",
1273 .data = &laptop_mode,
1274 .maxlen = sizeof(laptop_mode),
1275 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001276 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001277 },
1278 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001279 .procname = "block_dump",
1280 .data = &block_dump,
1281 .maxlen = sizeof(block_dump),
1282 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001283 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001284 .extra1 = &zero,
1285 },
1286 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001287 .procname = "vfs_cache_pressure",
1288 .data = &sysctl_vfs_cache_pressure,
1289 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1290 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001291 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001292 .extra1 = &zero,
1293 },
1294#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1295 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001296 .procname = "legacy_va_layout",
1297 .data = &sysctl_legacy_va_layout,
1298 .maxlen = sizeof(sysctl_legacy_va_layout),
1299 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001300 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001301 .extra1 = &zero,
1302 },
1303#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001304#ifdef CONFIG_NUMA
1305 {
Christoph Lameter17436602006-01-18 17:42:32 -08001306 .procname = "zone_reclaim_mode",
1307 .data = &zone_reclaim_mode,
1308 .maxlen = sizeof(zone_reclaim_mode),
1309 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001310 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001311 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001312 },
Christoph Lameter96146342006-07-03 00:24:13 -07001313 {
Christoph Lameter96146342006-07-03 00:24:13 -07001314 .procname = "min_unmapped_ratio",
1315 .data = &sysctl_min_unmapped_ratio,
1316 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1317 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001318 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001319 .extra1 = &zero,
1320 .extra2 = &one_hundred,
1321 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001322 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001323 .procname = "min_slab_ratio",
1324 .data = &sysctl_min_slab_ratio,
1325 .maxlen = sizeof(sysctl_min_slab_ratio),
1326 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001327 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001328 .extra1 = &zero,
1329 .extra2 = &one_hundred,
1330 },
Christoph Lameter17436602006-01-18 17:42:32 -08001331#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001332#ifdef CONFIG_SMP
1333 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001334 .procname = "stat_interval",
1335 .data = &sysctl_stat_interval,
1336 .maxlen = sizeof(sysctl_stat_interval),
1337 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001338 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001339 },
1340#endif
David Howells6e141542009-12-15 19:27:45 +00001341#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001342 {
Eric Parised032182007-06-28 15:55:21 -04001343 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001344 .data = &dac_mmap_min_addr,
1345 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001346 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001347 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001348 },
David Howells6e141542009-12-15 19:27:45 +00001349#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001350#ifdef CONFIG_NUMA
1351 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001352 .procname = "numa_zonelist_order",
1353 .data = &numa_zonelist_order,
1354 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1355 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001356 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001357 },
1358#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001359#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001360 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001361 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001362 .procname = "vdso_enabled",
1363 .data = &vdso_enabled,
1364 .maxlen = sizeof(vdso_enabled),
1365 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001366 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001367 .extra1 = &zero,
1368 },
1369#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001370#ifdef CONFIG_HIGHMEM
1371 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001372 .procname = "highmem_is_dirtyable",
1373 .data = &vm_highmem_is_dirtyable,
1374 .maxlen = sizeof(vm_highmem_is_dirtyable),
1375 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001376 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001377 .extra1 = &zero,
1378 .extra2 = &one,
1379 },
1380#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001381 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001382 .procname = "scan_unevictable_pages",
1383 .data = &scan_unevictable_pages,
1384 .maxlen = sizeof(scan_unevictable_pages),
1385 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001386 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001387 },
Andi Kleen6a460792009-09-16 11:50:15 +02001388#ifdef CONFIG_MEMORY_FAILURE
1389 {
Andi Kleen6a460792009-09-16 11:50:15 +02001390 .procname = "memory_failure_early_kill",
1391 .data = &sysctl_memory_failure_early_kill,
1392 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1393 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001394 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001395 .extra1 = &zero,
1396 .extra2 = &one,
1397 },
1398 {
Andi Kleen6a460792009-09-16 11:50:15 +02001399 .procname = "memory_failure_recovery",
1400 .data = &sysctl_memory_failure_recovery,
1401 .maxlen = sizeof(sysctl_memory_failure_recovery),
1402 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001403 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001404 .extra1 = &zero,
1405 .extra2 = &one,
1406 },
1407#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001408 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001409};
1410
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001411#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001412static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001413 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001414};
1415#endif
1416
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001417static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001419 .procname = "inode-nr",
1420 .data = &inodes_stat,
1421 .maxlen = 2*sizeof(int),
1422 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001423 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424 },
1425 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426 .procname = "inode-state",
1427 .data = &inodes_stat,
1428 .maxlen = 7*sizeof(int),
1429 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001430 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431 },
1432 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433 .procname = "file-nr",
1434 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001435 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001436 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001437 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 },
1439 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440 .procname = "file-max",
1441 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001442 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001443 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001444 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445 },
1446 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001447 .procname = "nr_open",
1448 .data = &sysctl_nr_open,
1449 .maxlen = sizeof(int),
1450 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001451 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001452 .extra1 = &sysctl_nr_open_min,
1453 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001454 },
1455 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001456 .procname = "dentry-state",
1457 .data = &dentry_stat,
1458 .maxlen = 6*sizeof(int),
1459 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001460 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001461 },
1462 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 .procname = "overflowuid",
1464 .data = &fs_overflowuid,
1465 .maxlen = sizeof(int),
1466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001467 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001468 .extra1 = &minolduid,
1469 .extra2 = &maxolduid,
1470 },
1471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 .procname = "overflowgid",
1473 .data = &fs_overflowgid,
1474 .maxlen = sizeof(int),
1475 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001476 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001477 .extra1 = &minolduid,
1478 .extra2 = &maxolduid,
1479 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001480#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001481 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001482 .procname = "leases-enable",
1483 .data = &leases_enable,
1484 .maxlen = sizeof(int),
1485 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001486 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001487 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001488#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001489#ifdef CONFIG_DNOTIFY
1490 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001491 .procname = "dir-notify-enable",
1492 .data = &dir_notify_enable,
1493 .maxlen = sizeof(int),
1494 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001495 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001496 },
1497#endif
1498#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001499#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001500 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001501 .procname = "lease-break-time",
1502 .data = &lease_break_time,
1503 .maxlen = sizeof(int),
1504 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001505 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001506 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001507#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001508#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001509 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001510 .procname = "aio-nr",
1511 .data = &aio_nr,
1512 .maxlen = sizeof(aio_nr),
1513 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001514 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001515 },
1516 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001517 .procname = "aio-max-nr",
1518 .data = &aio_max_nr,
1519 .maxlen = sizeof(aio_max_nr),
1520 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001521 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001522 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001523#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001524#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001525 {
Robert Love0399cb02005-07-13 12:38:18 -04001526 .procname = "inotify",
1527 .mode = 0555,
1528 .child = inotify_table,
1529 },
1530#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001531#ifdef CONFIG_EPOLL
1532 {
1533 .procname = "epoll",
1534 .mode = 0555,
1535 .child = epoll_table,
1536 },
1537#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001539 {
Alan Coxd6e71142005-06-23 00:09:43 -07001540 .procname = "suid_dumpable",
1541 .data = &suid_dumpable,
1542 .maxlen = sizeof(int),
1543 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001544 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001545 .extra1 = &zero,
1546 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001547 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001548#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1549 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001550 .procname = "binfmt_misc",
1551 .mode = 0555,
1552 .child = binfmt_misc_table,
1553 },
1554#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001555 {
Jens Axboeff9da692010-06-03 14:54:39 +02001556 .procname = "pipe-max-size",
1557 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001558 .maxlen = sizeof(int),
1559 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001560 .proc_handler = &pipe_proc_fn,
1561 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001562 },
Willy Tarreau53b4f1f2016-01-18 16:36:09 +01001563 {
1564 .procname = "pipe-user-pages-hard",
1565 .data = &pipe_user_pages_hard,
1566 .maxlen = sizeof(pipe_user_pages_hard),
1567 .mode = 0644,
1568 .proc_handler = proc_doulongvec_minmax,
1569 },
1570 {
1571 .procname = "pipe-user-pages-soft",
1572 .data = &pipe_user_pages_soft,
1573 .maxlen = sizeof(pipe_user_pages_soft),
1574 .mode = 0644,
1575 .proc_handler = proc_doulongvec_minmax,
1576 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001577 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001578};
1579
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001580static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001581#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001582 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001583 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001584 .procname = "exception-trace",
1585 .data = &show_unhandled_signals,
1586 .maxlen = sizeof(int),
1587 .mode = 0644,
1588 .proc_handler = proc_dointvec
1589 },
1590#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001591#if defined(CONFIG_OPTPROBES)
1592 {
1593 .procname = "kprobes-optimization",
1594 .data = &sysctl_kprobes_optimization,
1595 .maxlen = sizeof(int),
1596 .mode = 0644,
1597 .proc_handler = proc_kprobes_optimization_handler,
1598 .extra1 = &zero,
1599 .extra2 = &one,
1600 },
1601#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001602 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001603};
1604
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001605static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001606 { }
Robert Love0eeca282005-07-12 17:06:03 -04001607};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001608
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001609int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001610{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001611 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001612 return 0;
1613}
1614
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001615#endif /* CONFIG_SYSCTL */
1616
Linus Torvalds1da177e2005-04-16 15:20:36 -07001617/*
1618 * /proc/sys support
1619 */
1620
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001621#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001622
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001623static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001624 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001625 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001626{
1627 size_t len;
1628 char __user *p;
1629 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001630
1631 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001632 *lenp = 0;
1633 return 0;
1634 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001635
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001636 if (write) {
1637 len = 0;
1638 p = buffer;
1639 while (len < *lenp) {
1640 if (get_user(c, p++))
1641 return -EFAULT;
1642 if (c == 0 || c == '\n')
1643 break;
1644 len++;
1645 }
1646 if (len >= maxlen)
1647 len = maxlen-1;
1648 if(copy_from_user(data, buffer, len))
1649 return -EFAULT;
1650 ((char *) data)[len] = 0;
1651 *ppos += *lenp;
1652 } else {
1653 len = strlen(data);
1654 if (len > maxlen)
1655 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001656
1657 if (*ppos > len) {
1658 *lenp = 0;
1659 return 0;
1660 }
1661
1662 data += *ppos;
1663 len -= *ppos;
1664
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001665 if (len > *lenp)
1666 len = *lenp;
1667 if (len)
1668 if(copy_to_user(buffer, data, len))
1669 return -EFAULT;
1670 if (len < *lenp) {
1671 if(put_user('\n', ((char __user *) buffer) + len))
1672 return -EFAULT;
1673 len++;
1674 }
1675 *lenp = len;
1676 *ppos += len;
1677 }
1678 return 0;
1679}
1680
Linus Torvalds1da177e2005-04-16 15:20:36 -07001681/**
1682 * proc_dostring - read a string sysctl
1683 * @table: the sysctl table
1684 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001685 * @buffer: the user buffer
1686 * @lenp: the size of the user buffer
1687 * @ppos: file position
1688 *
1689 * Reads/writes a string from/to the user buffer. If the kernel
1690 * buffer provided is not large enough to hold the string, the
1691 * string is truncated. The copied string is %NULL-terminated.
1692 * If the string is being read by the user process, it is copied
1693 * and a newline '\n' is added. It is truncated if the buffer is
1694 * not large enough.
1695 *
1696 * Returns 0 on success.
1697 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001698int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001699 void __user *buffer, size_t *lenp, loff_t *ppos)
1700{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001701 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001702 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001703}
1704
Amerigo Wang00b7c332010-05-05 00:26:45 +00001705static size_t proc_skip_spaces(char **buf)
1706{
1707 size_t ret;
1708 char *tmp = skip_spaces(*buf);
1709 ret = tmp - *buf;
1710 *buf = tmp;
1711 return ret;
1712}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001713
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001714static void proc_skip_char(char **buf, size_t *size, const char v)
1715{
1716 while (*size) {
1717 if (**buf != v)
1718 break;
1719 (*size)--;
1720 (*buf)++;
1721 }
1722}
1723
Amerigo Wang00b7c332010-05-05 00:26:45 +00001724#define TMPBUFLEN 22
1725/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001726 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001727 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001728 * @buf: a kernel buffer
1729 * @size: size of the kernel buffer
1730 * @val: this is where the number will be stored
1731 * @neg: set to %TRUE if number is negative
1732 * @perm_tr: a vector which contains the allowed trailers
1733 * @perm_tr_len: size of the perm_tr vector
1734 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001735 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001736 * In case of success %0 is returned and @buf and @size are updated with
1737 * the amount of bytes read. If @tr is non-NULL and a trailing
1738 * character exists (size is non-zero after returning from this
1739 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001740 */
1741static int proc_get_long(char **buf, size_t *size,
1742 unsigned long *val, bool *neg,
1743 const char *perm_tr, unsigned perm_tr_len, char *tr)
1744{
1745 int len;
1746 char *p, tmp[TMPBUFLEN];
1747
1748 if (!*size)
1749 return -EINVAL;
1750
1751 len = *size;
1752 if (len > TMPBUFLEN - 1)
1753 len = TMPBUFLEN - 1;
1754
1755 memcpy(tmp, *buf, len);
1756
1757 tmp[len] = 0;
1758 p = tmp;
1759 if (*p == '-' && *size > 1) {
1760 *neg = true;
1761 p++;
1762 } else
1763 *neg = false;
1764 if (!isdigit(*p))
1765 return -EINVAL;
1766
1767 *val = simple_strtoul(p, &p, 0);
1768
1769 len = p - tmp;
1770
1771 /* We don't know if the next char is whitespace thus we may accept
1772 * invalid integers (e.g. 1234...a) or two integers instead of one
1773 * (e.g. 123...1). So lets not allow such large numbers. */
1774 if (len == TMPBUFLEN - 1)
1775 return -EINVAL;
1776
1777 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1778 return -EINVAL;
1779
1780 if (tr && (len < *size))
1781 *tr = *p;
1782
1783 *buf += len;
1784 *size -= len;
1785
1786 return 0;
1787}
1788
1789/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001790 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001791 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001792 * @buf: the user buffer
1793 * @size: the size of the user buffer
1794 * @val: the integer to be converted
1795 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001796 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001797 * In case of success %0 is returned and @buf and @size are updated with
1798 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001799 */
1800static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1801 bool neg)
1802{
1803 int len;
1804 char tmp[TMPBUFLEN], *p = tmp;
1805
1806 sprintf(p, "%s%lu", neg ? "-" : "", val);
1807 len = strlen(tmp);
1808 if (len > *size)
1809 len = *size;
1810 if (copy_to_user(*buf, tmp, len))
1811 return -EFAULT;
1812 *size -= len;
1813 *buf += len;
1814 return 0;
1815}
1816#undef TMPBUFLEN
1817
1818static int proc_put_char(void __user **buf, size_t *size, char c)
1819{
1820 if (*size) {
1821 char __user **buffer = (char __user **)buf;
1822 if (put_user(c, *buffer))
1823 return -EFAULT;
1824 (*size)--, (*buffer)++;
1825 *buf = *buffer;
1826 }
1827 return 0;
1828}
1829
1830static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001831 int *valp,
1832 int write, void *data)
1833{
1834 if (write) {
1835 *valp = *negp ? -*lvalp : *lvalp;
1836 } else {
1837 int val = *valp;
1838 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001839 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001840 *lvalp = (unsigned long)-val;
1841 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001842 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001843 *lvalp = (unsigned long)val;
1844 }
1845 }
1846 return 0;
1847}
1848
Amerigo Wang00b7c332010-05-05 00:26:45 +00001849static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1850
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001851static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001852 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001853 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001854 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001855 int write, void *data),
1856 void *data)
1857{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001858 int *i, vleft, first = 1, err = 0;
1859 unsigned long page = 0;
1860 size_t left;
1861 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001862
Amerigo Wang00b7c332010-05-05 00:26:45 +00001863 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001864 *lenp = 0;
1865 return 0;
1866 }
1867
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001868 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001869 vleft = table->maxlen / sizeof(*i);
1870 left = *lenp;
1871
1872 if (!conv)
1873 conv = do_proc_dointvec_conv;
1874
Linus Torvalds1da177e2005-04-16 15:20:36 -07001875 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001876 if (left > PAGE_SIZE - 1)
1877 left = PAGE_SIZE - 1;
1878 page = __get_free_page(GFP_TEMPORARY);
1879 kbuf = (char *) page;
1880 if (!kbuf)
1881 return -ENOMEM;
1882 if (copy_from_user(kbuf, buffer, left)) {
1883 err = -EFAULT;
1884 goto free;
1885 }
1886 kbuf[left] = 0;
1887 }
1888
1889 for (; left && vleft--; i++, first=0) {
1890 unsigned long lval;
1891 bool neg;
1892
1893 if (write) {
1894 left -= proc_skip_spaces(&kbuf);
1895
J. R. Okajima563b0462010-05-25 16:10:14 -07001896 if (!left)
1897 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001898 err = proc_get_long(&kbuf, &left, &lval, &neg,
1899 proc_wspace_sep,
1900 sizeof(proc_wspace_sep), NULL);
1901 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001902 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001903 if (conv(&neg, &lval, i, 1, data)) {
1904 err = -EINVAL;
1905 break;
1906 }
1907 } else {
1908 if (conv(&neg, &lval, i, 0, data)) {
1909 err = -EINVAL;
1910 break;
1911 }
1912 if (!first)
1913 err = proc_put_char(&buffer, &left, '\t');
1914 if (err)
1915 break;
1916 err = proc_put_long(&buffer, &left, lval, neg);
1917 if (err)
1918 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001919 }
1920 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001921
1922 if (!write && !first && left && !err)
1923 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001924 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001925 left -= proc_skip_spaces(&kbuf);
1926free:
1927 if (write) {
1928 free_page(page);
1929 if (first)
1930 return err ? : -EINVAL;
1931 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001932 *lenp -= left;
1933 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001934 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001935}
1936
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001937static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001938 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001939 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001940 int write, void *data),
1941 void *data)
1942{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001943 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001944 buffer, lenp, ppos, conv, data);
1945}
1946
Linus Torvalds1da177e2005-04-16 15:20:36 -07001947/**
1948 * proc_dointvec - read a vector of integers
1949 * @table: the sysctl table
1950 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001951 * @buffer: the user buffer
1952 * @lenp: the size of the user buffer
1953 * @ppos: file position
1954 *
1955 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1956 * values from/to the user buffer, treated as an ASCII string.
1957 *
1958 * Returns 0 on success.
1959 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001960int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001961 void __user *buffer, size_t *lenp, loff_t *ppos)
1962{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001963 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001964 NULL,NULL);
1965}
1966
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001967/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001968 * Taint values can only be increased
1969 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001970 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001971static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001972 void __user *buffer, size_t *lenp, loff_t *ppos)
1973{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001974 struct ctl_table t;
1975 unsigned long tmptaint = get_taint();
1976 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001977
Bastian Blank91fcd412007-04-23 14:41:14 -07001978 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001979 return -EPERM;
1980
Andi Kleen25ddbb12008-10-15 22:01:41 -07001981 t = *table;
1982 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001983 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001984 if (err < 0)
1985 return err;
1986
1987 if (write) {
1988 /*
1989 * Poor man's atomic or. Not worth adding a primitive
1990 * to everyone's atomic.h for this
1991 */
1992 int i;
1993 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1994 if ((tmptaint >> i) & 1)
1995 add_taint(i);
1996 }
1997 }
1998
1999 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002000}
2001
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002002#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07002003static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002004 void __user *buffer, size_t *lenp, loff_t *ppos)
2005{
2006 if (write && !capable(CAP_SYS_ADMIN))
2007 return -EPERM;
2008
2009 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2010}
2011#endif
2012
Linus Torvalds1da177e2005-04-16 15:20:36 -07002013struct do_proc_dointvec_minmax_conv_param {
2014 int *min;
2015 int *max;
2016};
2017
Amerigo Wang00b7c332010-05-05 00:26:45 +00002018static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2019 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002020 int write, void *data)
2021{
2022 struct do_proc_dointvec_minmax_conv_param *param = data;
2023 if (write) {
2024 int val = *negp ? -*lvalp : *lvalp;
2025 if ((param->min && *param->min > val) ||
2026 (param->max && *param->max < val))
2027 return -EINVAL;
2028 *valp = val;
2029 } else {
2030 int val = *valp;
2031 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002032 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002033 *lvalp = (unsigned long)-val;
2034 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002035 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002036 *lvalp = (unsigned long)val;
2037 }
2038 }
2039 return 0;
2040}
2041
2042/**
2043 * proc_dointvec_minmax - read a vector of integers with min/max values
2044 * @table: the sysctl table
2045 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002046 * @buffer: the user buffer
2047 * @lenp: the size of the user buffer
2048 * @ppos: file position
2049 *
2050 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2051 * values from/to the user buffer, treated as an ASCII string.
2052 *
2053 * This routine will ensure the values are within the range specified by
2054 * table->extra1 (min) and table->extra2 (max).
2055 *
2056 * Returns 0 on success.
2057 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002058int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002059 void __user *buffer, size_t *lenp, loff_t *ppos)
2060{
2061 struct do_proc_dointvec_minmax_conv_param param = {
2062 .min = (int *) table->extra1,
2063 .max = (int *) table->extra2,
2064 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002065 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002066 do_proc_dointvec_minmax_conv, &param);
2067}
2068
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002069static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002070 void __user *buffer,
2071 size_t *lenp, loff_t *ppos,
2072 unsigned long convmul,
2073 unsigned long convdiv)
2074{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002075 unsigned long *i, *min, *max;
2076 int vleft, first = 1, err = 0;
2077 unsigned long page = 0;
2078 size_t left;
2079 char *kbuf;
2080
2081 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082 *lenp = 0;
2083 return 0;
2084 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002085
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002086 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002087 min = (unsigned long *) table->extra1;
2088 max = (unsigned long *) table->extra2;
2089 vleft = table->maxlen / sizeof(unsigned long);
2090 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002091
2092 if (write) {
2093 if (left > PAGE_SIZE - 1)
2094 left = PAGE_SIZE - 1;
2095 page = __get_free_page(GFP_TEMPORARY);
2096 kbuf = (char *) page;
2097 if (!kbuf)
2098 return -ENOMEM;
2099 if (copy_from_user(kbuf, buffer, left)) {
2100 err = -EFAULT;
2101 goto free;
2102 }
2103 kbuf[left] = 0;
2104 }
2105
Eric Dumazet27b3d802010-10-07 12:59:29 -07002106 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002107 unsigned long val;
2108
Linus Torvalds1da177e2005-04-16 15:20:36 -07002109 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002110 bool neg;
2111
2112 left -= proc_skip_spaces(&kbuf);
2113
2114 err = proc_get_long(&kbuf, &left, &val, &neg,
2115 proc_wspace_sep,
2116 sizeof(proc_wspace_sep), NULL);
2117 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002118 break;
2119 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002120 continue;
2121 if ((min && val < *min) || (max && val > *max))
2122 continue;
2123 *i = val;
2124 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002125 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002126 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002127 err = proc_put_char(&buffer, &left, '\t');
2128 err = proc_put_long(&buffer, &left, val, false);
2129 if (err)
2130 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002131 }
2132 }
2133
Amerigo Wang00b7c332010-05-05 00:26:45 +00002134 if (!write && !first && left && !err)
2135 err = proc_put_char(&buffer, &left, '\n');
2136 if (write && !err)
2137 left -= proc_skip_spaces(&kbuf);
2138free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002139 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002140 free_page(page);
2141 if (first)
2142 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002143 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002144 *lenp -= left;
2145 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002146 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002147}
2148
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002149static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002150 void __user *buffer,
2151 size_t *lenp, loff_t *ppos,
2152 unsigned long convmul,
2153 unsigned long convdiv)
2154{
2155 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002156 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002157}
2158
Linus Torvalds1da177e2005-04-16 15:20:36 -07002159/**
2160 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2161 * @table: the sysctl table
2162 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002163 * @buffer: the user buffer
2164 * @lenp: the size of the user buffer
2165 * @ppos: file position
2166 *
2167 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2168 * values from/to the user buffer, treated as an ASCII string.
2169 *
2170 * This routine will ensure the values are within the range specified by
2171 * table->extra1 (min) and table->extra2 (max).
2172 *
2173 * Returns 0 on success.
2174 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002175int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002176 void __user *buffer, size_t *lenp, loff_t *ppos)
2177{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002178 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002179}
2180
2181/**
2182 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2183 * @table: the sysctl table
2184 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002185 * @buffer: the user buffer
2186 * @lenp: the size of the user buffer
2187 * @ppos: file position
2188 *
2189 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2190 * values from/to the user buffer, treated as an ASCII string. The values
2191 * are treated as milliseconds, and converted to jiffies when they are stored.
2192 *
2193 * This routine will ensure the values are within the range specified by
2194 * table->extra1 (min) and table->extra2 (max).
2195 *
2196 * Returns 0 on success.
2197 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002198int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002199 void __user *buffer,
2200 size_t *lenp, loff_t *ppos)
2201{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002202 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002203 lenp, ppos, HZ, 1000l);
2204}
2205
2206
Amerigo Wang00b7c332010-05-05 00:26:45 +00002207static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002208 int *valp,
2209 int write, void *data)
2210{
2211 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002212 if (*lvalp > LONG_MAX / HZ)
2213 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002214 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2215 } else {
2216 int val = *valp;
2217 unsigned long lval;
2218 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002219 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002220 lval = (unsigned long)-val;
2221 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002222 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002223 lval = (unsigned long)val;
2224 }
2225 *lvalp = lval / HZ;
2226 }
2227 return 0;
2228}
2229
Amerigo Wang00b7c332010-05-05 00:26:45 +00002230static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002231 int *valp,
2232 int write, void *data)
2233{
2234 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002235 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2236 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002237 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2238 } else {
2239 int val = *valp;
2240 unsigned long lval;
2241 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002242 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002243 lval = (unsigned long)-val;
2244 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002245 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002246 lval = (unsigned long)val;
2247 }
2248 *lvalp = jiffies_to_clock_t(lval);
2249 }
2250 return 0;
2251}
2252
Amerigo Wang00b7c332010-05-05 00:26:45 +00002253static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254 int *valp,
2255 int write, void *data)
2256{
2257 if (write) {
2258 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2259 } else {
2260 int val = *valp;
2261 unsigned long lval;
2262 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002263 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002264 lval = (unsigned long)-val;
2265 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002266 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002267 lval = (unsigned long)val;
2268 }
2269 *lvalp = jiffies_to_msecs(lval);
2270 }
2271 return 0;
2272}
2273
2274/**
2275 * proc_dointvec_jiffies - read a vector of integers as seconds
2276 * @table: the sysctl table
2277 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002278 * @buffer: the user buffer
2279 * @lenp: the size of the user buffer
2280 * @ppos: file position
2281 *
2282 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2283 * values from/to the user buffer, treated as an ASCII string.
2284 * The values read are assumed to be in seconds, and are converted into
2285 * jiffies.
2286 *
2287 * Returns 0 on success.
2288 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002289int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002290 void __user *buffer, size_t *lenp, loff_t *ppos)
2291{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002292 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002293 do_proc_dointvec_jiffies_conv,NULL);
2294}
2295
2296/**
2297 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2298 * @table: the sysctl table
2299 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002300 * @buffer: the user buffer
2301 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002302 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002303 *
2304 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2305 * values from/to the user buffer, treated as an ASCII string.
2306 * The values read are assumed to be in 1/USER_HZ seconds, and
2307 * are converted into jiffies.
2308 *
2309 * Returns 0 on success.
2310 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002311int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002312 void __user *buffer, size_t *lenp, loff_t *ppos)
2313{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002314 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002315 do_proc_dointvec_userhz_jiffies_conv,NULL);
2316}
2317
2318/**
2319 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2320 * @table: the sysctl table
2321 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002322 * @buffer: the user buffer
2323 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002324 * @ppos: file position
2325 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002326 *
2327 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2328 * values from/to the user buffer, treated as an ASCII string.
2329 * The values read are assumed to be in 1/1000 seconds, and
2330 * are converted into jiffies.
2331 *
2332 * Returns 0 on success.
2333 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002334int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002335 void __user *buffer, size_t *lenp, loff_t *ppos)
2336{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002337 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002338 do_proc_dointvec_ms_jiffies_conv, NULL);
2339}
2340
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002341static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002342 void __user *buffer, size_t *lenp, loff_t *ppos)
2343{
2344 struct pid *new_pid;
2345 pid_t tmp;
2346 int r;
2347
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002348 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002349
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002350 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002351 lenp, ppos, NULL, NULL);
2352 if (r || !write)
2353 return r;
2354
2355 new_pid = find_get_pid(tmp);
2356 if (!new_pid)
2357 return -ESRCH;
2358
2359 put_pid(xchg(&cad_pid, new_pid));
2360 return 0;
2361}
2362
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002363/**
2364 * proc_do_large_bitmap - read/write from/to a large bitmap
2365 * @table: the sysctl table
2366 * @write: %TRUE if this is a write to the sysctl file
2367 * @buffer: the user buffer
2368 * @lenp: the size of the user buffer
2369 * @ppos: file position
2370 *
2371 * The bitmap is stored at table->data and the bitmap length (in bits)
2372 * in table->maxlen.
2373 *
2374 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2375 * large bitmaps may be represented in a compact manner. Writing into
2376 * the file will clear the bitmap then update it with the given input.
2377 *
2378 * Returns 0 on success.
2379 */
2380int proc_do_large_bitmap(struct ctl_table *table, int write,
2381 void __user *buffer, size_t *lenp, loff_t *ppos)
2382{
2383 int err = 0;
2384 bool first = 1;
2385 size_t left = *lenp;
2386 unsigned long bitmap_len = table->maxlen;
2387 unsigned long *bitmap = (unsigned long *) table->data;
2388 unsigned long *tmp_bitmap = NULL;
2389 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2390
2391 if (!bitmap_len || !left || (*ppos && !write)) {
2392 *lenp = 0;
2393 return 0;
2394 }
2395
2396 if (write) {
2397 unsigned long page = 0;
2398 char *kbuf;
2399
2400 if (left > PAGE_SIZE - 1)
2401 left = PAGE_SIZE - 1;
2402
2403 page = __get_free_page(GFP_TEMPORARY);
2404 kbuf = (char *) page;
2405 if (!kbuf)
2406 return -ENOMEM;
2407 if (copy_from_user(kbuf, buffer, left)) {
2408 free_page(page);
2409 return -EFAULT;
2410 }
2411 kbuf[left] = 0;
2412
2413 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2414 GFP_KERNEL);
2415 if (!tmp_bitmap) {
2416 free_page(page);
2417 return -ENOMEM;
2418 }
2419 proc_skip_char(&kbuf, &left, '\n');
2420 while (!err && left) {
2421 unsigned long val_a, val_b;
2422 bool neg;
2423
2424 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2425 sizeof(tr_a), &c);
2426 if (err)
2427 break;
2428 if (val_a >= bitmap_len || neg) {
2429 err = -EINVAL;
2430 break;
2431 }
2432
2433 val_b = val_a;
2434 if (left) {
2435 kbuf++;
2436 left--;
2437 }
2438
2439 if (c == '-') {
2440 err = proc_get_long(&kbuf, &left, &val_b,
2441 &neg, tr_b, sizeof(tr_b),
2442 &c);
2443 if (err)
2444 break;
2445 if (val_b >= bitmap_len || neg ||
2446 val_a > val_b) {
2447 err = -EINVAL;
2448 break;
2449 }
2450 if (left) {
2451 kbuf++;
2452 left--;
2453 }
2454 }
2455
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002456 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002457 first = 0;
2458 proc_skip_char(&kbuf, &left, '\n');
2459 }
2460 free_page(page);
2461 } else {
2462 unsigned long bit_a, bit_b = 0;
2463
2464 while (left) {
2465 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2466 if (bit_a >= bitmap_len)
2467 break;
2468 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2469 bit_a + 1) - 1;
2470
2471 if (!first) {
2472 err = proc_put_char(&buffer, &left, ',');
2473 if (err)
2474 break;
2475 }
2476 err = proc_put_long(&buffer, &left, bit_a, false);
2477 if (err)
2478 break;
2479 if (bit_a != bit_b) {
2480 err = proc_put_char(&buffer, &left, '-');
2481 if (err)
2482 break;
2483 err = proc_put_long(&buffer, &left, bit_b, false);
2484 if (err)
2485 break;
2486 }
2487
2488 first = 0; bit_b++;
2489 }
2490 if (!err)
2491 err = proc_put_char(&buffer, &left, '\n');
2492 }
2493
2494 if (!err) {
2495 if (write) {
2496 if (*ppos)
2497 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2498 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002499 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002500 }
2501 kfree(tmp_bitmap);
2502 *lenp -= left;
2503 *ppos += *lenp;
2504 return 0;
2505 } else {
2506 kfree(tmp_bitmap);
2507 return err;
2508 }
2509}
2510
Jovi Zhang55610502011-01-12 17:00:45 -08002511#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002512
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002513int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002514 void __user *buffer, size_t *lenp, loff_t *ppos)
2515{
2516 return -ENOSYS;
2517}
2518
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002519int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002520 void __user *buffer, size_t *lenp, loff_t *ppos)
2521{
2522 return -ENOSYS;
2523}
2524
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002525int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002526 void __user *buffer, size_t *lenp, loff_t *ppos)
2527{
2528 return -ENOSYS;
2529}
2530
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002531int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002532 void __user *buffer, size_t *lenp, loff_t *ppos)
2533{
2534 return -ENOSYS;
2535}
2536
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002537int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002538 void __user *buffer, size_t *lenp, loff_t *ppos)
2539{
2540 return -ENOSYS;
2541}
2542
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002543int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002544 void __user *buffer, size_t *lenp, loff_t *ppos)
2545{
2546 return -ENOSYS;
2547}
2548
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002549int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002550 void __user *buffer, size_t *lenp, loff_t *ppos)
2551{
2552 return -ENOSYS;
2553}
2554
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002555int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002556 void __user *buffer,
2557 size_t *lenp, loff_t *ppos)
2558{
2559 return -ENOSYS;
2560}
2561
2562
Jovi Zhang55610502011-01-12 17:00:45 -08002563#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002564
Linus Torvalds1da177e2005-04-16 15:20:36 -07002565/*
2566 * No sense putting this after each symbol definition, twice,
2567 * exception granted :-)
2568 */
2569EXPORT_SYMBOL(proc_dointvec);
2570EXPORT_SYMBOL(proc_dointvec_jiffies);
2571EXPORT_SYMBOL(proc_dointvec_minmax);
2572EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2573EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2574EXPORT_SYMBOL(proc_dostring);
2575EXPORT_SYMBOL(proc_doulongvec_minmax);
2576EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);