blob: ae0d6ee6367f94de0e6822ba8d0e42e16a698f4d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl.c: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 * Added /proc support, Dec 1995
6 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
7 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
8 * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
9 * Dynamic registration fixes, Stephen Tweedie.
10 * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
11 * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
12 * Horn.
13 * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
14 * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
15 * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
16 * Wendling.
17 * The list_for_each() macro wasn't appropriate for the sysctl loop.
18 * Removed it and replaced it with older style, 03/23/00, Bill Wendling
19 */
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <linux/module.h>
22#include <linux/mm.h>
23#include <linux/swap.h>
24#include <linux/slab.h>
25#include <linux/sysctl.h>
Akinobu Mita5a04cca2012-03-28 14:42:50 -070026#include <linux/bitmap.h>
Dave Youngd33ed522010-03-10 15:23:59 -080027#include <linux/signal.h>
Dan Rosenberg455cd5a2011-01-12 16:59:41 -080028#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <linux/proc_fs.h>
Andrew Morgan72c2d582007-10-18 03:05:59 -070030#include <linux/security.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <linux/ctype.h>
Vegard Nossumdfec0722008-04-04 00:51:41 +020032#include <linux/kmemcheck.h>
Adrian Bunk62239ac2007-07-17 04:03:45 -070033#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <linux/init.h>
35#include <linux/kernel.h>
Kay Sievers0296b222005-11-11 05:33:52 +010036#include <linux/kobject.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030037#include <linux/net.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/sysrq.h>
39#include <linux/highuid.h>
40#include <linux/writeback.h>
Ingo Molnar3fff4c42009-09-22 16:18:09 +020041#include <linux/ratelimit.h>
Mel Gorman76ab0f52010-05-24 14:32:28 -070042#include <linux/compaction.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#include <linux/hugetlb.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <linux/initrd.h>
David Howells0b77f5b2008-04-29 01:01:32 -070045#include <linux/key.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#include <linux/times.h>
47#include <linux/limits.h>
48#include <linux/dcache.h>
Alexey Dobriyan6e006702010-01-20 22:27:56 +020049#include <linux/dnotify.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#include <linux/syscalls.h>
Adrian Bunkc748e132008-07-23 21:27:03 -070051#include <linux/vmstat.h>
Pavel Machekc255d842006-02-20 18:27:58 -080052#include <linux/nfs_fs.h>
53#include <linux/acpi.h>
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -070054#include <linux/reboot.h>
Steven Rostedtb0fc4942008-05-12 21:20:43 +020055#include <linux/ftrace.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020056#include <linux/perf_event.h>
Masami Hiramatsub2be84d2010-02-25 08:34:15 -050057#include <linux/kprobes.h>
Jens Axboeb492e952010-05-19 21:03:16 +020058#include <linux/pipe_fs_i.h>
David Rientjes8e4228e2010-08-09 17:18:56 -070059#include <linux/oom.h>
Eric Paris17f60a72011-04-01 17:07:50 -040060#include <linux/kmod.h>
Dan Ballard73efc032011-10-31 17:11:20 -070061#include <linux/capability.h>
Al Viro40401532012-02-13 03:58:52 +000062#include <linux/binfmts.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64#include <asm/uaccess.h>
65#include <asm/processor.h>
66
Andi Kleen29cbc782006-09-30 01:47:55 +020067#ifdef CONFIG_X86
68#include <asm/nmi.h>
Chuck Ebbert0741f4d2006-12-07 02:14:11 +010069#include <asm/stacktrace.h>
Ingo Molnar6e7c4022008-01-30 13:30:05 +010070#include <asm/io.h>
Andi Kleen29cbc782006-09-30 01:47:55 +020071#endif
David Howellsd550bbd2012-03-28 18:30:03 +010072#ifdef CONFIG_SPARC
73#include <asm/setup.h>
74#endif
Dave Youngc55b7c32010-03-10 15:24:08 -080075#ifdef CONFIG_BSD_PROCESS_ACCT
76#include <linux/acct.h>
77#endif
Dave Young4f0e0562010-03-10 15:24:09 -080078#ifdef CONFIG_RT_MUTEXES
79#include <linux/rtmutex.h>
80#endif
Dave Young2edf5e42010-03-10 15:24:10 -080081#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
82#include <linux/lockdep.h>
83#endif
Dave Young15485a42010-03-10 15:24:07 -080084#ifdef CONFIG_CHR_DEV_SG
85#include <scsi/sg.h>
86#endif
Andi Kleen29cbc782006-09-30 01:47:55 +020087
Don Zickus58687ac2010-05-07 17:11:44 -040088#ifdef CONFIG_LOCKUP_DETECTOR
Don Zickus504d7cf2010-02-12 17:19:19 -050089#include <linux/nmi.h>
90#endif
91
Eric W. Biederman7058cb02007-10-18 03:05:58 -070092
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#if defined(CONFIG_SYSCTL)
94
95/* External variables not in a header file. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096extern int sysctl_overcommit_memory;
97extern int sysctl_overcommit_ratio;
98extern int max_threads;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099extern int core_uses_pid;
Alan Coxd6e71142005-06-23 00:09:43 -0700100extern int suid_dumpable;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101extern char core_pattern[];
Neil Hormana2939802009-09-23 15:56:56 -0700102extern unsigned int core_pipe_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103extern int pid_max;
104extern int min_free_kbytes;
Rik van Riele13c80f2011-09-01 15:26:50 -0400105extern int extra_free_kbytes;
Arve Hjønnevågcde89492009-02-17 14:51:02 -0800106extern int min_free_order_shift;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107extern int pid_max_min, pid_max_max;
Andrew Morton9d0243b2006-01-08 01:00:39 -0800108extern int sysctl_drop_caches;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800109extern int percpu_pagelist_fraction;
Andi Kleenbebfa102006-06-26 13:56:52 +0200110extern int compat_log;
Arjan van de Ven97455122008-01-25 21:08:34 +0100111extern int latencytop_enabled;
Al Viroeceea0b2008-05-10 10:08:32 -0400112extern int sysctl_nr_open_min, sysctl_nr_open_max;
Paul Mundtdd8632a2009-01-08 12:04:47 +0000113#ifndef CONFIG_MMU
114extern int sysctl_nr_trim_pages;
115#endif
Jens Axboecb684b52009-09-15 21:53:11 +0200116#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +0200117extern int blk_iopoll_enabled;
Jens Axboecb684b52009-09-15 21:53:11 +0200118#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700120/* Constants used for minimum and maximum */
Don Zickus2508ce12010-05-07 17:11:46 -0400121#ifdef CONFIG_LOCKUP_DETECTOR
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700122static int sixty = 60;
Dimitri Sivanich9383d962008-05-12 21:21:14 +0200123static int neg_one = -1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700124#endif
125
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700126static int zero;
Linus Torvaldscd5f9a42009-04-06 13:38:46 -0700127static int __maybe_unused one = 1;
128static int __maybe_unused two = 2;
Petr Holasekcb16e952011-03-23 16:43:09 -0700129static int __maybe_unused three = 3;
Sven Wegenerfc3501d2009-02-11 13:04:23 -0800130static unsigned long one_ul = 1;
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700131static int one_hundred = 100;
Dave Youngaf913222009-09-22 16:43:33 -0700132#ifdef CONFIG_PRINTK
133static int ten_thousand = 10000;
134#endif
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700135
Andrea Righi9e4a5bd2009-04-30 15:08:57 -0700136/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
137static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
138
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
140static int maxolduid = 65535;
141static int minolduid;
Rohit Seth8ad4b1f2006-01-08 01:00:40 -0800142static int min_percpu_pagelist_fract = 8;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143
144static int ngroups_max = NGROUPS_MAX;
Dan Ballard73efc032011-10-31 17:11:20 -0700145static const int cap_last_cap = CAP_LAST_CAP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Liu Hua96f6aea2014-04-07 15:38:57 -0700147/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
148#ifdef CONFIG_DETECT_HUNG_TASK
149static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
150#endif
151
Dave Youngd14f1722010-02-25 20:28:57 -0500152#ifdef CONFIG_INOTIFY_USER
153#include <linux/inotify.h>
154#endif
David S. Miller72c57ed2008-09-11 23:29:54 -0700155#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#endif
157
David S. Miller08714202008-11-16 23:49:24 -0800158#ifdef CONFIG_SPARC64
159extern int sysctl_tsb_ratio;
160#endif
161
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162#ifdef __hppa__
163extern int pwrsw_enabled;
164extern int unaligned_enabled;
165#endif
166
Jes Sorensend2b176e2006-02-28 09:42:23 -0800167#ifdef CONFIG_IA64
168extern int no_unaligned_warning;
Doug Chapman88fc2412009-01-15 10:38:56 -0800169extern int unaligned_dump_stack;
Jes Sorensend2b176e2006-02-28 09:42:23 -0800170#endif
171
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700172#ifdef CONFIG_PROC_SYSCTL
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700173static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700174 void __user *buffer, size_t *lenp, loff_t *ppos);
Alexey Dobriyan8d65af72009-09-23 15:57:19 -0700175static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800176 void __user *buffer, size_t *lenp, loff_t *ppos);
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700177#endif
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700178
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700179#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -0700180static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -0700181 void __user *buffer, size_t *lenp, loff_t *ppos);
182#endif
183
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700184#ifdef CONFIG_MAGIC_SYSRQ
Andy Whitcroft8c6a98b2011-01-24 09:31:38 -0800185/* Note: sysrq code uses it's own private copy */
186static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700187
188static int sysrq_sysctl_handler(ctl_table *table, int write,
189 void __user *buffer, size_t *lenp,
190 loff_t *ppos)
191{
192 int error;
193
194 error = proc_dointvec(table, write, buffer, lenp, ppos);
195 if (error)
196 return error;
197
198 if (write)
199 sysrq_toggle_support(__sysrq_enabled);
200
201 return 0;
202}
203
204#endif
205
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700206static struct ctl_table kern_table[];
207static struct ctl_table vm_table[];
208static struct ctl_table fs_table[];
209static struct ctl_table debug_table[];
210static struct ctl_table dev_table[];
211extern struct ctl_table random_table[];
Davide Libenzi7ef99642008-12-01 13:13:55 -0800212#ifdef CONFIG_EPOLL
213extern struct ctl_table epoll_table[];
214#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215
216#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
217int sysctl_legacy_va_layout;
218#endif
219
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220/* The default sysctl tables: */
221
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -0800222static struct ctl_table sysctl_base_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 .procname = "kernel",
225 .mode = 0555,
226 .child = kern_table,
227 },
228 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229 .procname = "vm",
230 .mode = 0555,
231 .child = vm_table,
232 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 .procname = "fs",
235 .mode = 0555,
236 .child = fs_table,
237 },
238 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 .procname = "debug",
240 .mode = 0555,
241 .child = debug_table,
242 },
243 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244 .procname = "dev",
245 .mode = 0555,
246 .child = dev_table,
247 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -0700248 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249};
250
Ingo Molnar77e54a12007-07-09 18:52:00 +0200251#ifdef CONFIG_SCHED_DEBUG
Eric Dumazet73c4efd2007-12-18 15:21:13 +0100252static int min_sched_granularity_ns = 100000; /* 100 usecs */
253static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
254static int min_wakeup_granularity_ns; /* 0 usecs */
255static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100256static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE;
257static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1;
Ingo Molnar77e54a12007-07-09 18:52:00 +0200258#endif
259
Mel Gorman5e771902010-05-24 14:32:31 -0700260#ifdef CONFIG_COMPACTION
261static int min_extfrag_threshold;
262static int max_extfrag_threshold = 1000;
263#endif
264
Eric W. Biedermand8217f02007-10-18 03:05:22 -0700265static struct ctl_table kern_table[] = {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200266 {
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200267 .procname = "sched_child_runs_first",
268 .data = &sysctl_sched_child_runs_first,
269 .maxlen = sizeof(unsigned int),
270 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800271 .proc_handler = proc_dointvec,
Mike Galbraith2bba22c2009-09-09 15:41:37 +0200272 },
Steve Muckled448aba2012-10-24 15:00:20 -0700273 {
274 .procname = "sched_wake_to_idle",
275 .data = &sysctl_sched_wake_to_idle,
276 .maxlen = sizeof(unsigned int),
277 .mode = 0644,
278 .proc_handler = proc_dointvec,
279 },
Ingo Molnar77e54a12007-07-09 18:52:00 +0200280#ifdef CONFIG_SCHED_DEBUG
281 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100282 .procname = "sched_min_granularity_ns",
283 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200284 .maxlen = sizeof(unsigned int),
285 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800286 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100287 .extra1 = &min_sched_granularity_ns,
288 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200289 },
290 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200291 .procname = "sched_latency_ns",
292 .data = &sysctl_sched_latency,
293 .maxlen = sizeof(unsigned int),
294 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800295 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200296 .extra1 = &min_sched_granularity_ns,
297 .extra2 = &max_sched_granularity_ns,
298 },
299 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200300 .procname = "sched_wakeup_granularity_ns",
301 .data = &sysctl_sched_wakeup_granularity,
302 .maxlen = sizeof(unsigned int),
303 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800304 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200305 .extra1 = &min_wakeup_granularity_ns,
306 .extra2 = &max_wakeup_granularity_ns,
307 },
308 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100309 .procname = "sched_tunable_scaling",
310 .data = &sysctl_sched_tunable_scaling,
311 .maxlen = sizeof(enum sched_tunable_scaling),
312 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800313 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100314 .extra1 = &min_sched_tunable_scaling,
315 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200316 },
317 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200318 .procname = "sched_migration_cost",
319 .data = &sysctl_sched_migration_cost,
320 .maxlen = sizeof(unsigned int),
321 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800322 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200323 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100324 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100325 .procname = "sched_nr_migrate",
326 .data = &sysctl_sched_nr_migrate,
327 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100328 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800329 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100330 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530331 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200332 .procname = "sched_time_avg",
333 .data = &sysctl_sched_time_avg,
334 .maxlen = sizeof(unsigned int),
335 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800336 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200337 },
338 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800339 .procname = "sched_shares_window",
340 .data = &sysctl_sched_shares_window,
341 .maxlen = sizeof(unsigned int),
342 .mode = 0644,
343 .proc_handler = proc_dointvec,
344 },
345 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530346 .procname = "timer_migration",
347 .data = &sysctl_timer_migration,
348 .maxlen = sizeof(unsigned int),
349 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800350 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530351 .extra1 = &zero,
352 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530353 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200354#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200355 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100356 .procname = "sched_rt_period_us",
357 .data = &sysctl_sched_rt_period,
358 .maxlen = sizeof(unsigned int),
359 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800360 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100361 },
362 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100363 .procname = "sched_rt_runtime_us",
364 .data = &sysctl_sched_rt_runtime,
365 .maxlen = sizeof(int),
366 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800367 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100368 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100369#ifdef CONFIG_SCHED_AUTOGROUP
370 {
371 .procname = "sched_autogroup_enabled",
372 .data = &sysctl_sched_autogroup_enabled,
373 .maxlen = sizeof(unsigned int),
374 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800375 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100376 .extra1 = &zero,
377 .extra2 = &one,
378 },
379#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700380#ifdef CONFIG_CFS_BANDWIDTH
381 {
382 .procname = "sched_cfs_bandwidth_slice_us",
383 .data = &sysctl_sched_cfs_bandwidth_slice,
384 .maxlen = sizeof(unsigned int),
385 .mode = 0644,
386 .proc_handler = proc_dointvec_minmax,
387 .extra1 = &one,
388 },
389#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700390#ifdef CONFIG_PROVE_LOCKING
391 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700392 .procname = "prove_locking",
393 .data = &prove_locking,
394 .maxlen = sizeof(int),
395 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800396 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700397 },
398#endif
399#ifdef CONFIG_LOCK_STAT
400 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700401 .procname = "lock_stat",
402 .data = &lock_stat,
403 .maxlen = sizeof(int),
404 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800405 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700406 },
407#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200408 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 .procname = "panic",
410 .data = &panic_timeout,
411 .maxlen = sizeof(int),
412 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800413 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 },
415 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416 .procname = "core_uses_pid",
417 .data = &core_uses_pid,
418 .maxlen = sizeof(int),
419 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800420 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 },
422 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423 .procname = "core_pattern",
424 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700425 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800427 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 },
Neil Hormana2939802009-09-23 15:56:56 -0700429 {
Neil Hormana2939802009-09-23 15:56:56 -0700430 .procname = "core_pipe_limit",
431 .data = &core_pipe_limit,
432 .maxlen = sizeof(unsigned int),
433 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800434 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700435 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800436#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700439 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800440 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800441 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800443#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100444#ifdef CONFIG_LATENCYTOP
445 {
446 .procname = "latencytop",
447 .data = &latencytop_enabled,
448 .maxlen = sizeof(int),
449 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800450 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100451 },
452#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453#ifdef CONFIG_BLK_DEV_INITRD
454 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 .procname = "real-root-dev",
456 .data = &real_root_dev,
457 .maxlen = sizeof(int),
458 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800459 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 },
461#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700462 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700463 .procname = "print-fatal-signals",
464 .data = &print_fatal_signals,
465 .maxlen = sizeof(int),
466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800467 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700468 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700469#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 .procname = "reboot-cmd",
472 .data = reboot_command,
473 .maxlen = 256,
474 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800475 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 },
477 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 .procname = "stop-a",
479 .data = &stop_a_enabled,
480 .maxlen = sizeof (int),
481 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800482 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 },
484 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485 .procname = "scons-poweroff",
486 .data = &scons_pwroff,
487 .maxlen = sizeof (int),
488 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800489 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 },
491#endif
David S. Miller08714202008-11-16 23:49:24 -0800492#ifdef CONFIG_SPARC64
493 {
David S. Miller08714202008-11-16 23:49:24 -0800494 .procname = "tsb-ratio",
495 .data = &sysctl_tsb_ratio,
496 .maxlen = sizeof (int),
497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800499 },
500#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501#ifdef __hppa__
502 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503 .procname = "soft-power",
504 .data = &pwrsw_enabled,
505 .maxlen = sizeof (int),
506 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800507 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 },
509 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700510 .procname = "unaligned-trap",
511 .data = &unaligned_enabled,
512 .maxlen = sizeof (int),
513 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800514 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 },
516#endif
517 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 .procname = "ctrl-alt-del",
519 .data = &C_A_D,
520 .maxlen = sizeof(int),
521 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800522 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400524#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200525 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200526 .procname = "ftrace_enabled",
527 .data = &ftrace_enabled,
528 .maxlen = sizeof(int),
529 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800530 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200531 },
532#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500533#ifdef CONFIG_STACK_TRACER
534 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500535 .procname = "stack_tracer_enabled",
536 .data = &stack_tracer_enabled,
537 .maxlen = sizeof(int),
538 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800539 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500540 },
541#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400542#ifdef CONFIG_TRACING
543 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100544 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400545 .data = &ftrace_dump_on_oops,
546 .maxlen = sizeof(int),
547 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800548 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400549 },
550#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200551#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 .procname = "modprobe",
554 .data = &modprobe_path,
555 .maxlen = KMOD_PATH_LEN,
556 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800557 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558 },
Kees Cook3d433212009-04-02 15:49:29 -0700559 {
Kees Cook3d433212009-04-02 15:49:29 -0700560 .procname = "modules_disabled",
561 .data = &modules_disabled,
562 .maxlen = sizeof(int),
563 .mode = 0644,
564 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800565 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700566 .extra1 = &one,
567 .extra2 = &one,
568 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100570#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100573 .data = &uevent_helper,
574 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800576 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577 },
578#endif
579#ifdef CONFIG_CHR_DEV_SG
580 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 .procname = "sg-big-buff",
582 .data = &sg_big_buff,
583 .maxlen = sizeof (int),
584 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800585 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 },
587#endif
588#ifdef CONFIG_BSD_PROCESS_ACCT
589 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 .procname = "acct",
591 .data = &acct_parm,
592 .maxlen = 3*sizeof(int),
593 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800594 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 },
596#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597#ifdef CONFIG_MAGIC_SYSRQ
598 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800600 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 .maxlen = sizeof (int),
602 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700603 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700604 },
605#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700606#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700609 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 .maxlen = sizeof (int),
611 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800612 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700614#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616 .procname = "threads-max",
617 .data = &max_threads,
618 .maxlen = sizeof(int),
619 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800620 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621 },
622 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 .procname = "random",
624 .mode = 0555,
625 .child = random_table,
626 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627 {
Eric Paris17f60a72011-04-01 17:07:50 -0400628 .procname = "usermodehelper",
629 .mode = 0555,
630 .child = usermodehelper_table,
631 },
632 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633 .procname = "overflowuid",
634 .data = &overflowuid,
635 .maxlen = sizeof(int),
636 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800637 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638 .extra1 = &minolduid,
639 .extra2 = &maxolduid,
640 },
641 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 .procname = "overflowgid",
643 .data = &overflowgid,
644 .maxlen = sizeof(int),
645 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800646 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 .extra1 = &minolduid,
648 .extra2 = &maxolduid,
649 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800650#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651#ifdef CONFIG_MATHEMU
652 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653 .procname = "ieee_emulation_warnings",
654 .data = &sysctl_ieee_emulation_warnings,
655 .maxlen = sizeof(int),
656 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800657 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 },
659#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200662 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 .maxlen = sizeof(int),
664 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800665 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 },
667#endif
668 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .procname = "pid_max",
670 .data = &pid_max,
671 .maxlen = sizeof (int),
672 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800673 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 .extra1 = &pid_max_min,
675 .extra2 = &pid_max_max,
676 },
677 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 .procname = "panic_on_oops",
679 .data = &panic_on_oops,
680 .maxlen = sizeof(int),
681 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800682 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800684#if defined CONFIG_PRINTK
685 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800686 .procname = "printk",
687 .data = &console_loglevel,
688 .maxlen = 4*sizeof(int),
689 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800690 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800691 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700694 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695 .maxlen = sizeof(int),
696 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800697 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698 },
699 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700700 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700701 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 .maxlen = sizeof(int),
703 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800704 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705 },
Dave Youngaf913222009-09-22 16:43:33 -0700706 {
Dave Youngaf913222009-09-22 16:43:33 -0700707 .procname = "printk_delay",
708 .data = &printk_delay_msec,
709 .maxlen = sizeof(int),
710 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800711 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700712 .extra1 = &zero,
713 .extra2 = &ten_thousand,
714 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800716 .procname = "dmesg_restrict",
717 .data = &dmesg_restrict,
718 .maxlen = sizeof(int),
719 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700720 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800721 .extra1 = &zero,
722 .extra2 = &one,
723 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800724 {
725 .procname = "kptr_restrict",
726 .data = &kptr_restrict,
727 .maxlen = sizeof(int),
728 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700729 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800730 .extra1 = &zero,
731 .extra2 = &two,
732 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800733#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800734 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735 .procname = "ngroups_max",
736 .data = &ngroups_max,
737 .maxlen = sizeof (int),
738 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800739 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 },
Dan Ballard73efc032011-10-31 17:11:20 -0700741 {
742 .procname = "cap_last_cap",
743 .data = (void *)&cap_last_cap,
744 .maxlen = sizeof(int),
745 .mode = 0444,
746 .proc_handler = proc_dointvec,
747 },
Don Zickus58687ac2010-05-07 17:11:44 -0400748#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500749 {
Don Zickus58687ac2010-05-07 17:11:44 -0400750 .procname = "watchdog",
751 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500752 .maxlen = sizeof (int),
753 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700754 .proc_handler = proc_dowatchdog,
755 .extra1 = &zero,
756 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400757 },
758 {
759 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700760 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400761 .maxlen = sizeof(int),
762 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700763 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400764 .extra1 = &neg_one,
765 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500766 },
Don Zickus2508ce12010-05-07 17:11:46 -0400767 {
768 .procname = "softlockup_panic",
769 .data = &softlockup_panic,
770 .maxlen = sizeof(int),
771 .mode = 0644,
772 .proc_handler = proc_dointvec_minmax,
773 .extra1 = &zero,
774 .extra2 = &one,
775 },
Don Zickus5dc30552010-11-29 17:07:17 -0500776 {
777 .procname = "nmi_watchdog",
778 .data = &watchdog_enabled,
779 .maxlen = sizeof (int),
780 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700781 .proc_handler = proc_dowatchdog,
782 .extra1 = &zero,
783 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500784 },
785#endif
786#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
787 {
788 .procname = "unknown_nmi_panic",
789 .data = &unknown_nmi_panic,
790 .maxlen = sizeof (int),
791 .mode = 0644,
792 .proc_handler = proc_dointvec,
793 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500794#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795#if defined(CONFIG_X86)
796 {
Don Zickus8da5add2006-09-26 10:52:27 +0200797 .procname = "panic_on_unrecovered_nmi",
798 .data = &panic_on_unrecovered_nmi,
799 .maxlen = sizeof(int),
800 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800801 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200802 },
803 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700804 .procname = "panic_on_io_nmi",
805 .data = &panic_on_io_nmi,
806 .maxlen = sizeof(int),
807 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800808 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700809 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900810#ifdef CONFIG_DEBUG_STACKOVERFLOW
811 {
812 .procname = "panic_on_stackoverflow",
813 .data = &sysctl_panic_on_stackoverflow,
814 .maxlen = sizeof(int),
815 .mode = 0644,
816 .proc_handler = proc_dointvec,
817 },
818#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700819 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820 .procname = "bootloader_type",
821 .data = &bootloader_type,
822 .maxlen = sizeof (int),
823 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800824 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100826 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700827 .procname = "bootloader_version",
828 .data = &bootloader_version,
829 .maxlen = sizeof (int),
830 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800831 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700832 },
833 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100834 .procname = "kstack_depth_to_print",
835 .data = &kstack_depth_to_print,
836 .maxlen = sizeof(int),
837 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800838 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100839 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100840 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100841 .procname = "io_delay_type",
842 .data = &io_delay_type,
843 .maxlen = sizeof(int),
844 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800845 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100846 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800848#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850 .procname = "randomize_va_space",
851 .data = &randomize_va_space,
852 .maxlen = sizeof(int),
853 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800854 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800856#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800857#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700858 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700859 .procname = "spin_retry",
860 .data = &spin_retry,
861 .maxlen = sizeof (int),
862 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800863 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700864 },
865#endif
Len Brown673d5b42007-07-28 03:33:16 -0400866#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800867 {
Pavel Machekc255d842006-02-20 18:27:58 -0800868 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700869 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800870 .maxlen = sizeof (unsigned long),
871 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800872 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800873 },
874#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800875#ifdef CONFIG_IA64
876 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800877 .procname = "ignore-unaligned-usertrap",
878 .data = &no_unaligned_warning,
879 .maxlen = sizeof (int),
880 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800881 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800882 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800883 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800884 .procname = "unaligned-dump-stack",
885 .data = &unaligned_dump_stack,
886 .maxlen = sizeof (int),
887 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800888 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800889 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800890#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800891#ifdef CONFIG_DETECT_HUNG_TASK
892 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800893 .procname = "hung_task_panic",
894 .data = &sysctl_hung_task_panic,
895 .maxlen = sizeof(int),
896 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800897 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800898 .extra1 = &zero,
899 .extra2 = &one,
900 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100901 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100902 .procname = "hung_task_check_count",
903 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100904 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100905 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800906 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100907 },
908 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100909 .procname = "hung_task_timeout_secs",
910 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100911 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100912 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800913 .proc_handler = proc_dohung_task_timeout_secs,
Liu Hua96f6aea2014-04-07 15:38:57 -0700914 .extra2 = &hung_task_timeout_max,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100915 },
916 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100917 .procname = "hung_task_warnings",
918 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100919 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100920 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800921 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100922 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700923#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200924#ifdef CONFIG_COMPAT
925 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200926 .procname = "compat-log",
927 .data = &compat_log,
928 .maxlen = sizeof (int),
929 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800930 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200931 },
932#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700933#ifdef CONFIG_RT_MUTEXES
934 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700935 .procname = "max_lock_depth",
936 .data = &max_lock_depth,
937 .maxlen = sizeof(int),
938 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800939 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700940 },
941#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700942 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700943 .procname = "poweroff_cmd",
944 .data = &poweroff_cmd,
945 .maxlen = POWEROFF_CMD_PATH_LEN,
946 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800947 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700948 },
David Howells0b77f5b2008-04-29 01:01:32 -0700949#ifdef CONFIG_KEYS
950 {
David Howells0b77f5b2008-04-29 01:01:32 -0700951 .procname = "keys",
952 .mode = 0555,
953 .child = key_sysctls,
954 },
955#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700956#ifdef CONFIG_RCU_TORTURE_TEST
957 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700958 .procname = "rcutorture_runnable",
959 .data = &rcutorture_runnable,
960 .maxlen = sizeof(int),
961 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800962 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700963 },
964#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200965#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400966 /*
967 * User-space scripts rely on the existence of this file
968 * as a feature check for perf_events being enabled.
969 *
970 * So it's an ABI, do not remove!
971 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200972 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200973 .procname = "perf_event_paranoid",
974 .data = &sysctl_perf_event_paranoid,
975 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200976 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800977 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200978 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200979 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200980 .procname = "perf_event_mlock_kb",
981 .data = &sysctl_perf_event_mlock,
982 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200983 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800984 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200985 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200986 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200987 .procname = "perf_event_max_sample_rate",
988 .data = &sysctl_perf_event_sample_rate,
989 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200990 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +0100991 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +0200992 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200993#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +0200994#ifdef CONFIG_KMEMCHECK
995 {
Vegard Nossumdfec0722008-04-04 00:51:41 +0200996 .procname = "kmemcheck",
997 .data = &kmemcheck_enabled,
998 .maxlen = sizeof(int),
999 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001000 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +02001001 },
1002#endif
Jens Axboecb684b52009-09-15 21:53:11 +02001003#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +02001004 {
Jens Axboe5e605b62009-08-05 09:07:21 +02001005 .procname = "blk_iopoll",
1006 .data = &blk_iopoll_enabled,
1007 .maxlen = sizeof(int),
1008 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001009 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001010 },
Jens Axboecb684b52009-09-15 21:53:11 +02001011#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001012#ifdef CONFIG_ARM
1013 {
1014 .procname = "boot_reason",
1015 .data = &boot_reason,
1016 .maxlen = sizeof(int),
1017 .mode = 0444,
1018 .proc_handler = proc_dointvec,
1019},
1020#endif
1021/*
1022 * NOTE: do not add new entries to this table unless you have read
1023 * Documentation/sysctl/ctl_unnumbered.txt
1024 */
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001025 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001026};
1027
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001028static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001029 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001030 .procname = "overcommit_memory",
1031 .data = &sysctl_overcommit_memory,
1032 .maxlen = sizeof(sysctl_overcommit_memory),
1033 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001034 .proc_handler = proc_dointvec_minmax,
1035 .extra1 = &zero,
1036 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001037 },
1038 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001039 .procname = "panic_on_oom",
1040 .data = &sysctl_panic_on_oom,
1041 .maxlen = sizeof(sysctl_panic_on_oom),
1042 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001043 .proc_handler = proc_dointvec_minmax,
1044 .extra1 = &zero,
1045 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001046 },
1047 {
David Rientjesfe071d72007-10-16 23:25:56 -07001048 .procname = "oom_kill_allocating_task",
1049 .data = &sysctl_oom_kill_allocating_task,
1050 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1051 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001052 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001053 },
1054 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001055 .procname = "oom_dump_tasks",
1056 .data = &sysctl_oom_dump_tasks,
1057 .maxlen = sizeof(sysctl_oom_dump_tasks),
1058 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001059 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001060 },
1061 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001062 .procname = "overcommit_ratio",
1063 .data = &sysctl_overcommit_ratio,
1064 .maxlen = sizeof(sysctl_overcommit_ratio),
1065 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001066 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001067 },
1068 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001069 .procname = "page-cluster",
1070 .data = &page_cluster,
1071 .maxlen = sizeof(int),
1072 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001073 .proc_handler = proc_dointvec_minmax,
1074 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001075 },
1076 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 .procname = "dirty_background_ratio",
1078 .data = &dirty_background_ratio,
1079 .maxlen = sizeof(dirty_background_ratio),
1080 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001081 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001082 .extra1 = &zero,
1083 .extra2 = &one_hundred,
1084 },
1085 {
David Rientjes2da02992009-01-06 14:39:31 -08001086 .procname = "dirty_background_bytes",
1087 .data = &dirty_background_bytes,
1088 .maxlen = sizeof(dirty_background_bytes),
1089 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001090 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001091 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001092 },
1093 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001094 .procname = "dirty_ratio",
1095 .data = &vm_dirty_ratio,
1096 .maxlen = sizeof(vm_dirty_ratio),
1097 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001098 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099 .extra1 = &zero,
1100 .extra2 = &one_hundred,
1101 },
1102 {
David Rientjes2da02992009-01-06 14:39:31 -08001103 .procname = "dirty_bytes",
1104 .data = &vm_dirty_bytes,
1105 .maxlen = sizeof(vm_dirty_bytes),
1106 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001107 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001108 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001109 },
1110 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001111 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001112 .data = &dirty_writeback_interval,
1113 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001114 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001115 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 },
1117 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001119 .data = &dirty_expire_interval,
1120 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001122 .proc_handler = proc_dointvec_minmax,
1123 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001124 },
1125 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001126 .procname = "nr_pdflush_threads",
1127 .data = &nr_pdflush_threads,
1128 .maxlen = sizeof nr_pdflush_threads,
1129 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001130 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131 },
1132 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001133 .procname = "swappiness",
1134 .data = &vm_swappiness,
1135 .maxlen = sizeof(vm_swappiness),
1136 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001137 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 .extra1 = &zero,
1139 .extra2 = &one_hundred,
1140 },
1141#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001142 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001143 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001144 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001145 .maxlen = sizeof(unsigned long),
1146 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001147 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001148 .extra1 = (void *)&hugetlb_zero,
1149 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001150 },
1151#ifdef CONFIG_NUMA
1152 {
1153 .procname = "nr_hugepages_mempolicy",
1154 .data = NULL,
1155 .maxlen = sizeof(unsigned long),
1156 .mode = 0644,
1157 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1158 .extra1 = (void *)&hugetlb_zero,
1159 .extra2 = (void *)&hugetlb_infinity,
1160 },
1161#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163 .procname = "hugetlb_shm_group",
1164 .data = &sysctl_hugetlb_shm_group,
1165 .maxlen = sizeof(gid_t),
1166 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001167 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001168 },
Mel Gorman396faf02007-07-17 04:03:13 -07001169 {
Mel Gorman396faf02007-07-17 04:03:13 -07001170 .procname = "hugepages_treat_as_movable",
1171 .data = &hugepages_treat_as_movable,
1172 .maxlen = sizeof(int),
1173 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001174 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001175 },
Adam Litke54f9f802007-10-16 01:26:20 -07001176 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001177 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001178 .data = NULL,
1179 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001180 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001181 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001182 .extra1 = (void *)&hugetlb_zero,
1183 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001184 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001185#endif
1186 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001187 .procname = "lowmem_reserve_ratio",
1188 .data = &sysctl_lowmem_reserve_ratio,
1189 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1190 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001191 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001192 },
1193 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001194 .procname = "drop_caches",
1195 .data = &sysctl_drop_caches,
1196 .maxlen = sizeof(int),
1197 .mode = 0644,
1198 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001199 .extra1 = &one,
1200 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001201 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001202#ifdef CONFIG_COMPACTION
1203 {
1204 .procname = "compact_memory",
1205 .data = &sysctl_compact_memory,
1206 .maxlen = sizeof(int),
1207 .mode = 0200,
1208 .proc_handler = sysctl_compaction_handler,
1209 },
Mel Gorman5e771902010-05-24 14:32:31 -07001210 {
1211 .procname = "extfrag_threshold",
1212 .data = &sysctl_extfrag_threshold,
1213 .maxlen = sizeof(int),
1214 .mode = 0644,
1215 .proc_handler = sysctl_extfrag_handler,
1216 .extra1 = &min_extfrag_threshold,
1217 .extra2 = &max_extfrag_threshold,
1218 },
1219
Mel Gorman76ab0f52010-05-24 14:32:28 -07001220#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001222 .procname = "min_free_kbytes",
1223 .data = &min_free_kbytes,
1224 .maxlen = sizeof(min_free_kbytes),
1225 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001226 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001227 .extra1 = &zero,
1228 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001229 {
Rik van Riele13c80f2011-09-01 15:26:50 -04001230 .procname = "extra_free_kbytes",
1231 .data = &extra_free_kbytes,
1232 .maxlen = sizeof(extra_free_kbytes),
1233 .mode = 0644,
1234 .proc_handler = min_free_kbytes_sysctl_handler,
1235 .extra1 = &zero,
1236 },
1237 {
Arve Hjønnevågcde89492009-02-17 14:51:02 -08001238 .procname = "min_free_order_shift",
1239 .data = &min_free_order_shift,
1240 .maxlen = sizeof(min_free_order_shift),
1241 .mode = 0644,
1242 .proc_handler = &proc_dointvec
1243 },
1244 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001245 .procname = "percpu_pagelist_fraction",
1246 .data = &percpu_pagelist_fraction,
1247 .maxlen = sizeof(percpu_pagelist_fraction),
1248 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001249 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001250 .extra1 = &min_percpu_pagelist_fract,
1251 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001252#ifdef CONFIG_MMU
1253 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001254 .procname = "max_map_count",
1255 .data = &sysctl_max_map_count,
1256 .maxlen = sizeof(sysctl_max_map_count),
1257 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001258 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001259 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001260 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001261#else
1262 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001263 .procname = "nr_trim_pages",
1264 .data = &sysctl_nr_trim_pages,
1265 .maxlen = sizeof(sysctl_nr_trim_pages),
1266 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001267 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001268 .extra1 = &zero,
1269 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001270#endif
1271 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001272 .procname = "laptop_mode",
1273 .data = &laptop_mode,
1274 .maxlen = sizeof(laptop_mode),
1275 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001276 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001277 },
1278 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001279 .procname = "block_dump",
1280 .data = &block_dump,
1281 .maxlen = sizeof(block_dump),
1282 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001283 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001284 .extra1 = &zero,
1285 },
1286 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001287 .procname = "vfs_cache_pressure",
1288 .data = &sysctl_vfs_cache_pressure,
1289 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1290 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001291 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001292 .extra1 = &zero,
1293 },
1294#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1295 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001296 .procname = "legacy_va_layout",
1297 .data = &sysctl_legacy_va_layout,
1298 .maxlen = sizeof(sysctl_legacy_va_layout),
1299 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001300 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001301 .extra1 = &zero,
1302 },
1303#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001304#ifdef CONFIG_NUMA
1305 {
Christoph Lameter17436602006-01-18 17:42:32 -08001306 .procname = "zone_reclaim_mode",
1307 .data = &zone_reclaim_mode,
1308 .maxlen = sizeof(zone_reclaim_mode),
1309 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001310 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001311 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001312 },
Christoph Lameter96146342006-07-03 00:24:13 -07001313 {
Christoph Lameter96146342006-07-03 00:24:13 -07001314 .procname = "min_unmapped_ratio",
1315 .data = &sysctl_min_unmapped_ratio,
1316 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1317 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001318 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001319 .extra1 = &zero,
1320 .extra2 = &one_hundred,
1321 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001322 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001323 .procname = "min_slab_ratio",
1324 .data = &sysctl_min_slab_ratio,
1325 .maxlen = sizeof(sysctl_min_slab_ratio),
1326 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001327 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001328 .extra1 = &zero,
1329 .extra2 = &one_hundred,
1330 },
Christoph Lameter17436602006-01-18 17:42:32 -08001331#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001332#ifdef CONFIG_SMP
1333 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001334 .procname = "stat_interval",
1335 .data = &sysctl_stat_interval,
1336 .maxlen = sizeof(sysctl_stat_interval),
1337 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001338 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001339 },
1340#endif
David Howells6e141542009-12-15 19:27:45 +00001341#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001342 {
Eric Parised032182007-06-28 15:55:21 -04001343 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001344 .data = &dac_mmap_min_addr,
1345 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001346 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001347 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001348 },
David Howells6e141542009-12-15 19:27:45 +00001349#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001350#ifdef CONFIG_NUMA
1351 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001352 .procname = "numa_zonelist_order",
1353 .data = &numa_zonelist_order,
1354 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1355 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001356 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001357 },
1358#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001359#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001360 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001361 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001362 .procname = "vdso_enabled",
1363 .data = &vdso_enabled,
1364 .maxlen = sizeof(vdso_enabled),
1365 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001366 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001367 .extra1 = &zero,
1368 },
1369#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001370#ifdef CONFIG_HIGHMEM
1371 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001372 .procname = "highmem_is_dirtyable",
1373 .data = &vm_highmem_is_dirtyable,
1374 .maxlen = sizeof(vm_highmem_is_dirtyable),
1375 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001376 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001377 .extra1 = &zero,
1378 .extra2 = &one,
1379 },
1380#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001381 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001382 .procname = "scan_unevictable_pages",
1383 .data = &scan_unevictable_pages,
1384 .maxlen = sizeof(scan_unevictable_pages),
1385 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001386 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001387 },
Andi Kleen6a460792009-09-16 11:50:15 +02001388#ifdef CONFIG_MEMORY_FAILURE
1389 {
Andi Kleen6a460792009-09-16 11:50:15 +02001390 .procname = "memory_failure_early_kill",
1391 .data = &sysctl_memory_failure_early_kill,
1392 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1393 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001394 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001395 .extra1 = &zero,
1396 .extra2 = &one,
1397 },
1398 {
Andi Kleen6a460792009-09-16 11:50:15 +02001399 .procname = "memory_failure_recovery",
1400 .data = &sysctl_memory_failure_recovery,
1401 .maxlen = sizeof(sysctl_memory_failure_recovery),
1402 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001403 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001404 .extra1 = &zero,
1405 .extra2 = &one,
1406 },
1407#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001408 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001409};
1410
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001411#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001412static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001413 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001414};
1415#endif
1416
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001417static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001418 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001419 .procname = "inode-nr",
1420 .data = &inodes_stat,
1421 .maxlen = 2*sizeof(int),
1422 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001423 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001424 },
1425 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001426 .procname = "inode-state",
1427 .data = &inodes_stat,
1428 .maxlen = 7*sizeof(int),
1429 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001430 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001431 },
1432 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001433 .procname = "file-nr",
1434 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001435 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001436 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001437 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001438 },
1439 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440 .procname = "file-max",
1441 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001442 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001443 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001444 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001445 },
1446 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001447 .procname = "nr_open",
1448 .data = &sysctl_nr_open,
1449 .maxlen = sizeof(int),
1450 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001451 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001452 .extra1 = &sysctl_nr_open_min,
1453 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001454 },
1455 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001456 .procname = "dentry-state",
1457 .data = &dentry_stat,
1458 .maxlen = 6*sizeof(int),
1459 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001460 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001461 },
1462 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001463 .procname = "overflowuid",
1464 .data = &fs_overflowuid,
1465 .maxlen = sizeof(int),
1466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001467 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001468 .extra1 = &minolduid,
1469 .extra2 = &maxolduid,
1470 },
1471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 .procname = "overflowgid",
1473 .data = &fs_overflowgid,
1474 .maxlen = sizeof(int),
1475 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001476 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001477 .extra1 = &minolduid,
1478 .extra2 = &maxolduid,
1479 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001480#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001481 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001482 .procname = "leases-enable",
1483 .data = &leases_enable,
1484 .maxlen = sizeof(int),
1485 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001486 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001487 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001488#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001489#ifdef CONFIG_DNOTIFY
1490 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001491 .procname = "dir-notify-enable",
1492 .data = &dir_notify_enable,
1493 .maxlen = sizeof(int),
1494 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001495 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001496 },
1497#endif
1498#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001499#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001500 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001501 .procname = "lease-break-time",
1502 .data = &lease_break_time,
1503 .maxlen = sizeof(int),
1504 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001505 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001506 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001507#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001508#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001509 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001510 .procname = "aio-nr",
1511 .data = &aio_nr,
1512 .maxlen = sizeof(aio_nr),
1513 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001514 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001515 },
1516 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001517 .procname = "aio-max-nr",
1518 .data = &aio_max_nr,
1519 .maxlen = sizeof(aio_max_nr),
1520 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001521 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001522 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001523#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001524#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001525 {
Robert Love0399cb02005-07-13 12:38:18 -04001526 .procname = "inotify",
1527 .mode = 0555,
1528 .child = inotify_table,
1529 },
1530#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001531#ifdef CONFIG_EPOLL
1532 {
1533 .procname = "epoll",
1534 .mode = 0555,
1535 .child = epoll_table,
1536 },
1537#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001539 {
Alan Coxd6e71142005-06-23 00:09:43 -07001540 .procname = "suid_dumpable",
1541 .data = &suid_dumpable,
1542 .maxlen = sizeof(int),
1543 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001544 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001545 .extra1 = &zero,
1546 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001547 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001548#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1549 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001550 .procname = "binfmt_misc",
1551 .mode = 0555,
1552 .child = binfmt_misc_table,
1553 },
1554#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001555 {
Jens Axboeff9da692010-06-03 14:54:39 +02001556 .procname = "pipe-max-size",
1557 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001558 .maxlen = sizeof(int),
1559 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001560 .proc_handler = &pipe_proc_fn,
1561 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001562 },
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 debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001567#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001568 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001569 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001570 .procname = "exception-trace",
1571 .data = &show_unhandled_signals,
1572 .maxlen = sizeof(int),
1573 .mode = 0644,
1574 .proc_handler = proc_dointvec
1575 },
1576#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001577#if defined(CONFIG_OPTPROBES)
1578 {
1579 .procname = "kprobes-optimization",
1580 .data = &sysctl_kprobes_optimization,
1581 .maxlen = sizeof(int),
1582 .mode = 0644,
1583 .proc_handler = proc_kprobes_optimization_handler,
1584 .extra1 = &zero,
1585 .extra2 = &one,
1586 },
1587#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001588 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001589};
1590
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001591static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001592 { }
Robert Love0eeca282005-07-12 17:06:03 -04001593};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001594
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001595int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001596{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001597 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001598 return 0;
1599}
1600
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001601#endif /* CONFIG_SYSCTL */
1602
Linus Torvalds1da177e2005-04-16 15:20:36 -07001603/*
1604 * /proc/sys support
1605 */
1606
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001607#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001608
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001609static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001610 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001611 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001612{
1613 size_t len;
1614 char __user *p;
1615 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001616
1617 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001618 *lenp = 0;
1619 return 0;
1620 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001621
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001622 if (write) {
1623 len = 0;
1624 p = buffer;
1625 while (len < *lenp) {
1626 if (get_user(c, p++))
1627 return -EFAULT;
1628 if (c == 0 || c == '\n')
1629 break;
1630 len++;
1631 }
1632 if (len >= maxlen)
1633 len = maxlen-1;
1634 if(copy_from_user(data, buffer, len))
1635 return -EFAULT;
1636 ((char *) data)[len] = 0;
1637 *ppos += *lenp;
1638 } else {
1639 len = strlen(data);
1640 if (len > maxlen)
1641 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001642
1643 if (*ppos > len) {
1644 *lenp = 0;
1645 return 0;
1646 }
1647
1648 data += *ppos;
1649 len -= *ppos;
1650
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001651 if (len > *lenp)
1652 len = *lenp;
1653 if (len)
1654 if(copy_to_user(buffer, data, len))
1655 return -EFAULT;
1656 if (len < *lenp) {
1657 if(put_user('\n', ((char __user *) buffer) + len))
1658 return -EFAULT;
1659 len++;
1660 }
1661 *lenp = len;
1662 *ppos += len;
1663 }
1664 return 0;
1665}
1666
Linus Torvalds1da177e2005-04-16 15:20:36 -07001667/**
1668 * proc_dostring - read a string sysctl
1669 * @table: the sysctl table
1670 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001671 * @buffer: the user buffer
1672 * @lenp: the size of the user buffer
1673 * @ppos: file position
1674 *
1675 * Reads/writes a string from/to the user buffer. If the kernel
1676 * buffer provided is not large enough to hold the string, the
1677 * string is truncated. The copied string is %NULL-terminated.
1678 * If the string is being read by the user process, it is copied
1679 * and a newline '\n' is added. It is truncated if the buffer is
1680 * not large enough.
1681 *
1682 * Returns 0 on success.
1683 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001684int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001685 void __user *buffer, size_t *lenp, loff_t *ppos)
1686{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001687 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001688 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001689}
1690
Amerigo Wang00b7c332010-05-05 00:26:45 +00001691static size_t proc_skip_spaces(char **buf)
1692{
1693 size_t ret;
1694 char *tmp = skip_spaces(*buf);
1695 ret = tmp - *buf;
1696 *buf = tmp;
1697 return ret;
1698}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001699
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001700static void proc_skip_char(char **buf, size_t *size, const char v)
1701{
1702 while (*size) {
1703 if (**buf != v)
1704 break;
1705 (*size)--;
1706 (*buf)++;
1707 }
1708}
1709
Amerigo Wang00b7c332010-05-05 00:26:45 +00001710#define TMPBUFLEN 22
1711/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001712 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001713 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001714 * @buf: a kernel buffer
1715 * @size: size of the kernel buffer
1716 * @val: this is where the number will be stored
1717 * @neg: set to %TRUE if number is negative
1718 * @perm_tr: a vector which contains the allowed trailers
1719 * @perm_tr_len: size of the perm_tr vector
1720 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001721 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001722 * In case of success %0 is returned and @buf and @size are updated with
1723 * the amount of bytes read. If @tr is non-NULL and a trailing
1724 * character exists (size is non-zero after returning from this
1725 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001726 */
1727static int proc_get_long(char **buf, size_t *size,
1728 unsigned long *val, bool *neg,
1729 const char *perm_tr, unsigned perm_tr_len, char *tr)
1730{
1731 int len;
1732 char *p, tmp[TMPBUFLEN];
1733
1734 if (!*size)
1735 return -EINVAL;
1736
1737 len = *size;
1738 if (len > TMPBUFLEN - 1)
1739 len = TMPBUFLEN - 1;
1740
1741 memcpy(tmp, *buf, len);
1742
1743 tmp[len] = 0;
1744 p = tmp;
1745 if (*p == '-' && *size > 1) {
1746 *neg = true;
1747 p++;
1748 } else
1749 *neg = false;
1750 if (!isdigit(*p))
1751 return -EINVAL;
1752
1753 *val = simple_strtoul(p, &p, 0);
1754
1755 len = p - tmp;
1756
1757 /* We don't know if the next char is whitespace thus we may accept
1758 * invalid integers (e.g. 1234...a) or two integers instead of one
1759 * (e.g. 123...1). So lets not allow such large numbers. */
1760 if (len == TMPBUFLEN - 1)
1761 return -EINVAL;
1762
1763 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1764 return -EINVAL;
1765
1766 if (tr && (len < *size))
1767 *tr = *p;
1768
1769 *buf += len;
1770 *size -= len;
1771
1772 return 0;
1773}
1774
1775/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001776 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001777 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001778 * @buf: the user buffer
1779 * @size: the size of the user buffer
1780 * @val: the integer to be converted
1781 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001782 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001783 * In case of success %0 is returned and @buf and @size are updated with
1784 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001785 */
1786static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1787 bool neg)
1788{
1789 int len;
1790 char tmp[TMPBUFLEN], *p = tmp;
1791
1792 sprintf(p, "%s%lu", neg ? "-" : "", val);
1793 len = strlen(tmp);
1794 if (len > *size)
1795 len = *size;
1796 if (copy_to_user(*buf, tmp, len))
1797 return -EFAULT;
1798 *size -= len;
1799 *buf += len;
1800 return 0;
1801}
1802#undef TMPBUFLEN
1803
1804static int proc_put_char(void __user **buf, size_t *size, char c)
1805{
1806 if (*size) {
1807 char __user **buffer = (char __user **)buf;
1808 if (put_user(c, *buffer))
1809 return -EFAULT;
1810 (*size)--, (*buffer)++;
1811 *buf = *buffer;
1812 }
1813 return 0;
1814}
1815
1816static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001817 int *valp,
1818 int write, void *data)
1819{
1820 if (write) {
1821 *valp = *negp ? -*lvalp : *lvalp;
1822 } else {
1823 int val = *valp;
1824 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001825 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826 *lvalp = (unsigned long)-val;
1827 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001828 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001829 *lvalp = (unsigned long)val;
1830 }
1831 }
1832 return 0;
1833}
1834
Amerigo Wang00b7c332010-05-05 00:26:45 +00001835static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1836
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001837static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001838 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001839 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001840 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001841 int write, void *data),
1842 void *data)
1843{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001844 int *i, vleft, first = 1, err = 0;
1845 unsigned long page = 0;
1846 size_t left;
1847 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001848
Amerigo Wang00b7c332010-05-05 00:26:45 +00001849 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001850 *lenp = 0;
1851 return 0;
1852 }
1853
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001854 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001855 vleft = table->maxlen / sizeof(*i);
1856 left = *lenp;
1857
1858 if (!conv)
1859 conv = do_proc_dointvec_conv;
1860
Linus Torvalds1da177e2005-04-16 15:20:36 -07001861 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001862 if (left > PAGE_SIZE - 1)
1863 left = PAGE_SIZE - 1;
1864 page = __get_free_page(GFP_TEMPORARY);
1865 kbuf = (char *) page;
1866 if (!kbuf)
1867 return -ENOMEM;
1868 if (copy_from_user(kbuf, buffer, left)) {
1869 err = -EFAULT;
1870 goto free;
1871 }
1872 kbuf[left] = 0;
1873 }
1874
1875 for (; left && vleft--; i++, first=0) {
1876 unsigned long lval;
1877 bool neg;
1878
1879 if (write) {
1880 left -= proc_skip_spaces(&kbuf);
1881
J. R. Okajima563b0462010-05-25 16:10:14 -07001882 if (!left)
1883 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001884 err = proc_get_long(&kbuf, &left, &lval, &neg,
1885 proc_wspace_sep,
1886 sizeof(proc_wspace_sep), NULL);
1887 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001888 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001889 if (conv(&neg, &lval, i, 1, data)) {
1890 err = -EINVAL;
1891 break;
1892 }
1893 } else {
1894 if (conv(&neg, &lval, i, 0, data)) {
1895 err = -EINVAL;
1896 break;
1897 }
1898 if (!first)
1899 err = proc_put_char(&buffer, &left, '\t');
1900 if (err)
1901 break;
1902 err = proc_put_long(&buffer, &left, lval, neg);
1903 if (err)
1904 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001905 }
1906 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001907
1908 if (!write && !first && left && !err)
1909 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001910 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001911 left -= proc_skip_spaces(&kbuf);
1912free:
1913 if (write) {
1914 free_page(page);
1915 if (first)
1916 return err ? : -EINVAL;
1917 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001918 *lenp -= left;
1919 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001920 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001921}
1922
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001923static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001924 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001925 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001926 int write, void *data),
1927 void *data)
1928{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001929 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001930 buffer, lenp, ppos, conv, data);
1931}
1932
Linus Torvalds1da177e2005-04-16 15:20:36 -07001933/**
1934 * proc_dointvec - read a vector of integers
1935 * @table: the sysctl table
1936 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001937 * @buffer: the user buffer
1938 * @lenp: the size of the user buffer
1939 * @ppos: file position
1940 *
1941 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1942 * values from/to the user buffer, treated as an ASCII string.
1943 *
1944 * Returns 0 on success.
1945 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001946int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001947 void __user *buffer, size_t *lenp, loff_t *ppos)
1948{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001949 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001950 NULL,NULL);
1951}
1952
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001953/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001954 * Taint values can only be increased
1955 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001956 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001957static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001958 void __user *buffer, size_t *lenp, loff_t *ppos)
1959{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001960 struct ctl_table t;
1961 unsigned long tmptaint = get_taint();
1962 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001963
Bastian Blank91fcd412007-04-23 14:41:14 -07001964 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001965 return -EPERM;
1966
Andi Kleen25ddbb12008-10-15 22:01:41 -07001967 t = *table;
1968 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001969 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07001970 if (err < 0)
1971 return err;
1972
1973 if (write) {
1974 /*
1975 * Poor man's atomic or. Not worth adding a primitive
1976 * to everyone's atomic.h for this
1977 */
1978 int i;
1979 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
1980 if ((tmptaint >> i) & 1)
1981 add_taint(i);
1982 }
1983 }
1984
1985 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001986}
1987
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001988#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07001989static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07001990 void __user *buffer, size_t *lenp, loff_t *ppos)
1991{
1992 if (write && !capable(CAP_SYS_ADMIN))
1993 return -EPERM;
1994
1995 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
1996}
1997#endif
1998
Linus Torvalds1da177e2005-04-16 15:20:36 -07001999struct do_proc_dointvec_minmax_conv_param {
2000 int *min;
2001 int *max;
2002};
2003
Amerigo Wang00b7c332010-05-05 00:26:45 +00002004static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2005 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002006 int write, void *data)
2007{
2008 struct do_proc_dointvec_minmax_conv_param *param = data;
2009 if (write) {
2010 int val = *negp ? -*lvalp : *lvalp;
2011 if ((param->min && *param->min > val) ||
2012 (param->max && *param->max < val))
2013 return -EINVAL;
2014 *valp = val;
2015 } else {
2016 int val = *valp;
2017 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002018 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002019 *lvalp = (unsigned long)-val;
2020 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002021 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002022 *lvalp = (unsigned long)val;
2023 }
2024 }
2025 return 0;
2026}
2027
2028/**
2029 * proc_dointvec_minmax - read a vector of integers with min/max values
2030 * @table: the sysctl table
2031 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002032 * @buffer: the user buffer
2033 * @lenp: the size of the user buffer
2034 * @ppos: file position
2035 *
2036 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2037 * values from/to the user buffer, treated as an ASCII string.
2038 *
2039 * This routine will ensure the values are within the range specified by
2040 * table->extra1 (min) and table->extra2 (max).
2041 *
2042 * Returns 0 on success.
2043 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002044int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002045 void __user *buffer, size_t *lenp, loff_t *ppos)
2046{
2047 struct do_proc_dointvec_minmax_conv_param param = {
2048 .min = (int *) table->extra1,
2049 .max = (int *) table->extra2,
2050 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002051 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002052 do_proc_dointvec_minmax_conv, &param);
2053}
2054
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002055static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002056 void __user *buffer,
2057 size_t *lenp, loff_t *ppos,
2058 unsigned long convmul,
2059 unsigned long convdiv)
2060{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002061 unsigned long *i, *min, *max;
2062 int vleft, first = 1, err = 0;
2063 unsigned long page = 0;
2064 size_t left;
2065 char *kbuf;
2066
2067 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002068 *lenp = 0;
2069 return 0;
2070 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002071
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002072 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002073 min = (unsigned long *) table->extra1;
2074 max = (unsigned long *) table->extra2;
2075 vleft = table->maxlen / sizeof(unsigned long);
2076 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002077
2078 if (write) {
2079 if (left > PAGE_SIZE - 1)
2080 left = PAGE_SIZE - 1;
2081 page = __get_free_page(GFP_TEMPORARY);
2082 kbuf = (char *) page;
2083 if (!kbuf)
2084 return -ENOMEM;
2085 if (copy_from_user(kbuf, buffer, left)) {
2086 err = -EFAULT;
2087 goto free;
2088 }
2089 kbuf[left] = 0;
2090 }
2091
Eric Dumazet27b3d802010-10-07 12:59:29 -07002092 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002093 unsigned long val;
2094
Linus Torvalds1da177e2005-04-16 15:20:36 -07002095 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002096 bool neg;
2097
2098 left -= proc_skip_spaces(&kbuf);
2099
2100 err = proc_get_long(&kbuf, &left, &val, &neg,
2101 proc_wspace_sep,
2102 sizeof(proc_wspace_sep), NULL);
2103 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002104 break;
2105 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002106 continue;
2107 if ((min && val < *min) || (max && val > *max))
2108 continue;
2109 *i = val;
2110 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002111 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002112 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002113 err = proc_put_char(&buffer, &left, '\t');
2114 err = proc_put_long(&buffer, &left, val, false);
2115 if (err)
2116 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002117 }
2118 }
2119
Amerigo Wang00b7c332010-05-05 00:26:45 +00002120 if (!write && !first && left && !err)
2121 err = proc_put_char(&buffer, &left, '\n');
2122 if (write && !err)
2123 left -= proc_skip_spaces(&kbuf);
2124free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002125 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002126 free_page(page);
2127 if (first)
2128 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002129 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002130 *lenp -= left;
2131 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002132 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002133}
2134
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002135static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002136 void __user *buffer,
2137 size_t *lenp, loff_t *ppos,
2138 unsigned long convmul,
2139 unsigned long convdiv)
2140{
2141 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002142 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002143}
2144
Linus Torvalds1da177e2005-04-16 15:20:36 -07002145/**
2146 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2147 * @table: the sysctl table
2148 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002149 * @buffer: the user buffer
2150 * @lenp: the size of the user buffer
2151 * @ppos: file position
2152 *
2153 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2154 * values from/to the user buffer, treated as an ASCII string.
2155 *
2156 * This routine will ensure the values are within the range specified by
2157 * table->extra1 (min) and table->extra2 (max).
2158 *
2159 * Returns 0 on success.
2160 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002161int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002162 void __user *buffer, size_t *lenp, loff_t *ppos)
2163{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002164 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002165}
2166
2167/**
2168 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2169 * @table: the sysctl table
2170 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002171 * @buffer: the user buffer
2172 * @lenp: the size of the user buffer
2173 * @ppos: file position
2174 *
2175 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2176 * values from/to the user buffer, treated as an ASCII string. The values
2177 * are treated as milliseconds, and converted to jiffies when they are stored.
2178 *
2179 * This routine will ensure the values are within the range specified by
2180 * table->extra1 (min) and table->extra2 (max).
2181 *
2182 * Returns 0 on success.
2183 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002184int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002185 void __user *buffer,
2186 size_t *lenp, loff_t *ppos)
2187{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002188 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002189 lenp, ppos, HZ, 1000l);
2190}
2191
2192
Amerigo Wang00b7c332010-05-05 00:26:45 +00002193static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002194 int *valp,
2195 int write, void *data)
2196{
2197 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002198 if (*lvalp > LONG_MAX / HZ)
2199 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002200 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2201 } else {
2202 int val = *valp;
2203 unsigned long lval;
2204 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002205 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002206 lval = (unsigned long)-val;
2207 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002208 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002209 lval = (unsigned long)val;
2210 }
2211 *lvalp = lval / HZ;
2212 }
2213 return 0;
2214}
2215
Amerigo Wang00b7c332010-05-05 00:26:45 +00002216static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002217 int *valp,
2218 int write, void *data)
2219{
2220 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002221 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2222 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002223 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2224 } else {
2225 int val = *valp;
2226 unsigned long lval;
2227 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002228 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002229 lval = (unsigned long)-val;
2230 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002231 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002232 lval = (unsigned long)val;
2233 }
2234 *lvalp = jiffies_to_clock_t(lval);
2235 }
2236 return 0;
2237}
2238
Amerigo Wang00b7c332010-05-05 00:26:45 +00002239static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002240 int *valp,
2241 int write, void *data)
2242{
2243 if (write) {
2244 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2245 } else {
2246 int val = *valp;
2247 unsigned long lval;
2248 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002249 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002250 lval = (unsigned long)-val;
2251 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002252 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002253 lval = (unsigned long)val;
2254 }
2255 *lvalp = jiffies_to_msecs(lval);
2256 }
2257 return 0;
2258}
2259
2260/**
2261 * proc_dointvec_jiffies - read a vector of integers as seconds
2262 * @table: the sysctl table
2263 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002264 * @buffer: the user buffer
2265 * @lenp: the size of the user buffer
2266 * @ppos: file position
2267 *
2268 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2269 * values from/to the user buffer, treated as an ASCII string.
2270 * The values read are assumed to be in seconds, and are converted into
2271 * jiffies.
2272 *
2273 * Returns 0 on success.
2274 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002275int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002276 void __user *buffer, size_t *lenp, loff_t *ppos)
2277{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002278 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002279 do_proc_dointvec_jiffies_conv,NULL);
2280}
2281
2282/**
2283 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2284 * @table: the sysctl table
2285 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002286 * @buffer: the user buffer
2287 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002288 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002289 *
2290 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2291 * values from/to the user buffer, treated as an ASCII string.
2292 * The values read are assumed to be in 1/USER_HZ seconds, and
2293 * are converted into jiffies.
2294 *
2295 * Returns 0 on success.
2296 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002297int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002298 void __user *buffer, size_t *lenp, loff_t *ppos)
2299{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002300 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002301 do_proc_dointvec_userhz_jiffies_conv,NULL);
2302}
2303
2304/**
2305 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2306 * @table: the sysctl table
2307 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002308 * @buffer: the user buffer
2309 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002310 * @ppos: file position
2311 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002312 *
2313 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2314 * values from/to the user buffer, treated as an ASCII string.
2315 * The values read are assumed to be in 1/1000 seconds, and
2316 * are converted into jiffies.
2317 *
2318 * Returns 0 on success.
2319 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002320int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002321 void __user *buffer, size_t *lenp, loff_t *ppos)
2322{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002323 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002324 do_proc_dointvec_ms_jiffies_conv, NULL);
2325}
2326
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002327static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002328 void __user *buffer, size_t *lenp, loff_t *ppos)
2329{
2330 struct pid *new_pid;
2331 pid_t tmp;
2332 int r;
2333
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002334 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002335
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002336 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002337 lenp, ppos, NULL, NULL);
2338 if (r || !write)
2339 return r;
2340
2341 new_pid = find_get_pid(tmp);
2342 if (!new_pid)
2343 return -ESRCH;
2344
2345 put_pid(xchg(&cad_pid, new_pid));
2346 return 0;
2347}
2348
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002349/**
2350 * proc_do_large_bitmap - read/write from/to a large bitmap
2351 * @table: the sysctl table
2352 * @write: %TRUE if this is a write to the sysctl file
2353 * @buffer: the user buffer
2354 * @lenp: the size of the user buffer
2355 * @ppos: file position
2356 *
2357 * The bitmap is stored at table->data and the bitmap length (in bits)
2358 * in table->maxlen.
2359 *
2360 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2361 * large bitmaps may be represented in a compact manner. Writing into
2362 * the file will clear the bitmap then update it with the given input.
2363 *
2364 * Returns 0 on success.
2365 */
2366int proc_do_large_bitmap(struct ctl_table *table, int write,
2367 void __user *buffer, size_t *lenp, loff_t *ppos)
2368{
2369 int err = 0;
2370 bool first = 1;
2371 size_t left = *lenp;
2372 unsigned long bitmap_len = table->maxlen;
2373 unsigned long *bitmap = (unsigned long *) table->data;
2374 unsigned long *tmp_bitmap = NULL;
2375 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2376
2377 if (!bitmap_len || !left || (*ppos && !write)) {
2378 *lenp = 0;
2379 return 0;
2380 }
2381
2382 if (write) {
2383 unsigned long page = 0;
2384 char *kbuf;
2385
2386 if (left > PAGE_SIZE - 1)
2387 left = PAGE_SIZE - 1;
2388
2389 page = __get_free_page(GFP_TEMPORARY);
2390 kbuf = (char *) page;
2391 if (!kbuf)
2392 return -ENOMEM;
2393 if (copy_from_user(kbuf, buffer, left)) {
2394 free_page(page);
2395 return -EFAULT;
2396 }
2397 kbuf[left] = 0;
2398
2399 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2400 GFP_KERNEL);
2401 if (!tmp_bitmap) {
2402 free_page(page);
2403 return -ENOMEM;
2404 }
2405 proc_skip_char(&kbuf, &left, '\n');
2406 while (!err && left) {
2407 unsigned long val_a, val_b;
2408 bool neg;
2409
2410 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2411 sizeof(tr_a), &c);
2412 if (err)
2413 break;
2414 if (val_a >= bitmap_len || neg) {
2415 err = -EINVAL;
2416 break;
2417 }
2418
2419 val_b = val_a;
2420 if (left) {
2421 kbuf++;
2422 left--;
2423 }
2424
2425 if (c == '-') {
2426 err = proc_get_long(&kbuf, &left, &val_b,
2427 &neg, tr_b, sizeof(tr_b),
2428 &c);
2429 if (err)
2430 break;
2431 if (val_b >= bitmap_len || neg ||
2432 val_a > val_b) {
2433 err = -EINVAL;
2434 break;
2435 }
2436 if (left) {
2437 kbuf++;
2438 left--;
2439 }
2440 }
2441
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002442 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002443 first = 0;
2444 proc_skip_char(&kbuf, &left, '\n');
2445 }
2446 free_page(page);
2447 } else {
2448 unsigned long bit_a, bit_b = 0;
2449
2450 while (left) {
2451 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2452 if (bit_a >= bitmap_len)
2453 break;
2454 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2455 bit_a + 1) - 1;
2456
2457 if (!first) {
2458 err = proc_put_char(&buffer, &left, ',');
2459 if (err)
2460 break;
2461 }
2462 err = proc_put_long(&buffer, &left, bit_a, false);
2463 if (err)
2464 break;
2465 if (bit_a != bit_b) {
2466 err = proc_put_char(&buffer, &left, '-');
2467 if (err)
2468 break;
2469 err = proc_put_long(&buffer, &left, bit_b, false);
2470 if (err)
2471 break;
2472 }
2473
2474 first = 0; bit_b++;
2475 }
2476 if (!err)
2477 err = proc_put_char(&buffer, &left, '\n');
2478 }
2479
2480 if (!err) {
2481 if (write) {
2482 if (*ppos)
2483 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2484 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002485 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002486 }
2487 kfree(tmp_bitmap);
2488 *lenp -= left;
2489 *ppos += *lenp;
2490 return 0;
2491 } else {
2492 kfree(tmp_bitmap);
2493 return err;
2494 }
2495}
2496
Jovi Zhang55610502011-01-12 17:00:45 -08002497#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002498
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002499int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002500 void __user *buffer, size_t *lenp, loff_t *ppos)
2501{
2502 return -ENOSYS;
2503}
2504
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002505int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002506 void __user *buffer, size_t *lenp, loff_t *ppos)
2507{
2508 return -ENOSYS;
2509}
2510
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002511int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002512 void __user *buffer, size_t *lenp, loff_t *ppos)
2513{
2514 return -ENOSYS;
2515}
2516
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002517int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002518 void __user *buffer, size_t *lenp, loff_t *ppos)
2519{
2520 return -ENOSYS;
2521}
2522
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002523int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002524 void __user *buffer, size_t *lenp, loff_t *ppos)
2525{
2526 return -ENOSYS;
2527}
2528
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002529int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002530 void __user *buffer, size_t *lenp, loff_t *ppos)
2531{
2532 return -ENOSYS;
2533}
2534
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002535int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002536 void __user *buffer, size_t *lenp, loff_t *ppos)
2537{
2538 return -ENOSYS;
2539}
2540
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002541int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002542 void __user *buffer,
2543 size_t *lenp, loff_t *ppos)
2544{
2545 return -ENOSYS;
2546}
2547
2548
Jovi Zhang55610502011-01-12 17:00:45 -08002549#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002550
Linus Torvalds1da177e2005-04-16 15:20:36 -07002551/*
2552 * No sense putting this after each symbol definition, twice,
2553 * exception granted :-)
2554 */
2555EXPORT_SYMBOL(proc_dointvec);
2556EXPORT_SYMBOL(proc_dointvec_jiffies);
2557EXPORT_SYMBOL(proc_dointvec_minmax);
2558EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2559EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2560EXPORT_SYMBOL(proc_dostring);
2561EXPORT_SYMBOL(proc_doulongvec_minmax);
2562EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);