blob: 49f472582722438669597dfa30948633d372ad46 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070033#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/init.h>
35#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010036#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030037#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/sysrq.h>
39#include <linux/highuid.h>
40#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020041#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070042#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070045#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/times.h>
47#include <linux/limits.h>
48#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020049#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070051#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080052#include <linux/nfs_fs.h>
53#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070054#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020055#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020056#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050057#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020058#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070059#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040060#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070061#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000062#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#include <asm/uaccess.h>
65#include <asm/processor.h>
66
Andi Kleen29cbc782006-09-30 01:47:55 +020067#ifdef CONFIG_X86
68#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010069#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010070#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020071#endif
David Howellsd550bbd2012-03-28 18:30:03 +010072#ifdef CONFIG_SPARC
73#include <asm/setup.h>
74#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080075#ifdef CONFIG_BSD_PROCESS_ACCT
76#include <linux/acct.h>
77#endif
Dave Young4f0e0562010-03-10 15:24:09 -080078#ifdef CONFIG_RT_MUTEXES
79#include <linux/rtmutex.h>
80#endif
Dave Young2edf5e42010-03-10 15:24:10 -080081#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
82#include <linux/lockdep.h>
83#endif
Dave Young15485a42010-03-10 15:24:07 -080084#ifdef CONFIG_CHR_DEV_SG
85#include <scsi/sg.h>
86#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020087
Don Zickus58687ac2010-05-07 17:11:44 -040088#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050089#include <linux/nmi.h>
90#endif
91
Eric W. Biederman7058cb02007-10-18 03:05:58 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#if defined(CONFIG_SYSCTL)
94
95/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int sysctl_overcommit_memory;
97extern int sysctl_overcommit_ratio;
98extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700100extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700102extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103extern int pid_max;
104extern int min_free_kbytes;
Arve Hjønnevågcde89492009-02-17 14:51:02 -0800105extern int min_free_order_shift;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800107extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800108extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200109extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100110extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400111extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000112#ifndef CONFIG_MMU
113extern int sysctl_nr_trim_pages;
114#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200115#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200116extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200117#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700119/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400120#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700121static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200122static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700123#endif
124
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700125static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700126static int __maybe_unused one = 1;
127static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700128static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800129static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700130static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700131#ifdef CONFIG_PRINTK
132static int ten_thousand = 10000;
133#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700134
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700135/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
136static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
137
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
139static int maxolduid = 65535;
140static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800141static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142
143static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700144static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
Dave Youngd14f1722010-02-25 20:28:57 -0500146#ifdef CONFIG_INOTIFY_USER
147#include <linux/inotify.h>
148#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700149#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150#endif
151
David S. Miller08714202008-11-16 23:49:24 -0800152#ifdef CONFIG_SPARC64
153extern int sysctl_tsb_ratio;
154#endif
155
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#ifdef __hppa__
157extern int pwrsw_enabled;
158extern int unaligned_enabled;
159#endif
160
Jes Sorensend2b176e2006-02-28 09:42:23 -0800161#ifdef CONFIG_IA64
162extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800163extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800164#endif
165
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700166#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700167static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700168 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700169static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800170 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700171#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700172
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700173#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700174static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700175 void __user *buffer, size_t *lenp, loff_t *ppos);
176#endif
177
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700178#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800179/* Note: sysrq code uses it's own private copy */
180static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700181
182static int sysrq_sysctl_handler(ctl_table *table, int write,
183 void __user *buffer, size_t *lenp,
184 loff_t *ppos)
185{
186 int error;
187
188 error = proc_dointvec(table, write, buffer, lenp, ppos);
189 if (error)
190 return error;
191
192 if (write)
193 sysrq_toggle_support(__sysrq_enabled);
194
195 return 0;
196}
197
198#endif
199
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700200static struct ctl_table kern_table[];
201static struct ctl_table vm_table[];
202static struct ctl_table fs_table[];
203static struct ctl_table debug_table[];
204static struct ctl_table dev_table[];
205extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800206#ifdef CONFIG_EPOLL
207extern struct ctl_table epoll_table[];
208#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
211int sysctl_legacy_va_layout;
212#endif
213
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214/* The default sysctl tables: */
215
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800216static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218 .procname = "kernel",
219 .mode = 0555,
220 .child = kern_table,
221 },
222 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 .procname = "vm",
224 .mode = 0555,
225 .child = vm_table,
226 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228 .procname = "fs",
229 .mode = 0555,
230 .child = fs_table,
231 },
232 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 .procname = "debug",
234 .mode = 0555,
235 .child = debug_table,
236 },
237 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 .procname = "dev",
239 .mode = 0555,
240 .child = dev_table,
241 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700242 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243};
244
Ingo Molnar77e54a12007-07-09 18:52:00 +0200245#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100246static int min_sched_granularity_ns = 100000; /* 100 usecs */
247static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
248static int min_wakeup_granularity_ns; /* 0 usecs */
249static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100250static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
251static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200252#endif
253
Mel Gorman5e771902010-05-24 14:32:31 -0700254#ifdef CONFIG_COMPACTION
255static int min_extfrag_threshold;
256static int max_extfrag_threshold = 1000;
257#endif
258
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700259static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200260 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200261 .procname = "sched_child_runs_first",
262 .data = &sysctl_sched_child_runs_first,
263 .maxlen = sizeof(unsigned int),
264 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800265 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200266 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200267#ifdef CONFIG_SCHED_DEBUG
268 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100269 .procname = "sched_min_granularity_ns",
270 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200271 .maxlen = sizeof(unsigned int),
272 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800273 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100274 .extra1 = &min_sched_granularity_ns,
275 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200276 },
277 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200278 .procname = "sched_latency_ns",
279 .data = &sysctl_sched_latency,
280 .maxlen = sizeof(unsigned int),
281 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800282 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200283 .extra1 = &min_sched_granularity_ns,
284 .extra2 = &max_sched_granularity_ns,
285 },
286 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200287 .procname = "sched_wakeup_granularity_ns",
288 .data = &sysctl_sched_wakeup_granularity,
289 .maxlen = sizeof(unsigned int),
290 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800291 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200292 .extra1 = &min_wakeup_granularity_ns,
293 .extra2 = &max_wakeup_granularity_ns,
294 },
295 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100296 .procname = "sched_tunable_scaling",
297 .data = &sysctl_sched_tunable_scaling,
298 .maxlen = sizeof(enum sched_tunable_scaling),
299 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800300 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100301 .extra1 = &min_sched_tunable_scaling,
302 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200303 },
304 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200305 .procname = "sched_migration_cost",
306 .data = &sysctl_sched_migration_cost,
307 .maxlen = sizeof(unsigned int),
308 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800309 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200310 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100311 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100312 .procname = "sched_nr_migrate",
313 .data = &sysctl_sched_nr_migrate,
314 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100315 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800316 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100317 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530318 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200319 .procname = "sched_time_avg",
320 .data = &sysctl_sched_time_avg,
321 .maxlen = sizeof(unsigned int),
322 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800323 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200324 },
325 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800326 .procname = "sched_shares_window",
327 .data = &sysctl_sched_shares_window,
328 .maxlen = sizeof(unsigned int),
329 .mode = 0644,
330 .proc_handler = proc_dointvec,
331 },
332 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530333 .procname = "timer_migration",
334 .data = &sysctl_timer_migration,
335 .maxlen = sizeof(unsigned int),
336 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800337 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530338 .extra1 = &zero,
339 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530340 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200341#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200342 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100343 .procname = "sched_rt_period_us",
344 .data = &sysctl_sched_rt_period,
345 .maxlen = sizeof(unsigned int),
346 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800347 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100348 },
349 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100350 .procname = "sched_rt_runtime_us",
351 .data = &sysctl_sched_rt_runtime,
352 .maxlen = sizeof(int),
353 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800354 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100355 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100356#ifdef CONFIG_SCHED_AUTOGROUP
357 {
358 .procname = "sched_autogroup_enabled",
359 .data = &sysctl_sched_autogroup_enabled,
360 .maxlen = sizeof(unsigned int),
361 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800362 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100363 .extra1 = &zero,
364 .extra2 = &one,
365 },
366#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700367#ifdef CONFIG_CFS_BANDWIDTH
368 {
369 .procname = "sched_cfs_bandwidth_slice_us",
370 .data = &sysctl_sched_cfs_bandwidth_slice,
371 .maxlen = sizeof(unsigned int),
372 .mode = 0644,
373 .proc_handler = proc_dointvec_minmax,
374 .extra1 = &one,
375 },
376#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700377#ifdef CONFIG_PROVE_LOCKING
378 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700379 .procname = "prove_locking",
380 .data = &prove_locking,
381 .maxlen = sizeof(int),
382 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800383 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700384 },
385#endif
386#ifdef CONFIG_LOCK_STAT
387 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700388 .procname = "lock_stat",
389 .data = &lock_stat,
390 .maxlen = sizeof(int),
391 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800392 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700393 },
394#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200395 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 .procname = "panic",
397 .data = &panic_timeout,
398 .maxlen = sizeof(int),
399 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800400 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 },
402 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 .procname = "core_uses_pid",
404 .data = &core_uses_pid,
405 .maxlen = sizeof(int),
406 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800407 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 },
409 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410 .procname = "core_pattern",
411 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700412 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800414 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 },
Neil Hormana2939802009-09-23 15:56:56 -0700416 {
Neil Hormana2939802009-09-23 15:56:56 -0700417 .procname = "core_pipe_limit",
418 .data = &core_pipe_limit,
419 .maxlen = sizeof(unsigned int),
420 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800421 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700422 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800423#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700426 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800427 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800428 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800430#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100431#ifdef CONFIG_LATENCYTOP
432 {
433 .procname = "latencytop",
434 .data = &latencytop_enabled,
435 .maxlen = sizeof(int),
436 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800437 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100438 },
439#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440#ifdef CONFIG_BLK_DEV_INITRD
441 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 .procname = "real-root-dev",
443 .data = &real_root_dev,
444 .maxlen = sizeof(int),
445 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800446 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 },
448#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700449 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700450 .procname = "print-fatal-signals",
451 .data = &print_fatal_signals,
452 .maxlen = sizeof(int),
453 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800454 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700455 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700456#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 .procname = "reboot-cmd",
459 .data = reboot_command,
460 .maxlen = 256,
461 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800462 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 },
464 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465 .procname = "stop-a",
466 .data = &stop_a_enabled,
467 .maxlen = sizeof (int),
468 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800469 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 },
471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 .procname = "scons-poweroff",
473 .data = &scons_pwroff,
474 .maxlen = sizeof (int),
475 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800476 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 },
478#endif
David S. Miller08714202008-11-16 23:49:24 -0800479#ifdef CONFIG_SPARC64
480 {
David S. Miller08714202008-11-16 23:49:24 -0800481 .procname = "tsb-ratio",
482 .data = &sysctl_tsb_ratio,
483 .maxlen = sizeof (int),
484 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800485 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800486 },
487#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488#ifdef __hppa__
489 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 .procname = "soft-power",
491 .data = &pwrsw_enabled,
492 .maxlen = sizeof (int),
493 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800494 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 },
496 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700497 .procname = "unaligned-trap",
498 .data = &unaligned_enabled,
499 .maxlen = sizeof (int),
500 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800501 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 },
503#endif
504 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 .procname = "ctrl-alt-del",
506 .data = &C_A_D,
507 .maxlen = sizeof(int),
508 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800509 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400511#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200512 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200513 .procname = "ftrace_enabled",
514 .data = &ftrace_enabled,
515 .maxlen = sizeof(int),
516 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800517 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200518 },
519#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500520#ifdef CONFIG_STACK_TRACER
521 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500522 .procname = "stack_tracer_enabled",
523 .data = &stack_tracer_enabled,
524 .maxlen = sizeof(int),
525 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800526 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500527 },
528#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400529#ifdef CONFIG_TRACING
530 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100531 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400532 .data = &ftrace_dump_on_oops,
533 .maxlen = sizeof(int),
534 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800535 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400536 },
537#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200538#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 .procname = "modprobe",
541 .data = &modprobe_path,
542 .maxlen = KMOD_PATH_LEN,
543 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800544 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 },
Kees Cook3d433212009-04-02 15:49:29 -0700546 {
Kees Cook3d433212009-04-02 15:49:29 -0700547 .procname = "modules_disabled",
548 .data = &modules_disabled,
549 .maxlen = sizeof(int),
550 .mode = 0644,
551 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800552 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700553 .extra1 = &one,
554 .extra2 = &one,
555 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100557#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100560 .data = &uevent_helper,
561 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800563 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 },
565#endif
566#ifdef CONFIG_CHR_DEV_SG
567 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 .procname = "sg-big-buff",
569 .data = &sg_big_buff,
570 .maxlen = sizeof (int),
571 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800572 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573 },
574#endif
575#ifdef CONFIG_BSD_PROCESS_ACCT
576 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 .procname = "acct",
578 .data = &acct_parm,
579 .maxlen = 3*sizeof(int),
580 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800581 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582 },
583#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584#ifdef CONFIG_MAGIC_SYSRQ
585 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800587 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 .maxlen = sizeof (int),
589 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700590 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 },
592#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700593#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700596 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 .maxlen = sizeof (int),
598 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800599 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700601#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 .procname = "threads-max",
604 .data = &max_threads,
605 .maxlen = sizeof(int),
606 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800607 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 },
609 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 .procname = "random",
611 .mode = 0555,
612 .child = random_table,
613 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700614 {
Eric Paris17f60a72011-04-01 17:07:50 -0400615 .procname = "usermodehelper",
616 .mode = 0555,
617 .child = usermodehelper_table,
618 },
619 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620 .procname = "overflowuid",
621 .data = &overflowuid,
622 .maxlen = sizeof(int),
623 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800624 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625 .extra1 = &minolduid,
626 .extra2 = &maxolduid,
627 },
628 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .procname = "overflowgid",
630 .data = &overflowgid,
631 .maxlen = sizeof(int),
632 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800633 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634 .extra1 = &minolduid,
635 .extra2 = &maxolduid,
636 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800637#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638#ifdef CONFIG_MATHEMU
639 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700640 .procname = "ieee_emulation_warnings",
641 .data = &sysctl_ieee_emulation_warnings,
642 .maxlen = sizeof(int),
643 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800644 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 },
646#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200649 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 .maxlen = sizeof(int),
651 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800652 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 },
654#endif
655 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 .procname = "pid_max",
657 .data = &pid_max,
658 .maxlen = sizeof (int),
659 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800660 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 .extra1 = &pid_max_min,
662 .extra2 = &pid_max_max,
663 },
664 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 .procname = "panic_on_oops",
666 .data = &panic_on_oops,
667 .maxlen = sizeof(int),
668 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800669 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700670 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800671#if defined CONFIG_PRINTK
672 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800673 .procname = "printk",
674 .data = &console_loglevel,
675 .maxlen = 4*sizeof(int),
676 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800677 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800678 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700681 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682 .maxlen = sizeof(int),
683 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800684 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 },
686 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700688 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700689 .maxlen = sizeof(int),
690 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800691 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 },
Dave Youngaf913222009-09-22 16:43:33 -0700693 {
Dave Youngaf913222009-09-22 16:43:33 -0700694 .procname = "printk_delay",
695 .data = &printk_delay_msec,
696 .maxlen = sizeof(int),
697 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800698 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700699 .extra1 = &zero,
700 .extra2 = &ten_thousand,
701 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800703 .procname = "dmesg_restrict",
704 .data = &dmesg_restrict,
705 .maxlen = sizeof(int),
706 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700707 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800708 .extra1 = &zero,
709 .extra2 = &one,
710 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800711 {
712 .procname = "kptr_restrict",
713 .data = &kptr_restrict,
714 .maxlen = sizeof(int),
715 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700716 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800717 .extra1 = &zero,
718 .extra2 = &two,
719 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800720#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800721 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 .procname = "ngroups_max",
723 .data = &ngroups_max,
724 .maxlen = sizeof (int),
725 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800726 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 },
Dan Ballard73efc032011-10-31 17:11:20 -0700728 {
729 .procname = "cap_last_cap",
730 .data = (void *)&cap_last_cap,
731 .maxlen = sizeof(int),
732 .mode = 0444,
733 .proc_handler = proc_dointvec,
734 },
Don Zickus58687ac2010-05-07 17:11:44 -0400735#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500736 {
Don Zickus58687ac2010-05-07 17:11:44 -0400737 .procname = "watchdog",
738 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500739 .maxlen = sizeof (int),
740 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700741 .proc_handler = proc_dowatchdog,
742 .extra1 = &zero,
743 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400744 },
745 {
746 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700747 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400748 .maxlen = sizeof(int),
749 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700750 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400751 .extra1 = &neg_one,
752 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500753 },
Don Zickus2508ce12010-05-07 17:11:46 -0400754 {
755 .procname = "softlockup_panic",
756 .data = &softlockup_panic,
757 .maxlen = sizeof(int),
758 .mode = 0644,
759 .proc_handler = proc_dointvec_minmax,
760 .extra1 = &zero,
761 .extra2 = &one,
762 },
Don Zickus5dc30552010-11-29 17:07:17 -0500763 {
764 .procname = "nmi_watchdog",
765 .data = &watchdog_enabled,
766 .maxlen = sizeof (int),
767 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700768 .proc_handler = proc_dowatchdog,
769 .extra1 = &zero,
770 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500771 },
772#endif
773#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
774 {
775 .procname = "unknown_nmi_panic",
776 .data = &unknown_nmi_panic,
777 .maxlen = sizeof (int),
778 .mode = 0644,
779 .proc_handler = proc_dointvec,
780 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500781#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782#if defined(CONFIG_X86)
783 {
Don Zickus8da5add2006-09-26 10:52:27 +0200784 .procname = "panic_on_unrecovered_nmi",
785 .data = &panic_on_unrecovered_nmi,
786 .maxlen = sizeof(int),
787 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800788 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200789 },
790 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700791 .procname = "panic_on_io_nmi",
792 .data = &panic_on_io_nmi,
793 .maxlen = sizeof(int),
794 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800795 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700796 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900797#ifdef CONFIG_DEBUG_STACKOVERFLOW
798 {
799 .procname = "panic_on_stackoverflow",
800 .data = &sysctl_panic_on_stackoverflow,
801 .maxlen = sizeof(int),
802 .mode = 0644,
803 .proc_handler = proc_dointvec,
804 },
805#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700806 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 .procname = "bootloader_type",
808 .data = &bootloader_type,
809 .maxlen = sizeof (int),
810 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800811 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100813 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700814 .procname = "bootloader_version",
815 .data = &bootloader_version,
816 .maxlen = sizeof (int),
817 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800818 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700819 },
820 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100821 .procname = "kstack_depth_to_print",
822 .data = &kstack_depth_to_print,
823 .maxlen = sizeof(int),
824 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800825 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100826 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100827 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100828 .procname = "io_delay_type",
829 .data = &io_delay_type,
830 .maxlen = sizeof(int),
831 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800832 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100833 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800835#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837 .procname = "randomize_va_space",
838 .data = &randomize_va_space,
839 .maxlen = sizeof(int),
840 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800841 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800843#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800844#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700845 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700846 .procname = "spin_retry",
847 .data = &spin_retry,
848 .maxlen = sizeof (int),
849 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800850 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700851 },
852#endif
Len Brown673d5b42007-07-28 03:33:16 -0400853#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800854 {
Pavel Machekc255d842006-02-20 18:27:58 -0800855 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700856 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800857 .maxlen = sizeof (unsigned long),
858 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800859 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800860 },
861#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800862#ifdef CONFIG_IA64
863 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800864 .procname = "ignore-unaligned-usertrap",
865 .data = &no_unaligned_warning,
866 .maxlen = sizeof (int),
867 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800868 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800869 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800870 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800871 .procname = "unaligned-dump-stack",
872 .data = &unaligned_dump_stack,
873 .maxlen = sizeof (int),
874 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800875 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800876 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800877#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800878#ifdef CONFIG_DETECT_HUNG_TASK
879 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800880 .procname = "hung_task_panic",
881 .data = &sysctl_hung_task_panic,
882 .maxlen = sizeof(int),
883 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800884 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800885 .extra1 = &zero,
886 .extra2 = &one,
887 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100888 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100889 .procname = "hung_task_check_count",
890 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100891 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100892 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800893 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100894 },
895 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100896 .procname = "hung_task_timeout_secs",
897 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100898 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100899 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800900 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 },
902 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100903 .procname = "hung_task_warnings",
904 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100905 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100906 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800907 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100908 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700909#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200910#ifdef CONFIG_COMPAT
911 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200912 .procname = "compat-log",
913 .data = &compat_log,
914 .maxlen = sizeof (int),
915 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800916 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200917 },
918#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700919#ifdef CONFIG_RT_MUTEXES
920 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700921 .procname = "max_lock_depth",
922 .data = &max_lock_depth,
923 .maxlen = sizeof(int),
924 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800925 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700926 },
927#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700928 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700929 .procname = "poweroff_cmd",
930 .data = &poweroff_cmd,
931 .maxlen = POWEROFF_CMD_PATH_LEN,
932 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800933 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700934 },
David Howells0b77f5b2008-04-29 01:01:32 -0700935#ifdef CONFIG_KEYS
936 {
David Howells0b77f5b2008-04-29 01:01:32 -0700937 .procname = "keys",
938 .mode = 0555,
939 .child = key_sysctls,
940 },
941#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700942#ifdef CONFIG_RCU_TORTURE_TEST
943 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700944 .procname = "rcutorture_runnable",
945 .data = &rcutorture_runnable,
946 .maxlen = sizeof(int),
947 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800948 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700949 },
950#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200951#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400952 /*
953 * User-space scripts rely on the existence of this file
954 * as a feature check for perf_events being enabled.
955 *
956 * So it's an ABI, do not remove!
957 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200958 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200959 .procname = "perf_event_paranoid",
960 .data = &sysctl_perf_event_paranoid,
961 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200962 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800963 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200964 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200965 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200966 .procname = "perf_event_mlock_kb",
967 .data = &sysctl_perf_event_mlock,
968 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200969 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800970 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200971 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200972 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200973 .procname = "perf_event_max_sample_rate",
974 .data = &sysctl_perf_event_sample_rate,
975 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200976 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100977 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200978 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200979#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200980#ifdef CONFIG_KMEMCHECK
981 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200982 .procname = "kmemcheck",
983 .data = &kmemcheck_enabled,
984 .maxlen = sizeof(int),
985 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800986 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200987 },
988#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200989#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200990 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200991 .procname = "blk_iopoll",
992 .data = &blk_iopoll_enabled,
993 .maxlen = sizeof(int),
994 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800995 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +0200996 },
Jens Axboecb684b52009-09-15 21:53:11 +0200997#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700998 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700999};
1000
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001001static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001003 .procname = "overcommit_memory",
1004 .data = &sysctl_overcommit_memory,
1005 .maxlen = sizeof(sysctl_overcommit_memory),
1006 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001007 .proc_handler = proc_dointvec_minmax,
1008 .extra1 = &zero,
1009 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001010 },
1011 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001012 .procname = "panic_on_oom",
1013 .data = &sysctl_panic_on_oom,
1014 .maxlen = sizeof(sysctl_panic_on_oom),
1015 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001016 .proc_handler = proc_dointvec_minmax,
1017 .extra1 = &zero,
1018 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001019 },
1020 {
David Rientjesfe071d72007-10-16 23:25:56 -07001021 .procname = "oom_kill_allocating_task",
1022 .data = &sysctl_oom_kill_allocating_task,
1023 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1024 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001025 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001026 },
1027 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001028 .procname = "oom_dump_tasks",
1029 .data = &sysctl_oom_dump_tasks,
1030 .maxlen = sizeof(sysctl_oom_dump_tasks),
1031 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001032 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001033 },
1034 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001035 .procname = "overcommit_ratio",
1036 .data = &sysctl_overcommit_ratio,
1037 .maxlen = sizeof(sysctl_overcommit_ratio),
1038 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001039 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040 },
1041 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001042 .procname = "page-cluster",
1043 .data = &page_cluster,
1044 .maxlen = sizeof(int),
1045 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001046 .proc_handler = proc_dointvec_minmax,
1047 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001048 },
1049 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001050 .procname = "dirty_background_ratio",
1051 .data = &dirty_background_ratio,
1052 .maxlen = sizeof(dirty_background_ratio),
1053 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001054 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001055 .extra1 = &zero,
1056 .extra2 = &one_hundred,
1057 },
1058 {
David Rientjes2da02992009-01-06 14:39:31 -08001059 .procname = "dirty_background_bytes",
1060 .data = &dirty_background_bytes,
1061 .maxlen = sizeof(dirty_background_bytes),
1062 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001063 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001064 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001065 },
1066 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001067 .procname = "dirty_ratio",
1068 .data = &vm_dirty_ratio,
1069 .maxlen = sizeof(vm_dirty_ratio),
1070 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001071 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072 .extra1 = &zero,
1073 .extra2 = &one_hundred,
1074 },
1075 {
David Rientjes2da02992009-01-06 14:39:31 -08001076 .procname = "dirty_bytes",
1077 .data = &vm_dirty_bytes,
1078 .maxlen = sizeof(vm_dirty_bytes),
1079 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001080 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001081 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001082 },
1083 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001084 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001085 .data = &dirty_writeback_interval,
1086 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001087 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001088 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001089 },
1090 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001091 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001092 .data = &dirty_expire_interval,
1093 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001094 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001095 .proc_handler = proc_dointvec_minmax,
1096 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001097 },
1098 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099 .procname = "nr_pdflush_threads",
1100 .data = &nr_pdflush_threads,
1101 .maxlen = sizeof nr_pdflush_threads,
1102 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001103 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104 },
1105 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001106 .procname = "swappiness",
1107 .data = &vm_swappiness,
1108 .maxlen = sizeof(vm_swappiness),
1109 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001110 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 .extra1 = &zero,
1112 .extra2 = &one_hundred,
1113 },
1114#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001115 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001117 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118 .maxlen = sizeof(unsigned long),
1119 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001120 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .extra1 = (void *)&hugetlb_zero,
1122 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001123 },
1124#ifdef CONFIG_NUMA
1125 {
1126 .procname = "nr_hugepages_mempolicy",
1127 .data = NULL,
1128 .maxlen = sizeof(unsigned long),
1129 .mode = 0644,
1130 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1131 .extra1 = (void *)&hugetlb_zero,
1132 .extra2 = (void *)&hugetlb_infinity,
1133 },
1134#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001135 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001136 .procname = "hugetlb_shm_group",
1137 .data = &sysctl_hugetlb_shm_group,
1138 .maxlen = sizeof(gid_t),
1139 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001140 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001141 },
Mel Gorman396faf02007-07-17 04:03:13 -07001142 {
Mel Gorman396faf02007-07-17 04:03:13 -07001143 .procname = "hugepages_treat_as_movable",
1144 .data = &hugepages_treat_as_movable,
1145 .maxlen = sizeof(int),
1146 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001147 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001148 },
Adam Litke54f9f802007-10-16 01:26:20 -07001149 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001150 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001151 .data = NULL,
1152 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001153 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001154 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001155 .extra1 = (void *)&hugetlb_zero,
1156 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001157 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001158#endif
1159 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001160 .procname = "lowmem_reserve_ratio",
1161 .data = &sysctl_lowmem_reserve_ratio,
1162 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1163 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001164 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165 },
1166 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001167 .procname = "drop_caches",
1168 .data = &sysctl_drop_caches,
1169 .maxlen = sizeof(int),
1170 .mode = 0644,
1171 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001172 .extra1 = &one,
1173 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001174 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001175#ifdef CONFIG_COMPACTION
1176 {
1177 .procname = "compact_memory",
1178 .data = &sysctl_compact_memory,
1179 .maxlen = sizeof(int),
1180 .mode = 0200,
1181 .proc_handler = sysctl_compaction_handler,
1182 },
Mel Gorman5e771902010-05-24 14:32:31 -07001183 {
1184 .procname = "extfrag_threshold",
1185 .data = &sysctl_extfrag_threshold,
1186 .maxlen = sizeof(int),
1187 .mode = 0644,
1188 .proc_handler = sysctl_extfrag_handler,
1189 .extra1 = &min_extfrag_threshold,
1190 .extra2 = &max_extfrag_threshold,
1191 },
1192
Mel Gorman76ab0f52010-05-24 14:32:28 -07001193#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001194 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001195 .procname = "min_free_kbytes",
1196 .data = &min_free_kbytes,
1197 .maxlen = sizeof(min_free_kbytes),
1198 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001199 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001200 .extra1 = &zero,
1201 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001202 {
Arve Hjønnevågcde89492009-02-17 14:51:02 -08001203 .procname = "min_free_order_shift",
1204 .data = &min_free_order_shift,
1205 .maxlen = sizeof(min_free_order_shift),
1206 .mode = 0644,
1207 .proc_handler = &proc_dointvec
1208 },
1209 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001210 .procname = "percpu_pagelist_fraction",
1211 .data = &percpu_pagelist_fraction,
1212 .maxlen = sizeof(percpu_pagelist_fraction),
1213 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001214 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001215 .extra1 = &min_percpu_pagelist_fract,
1216 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001217#ifdef CONFIG_MMU
1218 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001219 .procname = "max_map_count",
1220 .data = &sysctl_max_map_count,
1221 .maxlen = sizeof(sysctl_max_map_count),
1222 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001223 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001224 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001225 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001226#else
1227 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001228 .procname = "nr_trim_pages",
1229 .data = &sysctl_nr_trim_pages,
1230 .maxlen = sizeof(sysctl_nr_trim_pages),
1231 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001232 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001233 .extra1 = &zero,
1234 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001235#endif
1236 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001237 .procname = "laptop_mode",
1238 .data = &laptop_mode,
1239 .maxlen = sizeof(laptop_mode),
1240 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001241 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001242 },
1243 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001244 .procname = "block_dump",
1245 .data = &block_dump,
1246 .maxlen = sizeof(block_dump),
1247 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001248 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001249 .extra1 = &zero,
1250 },
1251 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001252 .procname = "vfs_cache_pressure",
1253 .data = &sysctl_vfs_cache_pressure,
1254 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1255 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001256 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001257 .extra1 = &zero,
1258 },
1259#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1260 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001261 .procname = "legacy_va_layout",
1262 .data = &sysctl_legacy_va_layout,
1263 .maxlen = sizeof(sysctl_legacy_va_layout),
1264 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001265 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001266 .extra1 = &zero,
1267 },
1268#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001269#ifdef CONFIG_NUMA
1270 {
Christoph Lameter17436602006-01-18 17:42:32 -08001271 .procname = "zone_reclaim_mode",
1272 .data = &zone_reclaim_mode,
1273 .maxlen = sizeof(zone_reclaim_mode),
1274 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001275 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001276 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001277 },
Christoph Lameter96146342006-07-03 00:24:13 -07001278 {
Christoph Lameter96146342006-07-03 00:24:13 -07001279 .procname = "min_unmapped_ratio",
1280 .data = &sysctl_min_unmapped_ratio,
1281 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1282 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001283 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001284 .extra1 = &zero,
1285 .extra2 = &one_hundred,
1286 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001287 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001288 .procname = "min_slab_ratio",
1289 .data = &sysctl_min_slab_ratio,
1290 .maxlen = sizeof(sysctl_min_slab_ratio),
1291 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001292 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001293 .extra1 = &zero,
1294 .extra2 = &one_hundred,
1295 },
Christoph Lameter17436602006-01-18 17:42:32 -08001296#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001297#ifdef CONFIG_SMP
1298 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001299 .procname = "stat_interval",
1300 .data = &sysctl_stat_interval,
1301 .maxlen = sizeof(sysctl_stat_interval),
1302 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001303 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001304 },
1305#endif
David Howells6e141542009-12-15 19:27:45 +00001306#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001307 {
Eric Parised032182007-06-28 15:55:21 -04001308 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001309 .data = &dac_mmap_min_addr,
1310 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001311 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001312 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001313 },
David Howells6e141542009-12-15 19:27:45 +00001314#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001315#ifdef CONFIG_NUMA
1316 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001317 .procname = "numa_zonelist_order",
1318 .data = &numa_zonelist_order,
1319 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1320 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001321 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001322 },
1323#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001324#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001325 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001326 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001327 .procname = "vdso_enabled",
1328 .data = &vdso_enabled,
1329 .maxlen = sizeof(vdso_enabled),
1330 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001331 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001332 .extra1 = &zero,
1333 },
1334#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001335#ifdef CONFIG_HIGHMEM
1336 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001337 .procname = "highmem_is_dirtyable",
1338 .data = &vm_highmem_is_dirtyable,
1339 .maxlen = sizeof(vm_highmem_is_dirtyable),
1340 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001341 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001342 .extra1 = &zero,
1343 .extra2 = &one,
1344 },
1345#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001346 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001347 .procname = "scan_unevictable_pages",
1348 .data = &scan_unevictable_pages,
1349 .maxlen = sizeof(scan_unevictable_pages),
1350 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001351 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001352 },
Andi Kleen6a460792009-09-16 11:50:15 +02001353#ifdef CONFIG_MEMORY_FAILURE
1354 {
Andi Kleen6a460792009-09-16 11:50:15 +02001355 .procname = "memory_failure_early_kill",
1356 .data = &sysctl_memory_failure_early_kill,
1357 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1358 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001359 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001360 .extra1 = &zero,
1361 .extra2 = &one,
1362 },
1363 {
Andi Kleen6a460792009-09-16 11:50:15 +02001364 .procname = "memory_failure_recovery",
1365 .data = &sysctl_memory_failure_recovery,
1366 .maxlen = sizeof(sysctl_memory_failure_recovery),
1367 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001368 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001369 .extra1 = &zero,
1370 .extra2 = &one,
1371 },
1372#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001373 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001374};
1375
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001376#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001377static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001378 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001379};
1380#endif
1381
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001382static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001383 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001384 .procname = "inode-nr",
1385 .data = &inodes_stat,
1386 .maxlen = 2*sizeof(int),
1387 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001388 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001389 },
1390 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001391 .procname = "inode-state",
1392 .data = &inodes_stat,
1393 .maxlen = 7*sizeof(int),
1394 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001395 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001396 },
1397 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001398 .procname = "file-nr",
1399 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001400 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001401 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001402 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001403 },
1404 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001405 .procname = "file-max",
1406 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001407 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001408 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001409 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001410 },
1411 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001412 .procname = "nr_open",
1413 .data = &sysctl_nr_open,
1414 .maxlen = sizeof(int),
1415 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001416 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001417 .extra1 = &sysctl_nr_open_min,
1418 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001419 },
1420 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001421 .procname = "dentry-state",
1422 .data = &dentry_stat,
1423 .maxlen = 6*sizeof(int),
1424 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001425 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426 },
1427 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001428 .procname = "overflowuid",
1429 .data = &fs_overflowuid,
1430 .maxlen = sizeof(int),
1431 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001432 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433 .extra1 = &minolduid,
1434 .extra2 = &maxolduid,
1435 },
1436 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001437 .procname = "overflowgid",
1438 .data = &fs_overflowgid,
1439 .maxlen = sizeof(int),
1440 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001441 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001442 .extra1 = &minolduid,
1443 .extra2 = &maxolduid,
1444 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001445#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001446 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001447 .procname = "leases-enable",
1448 .data = &leases_enable,
1449 .maxlen = sizeof(int),
1450 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001451 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001453#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001454#ifdef CONFIG_DNOTIFY
1455 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001456 .procname = "dir-notify-enable",
1457 .data = &dir_notify_enable,
1458 .maxlen = sizeof(int),
1459 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001460 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001461 },
1462#endif
1463#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001464#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001465 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001466 .procname = "lease-break-time",
1467 .data = &lease_break_time,
1468 .maxlen = sizeof(int),
1469 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001470 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001471 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001472#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001473#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001475 .procname = "aio-nr",
1476 .data = &aio_nr,
1477 .maxlen = sizeof(aio_nr),
1478 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001479 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001480 },
1481 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001482 .procname = "aio-max-nr",
1483 .data = &aio_max_nr,
1484 .maxlen = sizeof(aio_max_nr),
1485 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001486 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001487 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001488#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001489#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001490 {
Robert Love0399cb02005-07-13 12:38:18 -04001491 .procname = "inotify",
1492 .mode = 0555,
1493 .child = inotify_table,
1494 },
1495#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001496#ifdef CONFIG_EPOLL
1497 {
1498 .procname = "epoll",
1499 .mode = 0555,
1500 .child = epoll_table,
1501 },
1502#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001503#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001504 {
Alan Coxd6e71142005-06-23 00:09:43 -07001505 .procname = "suid_dumpable",
1506 .data = &suid_dumpable,
1507 .maxlen = sizeof(int),
1508 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001509 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001510 .extra1 = &zero,
1511 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001512 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001513#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1514 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001515 .procname = "binfmt_misc",
1516 .mode = 0555,
1517 .child = binfmt_misc_table,
1518 },
1519#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001520 {
Jens Axboeff9da692010-06-03 14:54:39 +02001521 .procname = "pipe-max-size",
1522 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001523 .maxlen = sizeof(int),
1524 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001525 .proc_handler = &pipe_proc_fn,
1526 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001527 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001528 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001529};
1530
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001531static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001532#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001533 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001534 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001535 .procname = "exception-trace",
1536 .data = &show_unhandled_signals,
1537 .maxlen = sizeof(int),
1538 .mode = 0644,
1539 .proc_handler = proc_dointvec
1540 },
1541#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001542#if defined(CONFIG_OPTPROBES)
1543 {
1544 .procname = "kprobes-optimization",
1545 .data = &sysctl_kprobes_optimization,
1546 .maxlen = sizeof(int),
1547 .mode = 0644,
1548 .proc_handler = proc_kprobes_optimization_handler,
1549 .extra1 = &zero,
1550 .extra2 = &one,
1551 },
1552#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001553 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001554};
1555
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001556static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001557 { }
Robert Love0eeca282005-07-12 17:06:03 -04001558};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001559
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001560int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001561{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001562 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001563 return 0;
1564}
1565
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001566#endif /* CONFIG_SYSCTL */
1567
Linus Torvalds1da177e2005-04-16 15:20:36 -07001568/*
1569 * /proc/sys support
1570 */
1571
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001572#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001573
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001574static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001575 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001576 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001577{
1578 size_t len;
1579 char __user *p;
1580 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001581
1582 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001583 *lenp = 0;
1584 return 0;
1585 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001586
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001587 if (write) {
1588 len = 0;
1589 p = buffer;
1590 while (len < *lenp) {
1591 if (get_user(c, p++))
1592 return -EFAULT;
1593 if (c == 0 || c == '\n')
1594 break;
1595 len++;
1596 }
1597 if (len >= maxlen)
1598 len = maxlen-1;
1599 if(copy_from_user(data, buffer, len))
1600 return -EFAULT;
1601 ((char *) data)[len] = 0;
1602 *ppos += *lenp;
1603 } else {
1604 len = strlen(data);
1605 if (len > maxlen)
1606 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001607
1608 if (*ppos > len) {
1609 *lenp = 0;
1610 return 0;
1611 }
1612
1613 data += *ppos;
1614 len -= *ppos;
1615
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001616 if (len > *lenp)
1617 len = *lenp;
1618 if (len)
1619 if(copy_to_user(buffer, data, len))
1620 return -EFAULT;
1621 if (len < *lenp) {
1622 if(put_user('\n', ((char __user *) buffer) + len))
1623 return -EFAULT;
1624 len++;
1625 }
1626 *lenp = len;
1627 *ppos += len;
1628 }
1629 return 0;
1630}
1631
Linus Torvalds1da177e2005-04-16 15:20:36 -07001632/**
1633 * proc_dostring - read a string sysctl
1634 * @table: the sysctl table
1635 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001636 * @buffer: the user buffer
1637 * @lenp: the size of the user buffer
1638 * @ppos: file position
1639 *
1640 * Reads/writes a string from/to the user buffer. If the kernel
1641 * buffer provided is not large enough to hold the string, the
1642 * string is truncated. The copied string is %NULL-terminated.
1643 * If the string is being read by the user process, it is copied
1644 * and a newline '\n' is added. It is truncated if the buffer is
1645 * not large enough.
1646 *
1647 * Returns 0 on success.
1648 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001649int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001650 void __user *buffer, size_t *lenp, loff_t *ppos)
1651{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001652 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001653 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001654}
1655
Amerigo Wang00b7c332010-05-05 00:26:45 +00001656static size_t proc_skip_spaces(char **buf)
1657{
1658 size_t ret;
1659 char *tmp = skip_spaces(*buf);
1660 ret = tmp - *buf;
1661 *buf = tmp;
1662 return ret;
1663}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001664
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001665static void proc_skip_char(char **buf, size_t *size, const char v)
1666{
1667 while (*size) {
1668 if (**buf != v)
1669 break;
1670 (*size)--;
1671 (*buf)++;
1672 }
1673}
1674
Amerigo Wang00b7c332010-05-05 00:26:45 +00001675#define TMPBUFLEN 22
1676/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001677 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001678 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001679 * @buf: a kernel buffer
1680 * @size: size of the kernel buffer
1681 * @val: this is where the number will be stored
1682 * @neg: set to %TRUE if number is negative
1683 * @perm_tr: a vector which contains the allowed trailers
1684 * @perm_tr_len: size of the perm_tr vector
1685 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001686 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001687 * In case of success %0 is returned and @buf and @size are updated with
1688 * the amount of bytes read. If @tr is non-NULL and a trailing
1689 * character exists (size is non-zero after returning from this
1690 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001691 */
1692static int proc_get_long(char **buf, size_t *size,
1693 unsigned long *val, bool *neg,
1694 const char *perm_tr, unsigned perm_tr_len, char *tr)
1695{
1696 int len;
1697 char *p, tmp[TMPBUFLEN];
1698
1699 if (!*size)
1700 return -EINVAL;
1701
1702 len = *size;
1703 if (len > TMPBUFLEN - 1)
1704 len = TMPBUFLEN - 1;
1705
1706 memcpy(tmp, *buf, len);
1707
1708 tmp[len] = 0;
1709 p = tmp;
1710 if (*p == '-' && *size > 1) {
1711 *neg = true;
1712 p++;
1713 } else
1714 *neg = false;
1715 if (!isdigit(*p))
1716 return -EINVAL;
1717
1718 *val = simple_strtoul(p, &p, 0);
1719
1720 len = p - tmp;
1721
1722 /* We don't know if the next char is whitespace thus we may accept
1723 * invalid integers (e.g. 1234...a) or two integers instead of one
1724 * (e.g. 123...1). So lets not allow such large numbers. */
1725 if (len == TMPBUFLEN - 1)
1726 return -EINVAL;
1727
1728 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1729 return -EINVAL;
1730
1731 if (tr && (len < *size))
1732 *tr = *p;
1733
1734 *buf += len;
1735 *size -= len;
1736
1737 return 0;
1738}
1739
1740/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001741 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001742 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001743 * @buf: the user buffer
1744 * @size: the size of the user buffer
1745 * @val: the integer to be converted
1746 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001747 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001748 * In case of success %0 is returned and @buf and @size are updated with
1749 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001750 */
1751static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1752 bool neg)
1753{
1754 int len;
1755 char tmp[TMPBUFLEN], *p = tmp;
1756
1757 sprintf(p, "%s%lu", neg ? "-" : "", val);
1758 len = strlen(tmp);
1759 if (len > *size)
1760 len = *size;
1761 if (copy_to_user(*buf, tmp, len))
1762 return -EFAULT;
1763 *size -= len;
1764 *buf += len;
1765 return 0;
1766}
1767#undef TMPBUFLEN
1768
1769static int proc_put_char(void __user **buf, size_t *size, char c)
1770{
1771 if (*size) {
1772 char __user **buffer = (char __user **)buf;
1773 if (put_user(c, *buffer))
1774 return -EFAULT;
1775 (*size)--, (*buffer)++;
1776 *buf = *buffer;
1777 }
1778 return 0;
1779}
1780
1781static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001782 int *valp,
1783 int write, void *data)
1784{
1785 if (write) {
1786 *valp = *negp ? -*lvalp : *lvalp;
1787 } else {
1788 int val = *valp;
1789 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001790 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001791 *lvalp = (unsigned long)-val;
1792 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001793 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001794 *lvalp = (unsigned long)val;
1795 }
1796 }
1797 return 0;
1798}
1799
Amerigo Wang00b7c332010-05-05 00:26:45 +00001800static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1801
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001802static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001803 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001804 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001805 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001806 int write, void *data),
1807 void *data)
1808{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001809 int *i, vleft, first = 1, err = 0;
1810 unsigned long page = 0;
1811 size_t left;
1812 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001813
Amerigo Wang00b7c332010-05-05 00:26:45 +00001814 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001815 *lenp = 0;
1816 return 0;
1817 }
1818
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001819 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001820 vleft = table->maxlen / sizeof(*i);
1821 left = *lenp;
1822
1823 if (!conv)
1824 conv = do_proc_dointvec_conv;
1825
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001827 if (left > PAGE_SIZE - 1)
1828 left = PAGE_SIZE - 1;
1829 page = __get_free_page(GFP_TEMPORARY);
1830 kbuf = (char *) page;
1831 if (!kbuf)
1832 return -ENOMEM;
1833 if (copy_from_user(kbuf, buffer, left)) {
1834 err = -EFAULT;
1835 goto free;
1836 }
1837 kbuf[left] = 0;
1838 }
1839
1840 for (; left && vleft--; i++, first=0) {
1841 unsigned long lval;
1842 bool neg;
1843
1844 if (write) {
1845 left -= proc_skip_spaces(&kbuf);
1846
J. R. Okajima563b0462010-05-25 16:10:14 -07001847 if (!left)
1848 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001849 err = proc_get_long(&kbuf, &left, &lval, &neg,
1850 proc_wspace_sep,
1851 sizeof(proc_wspace_sep), NULL);
1852 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001853 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001854 if (conv(&neg, &lval, i, 1, data)) {
1855 err = -EINVAL;
1856 break;
1857 }
1858 } else {
1859 if (conv(&neg, &lval, i, 0, data)) {
1860 err = -EINVAL;
1861 break;
1862 }
1863 if (!first)
1864 err = proc_put_char(&buffer, &left, '\t');
1865 if (err)
1866 break;
1867 err = proc_put_long(&buffer, &left, lval, neg);
1868 if (err)
1869 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001870 }
1871 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001872
1873 if (!write && !first && left && !err)
1874 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001875 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001876 left -= proc_skip_spaces(&kbuf);
1877free:
1878 if (write) {
1879 free_page(page);
1880 if (first)
1881 return err ? : -EINVAL;
1882 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001883 *lenp -= left;
1884 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001885 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001886}
1887
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001888static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001889 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001890 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001891 int write, void *data),
1892 void *data)
1893{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001894 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001895 buffer, lenp, ppos, conv, data);
1896}
1897
Linus Torvalds1da177e2005-04-16 15:20:36 -07001898/**
1899 * proc_dointvec - read a vector of integers
1900 * @table: the sysctl table
1901 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001902 * @buffer: the user buffer
1903 * @lenp: the size of the user buffer
1904 * @ppos: file position
1905 *
1906 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1907 * values from/to the user buffer, treated as an ASCII string.
1908 *
1909 * Returns 0 on success.
1910 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001911int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001912 void __user *buffer, size_t *lenp, loff_t *ppos)
1913{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001914 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001915 NULL,NULL);
1916}
1917
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001918/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001919 * Taint values can only be increased
1920 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001921 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001922static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001923 void __user *buffer, size_t *lenp, loff_t *ppos)
1924{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001925 struct ctl_table t;
1926 unsigned long tmptaint = get_taint();
1927 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001928
Bastian Blank91fcd412007-04-23 14:41:14 -07001929 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001930 return -EPERM;
1931
Andi Kleen25ddbb12008-10-15 22:01:41 -07001932 t = *table;
1933 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001934 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001935 if (err < 0)
1936 return err;
1937
1938 if (write) {
1939 /*
1940 * Poor man's atomic or. Not worth adding a primitive
1941 * to everyone's atomic.h for this
1942 */
1943 int i;
1944 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1945 if ((tmptaint >> i) & 1)
1946 add_taint(i);
1947 }
1948 }
1949
1950 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001951}
1952
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001953#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001954static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001955 void __user *buffer, size_t *lenp, loff_t *ppos)
1956{
1957 if (write && !capable(CAP_SYS_ADMIN))
1958 return -EPERM;
1959
1960 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1961}
1962#endif
1963
Linus Torvalds1da177e2005-04-16 15:20:36 -07001964struct do_proc_dointvec_minmax_conv_param {
1965 int *min;
1966 int *max;
1967};
1968
Amerigo Wang00b7c332010-05-05 00:26:45 +00001969static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1970 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001971 int write, void *data)
1972{
1973 struct do_proc_dointvec_minmax_conv_param *param = data;
1974 if (write) {
1975 int val = *negp ? -*lvalp : *lvalp;
1976 if ((param->min && *param->min > val) ||
1977 (param->max && *param->max < val))
1978 return -EINVAL;
1979 *valp = val;
1980 } else {
1981 int val = *valp;
1982 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001983 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001984 *lvalp = (unsigned long)-val;
1985 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001986 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001987 *lvalp = (unsigned long)val;
1988 }
1989 }
1990 return 0;
1991}
1992
1993/**
1994 * proc_dointvec_minmax - read a vector of integers with min/max values
1995 * @table: the sysctl table
1996 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001997 * @buffer: the user buffer
1998 * @lenp: the size of the user buffer
1999 * @ppos: file position
2000 *
2001 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2002 * values from/to the user buffer, treated as an ASCII string.
2003 *
2004 * This routine will ensure the values are within the range specified by
2005 * table->extra1 (min) and table->extra2 (max).
2006 *
2007 * Returns 0 on success.
2008 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002009int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002010 void __user *buffer, size_t *lenp, loff_t *ppos)
2011{
2012 struct do_proc_dointvec_minmax_conv_param param = {
2013 .min = (int *) table->extra1,
2014 .max = (int *) table->extra2,
2015 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002016 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002017 do_proc_dointvec_minmax_conv, &param);
2018}
2019
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002020static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002021 void __user *buffer,
2022 size_t *lenp, loff_t *ppos,
2023 unsigned long convmul,
2024 unsigned long convdiv)
2025{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002026 unsigned long *i, *min, *max;
2027 int vleft, first = 1, err = 0;
2028 unsigned long page = 0;
2029 size_t left;
2030 char *kbuf;
2031
2032 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002033 *lenp = 0;
2034 return 0;
2035 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002036
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002037 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002038 min = (unsigned long *) table->extra1;
2039 max = (unsigned long *) table->extra2;
2040 vleft = table->maxlen / sizeof(unsigned long);
2041 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002042
2043 if (write) {
2044 if (left > PAGE_SIZE - 1)
2045 left = PAGE_SIZE - 1;
2046 page = __get_free_page(GFP_TEMPORARY);
2047 kbuf = (char *) page;
2048 if (!kbuf)
2049 return -ENOMEM;
2050 if (copy_from_user(kbuf, buffer, left)) {
2051 err = -EFAULT;
2052 goto free;
2053 }
2054 kbuf[left] = 0;
2055 }
2056
Eric Dumazet27b3d802010-10-07 12:59:29 -07002057 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002058 unsigned long val;
2059
Linus Torvalds1da177e2005-04-16 15:20:36 -07002060 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002061 bool neg;
2062
2063 left -= proc_skip_spaces(&kbuf);
2064
2065 err = proc_get_long(&kbuf, &left, &val, &neg,
2066 proc_wspace_sep,
2067 sizeof(proc_wspace_sep), NULL);
2068 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002069 break;
2070 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002071 continue;
2072 if ((min && val < *min) || (max && val > *max))
2073 continue;
2074 *i = val;
2075 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002076 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002077 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002078 err = proc_put_char(&buffer, &left, '\t');
2079 err = proc_put_long(&buffer, &left, val, false);
2080 if (err)
2081 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082 }
2083 }
2084
Amerigo Wang00b7c332010-05-05 00:26:45 +00002085 if (!write && !first && left && !err)
2086 err = proc_put_char(&buffer, &left, '\n');
2087 if (write && !err)
2088 left -= proc_skip_spaces(&kbuf);
2089free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002090 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002091 free_page(page);
2092 if (first)
2093 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002094 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002095 *lenp -= left;
2096 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002097 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002098}
2099
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002100static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002101 void __user *buffer,
2102 size_t *lenp, loff_t *ppos,
2103 unsigned long convmul,
2104 unsigned long convdiv)
2105{
2106 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002107 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002108}
2109
Linus Torvalds1da177e2005-04-16 15:20:36 -07002110/**
2111 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2112 * @table: the sysctl table
2113 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002114 * @buffer: the user buffer
2115 * @lenp: the size of the user buffer
2116 * @ppos: file position
2117 *
2118 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2119 * values from/to the user buffer, treated as an ASCII string.
2120 *
2121 * This routine will ensure the values are within the range specified by
2122 * table->extra1 (min) and table->extra2 (max).
2123 *
2124 * Returns 0 on success.
2125 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002126int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002127 void __user *buffer, size_t *lenp, loff_t *ppos)
2128{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002129 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002130}
2131
2132/**
2133 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2134 * @table: the sysctl table
2135 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002136 * @buffer: the user buffer
2137 * @lenp: the size of the user buffer
2138 * @ppos: file position
2139 *
2140 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2141 * values from/to the user buffer, treated as an ASCII string. The values
2142 * are treated as milliseconds, and converted to jiffies when they are stored.
2143 *
2144 * This routine will ensure the values are within the range specified by
2145 * table->extra1 (min) and table->extra2 (max).
2146 *
2147 * Returns 0 on success.
2148 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002149int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002150 void __user *buffer,
2151 size_t *lenp, loff_t *ppos)
2152{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002153 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002154 lenp, ppos, HZ, 1000l);
2155}
2156
2157
Amerigo Wang00b7c332010-05-05 00:26:45 +00002158static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002159 int *valp,
2160 int write, void *data)
2161{
2162 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002163 if (*lvalp > LONG_MAX / HZ)
2164 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002165 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2166 } else {
2167 int val = *valp;
2168 unsigned long lval;
2169 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002170 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002171 lval = (unsigned long)-val;
2172 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002173 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002174 lval = (unsigned long)val;
2175 }
2176 *lvalp = lval / HZ;
2177 }
2178 return 0;
2179}
2180
Amerigo Wang00b7c332010-05-05 00:26:45 +00002181static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002182 int *valp,
2183 int write, void *data)
2184{
2185 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002186 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2187 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002188 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2189 } else {
2190 int val = *valp;
2191 unsigned long lval;
2192 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002193 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002194 lval = (unsigned long)-val;
2195 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002196 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002197 lval = (unsigned long)val;
2198 }
2199 *lvalp = jiffies_to_clock_t(lval);
2200 }
2201 return 0;
2202}
2203
Amerigo Wang00b7c332010-05-05 00:26:45 +00002204static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002205 int *valp,
2206 int write, void *data)
2207{
2208 if (write) {
2209 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2210 } else {
2211 int val = *valp;
2212 unsigned long lval;
2213 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002214 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002215 lval = (unsigned long)-val;
2216 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002217 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002218 lval = (unsigned long)val;
2219 }
2220 *lvalp = jiffies_to_msecs(lval);
2221 }
2222 return 0;
2223}
2224
2225/**
2226 * proc_dointvec_jiffies - read a vector of integers as seconds
2227 * @table: the sysctl table
2228 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002229 * @buffer: the user buffer
2230 * @lenp: the size of the user buffer
2231 * @ppos: file position
2232 *
2233 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2234 * values from/to the user buffer, treated as an ASCII string.
2235 * The values read are assumed to be in seconds, and are converted into
2236 * jiffies.
2237 *
2238 * Returns 0 on success.
2239 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002240int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002241 void __user *buffer, size_t *lenp, loff_t *ppos)
2242{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002243 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002244 do_proc_dointvec_jiffies_conv,NULL);
2245}
2246
2247/**
2248 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2249 * @table: the sysctl table
2250 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002251 * @buffer: the user buffer
2252 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002253 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254 *
2255 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2256 * values from/to the user buffer, treated as an ASCII string.
2257 * The values read are assumed to be in 1/USER_HZ seconds, and
2258 * are converted into jiffies.
2259 *
2260 * Returns 0 on success.
2261 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002262int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002263 void __user *buffer, size_t *lenp, loff_t *ppos)
2264{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002265 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002266 do_proc_dointvec_userhz_jiffies_conv,NULL);
2267}
2268
2269/**
2270 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2271 * @table: the sysctl table
2272 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002273 * @buffer: the user buffer
2274 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002275 * @ppos: file position
2276 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002277 *
2278 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2279 * values from/to the user buffer, treated as an ASCII string.
2280 * The values read are assumed to be in 1/1000 seconds, and
2281 * are converted into jiffies.
2282 *
2283 * Returns 0 on success.
2284 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002285int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002286 void __user *buffer, size_t *lenp, loff_t *ppos)
2287{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002288 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002289 do_proc_dointvec_ms_jiffies_conv, NULL);
2290}
2291
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002292static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002293 void __user *buffer, size_t *lenp, loff_t *ppos)
2294{
2295 struct pid *new_pid;
2296 pid_t tmp;
2297 int r;
2298
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002299 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002300
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002301 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002302 lenp, ppos, NULL, NULL);
2303 if (r || !write)
2304 return r;
2305
2306 new_pid = find_get_pid(tmp);
2307 if (!new_pid)
2308 return -ESRCH;
2309
2310 put_pid(xchg(&cad_pid, new_pid));
2311 return 0;
2312}
2313
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002314/**
2315 * proc_do_large_bitmap - read/write from/to a large bitmap
2316 * @table: the sysctl table
2317 * @write: %TRUE if this is a write to the sysctl file
2318 * @buffer: the user buffer
2319 * @lenp: the size of the user buffer
2320 * @ppos: file position
2321 *
2322 * The bitmap is stored at table->data and the bitmap length (in bits)
2323 * in table->maxlen.
2324 *
2325 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2326 * large bitmaps may be represented in a compact manner. Writing into
2327 * the file will clear the bitmap then update it with the given input.
2328 *
2329 * Returns 0 on success.
2330 */
2331int proc_do_large_bitmap(struct ctl_table *table, int write,
2332 void __user *buffer, size_t *lenp, loff_t *ppos)
2333{
2334 int err = 0;
2335 bool first = 1;
2336 size_t left = *lenp;
2337 unsigned long bitmap_len = table->maxlen;
2338 unsigned long *bitmap = (unsigned long *) table->data;
2339 unsigned long *tmp_bitmap = NULL;
2340 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2341
2342 if (!bitmap_len || !left || (*ppos && !write)) {
2343 *lenp = 0;
2344 return 0;
2345 }
2346
2347 if (write) {
2348 unsigned long page = 0;
2349 char *kbuf;
2350
2351 if (left > PAGE_SIZE - 1)
2352 left = PAGE_SIZE - 1;
2353
2354 page = __get_free_page(GFP_TEMPORARY);
2355 kbuf = (char *) page;
2356 if (!kbuf)
2357 return -ENOMEM;
2358 if (copy_from_user(kbuf, buffer, left)) {
2359 free_page(page);
2360 return -EFAULT;
2361 }
2362 kbuf[left] = 0;
2363
2364 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2365 GFP_KERNEL);
2366 if (!tmp_bitmap) {
2367 free_page(page);
2368 return -ENOMEM;
2369 }
2370 proc_skip_char(&kbuf, &left, '\n');
2371 while (!err && left) {
2372 unsigned long val_a, val_b;
2373 bool neg;
2374
2375 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2376 sizeof(tr_a), &c);
2377 if (err)
2378 break;
2379 if (val_a >= bitmap_len || neg) {
2380 err = -EINVAL;
2381 break;
2382 }
2383
2384 val_b = val_a;
2385 if (left) {
2386 kbuf++;
2387 left--;
2388 }
2389
2390 if (c == '-') {
2391 err = proc_get_long(&kbuf, &left, &val_b,
2392 &neg, tr_b, sizeof(tr_b),
2393 &c);
2394 if (err)
2395 break;
2396 if (val_b >= bitmap_len || neg ||
2397 val_a > val_b) {
2398 err = -EINVAL;
2399 break;
2400 }
2401 if (left) {
2402 kbuf++;
2403 left--;
2404 }
2405 }
2406
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002407 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002408 first = 0;
2409 proc_skip_char(&kbuf, &left, '\n');
2410 }
2411 free_page(page);
2412 } else {
2413 unsigned long bit_a, bit_b = 0;
2414
2415 while (left) {
2416 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2417 if (bit_a >= bitmap_len)
2418 break;
2419 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2420 bit_a + 1) - 1;
2421
2422 if (!first) {
2423 err = proc_put_char(&buffer, &left, ',');
2424 if (err)
2425 break;
2426 }
2427 err = proc_put_long(&buffer, &left, bit_a, false);
2428 if (err)
2429 break;
2430 if (bit_a != bit_b) {
2431 err = proc_put_char(&buffer, &left, '-');
2432 if (err)
2433 break;
2434 err = proc_put_long(&buffer, &left, bit_b, false);
2435 if (err)
2436 break;
2437 }
2438
2439 first = 0; bit_b++;
2440 }
2441 if (!err)
2442 err = proc_put_char(&buffer, &left, '\n');
2443 }
2444
2445 if (!err) {
2446 if (write) {
2447 if (*ppos)
2448 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2449 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002450 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002451 }
2452 kfree(tmp_bitmap);
2453 *lenp -= left;
2454 *ppos += *lenp;
2455 return 0;
2456 } else {
2457 kfree(tmp_bitmap);
2458 return err;
2459 }
2460}
2461
Jovi Zhang55610502011-01-12 17:00:45 -08002462#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002463
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002464int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002465 void __user *buffer, size_t *lenp, loff_t *ppos)
2466{
2467 return -ENOSYS;
2468}
2469
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002470int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002471 void __user *buffer, size_t *lenp, loff_t *ppos)
2472{
2473 return -ENOSYS;
2474}
2475
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002476int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002477 void __user *buffer, size_t *lenp, loff_t *ppos)
2478{
2479 return -ENOSYS;
2480}
2481
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002482int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002483 void __user *buffer, size_t *lenp, loff_t *ppos)
2484{
2485 return -ENOSYS;
2486}
2487
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002488int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002489 void __user *buffer, size_t *lenp, loff_t *ppos)
2490{
2491 return -ENOSYS;
2492}
2493
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002494int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002495 void __user *buffer, size_t *lenp, loff_t *ppos)
2496{
2497 return -ENOSYS;
2498}
2499
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002500int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002501 void __user *buffer, size_t *lenp, loff_t *ppos)
2502{
2503 return -ENOSYS;
2504}
2505
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002506int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002507 void __user *buffer,
2508 size_t *lenp, loff_t *ppos)
2509{
2510 return -ENOSYS;
2511}
2512
2513
Jovi Zhang55610502011-01-12 17:00:45 -08002514#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002515
Linus Torvalds1da177e2005-04-16 15:20:36 -07002516/*
2517 * No sense putting this after each symbol definition, twice,
2518 * exception granted :-)
2519 */
2520EXPORT_SYMBOL(proc_dointvec);
2521EXPORT_SYMBOL(proc_dointvec_jiffies);
2522EXPORT_SYMBOL(proc_dointvec_minmax);
2523EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2524EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2525EXPORT_SYMBOL(proc_dostring);
2526EXPORT_SYMBOL(proc_doulongvec_minmax);
2527EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);