blob: e2772e13e81c3a0cb257a3269466af4d40935295 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070033#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/init.h>
35#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010036#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030037#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/sysrq.h>
39#include <linux/highuid.h>
40#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020041#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070042#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070045#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/times.h>
47#include <linux/limits.h>
48#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020049#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070051#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080052#include <linux/nfs_fs.h>
53#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070054#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020055#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020056#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050057#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020058#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070059#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040060#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070061#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000062#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#include <asm/uaccess.h>
65#include <asm/processor.h>
66
Andi Kleen29cbc782006-09-30 01:47:55 +020067#ifdef CONFIG_X86
68#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010069#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010070#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020071#endif
David Howellsd550bbd2012-03-28 18:30:03 +010072#ifdef CONFIG_SPARC
73#include <asm/setup.h>
74#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080075#ifdef CONFIG_BSD_PROCESS_ACCT
76#include <linux/acct.h>
77#endif
Dave Young4f0e0562010-03-10 15:24:09 -080078#ifdef CONFIG_RT_MUTEXES
79#include <linux/rtmutex.h>
80#endif
Dave Young2edf5e42010-03-10 15:24:10 -080081#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
82#include <linux/lockdep.h>
83#endif
Dave Young15485a42010-03-10 15:24:07 -080084#ifdef CONFIG_CHR_DEV_SG
85#include <scsi/sg.h>
86#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020087
Don Zickus58687ac2010-05-07 17:11:44 -040088#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050089#include <linux/nmi.h>
90#endif
91
Eric W. Biederman7058cb02007-10-18 03:05:58 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#if defined(CONFIG_SYSCTL)
94
95/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int sysctl_overcommit_memory;
97extern int sysctl_overcommit_ratio;
98extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700100extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700102extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103extern int pid_max;
104extern int min_free_kbytes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800106extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800107extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200108extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100109extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400110extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000111#ifndef CONFIG_MMU
112extern int sysctl_nr_trim_pages;
113#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200114#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200115extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200116#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700118/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400119#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700120static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200121static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700122#endif
123
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700125static int __maybe_unused one = 1;
126static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700127static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800128static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700129static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700130#ifdef CONFIG_PRINTK
131static int ten_thousand = 10000;
132#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700133
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700134/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
135static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
138static int maxolduid = 65535;
139static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800140static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700143static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
Liu Hua96f6aea2014-04-07 15:38:57 -0700145/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
146#ifdef CONFIG_DETECT_HUNG_TASK
147static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
148#endif
149
Dave Youngd14f1722010-02-25 20:28:57 -0500150#ifdef CONFIG_INOTIFY_USER
151#include <linux/inotify.h>
152#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700153#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154#endif
155
David S. Miller08714202008-11-16 23:49:24 -0800156#ifdef CONFIG_SPARC64
157extern int sysctl_tsb_ratio;
158#endif
159
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160#ifdef __hppa__
161extern int pwrsw_enabled;
162extern int unaligned_enabled;
163#endif
164
Jes Sorensend2b176e2006-02-28 09:42:23 -0800165#ifdef CONFIG_IA64
166extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800167extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800168#endif
169
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700170#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700171static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700172 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700173static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800174 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700175#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700176
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700177#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700178static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700179 void __user *buffer, size_t *lenp, loff_t *ppos);
180#endif
181
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700182#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800183/* Note: sysrq code uses it's own private copy */
184static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700185
186static int sysrq_sysctl_handler(ctl_table *table, int write,
187 void __user *buffer, size_t *lenp,
188 loff_t *ppos)
189{
190 int error;
191
192 error = proc_dointvec(table, write, buffer, lenp, ppos);
193 if (error)
194 return error;
195
196 if (write)
197 sysrq_toggle_support(__sysrq_enabled);
198
199 return 0;
200}
201
202#endif
203
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700204static struct ctl_table kern_table[];
205static struct ctl_table vm_table[];
206static struct ctl_table fs_table[];
207static struct ctl_table debug_table[];
208static struct ctl_table dev_table[];
209extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800210#ifdef CONFIG_EPOLL
211extern struct ctl_table epoll_table[];
212#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213
214#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
215int sysctl_legacy_va_layout;
216#endif
217
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218/* The default sysctl tables: */
219
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800220static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 .procname = "kernel",
223 .mode = 0555,
224 .child = kern_table,
225 },
226 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 .procname = "vm",
228 .mode = 0555,
229 .child = vm_table,
230 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 .procname = "fs",
233 .mode = 0555,
234 .child = fs_table,
235 },
236 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 .procname = "debug",
238 .mode = 0555,
239 .child = debug_table,
240 },
241 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 .procname = "dev",
243 .mode = 0555,
244 .child = dev_table,
245 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700246 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247};
248
Ingo Molnar77e54a12007-07-09 18:52:00 +0200249#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100250static int min_sched_granularity_ns = 100000; /* 100 usecs */
251static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
252static int min_wakeup_granularity_ns; /* 0 usecs */
253static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100254static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
255static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200256#endif
257
Mel Gorman5e771902010-05-24 14:32:31 -0700258#ifdef CONFIG_COMPACTION
259static int min_extfrag_threshold;
260static int max_extfrag_threshold = 1000;
261#endif
262
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700263static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200264 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200265 .procname = "sched_child_runs_first",
266 .data = &sysctl_sched_child_runs_first,
267 .maxlen = sizeof(unsigned int),
268 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800269 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200270 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200271#ifdef CONFIG_SCHED_DEBUG
272 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100273 .procname = "sched_min_granularity_ns",
274 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200275 .maxlen = sizeof(unsigned int),
276 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800277 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100278 .extra1 = &min_sched_granularity_ns,
279 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200280 },
281 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200282 .procname = "sched_latency_ns",
283 .data = &sysctl_sched_latency,
284 .maxlen = sizeof(unsigned int),
285 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800286 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200287 .extra1 = &min_sched_granularity_ns,
288 .extra2 = &max_sched_granularity_ns,
289 },
290 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200291 .procname = "sched_wakeup_granularity_ns",
292 .data = &sysctl_sched_wakeup_granularity,
293 .maxlen = sizeof(unsigned int),
294 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800295 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200296 .extra1 = &min_wakeup_granularity_ns,
297 .extra2 = &max_wakeup_granularity_ns,
298 },
299 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100300 .procname = "sched_tunable_scaling",
301 .data = &sysctl_sched_tunable_scaling,
302 .maxlen = sizeof(enum sched_tunable_scaling),
303 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800304 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100305 .extra1 = &min_sched_tunable_scaling,
306 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200307 },
308 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200309 .procname = "sched_migration_cost",
310 .data = &sysctl_sched_migration_cost,
311 .maxlen = sizeof(unsigned int),
312 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800313 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200314 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100315 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100316 .procname = "sched_nr_migrate",
317 .data = &sysctl_sched_nr_migrate,
318 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100319 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800320 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100321 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530322 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200323 .procname = "sched_time_avg",
324 .data = &sysctl_sched_time_avg,
325 .maxlen = sizeof(unsigned int),
326 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800327 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200328 },
329 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800330 .procname = "sched_shares_window",
331 .data = &sysctl_sched_shares_window,
332 .maxlen = sizeof(unsigned int),
333 .mode = 0644,
334 .proc_handler = proc_dointvec,
335 },
336 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530337 .procname = "timer_migration",
338 .data = &sysctl_timer_migration,
339 .maxlen = sizeof(unsigned int),
340 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800341 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530342 .extra1 = &zero,
343 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530344 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200345#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200346 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100347 .procname = "sched_rt_period_us",
348 .data = &sysctl_sched_rt_period,
349 .maxlen = sizeof(unsigned int),
350 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800351 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100352 },
353 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100354 .procname = "sched_rt_runtime_us",
355 .data = &sysctl_sched_rt_runtime,
356 .maxlen = sizeof(int),
357 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800358 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100359 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100360#ifdef CONFIG_SCHED_AUTOGROUP
361 {
362 .procname = "sched_autogroup_enabled",
363 .data = &sysctl_sched_autogroup_enabled,
364 .maxlen = sizeof(unsigned int),
365 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800366 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100367 .extra1 = &zero,
368 .extra2 = &one,
369 },
370#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700371#ifdef CONFIG_CFS_BANDWIDTH
372 {
373 .procname = "sched_cfs_bandwidth_slice_us",
374 .data = &sysctl_sched_cfs_bandwidth_slice,
375 .maxlen = sizeof(unsigned int),
376 .mode = 0644,
377 .proc_handler = proc_dointvec_minmax,
378 .extra1 = &one,
379 },
380#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700381#ifdef CONFIG_PROVE_LOCKING
382 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700383 .procname = "prove_locking",
384 .data = &prove_locking,
385 .maxlen = sizeof(int),
386 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800387 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700388 },
389#endif
390#ifdef CONFIG_LOCK_STAT
391 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700392 .procname = "lock_stat",
393 .data = &lock_stat,
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
Ingo Molnar77e54a12007-07-09 18:52:00 +0200399 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 .procname = "panic",
401 .data = &panic_timeout,
402 .maxlen = sizeof(int),
403 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800404 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 },
406 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 .procname = "core_uses_pid",
408 .data = &core_uses_pid,
409 .maxlen = sizeof(int),
410 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800411 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412 },
413 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 .procname = "core_pattern",
415 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700416 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800418 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 },
Neil Hormana2939802009-09-23 15:56:56 -0700420 {
Neil Hormana2939802009-09-23 15:56:56 -0700421 .procname = "core_pipe_limit",
422 .data = &core_pipe_limit,
423 .maxlen = sizeof(unsigned int),
424 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800425 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700426 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800427#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700430 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800431 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800432 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800434#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100435#ifdef CONFIG_LATENCYTOP
436 {
437 .procname = "latencytop",
438 .data = &latencytop_enabled,
439 .maxlen = sizeof(int),
440 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800441 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100442 },
443#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444#ifdef CONFIG_BLK_DEV_INITRD
445 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 .procname = "real-root-dev",
447 .data = &real_root_dev,
448 .maxlen = sizeof(int),
449 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800450 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 },
452#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700453 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700454 .procname = "print-fatal-signals",
455 .data = &print_fatal_signals,
456 .maxlen = sizeof(int),
457 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800458 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700459 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700460#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 .procname = "reboot-cmd",
463 .data = reboot_command,
464 .maxlen = 256,
465 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800466 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 },
468 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 .procname = "stop-a",
470 .data = &stop_a_enabled,
471 .maxlen = sizeof (int),
472 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800473 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474 },
475 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 .procname = "scons-poweroff",
477 .data = &scons_pwroff,
478 .maxlen = sizeof (int),
479 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800480 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 },
482#endif
David S. Miller08714202008-11-16 23:49:24 -0800483#ifdef CONFIG_SPARC64
484 {
David S. Miller08714202008-11-16 23:49:24 -0800485 .procname = "tsb-ratio",
486 .data = &sysctl_tsb_ratio,
487 .maxlen = sizeof (int),
488 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800489 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800490 },
491#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492#ifdef __hppa__
493 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 .procname = "soft-power",
495 .data = &pwrsw_enabled,
496 .maxlen = sizeof (int),
497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 },
500 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 .procname = "unaligned-trap",
502 .data = &unaligned_enabled,
503 .maxlen = sizeof (int),
504 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800505 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506 },
507#endif
508 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 .procname = "ctrl-alt-del",
510 .data = &C_A_D,
511 .maxlen = sizeof(int),
512 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800513 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700514 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400515#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200516 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200517 .procname = "ftrace_enabled",
518 .data = &ftrace_enabled,
519 .maxlen = sizeof(int),
520 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800521 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200522 },
523#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500524#ifdef CONFIG_STACK_TRACER
525 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500526 .procname = "stack_tracer_enabled",
527 .data = &stack_tracer_enabled,
528 .maxlen = sizeof(int),
529 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800530 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500531 },
532#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400533#ifdef CONFIG_TRACING
534 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100535 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400536 .data = &ftrace_dump_on_oops,
537 .maxlen = sizeof(int),
538 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800539 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400540 },
541#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200542#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 .procname = "modprobe",
545 .data = &modprobe_path,
546 .maxlen = KMOD_PATH_LEN,
547 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800548 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 },
Kees Cook3d433212009-04-02 15:49:29 -0700550 {
Kees Cook3d433212009-04-02 15:49:29 -0700551 .procname = "modules_disabled",
552 .data = &modules_disabled,
553 .maxlen = sizeof(int),
554 .mode = 0644,
555 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800556 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700557 .extra1 = &one,
558 .extra2 = &one,
559 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100561#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100564 .data = &uevent_helper,
565 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800567 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 },
569#endif
570#ifdef CONFIG_CHR_DEV_SG
571 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 .procname = "sg-big-buff",
573 .data = &sg_big_buff,
574 .maxlen = sizeof (int),
575 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800576 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 },
578#endif
579#ifdef CONFIG_BSD_PROCESS_ACCT
580 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 .procname = "acct",
582 .data = &acct_parm,
583 .maxlen = 3*sizeof(int),
584 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800585 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 },
587#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588#ifdef CONFIG_MAGIC_SYSRQ
589 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800591 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 .maxlen = sizeof (int),
593 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700594 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 },
596#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700597#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700600 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 .maxlen = sizeof (int),
602 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800603 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700605#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 .procname = "threads-max",
608 .data = &max_threads,
609 .maxlen = sizeof(int),
610 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800611 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 },
613 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614 .procname = "random",
615 .mode = 0555,
616 .child = random_table,
617 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618 {
Eric Paris17f60a72011-04-01 17:07:50 -0400619 .procname = "usermodehelper",
620 .mode = 0555,
621 .child = usermodehelper_table,
622 },
623 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 .procname = "overflowuid",
625 .data = &overflowuid,
626 .maxlen = sizeof(int),
627 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800628 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .extra1 = &minolduid,
630 .extra2 = &maxolduid,
631 },
632 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .procname = "overflowgid",
634 .data = &overflowgid,
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 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800641#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642#ifdef CONFIG_MATHEMU
643 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 .procname = "ieee_emulation_warnings",
645 .data = &sysctl_ieee_emulation_warnings,
646 .maxlen = sizeof(int),
647 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800648 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 },
650#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200653 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 .maxlen = sizeof(int),
655 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800656 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700657 },
658#endif
659 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 .procname = "pid_max",
661 .data = &pid_max,
662 .maxlen = sizeof (int),
663 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800664 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 .extra1 = &pid_max_min,
666 .extra2 = &pid_max_max,
667 },
668 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .procname = "panic_on_oops",
670 .data = &panic_on_oops,
671 .maxlen = sizeof(int),
672 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800673 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800675#if defined CONFIG_PRINTK
676 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800677 .procname = "printk",
678 .data = &console_loglevel,
679 .maxlen = 4*sizeof(int),
680 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800681 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800682 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700685 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 .maxlen = sizeof(int),
687 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800688 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 },
690 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700692 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 .maxlen = sizeof(int),
694 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800695 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 },
Dave Youngaf913222009-09-22 16:43:33 -0700697 {
Dave Youngaf913222009-09-22 16:43:33 -0700698 .procname = "printk_delay",
699 .data = &printk_delay_msec,
700 .maxlen = sizeof(int),
701 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800702 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700703 .extra1 = &zero,
704 .extra2 = &ten_thousand,
705 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800707 .procname = "dmesg_restrict",
708 .data = &dmesg_restrict,
709 .maxlen = sizeof(int),
710 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700711 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800712 .extra1 = &zero,
713 .extra2 = &one,
714 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800715 {
716 .procname = "kptr_restrict",
717 .data = &kptr_restrict,
718 .maxlen = sizeof(int),
719 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700720 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800721 .extra1 = &zero,
722 .extra2 = &two,
723 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800724#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800725 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726 .procname = "ngroups_max",
727 .data = &ngroups_max,
728 .maxlen = sizeof (int),
729 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800730 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731 },
Dan Ballard73efc032011-10-31 17:11:20 -0700732 {
733 .procname = "cap_last_cap",
734 .data = (void *)&cap_last_cap,
735 .maxlen = sizeof(int),
736 .mode = 0444,
737 .proc_handler = proc_dointvec,
738 },
Don Zickus58687ac2010-05-07 17:11:44 -0400739#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500740 {
Don Zickus58687ac2010-05-07 17:11:44 -0400741 .procname = "watchdog",
742 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500743 .maxlen = sizeof (int),
744 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700745 .proc_handler = proc_dowatchdog,
746 .extra1 = &zero,
747 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400748 },
749 {
750 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700751 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400752 .maxlen = sizeof(int),
753 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700754 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400755 .extra1 = &neg_one,
756 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500757 },
Don Zickus2508ce12010-05-07 17:11:46 -0400758 {
759 .procname = "softlockup_panic",
760 .data = &softlockup_panic,
761 .maxlen = sizeof(int),
762 .mode = 0644,
763 .proc_handler = proc_dointvec_minmax,
764 .extra1 = &zero,
765 .extra2 = &one,
766 },
Don Zickus5dc30552010-11-29 17:07:17 -0500767 {
768 .procname = "nmi_watchdog",
769 .data = &watchdog_enabled,
770 .maxlen = sizeof (int),
771 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700772 .proc_handler = proc_dowatchdog,
773 .extra1 = &zero,
774 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500775 },
776#endif
777#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
778 {
779 .procname = "unknown_nmi_panic",
780 .data = &unknown_nmi_panic,
781 .maxlen = sizeof (int),
782 .mode = 0644,
783 .proc_handler = proc_dointvec,
784 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500785#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786#if defined(CONFIG_X86)
787 {
Don Zickus8da5add2006-09-26 10:52:27 +0200788 .procname = "panic_on_unrecovered_nmi",
789 .data = &panic_on_unrecovered_nmi,
790 .maxlen = sizeof(int),
791 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800792 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200793 },
794 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700795 .procname = "panic_on_io_nmi",
796 .data = &panic_on_io_nmi,
797 .maxlen = sizeof(int),
798 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800799 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700800 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900801#ifdef CONFIG_DEBUG_STACKOVERFLOW
802 {
803 .procname = "panic_on_stackoverflow",
804 .data = &sysctl_panic_on_stackoverflow,
805 .maxlen = sizeof(int),
806 .mode = 0644,
807 .proc_handler = proc_dointvec,
808 },
809#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700810 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 .procname = "bootloader_type",
812 .data = &bootloader_type,
813 .maxlen = sizeof (int),
814 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800815 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100817 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700818 .procname = "bootloader_version",
819 .data = &bootloader_version,
820 .maxlen = sizeof (int),
821 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800822 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700823 },
824 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100825 .procname = "kstack_depth_to_print",
826 .data = &kstack_depth_to_print,
827 .maxlen = sizeof(int),
828 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800829 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100830 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100831 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100832 .procname = "io_delay_type",
833 .data = &io_delay_type,
834 .maxlen = sizeof(int),
835 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800836 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100837 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800839#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 .procname = "randomize_va_space",
842 .data = &randomize_va_space,
843 .maxlen = sizeof(int),
844 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800845 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700846 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800847#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800848#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700849 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700850 .procname = "spin_retry",
851 .data = &spin_retry,
852 .maxlen = sizeof (int),
853 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800854 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700855 },
856#endif
Len Brown673d5b42007-07-28 03:33:16 -0400857#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800858 {
Pavel Machekc255d842006-02-20 18:27:58 -0800859 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700860 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800861 .maxlen = sizeof (unsigned long),
862 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800863 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800864 },
865#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800866#ifdef CONFIG_IA64
867 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800868 .procname = "ignore-unaligned-usertrap",
869 .data = &no_unaligned_warning,
870 .maxlen = sizeof (int),
871 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800872 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800873 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800874 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800875 .procname = "unaligned-dump-stack",
876 .data = &unaligned_dump_stack,
877 .maxlen = sizeof (int),
878 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800879 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800880 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800881#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800882#ifdef CONFIG_DETECT_HUNG_TASK
883 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800884 .procname = "hung_task_panic",
885 .data = &sysctl_hung_task_panic,
886 .maxlen = sizeof(int),
887 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800888 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800889 .extra1 = &zero,
890 .extra2 = &one,
891 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100892 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100893 .procname = "hung_task_check_count",
894 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100895 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100896 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800897 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100898 },
899 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100900 .procname = "hung_task_timeout_secs",
901 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100902 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100903 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800904 .proc_handler = proc_dohung_task_timeout_secs,
Liu Hua96f6aea2014-04-07 15:38:57 -0700905 .extra2 = &hung_task_timeout_max,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100906 },
907 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100908 .procname = "hung_task_warnings",
909 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100910 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100911 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800912 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100913 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700914#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200915#ifdef CONFIG_COMPAT
916 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200917 .procname = "compat-log",
918 .data = &compat_log,
919 .maxlen = sizeof (int),
920 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800921 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200922 },
923#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700924#ifdef CONFIG_RT_MUTEXES
925 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700926 .procname = "max_lock_depth",
927 .data = &max_lock_depth,
928 .maxlen = sizeof(int),
929 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800930 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700931 },
932#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700933 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700934 .procname = "poweroff_cmd",
935 .data = &poweroff_cmd,
936 .maxlen = POWEROFF_CMD_PATH_LEN,
937 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800938 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700939 },
David Howells0b77f5b2008-04-29 01:01:32 -0700940#ifdef CONFIG_KEYS
941 {
David Howells0b77f5b2008-04-29 01:01:32 -0700942 .procname = "keys",
943 .mode = 0555,
944 .child = key_sysctls,
945 },
946#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700947#ifdef CONFIG_RCU_TORTURE_TEST
948 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700949 .procname = "rcutorture_runnable",
950 .data = &rcutorture_runnable,
951 .maxlen = sizeof(int),
952 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800953 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700954 },
955#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200956#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400957 /*
958 * User-space scripts rely on the existence of this file
959 * as a feature check for perf_events being enabled.
960 *
961 * So it's an ABI, do not remove!
962 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200963 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200964 .procname = "perf_event_paranoid",
965 .data = &sysctl_perf_event_paranoid,
966 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200967 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800968 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200969 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200970 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200971 .procname = "perf_event_mlock_kb",
972 .data = &sysctl_perf_event_mlock,
973 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200974 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800975 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200976 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200977 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200978 .procname = "perf_event_max_sample_rate",
979 .data = &sysctl_perf_event_sample_rate,
980 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200981 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100982 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200983 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200984#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200985#ifdef CONFIG_KMEMCHECK
986 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200987 .procname = "kmemcheck",
988 .data = &kmemcheck_enabled,
989 .maxlen = sizeof(int),
990 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800991 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200992 },
993#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200994#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200995 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200996 .procname = "blk_iopoll",
997 .data = &blk_iopoll_enabled,
998 .maxlen = sizeof(int),
999 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001000 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001001 },
Jens Axboecb684b52009-09-15 21:53:11 +02001002#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001003 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001004};
1005
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001006static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001007 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001008 .procname = "overcommit_memory",
1009 .data = &sysctl_overcommit_memory,
1010 .maxlen = sizeof(sysctl_overcommit_memory),
1011 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001012 .proc_handler = proc_dointvec_minmax,
1013 .extra1 = &zero,
1014 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001015 },
1016 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001017 .procname = "panic_on_oom",
1018 .data = &sysctl_panic_on_oom,
1019 .maxlen = sizeof(sysctl_panic_on_oom),
1020 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001021 .proc_handler = proc_dointvec_minmax,
1022 .extra1 = &zero,
1023 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001024 },
1025 {
David Rientjesfe071d72007-10-16 23:25:56 -07001026 .procname = "oom_kill_allocating_task",
1027 .data = &sysctl_oom_kill_allocating_task,
1028 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1029 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001030 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001031 },
1032 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001033 .procname = "oom_dump_tasks",
1034 .data = &sysctl_oom_dump_tasks,
1035 .maxlen = sizeof(sysctl_oom_dump_tasks),
1036 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001037 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001038 },
1039 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040 .procname = "overcommit_ratio",
1041 .data = &sysctl_overcommit_ratio,
1042 .maxlen = sizeof(sysctl_overcommit_ratio),
1043 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001044 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001045 },
1046 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001047 .procname = "page-cluster",
1048 .data = &page_cluster,
1049 .maxlen = sizeof(int),
1050 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001051 .proc_handler = proc_dointvec_minmax,
1052 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053 },
1054 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 .procname = "dirty_background_ratio",
1056 .data = &dirty_background_ratio,
1057 .maxlen = sizeof(dirty_background_ratio),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001060 .extra1 = &zero,
1061 .extra2 = &one_hundred,
1062 },
1063 {
David Rientjes2da02992009-01-06 14:39:31 -08001064 .procname = "dirty_background_bytes",
1065 .data = &dirty_background_bytes,
1066 .maxlen = sizeof(dirty_background_bytes),
1067 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001068 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001069 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001070 },
1071 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072 .procname = "dirty_ratio",
1073 .data = &vm_dirty_ratio,
1074 .maxlen = sizeof(vm_dirty_ratio),
1075 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001076 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 .extra1 = &zero,
1078 .extra2 = &one_hundred,
1079 },
1080 {
David Rientjes2da02992009-01-06 14:39:31 -08001081 .procname = "dirty_bytes",
1082 .data = &vm_dirty_bytes,
1083 .maxlen = sizeof(vm_dirty_bytes),
1084 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001085 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001086 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001087 },
1088 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001089 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001090 .data = &dirty_writeback_interval,
1091 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001093 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001094 },
1095 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001096 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001097 .data = &dirty_expire_interval,
1098 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001100 .proc_handler = proc_dointvec_minmax,
1101 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001102 },
1103 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 .procname = "nr_pdflush_threads",
1105 .data = &nr_pdflush_threads,
1106 .maxlen = sizeof nr_pdflush_threads,
1107 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001108 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001109 },
1110 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 .procname = "swappiness",
1112 .data = &vm_swappiness,
1113 .maxlen = sizeof(vm_swappiness),
1114 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001115 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 .extra1 = &zero,
1117 .extra2 = &one_hundred,
1118 },
1119#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001120 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001122 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001123 .maxlen = sizeof(unsigned long),
1124 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001125 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001126 .extra1 = (void *)&hugetlb_zero,
1127 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001128 },
1129#ifdef CONFIG_NUMA
1130 {
1131 .procname = "nr_hugepages_mempolicy",
1132 .data = NULL,
1133 .maxlen = sizeof(unsigned long),
1134 .mode = 0644,
1135 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1136 .extra1 = (void *)&hugetlb_zero,
1137 .extra2 = (void *)&hugetlb_infinity,
1138 },
1139#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001140 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001141 .procname = "hugetlb_shm_group",
1142 .data = &sysctl_hugetlb_shm_group,
1143 .maxlen = sizeof(gid_t),
1144 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001145 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001146 },
Mel Gorman396faf02007-07-17 04:03:13 -07001147 {
Mel Gorman396faf02007-07-17 04:03:13 -07001148 .procname = "hugepages_treat_as_movable",
1149 .data = &hugepages_treat_as_movable,
1150 .maxlen = sizeof(int),
1151 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001152 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001153 },
Adam Litke54f9f802007-10-16 01:26:20 -07001154 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001155 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001156 .data = NULL,
1157 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001158 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001159 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001160 .extra1 = (void *)&hugetlb_zero,
1161 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001162 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163#endif
1164 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165 .procname = "lowmem_reserve_ratio",
1166 .data = &sysctl_lowmem_reserve_ratio,
1167 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1168 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001169 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001170 },
1171 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001172 .procname = "drop_caches",
1173 .data = &sysctl_drop_caches,
1174 .maxlen = sizeof(int),
1175 .mode = 0644,
1176 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001177 .extra1 = &one,
1178 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001179 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001180#ifdef CONFIG_COMPACTION
1181 {
1182 .procname = "compact_memory",
1183 .data = &sysctl_compact_memory,
1184 .maxlen = sizeof(int),
1185 .mode = 0200,
1186 .proc_handler = sysctl_compaction_handler,
1187 },
Mel Gorman5e771902010-05-24 14:32:31 -07001188 {
1189 .procname = "extfrag_threshold",
1190 .data = &sysctl_extfrag_threshold,
1191 .maxlen = sizeof(int),
1192 .mode = 0644,
1193 .proc_handler = sysctl_extfrag_handler,
1194 .extra1 = &min_extfrag_threshold,
1195 .extra2 = &max_extfrag_threshold,
1196 },
1197
Mel Gorman76ab0f52010-05-24 14:32:28 -07001198#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001199 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001200 .procname = "min_free_kbytes",
1201 .data = &min_free_kbytes,
1202 .maxlen = sizeof(min_free_kbytes),
1203 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001204 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001205 .extra1 = &zero,
1206 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001207 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001208 .procname = "percpu_pagelist_fraction",
1209 .data = &percpu_pagelist_fraction,
1210 .maxlen = sizeof(percpu_pagelist_fraction),
1211 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001212 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001213 .extra1 = &min_percpu_pagelist_fract,
1214 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215#ifdef CONFIG_MMU
1216 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001217 .procname = "max_map_count",
1218 .data = &sysctl_max_map_count,
1219 .maxlen = sizeof(sysctl_max_map_count),
1220 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001221 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001222 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001223 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001224#else
1225 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001226 .procname = "nr_trim_pages",
1227 .data = &sysctl_nr_trim_pages,
1228 .maxlen = sizeof(sysctl_nr_trim_pages),
1229 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001230 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001231 .extra1 = &zero,
1232 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001233#endif
1234 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001235 .procname = "laptop_mode",
1236 .data = &laptop_mode,
1237 .maxlen = sizeof(laptop_mode),
1238 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001239 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001240 },
1241 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001242 .procname = "block_dump",
1243 .data = &block_dump,
1244 .maxlen = sizeof(block_dump),
1245 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001246 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001247 .extra1 = &zero,
1248 },
1249 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001250 .procname = "vfs_cache_pressure",
1251 .data = &sysctl_vfs_cache_pressure,
1252 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1253 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001254 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001255 .extra1 = &zero,
1256 },
1257#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1258 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001259 .procname = "legacy_va_layout",
1260 .data = &sysctl_legacy_va_layout,
1261 .maxlen = sizeof(sysctl_legacy_va_layout),
1262 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001263 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001264 .extra1 = &zero,
1265 },
1266#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001267#ifdef CONFIG_NUMA
1268 {
Christoph Lameter17436602006-01-18 17:42:32 -08001269 .procname = "zone_reclaim_mode",
1270 .data = &zone_reclaim_mode,
1271 .maxlen = sizeof(zone_reclaim_mode),
1272 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001273 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001274 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001275 },
Christoph Lameter96146342006-07-03 00:24:13 -07001276 {
Christoph Lameter96146342006-07-03 00:24:13 -07001277 .procname = "min_unmapped_ratio",
1278 .data = &sysctl_min_unmapped_ratio,
1279 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1280 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001281 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001282 .extra1 = &zero,
1283 .extra2 = &one_hundred,
1284 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001285 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001286 .procname = "min_slab_ratio",
1287 .data = &sysctl_min_slab_ratio,
1288 .maxlen = sizeof(sysctl_min_slab_ratio),
1289 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001290 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001291 .extra1 = &zero,
1292 .extra2 = &one_hundred,
1293 },
Christoph Lameter17436602006-01-18 17:42:32 -08001294#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001295#ifdef CONFIG_SMP
1296 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001297 .procname = "stat_interval",
1298 .data = &sysctl_stat_interval,
1299 .maxlen = sizeof(sysctl_stat_interval),
1300 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001301 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001302 },
1303#endif
David Howells6e141542009-12-15 19:27:45 +00001304#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001305 {
Eric Parised032182007-06-28 15:55:21 -04001306 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001307 .data = &dac_mmap_min_addr,
1308 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001309 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001310 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001311 },
David Howells6e141542009-12-15 19:27:45 +00001312#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001313#ifdef CONFIG_NUMA
1314 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001315 .procname = "numa_zonelist_order",
1316 .data = &numa_zonelist_order,
1317 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1318 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001319 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001320 },
1321#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001322#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001323 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001324 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001325 .procname = "vdso_enabled",
1326 .data = &vdso_enabled,
1327 .maxlen = sizeof(vdso_enabled),
1328 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001329 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001330 .extra1 = &zero,
1331 },
1332#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001333#ifdef CONFIG_HIGHMEM
1334 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001335 .procname = "highmem_is_dirtyable",
1336 .data = &vm_highmem_is_dirtyable,
1337 .maxlen = sizeof(vm_highmem_is_dirtyable),
1338 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001339 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001340 .extra1 = &zero,
1341 .extra2 = &one,
1342 },
1343#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001344 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001345 .procname = "scan_unevictable_pages",
1346 .data = &scan_unevictable_pages,
1347 .maxlen = sizeof(scan_unevictable_pages),
1348 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001349 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001350 },
Andi Kleen6a460792009-09-16 11:50:15 +02001351#ifdef CONFIG_MEMORY_FAILURE
1352 {
Andi Kleen6a460792009-09-16 11:50:15 +02001353 .procname = "memory_failure_early_kill",
1354 .data = &sysctl_memory_failure_early_kill,
1355 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1356 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001357 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001358 .extra1 = &zero,
1359 .extra2 = &one,
1360 },
1361 {
Andi Kleen6a460792009-09-16 11:50:15 +02001362 .procname = "memory_failure_recovery",
1363 .data = &sysctl_memory_failure_recovery,
1364 .maxlen = sizeof(sysctl_memory_failure_recovery),
1365 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001366 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001367 .extra1 = &zero,
1368 .extra2 = &one,
1369 },
1370#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001371 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001372};
1373
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001374#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001375static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001376 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001377};
1378#endif
1379
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001380static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001382 .procname = "inode-nr",
1383 .data = &inodes_stat,
1384 .maxlen = 2*sizeof(int),
1385 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001386 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001387 },
1388 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001389 .procname = "inode-state",
1390 .data = &inodes_stat,
1391 .maxlen = 7*sizeof(int),
1392 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001393 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001394 },
1395 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001396 .procname = "file-nr",
1397 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001398 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001399 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001400 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401 },
1402 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001403 .procname = "file-max",
1404 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001405 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001406 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001407 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001408 },
1409 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001410 .procname = "nr_open",
1411 .data = &sysctl_nr_open,
1412 .maxlen = sizeof(int),
1413 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001414 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001415 .extra1 = &sysctl_nr_open_min,
1416 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001417 },
1418 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001419 .procname = "dentry-state",
1420 .data = &dentry_stat,
1421 .maxlen = 6*sizeof(int),
1422 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001423 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424 },
1425 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426 .procname = "overflowuid",
1427 .data = &fs_overflowuid,
1428 .maxlen = sizeof(int),
1429 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001430 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431 .extra1 = &minolduid,
1432 .extra2 = &maxolduid,
1433 },
1434 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001435 .procname = "overflowgid",
1436 .data = &fs_overflowgid,
1437 .maxlen = sizeof(int),
1438 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001439 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440 .extra1 = &minolduid,
1441 .extra2 = &maxolduid,
1442 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001443#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001444 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445 .procname = "leases-enable",
1446 .data = &leases_enable,
1447 .maxlen = sizeof(int),
1448 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001449 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001450 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001451#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452#ifdef CONFIG_DNOTIFY
1453 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001454 .procname = "dir-notify-enable",
1455 .data = &dir_notify_enable,
1456 .maxlen = sizeof(int),
1457 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001458 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001459 },
1460#endif
1461#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001462#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001464 .procname = "lease-break-time",
1465 .data = &lease_break_time,
1466 .maxlen = sizeof(int),
1467 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001468 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001469 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001470#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001471#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001473 .procname = "aio-nr",
1474 .data = &aio_nr,
1475 .maxlen = sizeof(aio_nr),
1476 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001477 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001478 },
1479 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001480 .procname = "aio-max-nr",
1481 .data = &aio_max_nr,
1482 .maxlen = sizeof(aio_max_nr),
1483 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001484 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001485 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001486#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001487#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001488 {
Robert Love0399cb02005-07-13 12:38:18 -04001489 .procname = "inotify",
1490 .mode = 0555,
1491 .child = inotify_table,
1492 },
1493#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001494#ifdef CONFIG_EPOLL
1495 {
1496 .procname = "epoll",
1497 .mode = 0555,
1498 .child = epoll_table,
1499 },
1500#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001501#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001502 {
Alan Coxd6e71142005-06-23 00:09:43 -07001503 .procname = "suid_dumpable",
1504 .data = &suid_dumpable,
1505 .maxlen = sizeof(int),
1506 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001507 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001508 .extra1 = &zero,
1509 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001510 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001511#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1512 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001513 .procname = "binfmt_misc",
1514 .mode = 0555,
1515 .child = binfmt_misc_table,
1516 },
1517#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001518 {
Jens Axboeff9da692010-06-03 14:54:39 +02001519 .procname = "pipe-max-size",
1520 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001521 .maxlen = sizeof(int),
1522 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001523 .proc_handler = &pipe_proc_fn,
1524 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001525 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001526 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001527};
1528
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001529static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001530#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001531 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001532 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001533 .procname = "exception-trace",
1534 .data = &show_unhandled_signals,
1535 .maxlen = sizeof(int),
1536 .mode = 0644,
1537 .proc_handler = proc_dointvec
1538 },
1539#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001540#if defined(CONFIG_OPTPROBES)
1541 {
1542 .procname = "kprobes-optimization",
1543 .data = &sysctl_kprobes_optimization,
1544 .maxlen = sizeof(int),
1545 .mode = 0644,
1546 .proc_handler = proc_kprobes_optimization_handler,
1547 .extra1 = &zero,
1548 .extra2 = &one,
1549 },
1550#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001551 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001552};
1553
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001554static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001555 { }
Robert Love0eeca282005-07-12 17:06:03 -04001556};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001557
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001558int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001559{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001560 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001561 return 0;
1562}
1563
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001564#endif /* CONFIG_SYSCTL */
1565
Linus Torvalds1da177e2005-04-16 15:20:36 -07001566/*
1567 * /proc/sys support
1568 */
1569
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001570#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001571
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001572static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001573 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001574 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001575{
1576 size_t len;
1577 char __user *p;
1578 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001579
1580 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001581 *lenp = 0;
1582 return 0;
1583 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001584
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001585 if (write) {
1586 len = 0;
1587 p = buffer;
1588 while (len < *lenp) {
1589 if (get_user(c, p++))
1590 return -EFAULT;
1591 if (c == 0 || c == '\n')
1592 break;
1593 len++;
1594 }
1595 if (len >= maxlen)
1596 len = maxlen-1;
1597 if(copy_from_user(data, buffer, len))
1598 return -EFAULT;
1599 ((char *) data)[len] = 0;
1600 *ppos += *lenp;
1601 } else {
1602 len = strlen(data);
1603 if (len > maxlen)
1604 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001605
1606 if (*ppos > len) {
1607 *lenp = 0;
1608 return 0;
1609 }
1610
1611 data += *ppos;
1612 len -= *ppos;
1613
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001614 if (len > *lenp)
1615 len = *lenp;
1616 if (len)
1617 if(copy_to_user(buffer, data, len))
1618 return -EFAULT;
1619 if (len < *lenp) {
1620 if(put_user('\n', ((char __user *) buffer) + len))
1621 return -EFAULT;
1622 len++;
1623 }
1624 *lenp = len;
1625 *ppos += len;
1626 }
1627 return 0;
1628}
1629
Linus Torvalds1da177e2005-04-16 15:20:36 -07001630/**
1631 * proc_dostring - read a string sysctl
1632 * @table: the sysctl table
1633 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001634 * @buffer: the user buffer
1635 * @lenp: the size of the user buffer
1636 * @ppos: file position
1637 *
1638 * Reads/writes a string from/to the user buffer. If the kernel
1639 * buffer provided is not large enough to hold the string, the
1640 * string is truncated. The copied string is %NULL-terminated.
1641 * If the string is being read by the user process, it is copied
1642 * and a newline '\n' is added. It is truncated if the buffer is
1643 * not large enough.
1644 *
1645 * Returns 0 on success.
1646 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001647int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001648 void __user *buffer, size_t *lenp, loff_t *ppos)
1649{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001650 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001651 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001652}
1653
Amerigo Wang00b7c332010-05-05 00:26:45 +00001654static size_t proc_skip_spaces(char **buf)
1655{
1656 size_t ret;
1657 char *tmp = skip_spaces(*buf);
1658 ret = tmp - *buf;
1659 *buf = tmp;
1660 return ret;
1661}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001662
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001663static void proc_skip_char(char **buf, size_t *size, const char v)
1664{
1665 while (*size) {
1666 if (**buf != v)
1667 break;
1668 (*size)--;
1669 (*buf)++;
1670 }
1671}
1672
Amerigo Wang00b7c332010-05-05 00:26:45 +00001673#define TMPBUFLEN 22
1674/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001675 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001676 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001677 * @buf: a kernel buffer
1678 * @size: size of the kernel buffer
1679 * @val: this is where the number will be stored
1680 * @neg: set to %TRUE if number is negative
1681 * @perm_tr: a vector which contains the allowed trailers
1682 * @perm_tr_len: size of the perm_tr vector
1683 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001684 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001685 * In case of success %0 is returned and @buf and @size are updated with
1686 * the amount of bytes read. If @tr is non-NULL and a trailing
1687 * character exists (size is non-zero after returning from this
1688 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001689 */
1690static int proc_get_long(char **buf, size_t *size,
1691 unsigned long *val, bool *neg,
1692 const char *perm_tr, unsigned perm_tr_len, char *tr)
1693{
1694 int len;
1695 char *p, tmp[TMPBUFLEN];
1696
1697 if (!*size)
1698 return -EINVAL;
1699
1700 len = *size;
1701 if (len > TMPBUFLEN - 1)
1702 len = TMPBUFLEN - 1;
1703
1704 memcpy(tmp, *buf, len);
1705
1706 tmp[len] = 0;
1707 p = tmp;
1708 if (*p == '-' && *size > 1) {
1709 *neg = true;
1710 p++;
1711 } else
1712 *neg = false;
1713 if (!isdigit(*p))
1714 return -EINVAL;
1715
1716 *val = simple_strtoul(p, &p, 0);
1717
1718 len = p - tmp;
1719
1720 /* We don't know if the next char is whitespace thus we may accept
1721 * invalid integers (e.g. 1234...a) or two integers instead of one
1722 * (e.g. 123...1). So lets not allow such large numbers. */
1723 if (len == TMPBUFLEN - 1)
1724 return -EINVAL;
1725
1726 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1727 return -EINVAL;
1728
1729 if (tr && (len < *size))
1730 *tr = *p;
1731
1732 *buf += len;
1733 *size -= len;
1734
1735 return 0;
1736}
1737
1738/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001739 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001740 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001741 * @buf: the user buffer
1742 * @size: the size of the user buffer
1743 * @val: the integer to be converted
1744 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001745 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001746 * In case of success %0 is returned and @buf and @size are updated with
1747 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001748 */
1749static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1750 bool neg)
1751{
1752 int len;
1753 char tmp[TMPBUFLEN], *p = tmp;
1754
1755 sprintf(p, "%s%lu", neg ? "-" : "", val);
1756 len = strlen(tmp);
1757 if (len > *size)
1758 len = *size;
1759 if (copy_to_user(*buf, tmp, len))
1760 return -EFAULT;
1761 *size -= len;
1762 *buf += len;
1763 return 0;
1764}
1765#undef TMPBUFLEN
1766
1767static int proc_put_char(void __user **buf, size_t *size, char c)
1768{
1769 if (*size) {
1770 char __user **buffer = (char __user **)buf;
1771 if (put_user(c, *buffer))
1772 return -EFAULT;
1773 (*size)--, (*buffer)++;
1774 *buf = *buffer;
1775 }
1776 return 0;
1777}
1778
1779static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001780 int *valp,
1781 int write, void *data)
1782{
1783 if (write) {
1784 *valp = *negp ? -*lvalp : *lvalp;
1785 } else {
1786 int val = *valp;
1787 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001788 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001789 *lvalp = (unsigned long)-val;
1790 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001791 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001792 *lvalp = (unsigned long)val;
1793 }
1794 }
1795 return 0;
1796}
1797
Amerigo Wang00b7c332010-05-05 00:26:45 +00001798static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1799
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001800static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001801 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001802 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001803 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001804 int write, void *data),
1805 void *data)
1806{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001807 int *i, vleft, first = 1, err = 0;
1808 unsigned long page = 0;
1809 size_t left;
1810 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001811
Amerigo Wang00b7c332010-05-05 00:26:45 +00001812 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001813 *lenp = 0;
1814 return 0;
1815 }
1816
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001817 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001818 vleft = table->maxlen / sizeof(*i);
1819 left = *lenp;
1820
1821 if (!conv)
1822 conv = do_proc_dointvec_conv;
1823
Linus Torvalds1da177e2005-04-16 15:20:36 -07001824 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001825 if (left > PAGE_SIZE - 1)
1826 left = PAGE_SIZE - 1;
1827 page = __get_free_page(GFP_TEMPORARY);
1828 kbuf = (char *) page;
1829 if (!kbuf)
1830 return -ENOMEM;
1831 if (copy_from_user(kbuf, buffer, left)) {
1832 err = -EFAULT;
1833 goto free;
1834 }
1835 kbuf[left] = 0;
1836 }
1837
1838 for (; left && vleft--; i++, first=0) {
1839 unsigned long lval;
1840 bool neg;
1841
1842 if (write) {
1843 left -= proc_skip_spaces(&kbuf);
1844
J. R. Okajima563b0462010-05-25 16:10:14 -07001845 if (!left)
1846 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001847 err = proc_get_long(&kbuf, &left, &lval, &neg,
1848 proc_wspace_sep,
1849 sizeof(proc_wspace_sep), NULL);
1850 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001851 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001852 if (conv(&neg, &lval, i, 1, data)) {
1853 err = -EINVAL;
1854 break;
1855 }
1856 } else {
1857 if (conv(&neg, &lval, i, 0, data)) {
1858 err = -EINVAL;
1859 break;
1860 }
1861 if (!first)
1862 err = proc_put_char(&buffer, &left, '\t');
1863 if (err)
1864 break;
1865 err = proc_put_long(&buffer, &left, lval, neg);
1866 if (err)
1867 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001868 }
1869 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001870
1871 if (!write && !first && left && !err)
1872 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001873 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001874 left -= proc_skip_spaces(&kbuf);
1875free:
1876 if (write) {
1877 free_page(page);
1878 if (first)
1879 return err ? : -EINVAL;
1880 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001881 *lenp -= left;
1882 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001883 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001884}
1885
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001886static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001887 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001888 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001889 int write, void *data),
1890 void *data)
1891{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001892 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001893 buffer, lenp, ppos, conv, data);
1894}
1895
Linus Torvalds1da177e2005-04-16 15:20:36 -07001896/**
1897 * proc_dointvec - read a vector of integers
1898 * @table: the sysctl table
1899 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001900 * @buffer: the user buffer
1901 * @lenp: the size of the user buffer
1902 * @ppos: file position
1903 *
1904 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1905 * values from/to the user buffer, treated as an ASCII string.
1906 *
1907 * Returns 0 on success.
1908 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001909int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001910 void __user *buffer, size_t *lenp, loff_t *ppos)
1911{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001912 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001913 NULL,NULL);
1914}
1915
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001916/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001917 * Taint values can only be increased
1918 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001919 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001920static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001921 void __user *buffer, size_t *lenp, loff_t *ppos)
1922{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001923 struct ctl_table t;
1924 unsigned long tmptaint = get_taint();
1925 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001926
Bastian Blank91fcd412007-04-23 14:41:14 -07001927 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001928 return -EPERM;
1929
Andi Kleen25ddbb12008-10-15 22:01:41 -07001930 t = *table;
1931 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001932 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001933 if (err < 0)
1934 return err;
1935
1936 if (write) {
1937 /*
1938 * Poor man's atomic or. Not worth adding a primitive
1939 * to everyone's atomic.h for this
1940 */
1941 int i;
1942 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1943 if ((tmptaint >> i) & 1)
1944 add_taint(i);
1945 }
1946 }
1947
1948 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001949}
1950
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001951#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001952static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001953 void __user *buffer, size_t *lenp, loff_t *ppos)
1954{
1955 if (write && !capable(CAP_SYS_ADMIN))
1956 return -EPERM;
1957
1958 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1959}
1960#endif
1961
Linus Torvalds1da177e2005-04-16 15:20:36 -07001962struct do_proc_dointvec_minmax_conv_param {
1963 int *min;
1964 int *max;
1965};
1966
Amerigo Wang00b7c332010-05-05 00:26:45 +00001967static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1968 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001969 int write, void *data)
1970{
1971 struct do_proc_dointvec_minmax_conv_param *param = data;
1972 if (write) {
1973 int val = *negp ? -*lvalp : *lvalp;
1974 if ((param->min && *param->min > val) ||
1975 (param->max && *param->max < val))
1976 return -EINVAL;
1977 *valp = val;
1978 } else {
1979 int val = *valp;
1980 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001981 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001982 *lvalp = (unsigned long)-val;
1983 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001984 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001985 *lvalp = (unsigned long)val;
1986 }
1987 }
1988 return 0;
1989}
1990
1991/**
1992 * proc_dointvec_minmax - read a vector of integers with min/max values
1993 * @table: the sysctl table
1994 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001995 * @buffer: the user buffer
1996 * @lenp: the size of the user buffer
1997 * @ppos: file position
1998 *
1999 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2000 * values from/to the user buffer, treated as an ASCII string.
2001 *
2002 * This routine will ensure the values are within the range specified by
2003 * table->extra1 (min) and table->extra2 (max).
2004 *
2005 * Returns 0 on success.
2006 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002007int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002008 void __user *buffer, size_t *lenp, loff_t *ppos)
2009{
2010 struct do_proc_dointvec_minmax_conv_param param = {
2011 .min = (int *) table->extra1,
2012 .max = (int *) table->extra2,
2013 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002014 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002015 do_proc_dointvec_minmax_conv, &param);
2016}
2017
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002018static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002019 void __user *buffer,
2020 size_t *lenp, loff_t *ppos,
2021 unsigned long convmul,
2022 unsigned long convdiv)
2023{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002024 unsigned long *i, *min, *max;
2025 int vleft, first = 1, err = 0;
2026 unsigned long page = 0;
2027 size_t left;
2028 char *kbuf;
2029
2030 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002031 *lenp = 0;
2032 return 0;
2033 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002034
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002035 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002036 min = (unsigned long *) table->extra1;
2037 max = (unsigned long *) table->extra2;
2038 vleft = table->maxlen / sizeof(unsigned long);
2039 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002040
2041 if (write) {
2042 if (left > PAGE_SIZE - 1)
2043 left = PAGE_SIZE - 1;
2044 page = __get_free_page(GFP_TEMPORARY);
2045 kbuf = (char *) page;
2046 if (!kbuf)
2047 return -ENOMEM;
2048 if (copy_from_user(kbuf, buffer, left)) {
2049 err = -EFAULT;
2050 goto free;
2051 }
2052 kbuf[left] = 0;
2053 }
2054
Eric Dumazet27b3d802010-10-07 12:59:29 -07002055 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002056 unsigned long val;
2057
Linus Torvalds1da177e2005-04-16 15:20:36 -07002058 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002059 bool neg;
2060
2061 left -= proc_skip_spaces(&kbuf);
2062
2063 err = proc_get_long(&kbuf, &left, &val, &neg,
2064 proc_wspace_sep,
2065 sizeof(proc_wspace_sep), NULL);
2066 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002067 break;
2068 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002069 continue;
2070 if ((min && val < *min) || (max && val > *max))
2071 continue;
2072 *i = val;
2073 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002074 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002075 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002076 err = proc_put_char(&buffer, &left, '\t');
2077 err = proc_put_long(&buffer, &left, val, false);
2078 if (err)
2079 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002080 }
2081 }
2082
Amerigo Wang00b7c332010-05-05 00:26:45 +00002083 if (!write && !first && left && !err)
2084 err = proc_put_char(&buffer, &left, '\n');
2085 if (write && !err)
2086 left -= proc_skip_spaces(&kbuf);
2087free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002088 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002089 free_page(page);
2090 if (first)
2091 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002092 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002093 *lenp -= left;
2094 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002095 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002096}
2097
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002098static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002099 void __user *buffer,
2100 size_t *lenp, loff_t *ppos,
2101 unsigned long convmul,
2102 unsigned long convdiv)
2103{
2104 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002105 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002106}
2107
Linus Torvalds1da177e2005-04-16 15:20:36 -07002108/**
2109 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2110 * @table: the sysctl table
2111 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002112 * @buffer: the user buffer
2113 * @lenp: the size of the user buffer
2114 * @ppos: file position
2115 *
2116 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2117 * values from/to the user buffer, treated as an ASCII string.
2118 *
2119 * This routine will ensure the values are within the range specified by
2120 * table->extra1 (min) and table->extra2 (max).
2121 *
2122 * Returns 0 on success.
2123 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002124int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002125 void __user *buffer, size_t *lenp, loff_t *ppos)
2126{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002127 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002128}
2129
2130/**
2131 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2132 * @table: the sysctl table
2133 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002134 * @buffer: the user buffer
2135 * @lenp: the size of the user buffer
2136 * @ppos: file position
2137 *
2138 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2139 * values from/to the user buffer, treated as an ASCII string. The values
2140 * are treated as milliseconds, and converted to jiffies when they are stored.
2141 *
2142 * This routine will ensure the values are within the range specified by
2143 * table->extra1 (min) and table->extra2 (max).
2144 *
2145 * Returns 0 on success.
2146 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002147int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002148 void __user *buffer,
2149 size_t *lenp, loff_t *ppos)
2150{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002151 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002152 lenp, ppos, HZ, 1000l);
2153}
2154
2155
Amerigo Wang00b7c332010-05-05 00:26:45 +00002156static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002157 int *valp,
2158 int write, void *data)
2159{
2160 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002161 if (*lvalp > LONG_MAX / HZ)
2162 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002163 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2164 } else {
2165 int val = *valp;
2166 unsigned long lval;
2167 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002168 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002169 lval = (unsigned long)-val;
2170 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002171 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002172 lval = (unsigned long)val;
2173 }
2174 *lvalp = lval / HZ;
2175 }
2176 return 0;
2177}
2178
Amerigo Wang00b7c332010-05-05 00:26:45 +00002179static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002180 int *valp,
2181 int write, void *data)
2182{
2183 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002184 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2185 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002186 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2187 } else {
2188 int val = *valp;
2189 unsigned long lval;
2190 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002191 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002192 lval = (unsigned long)-val;
2193 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002194 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002195 lval = (unsigned long)val;
2196 }
2197 *lvalp = jiffies_to_clock_t(lval);
2198 }
2199 return 0;
2200}
2201
Amerigo Wang00b7c332010-05-05 00:26:45 +00002202static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002203 int *valp,
2204 int write, void *data)
2205{
2206 if (write) {
2207 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2208 } else {
2209 int val = *valp;
2210 unsigned long lval;
2211 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002212 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002213 lval = (unsigned long)-val;
2214 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002215 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002216 lval = (unsigned long)val;
2217 }
2218 *lvalp = jiffies_to_msecs(lval);
2219 }
2220 return 0;
2221}
2222
2223/**
2224 * proc_dointvec_jiffies - read a vector of integers as seconds
2225 * @table: the sysctl table
2226 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002227 * @buffer: the user buffer
2228 * @lenp: the size of the user buffer
2229 * @ppos: file position
2230 *
2231 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2232 * values from/to the user buffer, treated as an ASCII string.
2233 * The values read are assumed to be in seconds, and are converted into
2234 * jiffies.
2235 *
2236 * Returns 0 on success.
2237 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002238int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002239 void __user *buffer, size_t *lenp, loff_t *ppos)
2240{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002241 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002242 do_proc_dointvec_jiffies_conv,NULL);
2243}
2244
2245/**
2246 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2247 * @table: the sysctl table
2248 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002249 * @buffer: the user buffer
2250 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002251 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002252 *
2253 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2254 * values from/to the user buffer, treated as an ASCII string.
2255 * The values read are assumed to be in 1/USER_HZ seconds, and
2256 * are converted into jiffies.
2257 *
2258 * Returns 0 on success.
2259 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002260int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002261 void __user *buffer, size_t *lenp, loff_t *ppos)
2262{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002263 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002264 do_proc_dointvec_userhz_jiffies_conv,NULL);
2265}
2266
2267/**
2268 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2269 * @table: the sysctl table
2270 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002271 * @buffer: the user buffer
2272 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002273 * @ppos: file position
2274 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002275 *
2276 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2277 * values from/to the user buffer, treated as an ASCII string.
2278 * The values read are assumed to be in 1/1000 seconds, and
2279 * are converted into jiffies.
2280 *
2281 * Returns 0 on success.
2282 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002283int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002284 void __user *buffer, size_t *lenp, loff_t *ppos)
2285{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002286 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002287 do_proc_dointvec_ms_jiffies_conv, NULL);
2288}
2289
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002290static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002291 void __user *buffer, size_t *lenp, loff_t *ppos)
2292{
2293 struct pid *new_pid;
2294 pid_t tmp;
2295 int r;
2296
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002297 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002298
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002299 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002300 lenp, ppos, NULL, NULL);
2301 if (r || !write)
2302 return r;
2303
2304 new_pid = find_get_pid(tmp);
2305 if (!new_pid)
2306 return -ESRCH;
2307
2308 put_pid(xchg(&cad_pid, new_pid));
2309 return 0;
2310}
2311
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002312/**
2313 * proc_do_large_bitmap - read/write from/to a large bitmap
2314 * @table: the sysctl table
2315 * @write: %TRUE if this is a write to the sysctl file
2316 * @buffer: the user buffer
2317 * @lenp: the size of the user buffer
2318 * @ppos: file position
2319 *
2320 * The bitmap is stored at table->data and the bitmap length (in bits)
2321 * in table->maxlen.
2322 *
2323 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2324 * large bitmaps may be represented in a compact manner. Writing into
2325 * the file will clear the bitmap then update it with the given input.
2326 *
2327 * Returns 0 on success.
2328 */
2329int proc_do_large_bitmap(struct ctl_table *table, int write,
2330 void __user *buffer, size_t *lenp, loff_t *ppos)
2331{
2332 int err = 0;
2333 bool first = 1;
2334 size_t left = *lenp;
2335 unsigned long bitmap_len = table->maxlen;
2336 unsigned long *bitmap = (unsigned long *) table->data;
2337 unsigned long *tmp_bitmap = NULL;
2338 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2339
2340 if (!bitmap_len || !left || (*ppos && !write)) {
2341 *lenp = 0;
2342 return 0;
2343 }
2344
2345 if (write) {
2346 unsigned long page = 0;
2347 char *kbuf;
2348
2349 if (left > PAGE_SIZE - 1)
2350 left = PAGE_SIZE - 1;
2351
2352 page = __get_free_page(GFP_TEMPORARY);
2353 kbuf = (char *) page;
2354 if (!kbuf)
2355 return -ENOMEM;
2356 if (copy_from_user(kbuf, buffer, left)) {
2357 free_page(page);
2358 return -EFAULT;
2359 }
2360 kbuf[left] = 0;
2361
2362 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2363 GFP_KERNEL);
2364 if (!tmp_bitmap) {
2365 free_page(page);
2366 return -ENOMEM;
2367 }
2368 proc_skip_char(&kbuf, &left, '\n');
2369 while (!err && left) {
2370 unsigned long val_a, val_b;
2371 bool neg;
2372
2373 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2374 sizeof(tr_a), &c);
2375 if (err)
2376 break;
2377 if (val_a >= bitmap_len || neg) {
2378 err = -EINVAL;
2379 break;
2380 }
2381
2382 val_b = val_a;
2383 if (left) {
2384 kbuf++;
2385 left--;
2386 }
2387
2388 if (c == '-') {
2389 err = proc_get_long(&kbuf, &left, &val_b,
2390 &neg, tr_b, sizeof(tr_b),
2391 &c);
2392 if (err)
2393 break;
2394 if (val_b >= bitmap_len || neg ||
2395 val_a > val_b) {
2396 err = -EINVAL;
2397 break;
2398 }
2399 if (left) {
2400 kbuf++;
2401 left--;
2402 }
2403 }
2404
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002405 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002406 first = 0;
2407 proc_skip_char(&kbuf, &left, '\n');
2408 }
2409 free_page(page);
2410 } else {
2411 unsigned long bit_a, bit_b = 0;
2412
2413 while (left) {
2414 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2415 if (bit_a >= bitmap_len)
2416 break;
2417 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2418 bit_a + 1) - 1;
2419
2420 if (!first) {
2421 err = proc_put_char(&buffer, &left, ',');
2422 if (err)
2423 break;
2424 }
2425 err = proc_put_long(&buffer, &left, bit_a, false);
2426 if (err)
2427 break;
2428 if (bit_a != bit_b) {
2429 err = proc_put_char(&buffer, &left, '-');
2430 if (err)
2431 break;
2432 err = proc_put_long(&buffer, &left, bit_b, false);
2433 if (err)
2434 break;
2435 }
2436
2437 first = 0; bit_b++;
2438 }
2439 if (!err)
2440 err = proc_put_char(&buffer, &left, '\n');
2441 }
2442
2443 if (!err) {
2444 if (write) {
2445 if (*ppos)
2446 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2447 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002448 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002449 }
2450 kfree(tmp_bitmap);
2451 *lenp -= left;
2452 *ppos += *lenp;
2453 return 0;
2454 } else {
2455 kfree(tmp_bitmap);
2456 return err;
2457 }
2458}
2459
Jovi Zhang55610502011-01-12 17:00:45 -08002460#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002461
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002462int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002463 void __user *buffer, size_t *lenp, loff_t *ppos)
2464{
2465 return -ENOSYS;
2466}
2467
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002468int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002469 void __user *buffer, size_t *lenp, loff_t *ppos)
2470{
2471 return -ENOSYS;
2472}
2473
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002474int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002475 void __user *buffer, size_t *lenp, loff_t *ppos)
2476{
2477 return -ENOSYS;
2478}
2479
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002480int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002481 void __user *buffer, size_t *lenp, loff_t *ppos)
2482{
2483 return -ENOSYS;
2484}
2485
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002486int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002487 void __user *buffer, size_t *lenp, loff_t *ppos)
2488{
2489 return -ENOSYS;
2490}
2491
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002492int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002493 void __user *buffer, size_t *lenp, loff_t *ppos)
2494{
2495 return -ENOSYS;
2496}
2497
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002498int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002499 void __user *buffer, size_t *lenp, loff_t *ppos)
2500{
2501 return -ENOSYS;
2502}
2503
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002504int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002505 void __user *buffer,
2506 size_t *lenp, loff_t *ppos)
2507{
2508 return -ENOSYS;
2509}
2510
2511
Jovi Zhang55610502011-01-12 17:00:45 -08002512#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002513
Linus Torvalds1da177e2005-04-16 15:20:36 -07002514/*
2515 * No sense putting this after each symbol definition, twice,
2516 * exception granted :-)
2517 */
2518EXPORT_SYMBOL(proc_dointvec);
2519EXPORT_SYMBOL(proc_dointvec_jiffies);
2520EXPORT_SYMBOL(proc_dointvec_minmax);
2521EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2522EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2523EXPORT_SYMBOL(proc_dostring);
2524EXPORT_SYMBOL(proc_doulongvec_minmax);
2525EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);