blob: 5d9a1d2b27b419167caa9b3784fad2fd79a99907 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070033#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/init.h>
35#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010036#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030037#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/sysrq.h>
39#include <linux/highuid.h>
40#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020041#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070042#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070045#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/times.h>
47#include <linux/limits.h>
48#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020049#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070051#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080052#include <linux/nfs_fs.h>
53#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070054#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020055#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020056#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050057#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020058#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070059#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040060#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070061#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000062#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#include <asm/uaccess.h>
65#include <asm/processor.h>
66
Andi Kleen29cbc782006-09-30 01:47:55 +020067#ifdef CONFIG_X86
68#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010069#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010070#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020071#endif
David Howellsd550bbd2012-03-28 18:30:03 +010072#ifdef CONFIG_SPARC
73#include <asm/setup.h>
74#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080075#ifdef CONFIG_BSD_PROCESS_ACCT
76#include <linux/acct.h>
77#endif
Dave Young4f0e0562010-03-10 15:24:09 -080078#ifdef CONFIG_RT_MUTEXES
79#include <linux/rtmutex.h>
80#endif
Dave Young2edf5e42010-03-10 15:24:10 -080081#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
82#include <linux/lockdep.h>
83#endif
Dave Young15485a42010-03-10 15:24:07 -080084#ifdef CONFIG_CHR_DEV_SG
85#include <scsi/sg.h>
86#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020087
Don Zickus58687ac2010-05-07 17:11:44 -040088#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050089#include <linux/nmi.h>
90#endif
91
Eric W. Biederman7058cb02007-10-18 03:05:58 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#if defined(CONFIG_SYSCTL)
94
95/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int sysctl_overcommit_memory;
97extern int sysctl_overcommit_ratio;
98extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700100extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700102extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103extern int pid_max;
104extern int min_free_kbytes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800106extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800107extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200108extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100109extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400110extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000111#ifndef CONFIG_MMU
112extern int sysctl_nr_trim_pages;
113#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200114#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200115extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200116#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700118/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400119#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700120static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200121static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700122#endif
123
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700125static int __maybe_unused one = 1;
126static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700127static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800128static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700129static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700130#ifdef CONFIG_PRINTK
131static int ten_thousand = 10000;
132#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700133
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700134/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
135static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
138static int maxolduid = 65535;
139static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800140static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141
142static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700143static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144
Dave Youngd14f1722010-02-25 20:28:57 -0500145#ifdef CONFIG_INOTIFY_USER
146#include <linux/inotify.h>
147#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700148#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149#endif
150
David S. Miller08714202008-11-16 23:49:24 -0800151#ifdef CONFIG_SPARC64
152extern int sysctl_tsb_ratio;
153#endif
154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#ifdef __hppa__
156extern int pwrsw_enabled;
157extern int unaligned_enabled;
158#endif
159
Jes Sorensend2b176e2006-02-28 09:42:23 -0800160#ifdef CONFIG_IA64
161extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800162extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800163#endif
164
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700165#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700166static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700167 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700168static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800169 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700170#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700171
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700172#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700173static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700174 void __user *buffer, size_t *lenp, loff_t *ppos);
175#endif
176
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700177#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800178/* Note: sysrq code uses it's own private copy */
179static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700180
181static int sysrq_sysctl_handler(ctl_table *table, int write,
182 void __user *buffer, size_t *lenp,
183 loff_t *ppos)
184{
185 int error;
186
187 error = proc_dointvec(table, write, buffer, lenp, ppos);
188 if (error)
189 return error;
190
191 if (write)
192 sysrq_toggle_support(__sysrq_enabled);
193
194 return 0;
195}
196
197#endif
198
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700199static struct ctl_table kern_table[];
200static struct ctl_table vm_table[];
201static struct ctl_table fs_table[];
202static struct ctl_table debug_table[];
203static struct ctl_table dev_table[];
204extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800205#ifdef CONFIG_EPOLL
206extern struct ctl_table epoll_table[];
207#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
209#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
210int sysctl_legacy_va_layout;
211#endif
212
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213/* The default sysctl tables: */
214
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800215static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217 .procname = "kernel",
218 .mode = 0555,
219 .child = kern_table,
220 },
221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 .procname = "vm",
223 .mode = 0555,
224 .child = vm_table,
225 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227 .procname = "fs",
228 .mode = 0555,
229 .child = fs_table,
230 },
231 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 .procname = "debug",
233 .mode = 0555,
234 .child = debug_table,
235 },
236 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 .procname = "dev",
238 .mode = 0555,
239 .child = dev_table,
240 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700241 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242};
243
Ingo Molnar77e54a12007-07-09 18:52:00 +0200244#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100245static int min_sched_granularity_ns = 100000; /* 100 usecs */
246static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
247static int min_wakeup_granularity_ns; /* 0 usecs */
248static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100249static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
250static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200251#endif
252
Mel Gorman5e771902010-05-24 14:32:31 -0700253#ifdef CONFIG_COMPACTION
254static int min_extfrag_threshold;
255static int max_extfrag_threshold = 1000;
256#endif
257
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700258static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200259 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200260 .procname = "sched_child_runs_first",
261 .data = &sysctl_sched_child_runs_first,
262 .maxlen = sizeof(unsigned int),
263 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800264 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200265 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200266#ifdef CONFIG_SCHED_DEBUG
267 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100268 .procname = "sched_min_granularity_ns",
269 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200270 .maxlen = sizeof(unsigned int),
271 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800272 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100273 .extra1 = &min_sched_granularity_ns,
274 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200275 },
276 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200277 .procname = "sched_latency_ns",
278 .data = &sysctl_sched_latency,
279 .maxlen = sizeof(unsigned int),
280 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800281 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200282 .extra1 = &min_sched_granularity_ns,
283 .extra2 = &max_sched_granularity_ns,
284 },
285 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200286 .procname = "sched_wakeup_granularity_ns",
287 .data = &sysctl_sched_wakeup_granularity,
288 .maxlen = sizeof(unsigned int),
289 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800290 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200291 .extra1 = &min_wakeup_granularity_ns,
292 .extra2 = &max_wakeup_granularity_ns,
293 },
294 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100295 .procname = "sched_tunable_scaling",
296 .data = &sysctl_sched_tunable_scaling,
297 .maxlen = sizeof(enum sched_tunable_scaling),
298 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800299 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100300 .extra1 = &min_sched_tunable_scaling,
301 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200302 },
303 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200304 .procname = "sched_migration_cost",
305 .data = &sysctl_sched_migration_cost,
306 .maxlen = sizeof(unsigned int),
307 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800308 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200309 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100310 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100311 .procname = "sched_nr_migrate",
312 .data = &sysctl_sched_nr_migrate,
313 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100314 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800315 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100316 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530317 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200318 .procname = "sched_time_avg",
319 .data = &sysctl_sched_time_avg,
320 .maxlen = sizeof(unsigned int),
321 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800322 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200323 },
324 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800325 .procname = "sched_shares_window",
326 .data = &sysctl_sched_shares_window,
327 .maxlen = sizeof(unsigned int),
328 .mode = 0644,
329 .proc_handler = proc_dointvec,
330 },
331 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530332 .procname = "timer_migration",
333 .data = &sysctl_timer_migration,
334 .maxlen = sizeof(unsigned int),
335 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800336 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530337 .extra1 = &zero,
338 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530339 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200340#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200341 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100342 .procname = "sched_rt_period_us",
343 .data = &sysctl_sched_rt_period,
344 .maxlen = sizeof(unsigned int),
345 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800346 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100347 },
348 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100349 .procname = "sched_rt_runtime_us",
350 .data = &sysctl_sched_rt_runtime,
351 .maxlen = sizeof(int),
352 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800353 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100354 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100355#ifdef CONFIG_SCHED_AUTOGROUP
356 {
357 .procname = "sched_autogroup_enabled",
358 .data = &sysctl_sched_autogroup_enabled,
359 .maxlen = sizeof(unsigned int),
360 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800361 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100362 .extra1 = &zero,
363 .extra2 = &one,
364 },
365#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700366#ifdef CONFIG_CFS_BANDWIDTH
367 {
368 .procname = "sched_cfs_bandwidth_slice_us",
369 .data = &sysctl_sched_cfs_bandwidth_slice,
370 .maxlen = sizeof(unsigned int),
371 .mode = 0644,
372 .proc_handler = proc_dointvec_minmax,
373 .extra1 = &one,
374 },
375#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700376#ifdef CONFIG_PROVE_LOCKING
377 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700378 .procname = "prove_locking",
379 .data = &prove_locking,
380 .maxlen = sizeof(int),
381 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800382 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700383 },
384#endif
385#ifdef CONFIG_LOCK_STAT
386 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700387 .procname = "lock_stat",
388 .data = &lock_stat,
389 .maxlen = sizeof(int),
390 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800391 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700392 },
393#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200394 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395 .procname = "panic",
396 .data = &panic_timeout,
397 .maxlen = sizeof(int),
398 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800399 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700400 },
401 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 .procname = "core_uses_pid",
403 .data = &core_uses_pid,
404 .maxlen = sizeof(int),
405 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800406 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700407 },
408 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 .procname = "core_pattern",
410 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700411 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800413 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 },
Neil Hormana2939802009-09-23 15:56:56 -0700415 {
Neil Hormana2939802009-09-23 15:56:56 -0700416 .procname = "core_pipe_limit",
417 .data = &core_pipe_limit,
418 .maxlen = sizeof(unsigned int),
419 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800420 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700421 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800422#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700425 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800426 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800427 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800429#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100430#ifdef CONFIG_LATENCYTOP
431 {
432 .procname = "latencytop",
433 .data = &latencytop_enabled,
434 .maxlen = sizeof(int),
435 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800436 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100437 },
438#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439#ifdef CONFIG_BLK_DEV_INITRD
440 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 .procname = "real-root-dev",
442 .data = &real_root_dev,
443 .maxlen = sizeof(int),
444 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800445 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 },
447#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700448 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700449 .procname = "print-fatal-signals",
450 .data = &print_fatal_signals,
451 .maxlen = sizeof(int),
452 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800453 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700454 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700455#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 .procname = "reboot-cmd",
458 .data = reboot_command,
459 .maxlen = 256,
460 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800461 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 },
463 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 .procname = "stop-a",
465 .data = &stop_a_enabled,
466 .maxlen = sizeof (int),
467 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800468 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 },
470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 .procname = "scons-poweroff",
472 .data = &scons_pwroff,
473 .maxlen = sizeof (int),
474 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800475 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 },
477#endif
David S. Miller08714202008-11-16 23:49:24 -0800478#ifdef CONFIG_SPARC64
479 {
David S. Miller08714202008-11-16 23:49:24 -0800480 .procname = "tsb-ratio",
481 .data = &sysctl_tsb_ratio,
482 .maxlen = sizeof (int),
483 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800484 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800485 },
486#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487#ifdef __hppa__
488 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489 .procname = "soft-power",
490 .data = &pwrsw_enabled,
491 .maxlen = sizeof (int),
492 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800493 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 },
495 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 .procname = "unaligned-trap",
497 .data = &unaligned_enabled,
498 .maxlen = sizeof (int),
499 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800500 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 },
502#endif
503 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700504 .procname = "ctrl-alt-del",
505 .data = &C_A_D,
506 .maxlen = sizeof(int),
507 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800508 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400510#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200511 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200512 .procname = "ftrace_enabled",
513 .data = &ftrace_enabled,
514 .maxlen = sizeof(int),
515 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800516 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200517 },
518#endif
Steven Rostedtf38f1d2a2008-12-16 23:06:40 -0500519#ifdef CONFIG_STACK_TRACER
520 {
Steven Rostedtf38f1d2a2008-12-16 23:06:40 -0500521 .procname = "stack_tracer_enabled",
522 .data = &stack_tracer_enabled,
523 .maxlen = sizeof(int),
524 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800525 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d2a2008-12-16 23:06:40 -0500526 },
527#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400528#ifdef CONFIG_TRACING
529 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100530 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400531 .data = &ftrace_dump_on_oops,
532 .maxlen = sizeof(int),
533 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800534 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400535 },
536#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200537#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 .procname = "modprobe",
540 .data = &modprobe_path,
541 .maxlen = KMOD_PATH_LEN,
542 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800543 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 },
Kees Cook3d433212009-04-02 15:49:29 -0700545 {
Kees Cook3d433212009-04-02 15:49:29 -0700546 .procname = "modules_disabled",
547 .data = &modules_disabled,
548 .maxlen = sizeof(int),
549 .mode = 0644,
550 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800551 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700552 .extra1 = &one,
553 .extra2 = &one,
554 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100556#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100559 .data = &uevent_helper,
560 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800562 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 },
564#endif
565#ifdef CONFIG_CHR_DEV_SG
566 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 .procname = "sg-big-buff",
568 .data = &sg_big_buff,
569 .maxlen = sizeof (int),
570 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800571 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 },
573#endif
574#ifdef CONFIG_BSD_PROCESS_ACCT
575 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576 .procname = "acct",
577 .data = &acct_parm,
578 .maxlen = 3*sizeof(int),
579 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800580 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 },
582#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583#ifdef CONFIG_MAGIC_SYSRQ
584 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800586 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 .maxlen = sizeof (int),
588 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700589 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 },
591#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700592#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700595 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596 .maxlen = sizeof (int),
597 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800598 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700600#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 .procname = "threads-max",
603 .data = &max_threads,
604 .maxlen = sizeof(int),
605 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800606 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 },
608 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609 .procname = "random",
610 .mode = 0555,
611 .child = random_table,
612 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 {
Eric Paris17f60a72011-04-01 17:07:50 -0400614 .procname = "usermodehelper",
615 .mode = 0555,
616 .child = usermodehelper_table,
617 },
618 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700619 .procname = "overflowuid",
620 .data = &overflowuid,
621 .maxlen = sizeof(int),
622 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800623 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 .extra1 = &minolduid,
625 .extra2 = &maxolduid,
626 },
627 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 .procname = "overflowgid",
629 .data = &overflowgid,
630 .maxlen = sizeof(int),
631 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800632 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .extra1 = &minolduid,
634 .extra2 = &maxolduid,
635 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800636#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637#ifdef CONFIG_MATHEMU
638 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 .procname = "ieee_emulation_warnings",
640 .data = &sysctl_ieee_emulation_warnings,
641 .maxlen = sizeof(int),
642 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800643 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644 },
645#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200648 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 .maxlen = sizeof(int),
650 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800651 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652 },
653#endif
654 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700655 .procname = "pid_max",
656 .data = &pid_max,
657 .maxlen = sizeof (int),
658 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800659 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 .extra1 = &pid_max_min,
661 .extra2 = &pid_max_max,
662 },
663 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 .procname = "panic_on_oops",
665 .data = &panic_on_oops,
666 .maxlen = sizeof(int),
667 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800668 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800670#if defined CONFIG_PRINTK
671 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800672 .procname = "printk",
673 .data = &console_loglevel,
674 .maxlen = 4*sizeof(int),
675 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800676 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800677 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700680 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 .maxlen = sizeof(int),
682 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800683 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 },
685 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700687 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688 .maxlen = sizeof(int),
689 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800690 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 },
Dave Youngaf913222009-09-22 16:43:33 -0700692 {
Dave Youngaf913222009-09-22 16:43:33 -0700693 .procname = "printk_delay",
694 .data = &printk_delay_msec,
695 .maxlen = sizeof(int),
696 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800697 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700698 .extra1 = &zero,
699 .extra2 = &ten_thousand,
700 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800702 .procname = "dmesg_restrict",
703 .data = &dmesg_restrict,
704 .maxlen = sizeof(int),
705 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700706 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800707 .extra1 = &zero,
708 .extra2 = &one,
709 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800710 {
711 .procname = "kptr_restrict",
712 .data = &kptr_restrict,
713 .maxlen = sizeof(int),
714 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700715 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800716 .extra1 = &zero,
717 .extra2 = &two,
718 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800719#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800720 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 .procname = "ngroups_max",
722 .data = &ngroups_max,
723 .maxlen = sizeof (int),
724 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800725 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726 },
Dan Ballard73efc032011-10-31 17:11:20 -0700727 {
728 .procname = "cap_last_cap",
729 .data = (void *)&cap_last_cap,
730 .maxlen = sizeof(int),
731 .mode = 0444,
732 .proc_handler = proc_dointvec,
733 },
Don Zickus58687ac2010-05-07 17:11:44 -0400734#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500735 {
Don Zickus58687ac2010-05-07 17:11:44 -0400736 .procname = "watchdog",
737 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500738 .maxlen = sizeof (int),
739 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700740 .proc_handler = proc_dowatchdog,
741 .extra1 = &zero,
742 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400743 },
744 {
745 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700746 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400747 .maxlen = sizeof(int),
748 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700749 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400750 .extra1 = &neg_one,
751 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500752 },
Don Zickus2508ce12010-05-07 17:11:46 -0400753 {
754 .procname = "softlockup_panic",
755 .data = &softlockup_panic,
756 .maxlen = sizeof(int),
757 .mode = 0644,
758 .proc_handler = proc_dointvec_minmax,
759 .extra1 = &zero,
760 .extra2 = &one,
761 },
Don Zickus5dc30552010-11-29 17:07:17 -0500762 {
763 .procname = "nmi_watchdog",
764 .data = &watchdog_enabled,
765 .maxlen = sizeof (int),
766 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700767 .proc_handler = proc_dowatchdog,
768 .extra1 = &zero,
769 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500770 },
771#endif
772#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
773 {
774 .procname = "unknown_nmi_panic",
775 .data = &unknown_nmi_panic,
776 .maxlen = sizeof (int),
777 .mode = 0644,
778 .proc_handler = proc_dointvec,
779 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500780#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781#if defined(CONFIG_X86)
782 {
Don Zickus8da5add2006-09-26 10:52:27 +0200783 .procname = "panic_on_unrecovered_nmi",
784 .data = &panic_on_unrecovered_nmi,
785 .maxlen = sizeof(int),
786 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800787 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200788 },
789 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700790 .procname = "panic_on_io_nmi",
791 .data = &panic_on_io_nmi,
792 .maxlen = sizeof(int),
793 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800794 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700795 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900796#ifdef CONFIG_DEBUG_STACKOVERFLOW
797 {
798 .procname = "panic_on_stackoverflow",
799 .data = &sysctl_panic_on_stackoverflow,
800 .maxlen = sizeof(int),
801 .mode = 0644,
802 .proc_handler = proc_dointvec,
803 },
804#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700805 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 .procname = "bootloader_type",
807 .data = &bootloader_type,
808 .maxlen = sizeof (int),
809 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800810 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100812 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700813 .procname = "bootloader_version",
814 .data = &bootloader_version,
815 .maxlen = sizeof (int),
816 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800817 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700818 },
819 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100820 .procname = "kstack_depth_to_print",
821 .data = &kstack_depth_to_print,
822 .maxlen = sizeof(int),
823 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800824 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100825 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100826 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100827 .procname = "io_delay_type",
828 .data = &io_delay_type,
829 .maxlen = sizeof(int),
830 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800831 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100832 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800834#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 .procname = "randomize_va_space",
837 .data = &randomize_va_space,
838 .maxlen = sizeof(int),
839 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800840 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800842#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800843#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700844 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700845 .procname = "spin_retry",
846 .data = &spin_retry,
847 .maxlen = sizeof (int),
848 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800849 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700850 },
851#endif
Len Brown673d5b42007-07-28 03:33:16 -0400852#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800853 {
Pavel Machekc255d842006-02-20 18:27:58 -0800854 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700855 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800856 .maxlen = sizeof (unsigned long),
857 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800858 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800859 },
860#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800861#ifdef CONFIG_IA64
862 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800863 .procname = "ignore-unaligned-usertrap",
864 .data = &no_unaligned_warning,
865 .maxlen = sizeof (int),
866 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800867 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800868 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800869 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800870 .procname = "unaligned-dump-stack",
871 .data = &unaligned_dump_stack,
872 .maxlen = sizeof (int),
873 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800874 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800875 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800876#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800877#ifdef CONFIG_DETECT_HUNG_TASK
878 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800879 .procname = "hung_task_panic",
880 .data = &sysctl_hung_task_panic,
881 .maxlen = sizeof(int),
882 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800883 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800884 .extra1 = &zero,
885 .extra2 = &one,
886 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100887 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100888 .procname = "hung_task_check_count",
889 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100890 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100891 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800892 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100893 },
894 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100895 .procname = "hung_task_timeout_secs",
896 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100897 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100898 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800899 .proc_handler = proc_dohung_task_timeout_secs,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100900 },
901 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100902 .procname = "hung_task_warnings",
903 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100904 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100905 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800906 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100907 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700908#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200909#ifdef CONFIG_COMPAT
910 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200911 .procname = "compat-log",
912 .data = &compat_log,
913 .maxlen = sizeof (int),
914 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800915 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200916 },
917#endif
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700918#ifdef CONFIG_RT_MUTEXES
919 {
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700920 .procname = "max_lock_depth",
921 .data = &max_lock_depth,
922 .maxlen = sizeof(int),
923 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800924 .proc_handler = proc_dointvec,
Ingo Molnar23f78d4a2006-06-27 02:54:53 -0700925 },
926#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700927 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700928 .procname = "poweroff_cmd",
929 .data = &poweroff_cmd,
930 .maxlen = POWEROFF_CMD_PATH_LEN,
931 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800932 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700933 },
David Howells0b77f5b2008-04-29 01:01:32 -0700934#ifdef CONFIG_KEYS
935 {
David Howells0b77f5b2008-04-29 01:01:32 -0700936 .procname = "keys",
937 .mode = 0555,
938 .child = key_sysctls,
939 },
940#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700941#ifdef CONFIG_RCU_TORTURE_TEST
942 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700943 .procname = "rcutorture_runnable",
944 .data = &rcutorture_runnable,
945 .maxlen = sizeof(int),
946 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800947 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700948 },
949#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200950#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400951 /*
952 * User-space scripts rely on the existence of this file
953 * as a feature check for perf_events being enabled.
954 *
955 * So it's an ABI, do not remove!
956 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200957 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200958 .procname = "perf_event_paranoid",
959 .data = &sysctl_perf_event_paranoid,
960 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200961 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800962 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200963 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200964 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200965 .procname = "perf_event_mlock_kb",
966 .data = &sysctl_perf_event_mlock,
967 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200968 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800969 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200970 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200971 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200972 .procname = "perf_event_max_sample_rate",
973 .data = &sysctl_perf_event_sample_rate,
974 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200975 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100976 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200977 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200978#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200979#ifdef CONFIG_KMEMCHECK
980 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200981 .procname = "kmemcheck",
982 .data = &kmemcheck_enabled,
983 .maxlen = sizeof(int),
984 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800985 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +0200986 },
987#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200988#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200989 {
Jens Axboe5e605b62009-08-05 09:07:21 +0200990 .procname = "blk_iopoll",
991 .data = &blk_iopoll_enabled,
992 .maxlen = sizeof(int),
993 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800994 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +0200995 },
Jens Axboecb684b52009-09-15 21:53:11 +0200996#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700997 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700998};
999
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001000static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001001 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002 .procname = "overcommit_memory",
1003 .data = &sysctl_overcommit_memory,
1004 .maxlen = sizeof(sysctl_overcommit_memory),
1005 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001006 .proc_handler = proc_dointvec_minmax,
1007 .extra1 = &zero,
1008 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001009 },
1010 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001011 .procname = "panic_on_oom",
1012 .data = &sysctl_panic_on_oom,
1013 .maxlen = sizeof(sysctl_panic_on_oom),
1014 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001015 .proc_handler = proc_dointvec_minmax,
1016 .extra1 = &zero,
1017 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001018 },
1019 {
David Rientjesfe071d72007-10-16 23:25:56 -07001020 .procname = "oom_kill_allocating_task",
1021 .data = &sysctl_oom_kill_allocating_task,
1022 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1023 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001024 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001025 },
1026 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001027 .procname = "oom_dump_tasks",
1028 .data = &sysctl_oom_dump_tasks,
1029 .maxlen = sizeof(sysctl_oom_dump_tasks),
1030 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001031 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001032 },
1033 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001034 .procname = "overcommit_ratio",
1035 .data = &sysctl_overcommit_ratio,
1036 .maxlen = sizeof(sysctl_overcommit_ratio),
1037 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001038 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001039 },
1040 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001041 .procname = "page-cluster",
1042 .data = &page_cluster,
1043 .maxlen = sizeof(int),
1044 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001045 .proc_handler = proc_dointvec_minmax,
1046 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001047 },
1048 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001049 .procname = "dirty_background_ratio",
1050 .data = &dirty_background_ratio,
1051 .maxlen = sizeof(dirty_background_ratio),
1052 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001053 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054 .extra1 = &zero,
1055 .extra2 = &one_hundred,
1056 },
1057 {
David Rientjes2da02992009-01-06 14:39:31 -08001058 .procname = "dirty_background_bytes",
1059 .data = &dirty_background_bytes,
1060 .maxlen = sizeof(dirty_background_bytes),
1061 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001062 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001063 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001064 },
1065 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001066 .procname = "dirty_ratio",
1067 .data = &vm_dirty_ratio,
1068 .maxlen = sizeof(vm_dirty_ratio),
1069 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001070 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001071 .extra1 = &zero,
1072 .extra2 = &one_hundred,
1073 },
1074 {
David Rientjes2da02992009-01-06 14:39:31 -08001075 .procname = "dirty_bytes",
1076 .data = &vm_dirty_bytes,
1077 .maxlen = sizeof(vm_dirty_bytes),
1078 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001079 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001080 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001081 },
1082 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001083 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001084 .data = &dirty_writeback_interval,
1085 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001086 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001087 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001088 },
1089 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001090 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001091 .data = &dirty_expire_interval,
1092 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001093 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001094 .proc_handler = proc_dointvec_minmax,
1095 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001096 },
1097 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098 .procname = "nr_pdflush_threads",
1099 .data = &nr_pdflush_threads,
1100 .maxlen = sizeof nr_pdflush_threads,
1101 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001102 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001103 },
1104 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001105 .procname = "swappiness",
1106 .data = &vm_swappiness,
1107 .maxlen = sizeof(vm_swappiness),
1108 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001109 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110 .extra1 = &zero,
1111 .extra2 = &one_hundred,
1112 },
1113#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001114 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001115 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001116 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001117 .maxlen = sizeof(unsigned long),
1118 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001119 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001120 .extra1 = (void *)&hugetlb_zero,
1121 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001122 },
1123#ifdef CONFIG_NUMA
1124 {
1125 .procname = "nr_hugepages_mempolicy",
1126 .data = NULL,
1127 .maxlen = sizeof(unsigned long),
1128 .mode = 0644,
1129 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1130 .extra1 = (void *)&hugetlb_zero,
1131 .extra2 = (void *)&hugetlb_infinity,
1132 },
1133#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001134 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001135 .procname = "hugetlb_shm_group",
1136 .data = &sysctl_hugetlb_shm_group,
1137 .maxlen = sizeof(gid_t),
1138 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001139 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001140 },
Mel Gorman396faf02007-07-17 04:03:13 -07001141 {
Mel Gorman396faf02007-07-17 04:03:13 -07001142 .procname = "hugepages_treat_as_movable",
1143 .data = &hugepages_treat_as_movable,
1144 .maxlen = sizeof(int),
1145 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001146 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001147 },
Adam Litke54f9f802007-10-16 01:26:20 -07001148 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001149 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001150 .data = NULL,
1151 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001152 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001153 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001154 .extra1 = (void *)&hugetlb_zero,
1155 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001156 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001157#endif
1158 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001159 .procname = "lowmem_reserve_ratio",
1160 .data = &sysctl_lowmem_reserve_ratio,
1161 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1162 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001163 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164 },
1165 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001166 .procname = "drop_caches",
1167 .data = &sysctl_drop_caches,
1168 .maxlen = sizeof(int),
1169 .mode = 0644,
1170 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001171 .extra1 = &one,
1172 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001173 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001174#ifdef CONFIG_COMPACTION
1175 {
1176 .procname = "compact_memory",
1177 .data = &sysctl_compact_memory,
1178 .maxlen = sizeof(int),
1179 .mode = 0200,
1180 .proc_handler = sysctl_compaction_handler,
1181 },
Mel Gorman5e771902010-05-24 14:32:31 -07001182 {
1183 .procname = "extfrag_threshold",
1184 .data = &sysctl_extfrag_threshold,
1185 .maxlen = sizeof(int),
1186 .mode = 0644,
1187 .proc_handler = sysctl_extfrag_handler,
1188 .extra1 = &min_extfrag_threshold,
1189 .extra2 = &max_extfrag_threshold,
1190 },
1191
Mel Gorman76ab0f52010-05-24 14:32:28 -07001192#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001193 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001194 .procname = "min_free_kbytes",
1195 .data = &min_free_kbytes,
1196 .maxlen = sizeof(min_free_kbytes),
1197 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001198 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001199 .extra1 = &zero,
1200 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001201 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001202 .procname = "percpu_pagelist_fraction",
1203 .data = &percpu_pagelist_fraction,
1204 .maxlen = sizeof(percpu_pagelist_fraction),
1205 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001206 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001207 .extra1 = &min_percpu_pagelist_fract,
1208 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001209#ifdef CONFIG_MMU
1210 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001211 .procname = "max_map_count",
1212 .data = &sysctl_max_map_count,
1213 .maxlen = sizeof(sysctl_max_map_count),
1214 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001215 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001216 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001217 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001218#else
1219 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001220 .procname = "nr_trim_pages",
1221 .data = &sysctl_nr_trim_pages,
1222 .maxlen = sizeof(sysctl_nr_trim_pages),
1223 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001224 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001225 .extra1 = &zero,
1226 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001227#endif
1228 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001229 .procname = "laptop_mode",
1230 .data = &laptop_mode,
1231 .maxlen = sizeof(laptop_mode),
1232 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001233 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001234 },
1235 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001236 .procname = "block_dump",
1237 .data = &block_dump,
1238 .maxlen = sizeof(block_dump),
1239 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001240 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001241 .extra1 = &zero,
1242 },
1243 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001244 .procname = "vfs_cache_pressure",
1245 .data = &sysctl_vfs_cache_pressure,
1246 .maxlen = sizeof(sysctl_vfs_cache_pressure),
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#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1252 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001253 .procname = "legacy_va_layout",
1254 .data = &sysctl_legacy_va_layout,
1255 .maxlen = sizeof(sysctl_legacy_va_layout),
1256 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001257 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001258 .extra1 = &zero,
1259 },
1260#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001261#ifdef CONFIG_NUMA
1262 {
Christoph Lameter17436602006-01-18 17:42:32 -08001263 .procname = "zone_reclaim_mode",
1264 .data = &zone_reclaim_mode,
1265 .maxlen = sizeof(zone_reclaim_mode),
1266 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001267 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001268 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001269 },
Christoph Lameter96146342006-07-03 00:24:13 -07001270 {
Christoph Lameter96146342006-07-03 00:24:13 -07001271 .procname = "min_unmapped_ratio",
1272 .data = &sysctl_min_unmapped_ratio,
1273 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1274 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001275 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001276 .extra1 = &zero,
1277 .extra2 = &one_hundred,
1278 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001279 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001280 .procname = "min_slab_ratio",
1281 .data = &sysctl_min_slab_ratio,
1282 .maxlen = sizeof(sysctl_min_slab_ratio),
1283 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001284 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001285 .extra1 = &zero,
1286 .extra2 = &one_hundred,
1287 },
Christoph Lameter17436602006-01-18 17:42:32 -08001288#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001289#ifdef CONFIG_SMP
1290 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001291 .procname = "stat_interval",
1292 .data = &sysctl_stat_interval,
1293 .maxlen = sizeof(sysctl_stat_interval),
1294 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001295 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001296 },
1297#endif
David Howells6e141542009-12-15 19:27:45 +00001298#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001299 {
Eric Parised032182007-06-28 15:55:21 -04001300 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001301 .data = &dac_mmap_min_addr,
1302 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001303 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001304 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001305 },
David Howells6e141542009-12-15 19:27:45 +00001306#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001307#ifdef CONFIG_NUMA
1308 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001309 .procname = "numa_zonelist_order",
1310 .data = &numa_zonelist_order,
1311 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1312 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001313 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001314 },
1315#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001316#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001317 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001318 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001319 .procname = "vdso_enabled",
1320 .data = &vdso_enabled,
1321 .maxlen = sizeof(vdso_enabled),
1322 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001323 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001324 .extra1 = &zero,
1325 },
1326#endif
Bron Gondwana195cf4532008-02-04 22:29:20 -08001327#ifdef CONFIG_HIGHMEM
1328 {
Bron Gondwana195cf4532008-02-04 22:29:20 -08001329 .procname = "highmem_is_dirtyable",
1330 .data = &vm_highmem_is_dirtyable,
1331 .maxlen = sizeof(vm_highmem_is_dirtyable),
1332 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001333 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf4532008-02-04 22:29:20 -08001334 .extra1 = &zero,
1335 .extra2 = &one,
1336 },
1337#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001338 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001339 .procname = "scan_unevictable_pages",
1340 .data = &scan_unevictable_pages,
1341 .maxlen = sizeof(scan_unevictable_pages),
1342 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001343 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001344 },
Andi Kleen6a460792009-09-16 11:50:15 +02001345#ifdef CONFIG_MEMORY_FAILURE
1346 {
Andi Kleen6a460792009-09-16 11:50:15 +02001347 .procname = "memory_failure_early_kill",
1348 .data = &sysctl_memory_failure_early_kill,
1349 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1350 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001351 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001352 .extra1 = &zero,
1353 .extra2 = &one,
1354 },
1355 {
Andi Kleen6a460792009-09-16 11:50:15 +02001356 .procname = "memory_failure_recovery",
1357 .data = &sysctl_memory_failure_recovery,
1358 .maxlen = sizeof(sysctl_memory_failure_recovery),
1359 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001360 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001361 .extra1 = &zero,
1362 .extra2 = &one,
1363 },
1364#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001365 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366};
1367
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001368#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001369static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001370 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001371};
1372#endif
1373
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001374static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001375 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001376 .procname = "inode-nr",
1377 .data = &inodes_stat,
1378 .maxlen = 2*sizeof(int),
1379 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001380 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001381 },
1382 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001383 .procname = "inode-state",
1384 .data = &inodes_stat,
1385 .maxlen = 7*sizeof(int),
1386 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001387 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388 },
1389 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001390 .procname = "file-nr",
1391 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001392 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001393 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001394 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001395 },
1396 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001397 .procname = "file-max",
1398 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001399 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001400 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001401 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001402 },
1403 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001404 .procname = "nr_open",
1405 .data = &sysctl_nr_open,
1406 .maxlen = sizeof(int),
1407 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001408 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001409 .extra1 = &sysctl_nr_open_min,
1410 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001411 },
1412 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001413 .procname = "dentry-state",
1414 .data = &dentry_stat,
1415 .maxlen = 6*sizeof(int),
1416 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001417 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 },
1419 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001420 .procname = "overflowuid",
1421 .data = &fs_overflowuid,
1422 .maxlen = sizeof(int),
1423 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001424 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001425 .extra1 = &minolduid,
1426 .extra2 = &maxolduid,
1427 },
1428 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001429 .procname = "overflowgid",
1430 .data = &fs_overflowgid,
1431 .maxlen = sizeof(int),
1432 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001433 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001434 .extra1 = &minolduid,
1435 .extra2 = &maxolduid,
1436 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001437#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001439 .procname = "leases-enable",
1440 .data = &leases_enable,
1441 .maxlen = sizeof(int),
1442 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001443 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001444 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001445#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001446#ifdef CONFIG_DNOTIFY
1447 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001448 .procname = "dir-notify-enable",
1449 .data = &dir_notify_enable,
1450 .maxlen = sizeof(int),
1451 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001452 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001453 },
1454#endif
1455#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001456#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001457 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001458 .procname = "lease-break-time",
1459 .data = &lease_break_time,
1460 .maxlen = sizeof(int),
1461 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001462 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001464#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001465#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001466 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001467 .procname = "aio-nr",
1468 .data = &aio_nr,
1469 .maxlen = sizeof(aio_nr),
1470 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001471 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 },
1473 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001474 .procname = "aio-max-nr",
1475 .data = &aio_max_nr,
1476 .maxlen = sizeof(aio_max_nr),
1477 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001478 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001479 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001480#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001481#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001482 {
Robert Love0399cb02005-07-13 12:38:18 -04001483 .procname = "inotify",
1484 .mode = 0555,
1485 .child = inotify_table,
1486 },
1487#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001488#ifdef CONFIG_EPOLL
1489 {
1490 .procname = "epoll",
1491 .mode = 0555,
1492 .child = epoll_table,
1493 },
1494#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001495#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001496 {
Kees Cook800179c2012-07-25 17:29:07 -07001497 .procname = "protected_symlinks",
1498 .data = &sysctl_protected_symlinks,
1499 .maxlen = sizeof(int),
1500 .mode = 0600,
1501 .proc_handler = proc_dointvec_minmax,
1502 .extra1 = &zero,
1503 .extra2 = &one,
1504 },
1505 {
1506 .procname = "protected_hardlinks",
1507 .data = &sysctl_protected_hardlinks,
1508 .maxlen = sizeof(int),
1509 .mode = 0600,
1510 .proc_handler = proc_dointvec_minmax,
1511 .extra1 = &zero,
1512 .extra2 = &one,
1513 },
1514 {
Alan Coxd6e71142005-06-23 00:09:43 -07001515 .procname = "suid_dumpable",
1516 .data = &suid_dumpable,
1517 .maxlen = sizeof(int),
1518 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001519 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001520 .extra1 = &zero,
1521 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001522 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001523#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1524 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001525 .procname = "binfmt_misc",
1526 .mode = 0555,
1527 .child = binfmt_misc_table,
1528 },
1529#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001530 {
Jens Axboeff9da692010-06-03 14:54:39 +02001531 .procname = "pipe-max-size",
1532 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001533 .maxlen = sizeof(int),
1534 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001535 .proc_handler = &pipe_proc_fn,
1536 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001537 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001538 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001539};
1540
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001541static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001542#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001543 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001544 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001545 .procname = "exception-trace",
1546 .data = &show_unhandled_signals,
1547 .maxlen = sizeof(int),
1548 .mode = 0644,
1549 .proc_handler = proc_dointvec
1550 },
1551#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001552#if defined(CONFIG_OPTPROBES)
1553 {
1554 .procname = "kprobes-optimization",
1555 .data = &sysctl_kprobes_optimization,
1556 .maxlen = sizeof(int),
1557 .mode = 0644,
1558 .proc_handler = proc_kprobes_optimization_handler,
1559 .extra1 = &zero,
1560 .extra2 = &one,
1561 },
1562#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001563 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001564};
1565
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001566static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001567 { }
Robert Love0eeca282005-07-12 17:06:03 -04001568};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001569
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001570int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001571{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001572 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001573 return 0;
1574}
1575
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001576#endif /* CONFIG_SYSCTL */
1577
Linus Torvalds1da177e2005-04-16 15:20:36 -07001578/*
1579 * /proc/sys support
1580 */
1581
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001582#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001583
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001584static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001585 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001586 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001587{
1588 size_t len;
1589 char __user *p;
1590 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001591
1592 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001593 *lenp = 0;
1594 return 0;
1595 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001596
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001597 if (write) {
1598 len = 0;
1599 p = buffer;
1600 while (len < *lenp) {
1601 if (get_user(c, p++))
1602 return -EFAULT;
1603 if (c == 0 || c == '\n')
1604 break;
1605 len++;
1606 }
1607 if (len >= maxlen)
1608 len = maxlen-1;
1609 if(copy_from_user(data, buffer, len))
1610 return -EFAULT;
1611 ((char *) data)[len] = 0;
1612 *ppos += *lenp;
1613 } else {
1614 len = strlen(data);
1615 if (len > maxlen)
1616 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001617
1618 if (*ppos > len) {
1619 *lenp = 0;
1620 return 0;
1621 }
1622
1623 data += *ppos;
1624 len -= *ppos;
1625
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001626 if (len > *lenp)
1627 len = *lenp;
1628 if (len)
1629 if(copy_to_user(buffer, data, len))
1630 return -EFAULT;
1631 if (len < *lenp) {
1632 if(put_user('\n', ((char __user *) buffer) + len))
1633 return -EFAULT;
1634 len++;
1635 }
1636 *lenp = len;
1637 *ppos += len;
1638 }
1639 return 0;
1640}
1641
Linus Torvalds1da177e2005-04-16 15:20:36 -07001642/**
1643 * proc_dostring - read a string sysctl
1644 * @table: the sysctl table
1645 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001646 * @buffer: the user buffer
1647 * @lenp: the size of the user buffer
1648 * @ppos: file position
1649 *
1650 * Reads/writes a string from/to the user buffer. If the kernel
1651 * buffer provided is not large enough to hold the string, the
1652 * string is truncated. The copied string is %NULL-terminated.
1653 * If the string is being read by the user process, it is copied
1654 * and a newline '\n' is added. It is truncated if the buffer is
1655 * not large enough.
1656 *
1657 * Returns 0 on success.
1658 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001659int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001660 void __user *buffer, size_t *lenp, loff_t *ppos)
1661{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001662 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001663 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001664}
1665
Amerigo Wang00b7c332010-05-05 00:26:45 +00001666static size_t proc_skip_spaces(char **buf)
1667{
1668 size_t ret;
1669 char *tmp = skip_spaces(*buf);
1670 ret = tmp - *buf;
1671 *buf = tmp;
1672 return ret;
1673}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001674
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001675static void proc_skip_char(char **buf, size_t *size, const char v)
1676{
1677 while (*size) {
1678 if (**buf != v)
1679 break;
1680 (*size)--;
1681 (*buf)++;
1682 }
1683}
1684
Amerigo Wang00b7c332010-05-05 00:26:45 +00001685#define TMPBUFLEN 22
1686/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001687 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001688 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001689 * @buf: a kernel buffer
1690 * @size: size of the kernel buffer
1691 * @val: this is where the number will be stored
1692 * @neg: set to %TRUE if number is negative
1693 * @perm_tr: a vector which contains the allowed trailers
1694 * @perm_tr_len: size of the perm_tr vector
1695 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001696 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001697 * In case of success %0 is returned and @buf and @size are updated with
1698 * the amount of bytes read. If @tr is non-NULL and a trailing
1699 * character exists (size is non-zero after returning from this
1700 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001701 */
1702static int proc_get_long(char **buf, size_t *size,
1703 unsigned long *val, bool *neg,
1704 const char *perm_tr, unsigned perm_tr_len, char *tr)
1705{
1706 int len;
1707 char *p, tmp[TMPBUFLEN];
1708
1709 if (!*size)
1710 return -EINVAL;
1711
1712 len = *size;
1713 if (len > TMPBUFLEN - 1)
1714 len = TMPBUFLEN - 1;
1715
1716 memcpy(tmp, *buf, len);
1717
1718 tmp[len] = 0;
1719 p = tmp;
1720 if (*p == '-' && *size > 1) {
1721 *neg = true;
1722 p++;
1723 } else
1724 *neg = false;
1725 if (!isdigit(*p))
1726 return -EINVAL;
1727
1728 *val = simple_strtoul(p, &p, 0);
1729
1730 len = p - tmp;
1731
1732 /* We don't know if the next char is whitespace thus we may accept
1733 * invalid integers (e.g. 1234...a) or two integers instead of one
1734 * (e.g. 123...1). So lets not allow such large numbers. */
1735 if (len == TMPBUFLEN - 1)
1736 return -EINVAL;
1737
1738 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1739 return -EINVAL;
1740
1741 if (tr && (len < *size))
1742 *tr = *p;
1743
1744 *buf += len;
1745 *size -= len;
1746
1747 return 0;
1748}
1749
1750/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001751 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001752 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001753 * @buf: the user buffer
1754 * @size: the size of the user buffer
1755 * @val: the integer to be converted
1756 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001757 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001758 * In case of success %0 is returned and @buf and @size are updated with
1759 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001760 */
1761static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1762 bool neg)
1763{
1764 int len;
1765 char tmp[TMPBUFLEN], *p = tmp;
1766
1767 sprintf(p, "%s%lu", neg ? "-" : "", val);
1768 len = strlen(tmp);
1769 if (len > *size)
1770 len = *size;
1771 if (copy_to_user(*buf, tmp, len))
1772 return -EFAULT;
1773 *size -= len;
1774 *buf += len;
1775 return 0;
1776}
1777#undef TMPBUFLEN
1778
1779static int proc_put_char(void __user **buf, size_t *size, char c)
1780{
1781 if (*size) {
1782 char __user **buffer = (char __user **)buf;
1783 if (put_user(c, *buffer))
1784 return -EFAULT;
1785 (*size)--, (*buffer)++;
1786 *buf = *buffer;
1787 }
1788 return 0;
1789}
1790
1791static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001792 int *valp,
1793 int write, void *data)
1794{
1795 if (write) {
1796 *valp = *negp ? -*lvalp : *lvalp;
1797 } else {
1798 int val = *valp;
1799 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001800 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001801 *lvalp = (unsigned long)-val;
1802 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001803 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001804 *lvalp = (unsigned long)val;
1805 }
1806 }
1807 return 0;
1808}
1809
Amerigo Wang00b7c332010-05-05 00:26:45 +00001810static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1811
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001812static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001813 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001814 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001815 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001816 int write, void *data),
1817 void *data)
1818{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001819 int *i, vleft, first = 1, err = 0;
1820 unsigned long page = 0;
1821 size_t left;
1822 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001823
Amerigo Wang00b7c332010-05-05 00:26:45 +00001824 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001825 *lenp = 0;
1826 return 0;
1827 }
1828
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001829 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001830 vleft = table->maxlen / sizeof(*i);
1831 left = *lenp;
1832
1833 if (!conv)
1834 conv = do_proc_dointvec_conv;
1835
Linus Torvalds1da177e2005-04-16 15:20:36 -07001836 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001837 if (left > PAGE_SIZE - 1)
1838 left = PAGE_SIZE - 1;
1839 page = __get_free_page(GFP_TEMPORARY);
1840 kbuf = (char *) page;
1841 if (!kbuf)
1842 return -ENOMEM;
1843 if (copy_from_user(kbuf, buffer, left)) {
1844 err = -EFAULT;
1845 goto free;
1846 }
1847 kbuf[left] = 0;
1848 }
1849
1850 for (; left && vleft--; i++, first=0) {
1851 unsigned long lval;
1852 bool neg;
1853
1854 if (write) {
1855 left -= proc_skip_spaces(&kbuf);
1856
J. R. Okajima563b0462010-05-25 16:10:14 -07001857 if (!left)
1858 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001859 err = proc_get_long(&kbuf, &left, &lval, &neg,
1860 proc_wspace_sep,
1861 sizeof(proc_wspace_sep), NULL);
1862 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001863 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001864 if (conv(&neg, &lval, i, 1, data)) {
1865 err = -EINVAL;
1866 break;
1867 }
1868 } else {
1869 if (conv(&neg, &lval, i, 0, data)) {
1870 err = -EINVAL;
1871 break;
1872 }
1873 if (!first)
1874 err = proc_put_char(&buffer, &left, '\t');
1875 if (err)
1876 break;
1877 err = proc_put_long(&buffer, &left, lval, neg);
1878 if (err)
1879 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001880 }
1881 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001882
1883 if (!write && !first && left && !err)
1884 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001885 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001886 left -= proc_skip_spaces(&kbuf);
1887free:
1888 if (write) {
1889 free_page(page);
1890 if (first)
1891 return err ? : -EINVAL;
1892 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001893 *lenp -= left;
1894 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001895 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001896}
1897
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001898static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001899 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001900 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001901 int write, void *data),
1902 void *data)
1903{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001904 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001905 buffer, lenp, ppos, conv, data);
1906}
1907
Linus Torvalds1da177e2005-04-16 15:20:36 -07001908/**
1909 * proc_dointvec - read a vector of integers
1910 * @table: the sysctl table
1911 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001912 * @buffer: the user buffer
1913 * @lenp: the size of the user buffer
1914 * @ppos: file position
1915 *
1916 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1917 * values from/to the user buffer, treated as an ASCII string.
1918 *
1919 * Returns 0 on success.
1920 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001921int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001922 void __user *buffer, size_t *lenp, loff_t *ppos)
1923{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001924 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001925 NULL,NULL);
1926}
1927
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001928/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001929 * Taint values can only be increased
1930 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001931 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001932static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001933 void __user *buffer, size_t *lenp, loff_t *ppos)
1934{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001935 struct ctl_table t;
1936 unsigned long tmptaint = get_taint();
1937 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001938
Bastian Blank91fcd412007-04-23 14:41:14 -07001939 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001940 return -EPERM;
1941
Andi Kleen25ddbb12008-10-15 22:01:41 -07001942 t = *table;
1943 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001944 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001945 if (err < 0)
1946 return err;
1947
1948 if (write) {
1949 /*
1950 * Poor man's atomic or. Not worth adding a primitive
1951 * to everyone's atomic.h for this
1952 */
1953 int i;
1954 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1955 if ((tmptaint >> i) & 1)
1956 add_taint(i);
1957 }
1958 }
1959
1960 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001961}
1962
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001963#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001964static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001965 void __user *buffer, size_t *lenp, loff_t *ppos)
1966{
1967 if (write && !capable(CAP_SYS_ADMIN))
1968 return -EPERM;
1969
1970 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1971}
1972#endif
1973
Linus Torvalds1da177e2005-04-16 15:20:36 -07001974struct do_proc_dointvec_minmax_conv_param {
1975 int *min;
1976 int *max;
1977};
1978
Amerigo Wang00b7c332010-05-05 00:26:45 +00001979static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
1980 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001981 int write, void *data)
1982{
1983 struct do_proc_dointvec_minmax_conv_param *param = data;
1984 if (write) {
1985 int val = *negp ? -*lvalp : *lvalp;
1986 if ((param->min && *param->min > val) ||
1987 (param->max && *param->max < val))
1988 return -EINVAL;
1989 *valp = val;
1990 } else {
1991 int val = *valp;
1992 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001993 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001994 *lvalp = (unsigned long)-val;
1995 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001996 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001997 *lvalp = (unsigned long)val;
1998 }
1999 }
2000 return 0;
2001}
2002
2003/**
2004 * proc_dointvec_minmax - read a vector of integers with min/max values
2005 * @table: the sysctl table
2006 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002007 * @buffer: the user buffer
2008 * @lenp: the size of the user buffer
2009 * @ppos: file position
2010 *
2011 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2012 * values from/to the user buffer, treated as an ASCII string.
2013 *
2014 * This routine will ensure the values are within the range specified by
2015 * table->extra1 (min) and table->extra2 (max).
2016 *
2017 * Returns 0 on success.
2018 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002019int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002020 void __user *buffer, size_t *lenp, loff_t *ppos)
2021{
2022 struct do_proc_dointvec_minmax_conv_param param = {
2023 .min = (int *) table->extra1,
2024 .max = (int *) table->extra2,
2025 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002026 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002027 do_proc_dointvec_minmax_conv, &param);
2028}
2029
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002030static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002031 void __user *buffer,
2032 size_t *lenp, loff_t *ppos,
2033 unsigned long convmul,
2034 unsigned long convdiv)
2035{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002036 unsigned long *i, *min, *max;
2037 int vleft, first = 1, err = 0;
2038 unsigned long page = 0;
2039 size_t left;
2040 char *kbuf;
2041
2042 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002043 *lenp = 0;
2044 return 0;
2045 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002046
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002047 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002048 min = (unsigned long *) table->extra1;
2049 max = (unsigned long *) table->extra2;
2050 vleft = table->maxlen / sizeof(unsigned long);
2051 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002052
2053 if (write) {
2054 if (left > PAGE_SIZE - 1)
2055 left = PAGE_SIZE - 1;
2056 page = __get_free_page(GFP_TEMPORARY);
2057 kbuf = (char *) page;
2058 if (!kbuf)
2059 return -ENOMEM;
2060 if (copy_from_user(kbuf, buffer, left)) {
2061 err = -EFAULT;
2062 goto free;
2063 }
2064 kbuf[left] = 0;
2065 }
2066
Eric Dumazet27b3d802010-10-07 12:59:29 -07002067 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002068 unsigned long val;
2069
Linus Torvalds1da177e2005-04-16 15:20:36 -07002070 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002071 bool neg;
2072
2073 left -= proc_skip_spaces(&kbuf);
2074
2075 err = proc_get_long(&kbuf, &left, &val, &neg,
2076 proc_wspace_sep,
2077 sizeof(proc_wspace_sep), NULL);
2078 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002079 break;
2080 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002081 continue;
2082 if ((min && val < *min) || (max && val > *max))
2083 continue;
2084 *i = val;
2085 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002086 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002087 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002088 err = proc_put_char(&buffer, &left, '\t');
2089 err = proc_put_long(&buffer, &left, val, false);
2090 if (err)
2091 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002092 }
2093 }
2094
Amerigo Wang00b7c332010-05-05 00:26:45 +00002095 if (!write && !first && left && !err)
2096 err = proc_put_char(&buffer, &left, '\n');
2097 if (write && !err)
2098 left -= proc_skip_spaces(&kbuf);
2099free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002100 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002101 free_page(page);
2102 if (first)
2103 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002104 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002105 *lenp -= left;
2106 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002107 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002108}
2109
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002110static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002111 void __user *buffer,
2112 size_t *lenp, loff_t *ppos,
2113 unsigned long convmul,
2114 unsigned long convdiv)
2115{
2116 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002117 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002118}
2119
Linus Torvalds1da177e2005-04-16 15:20:36 -07002120/**
2121 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2122 * @table: the sysctl table
2123 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002124 * @buffer: the user buffer
2125 * @lenp: the size of the user buffer
2126 * @ppos: file position
2127 *
2128 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2129 * values from/to the user buffer, treated as an ASCII string.
2130 *
2131 * This routine will ensure the values are within the range specified by
2132 * table->extra1 (min) and table->extra2 (max).
2133 *
2134 * Returns 0 on success.
2135 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002136int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002137 void __user *buffer, size_t *lenp, loff_t *ppos)
2138{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002139 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002140}
2141
2142/**
2143 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2144 * @table: the sysctl table
2145 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002146 * @buffer: the user buffer
2147 * @lenp: the size of the user buffer
2148 * @ppos: file position
2149 *
2150 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2151 * values from/to the user buffer, treated as an ASCII string. The values
2152 * are treated as milliseconds, and converted to jiffies when they are stored.
2153 *
2154 * This routine will ensure the values are within the range specified by
2155 * table->extra1 (min) and table->extra2 (max).
2156 *
2157 * Returns 0 on success.
2158 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002159int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002160 void __user *buffer,
2161 size_t *lenp, loff_t *ppos)
2162{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002163 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002164 lenp, ppos, HZ, 1000l);
2165}
2166
2167
Amerigo Wang00b7c332010-05-05 00:26:45 +00002168static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002169 int *valp,
2170 int write, void *data)
2171{
2172 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002173 if (*lvalp > LONG_MAX / HZ)
2174 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002175 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2176 } else {
2177 int val = *valp;
2178 unsigned long lval;
2179 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002180 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002181 lval = (unsigned long)-val;
2182 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002183 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002184 lval = (unsigned long)val;
2185 }
2186 *lvalp = lval / HZ;
2187 }
2188 return 0;
2189}
2190
Amerigo Wang00b7c332010-05-05 00:26:45 +00002191static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002192 int *valp,
2193 int write, void *data)
2194{
2195 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002196 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2197 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002198 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2199 } else {
2200 int val = *valp;
2201 unsigned long lval;
2202 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002203 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002204 lval = (unsigned long)-val;
2205 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002206 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002207 lval = (unsigned long)val;
2208 }
2209 *lvalp = jiffies_to_clock_t(lval);
2210 }
2211 return 0;
2212}
2213
Amerigo Wang00b7c332010-05-05 00:26:45 +00002214static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002215 int *valp,
2216 int write, void *data)
2217{
2218 if (write) {
2219 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2220 } else {
2221 int val = *valp;
2222 unsigned long lval;
2223 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002224 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002225 lval = (unsigned long)-val;
2226 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002227 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002228 lval = (unsigned long)val;
2229 }
2230 *lvalp = jiffies_to_msecs(lval);
2231 }
2232 return 0;
2233}
2234
2235/**
2236 * proc_dointvec_jiffies - read a vector of integers as seconds
2237 * @table: the sysctl table
2238 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002239 * @buffer: the user buffer
2240 * @lenp: the size of the user buffer
2241 * @ppos: file position
2242 *
2243 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2244 * values from/to the user buffer, treated as an ASCII string.
2245 * The values read are assumed to be in seconds, and are converted into
2246 * jiffies.
2247 *
2248 * Returns 0 on success.
2249 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002250int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002251 void __user *buffer, size_t *lenp, loff_t *ppos)
2252{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002253 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002254 do_proc_dointvec_jiffies_conv,NULL);
2255}
2256
2257/**
2258 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2259 * @table: the sysctl table
2260 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002261 * @buffer: the user buffer
2262 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002263 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002264 *
2265 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2266 * values from/to the user buffer, treated as an ASCII string.
2267 * The values read are assumed to be in 1/USER_HZ seconds, and
2268 * are converted into jiffies.
2269 *
2270 * Returns 0 on success.
2271 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002272int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002273 void __user *buffer, size_t *lenp, loff_t *ppos)
2274{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002275 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002276 do_proc_dointvec_userhz_jiffies_conv,NULL);
2277}
2278
2279/**
2280 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2281 * @table: the sysctl table
2282 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002283 * @buffer: the user buffer
2284 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002285 * @ppos: file position
2286 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002287 *
2288 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2289 * values from/to the user buffer, treated as an ASCII string.
2290 * The values read are assumed to be in 1/1000 seconds, and
2291 * are converted into jiffies.
2292 *
2293 * Returns 0 on success.
2294 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002295int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002296 void __user *buffer, size_t *lenp, loff_t *ppos)
2297{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002298 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002299 do_proc_dointvec_ms_jiffies_conv, NULL);
2300}
2301
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002302static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002303 void __user *buffer, size_t *lenp, loff_t *ppos)
2304{
2305 struct pid *new_pid;
2306 pid_t tmp;
2307 int r;
2308
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002309 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002310
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002311 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002312 lenp, ppos, NULL, NULL);
2313 if (r || !write)
2314 return r;
2315
2316 new_pid = find_get_pid(tmp);
2317 if (!new_pid)
2318 return -ESRCH;
2319
2320 put_pid(xchg(&cad_pid, new_pid));
2321 return 0;
2322}
2323
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002324/**
2325 * proc_do_large_bitmap - read/write from/to a large bitmap
2326 * @table: the sysctl table
2327 * @write: %TRUE if this is a write to the sysctl file
2328 * @buffer: the user buffer
2329 * @lenp: the size of the user buffer
2330 * @ppos: file position
2331 *
2332 * The bitmap is stored at table->data and the bitmap length (in bits)
2333 * in table->maxlen.
2334 *
2335 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2336 * large bitmaps may be represented in a compact manner. Writing into
2337 * the file will clear the bitmap then update it with the given input.
2338 *
2339 * Returns 0 on success.
2340 */
2341int proc_do_large_bitmap(struct ctl_table *table, int write,
2342 void __user *buffer, size_t *lenp, loff_t *ppos)
2343{
2344 int err = 0;
2345 bool first = 1;
2346 size_t left = *lenp;
2347 unsigned long bitmap_len = table->maxlen;
2348 unsigned long *bitmap = (unsigned long *) table->data;
2349 unsigned long *tmp_bitmap = NULL;
2350 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2351
2352 if (!bitmap_len || !left || (*ppos && !write)) {
2353 *lenp = 0;
2354 return 0;
2355 }
2356
2357 if (write) {
2358 unsigned long page = 0;
2359 char *kbuf;
2360
2361 if (left > PAGE_SIZE - 1)
2362 left = PAGE_SIZE - 1;
2363
2364 page = __get_free_page(GFP_TEMPORARY);
2365 kbuf = (char *) page;
2366 if (!kbuf)
2367 return -ENOMEM;
2368 if (copy_from_user(kbuf, buffer, left)) {
2369 free_page(page);
2370 return -EFAULT;
2371 }
2372 kbuf[left] = 0;
2373
2374 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2375 GFP_KERNEL);
2376 if (!tmp_bitmap) {
2377 free_page(page);
2378 return -ENOMEM;
2379 }
2380 proc_skip_char(&kbuf, &left, '\n');
2381 while (!err && left) {
2382 unsigned long val_a, val_b;
2383 bool neg;
2384
2385 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2386 sizeof(tr_a), &c);
2387 if (err)
2388 break;
2389 if (val_a >= bitmap_len || neg) {
2390 err = -EINVAL;
2391 break;
2392 }
2393
2394 val_b = val_a;
2395 if (left) {
2396 kbuf++;
2397 left--;
2398 }
2399
2400 if (c == '-') {
2401 err = proc_get_long(&kbuf, &left, &val_b,
2402 &neg, tr_b, sizeof(tr_b),
2403 &c);
2404 if (err)
2405 break;
2406 if (val_b >= bitmap_len || neg ||
2407 val_a > val_b) {
2408 err = -EINVAL;
2409 break;
2410 }
2411 if (left) {
2412 kbuf++;
2413 left--;
2414 }
2415 }
2416
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002417 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002418 first = 0;
2419 proc_skip_char(&kbuf, &left, '\n');
2420 }
2421 free_page(page);
2422 } else {
2423 unsigned long bit_a, bit_b = 0;
2424
2425 while (left) {
2426 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2427 if (bit_a >= bitmap_len)
2428 break;
2429 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2430 bit_a + 1) - 1;
2431
2432 if (!first) {
2433 err = proc_put_char(&buffer, &left, ',');
2434 if (err)
2435 break;
2436 }
2437 err = proc_put_long(&buffer, &left, bit_a, false);
2438 if (err)
2439 break;
2440 if (bit_a != bit_b) {
2441 err = proc_put_char(&buffer, &left, '-');
2442 if (err)
2443 break;
2444 err = proc_put_long(&buffer, &left, bit_b, false);
2445 if (err)
2446 break;
2447 }
2448
2449 first = 0; bit_b++;
2450 }
2451 if (!err)
2452 err = proc_put_char(&buffer, &left, '\n');
2453 }
2454
2455 if (!err) {
2456 if (write) {
2457 if (*ppos)
2458 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2459 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002460 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002461 }
2462 kfree(tmp_bitmap);
2463 *lenp -= left;
2464 *ppos += *lenp;
2465 return 0;
2466 } else {
2467 kfree(tmp_bitmap);
2468 return err;
2469 }
2470}
2471
Jovi Zhang55610502011-01-12 17:00:45 -08002472#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002473
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002474int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002475 void __user *buffer, size_t *lenp, loff_t *ppos)
2476{
2477 return -ENOSYS;
2478}
2479
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002480int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002481 void __user *buffer, size_t *lenp, loff_t *ppos)
2482{
2483 return -ENOSYS;
2484}
2485
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002486int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002487 void __user *buffer, size_t *lenp, loff_t *ppos)
2488{
2489 return -ENOSYS;
2490}
2491
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002492int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002493 void __user *buffer, size_t *lenp, loff_t *ppos)
2494{
2495 return -ENOSYS;
2496}
2497
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002498int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002499 void __user *buffer, size_t *lenp, loff_t *ppos)
2500{
2501 return -ENOSYS;
2502}
2503
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002504int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002505 void __user *buffer, size_t *lenp, loff_t *ppos)
2506{
2507 return -ENOSYS;
2508}
2509
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002510int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002511 void __user *buffer, size_t *lenp, loff_t *ppos)
2512{
2513 return -ENOSYS;
2514}
2515
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002516int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002517 void __user *buffer,
2518 size_t *lenp, loff_t *ppos)
2519{
2520 return -ENOSYS;
2521}
2522
2523
Jovi Zhang55610502011-01-12 17:00:45 -08002524#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002525
Linus Torvalds1da177e2005-04-16 15:20:36 -07002526/*
2527 * No sense putting this after each symbol definition, twice,
2528 * exception granted :-)
2529 */
2530EXPORT_SYMBOL(proc_dointvec);
2531EXPORT_SYMBOL(proc_dointvec_jiffies);
2532EXPORT_SYMBOL(proc_dointvec_minmax);
2533EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2534EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2535EXPORT_SYMBOL(proc_dostring);
2536EXPORT_SYMBOL(proc_doulongvec_minmax);
2537EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);