blob: 0fd5fa2de26e7442fe7899dd770cfe5afb8bab5c [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 },
Srivatsa Vaddagiriaa14be32014-03-29 16:56:45 -0700280#ifdef CONFIG_SCHED_FREQ_INPUT
Srivatsa Vaddagiri889de8f2014-01-06 16:24:48 -0800281 {
Srivatsa Vaddagirif906ba02014-03-29 11:40:16 -0700282 .procname = "sched_window_stats_policy",
283 .data = &sysctl_sched_window_stats_policy,
284 .maxlen = sizeof(unsigned int),
285 .mode = 0644,
286 .proc_handler = proc_dointvec,
287 },
288 {
Rohit Gupta1bd9e1f2014-03-13 20:54:47 -0700289 .procname = "sched_wakeup_load_threshold",
290 .data = &sysctl_sched_wakeup_load_threshold,
291 .maxlen = sizeof(unsigned int),
292 .mode = 0644,
293 .proc_handler = proc_dointvec,
294 },
Srivatsa Vaddagiriaa14be32014-03-29 16:56:45 -0700295#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200296#ifdef CONFIG_SCHED_DEBUG
297 {
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100298 .procname = "sched_min_granularity_ns",
299 .data = &sysctl_sched_min_granularity,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200300 .maxlen = sizeof(unsigned int),
301 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800302 .proc_handler = sched_proc_update_handler,
Peter Zijlstrab2be5e92007-11-09 22:39:37 +0100303 .extra1 = &min_sched_granularity_ns,
304 .extra2 = &max_sched_granularity_ns,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200305 },
306 {
Peter Zijlstra21805082007-08-25 18:41:53 +0200307 .procname = "sched_latency_ns",
308 .data = &sysctl_sched_latency,
309 .maxlen = sizeof(unsigned int),
310 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800311 .proc_handler = sched_proc_update_handler,
Peter Zijlstra21805082007-08-25 18:41:53 +0200312 .extra1 = &min_sched_granularity_ns,
313 .extra2 = &max_sched_granularity_ns,
314 },
315 {
Ingo Molnar77e54a12007-07-09 18:52:00 +0200316 .procname = "sched_wakeup_granularity_ns",
317 .data = &sysctl_sched_wakeup_granularity,
318 .maxlen = sizeof(unsigned int),
319 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800320 .proc_handler = sched_proc_update_handler,
Ingo Molnar77e54a12007-07-09 18:52:00 +0200321 .extra1 = &min_wakeup_granularity_ns,
322 .extra2 = &max_wakeup_granularity_ns,
323 },
324 {
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100325 .procname = "sched_tunable_scaling",
326 .data = &sysctl_sched_tunable_scaling,
327 .maxlen = sizeof(enum sched_tunable_scaling),
328 .mode = 0644,
Linus Torvalds702a7c72009-12-12 11:34:10 -0800329 .proc_handler = sched_proc_update_handler,
Christian Ehrhardt1983a922009-11-30 12:16:47 +0100330 .extra1 = &min_sched_tunable_scaling,
331 .extra2 = &max_sched_tunable_scaling,
Peter Zijlstra2398f2c2008-06-27 13:41:35 +0200332 },
333 {
Ingo Molnarda84d962007-10-15 17:00:18 +0200334 .procname = "sched_migration_cost",
335 .data = &sysctl_sched_migration_cost,
336 .maxlen = sizeof(unsigned int),
337 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800338 .proc_handler = proc_dointvec,
Ingo Molnarda84d962007-10-15 17:00:18 +0200339 },
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100340 {
Peter Zijlstrab82d9fd2007-11-09 22:39:39 +0100341 .procname = "sched_nr_migrate",
342 .data = &sysctl_sched_nr_migrate,
343 .maxlen = sizeof(unsigned int),
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100344 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800345 .proc_handler = proc_dointvec,
Peter Zijlstrafa85ae22008-01-25 21:08:29 +0100346 },
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530347 {
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200348 .procname = "sched_time_avg",
349 .data = &sysctl_sched_time_avg,
350 .maxlen = sizeof(unsigned int),
351 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800352 .proc_handler = proc_dointvec,
Peter Zijlstrae9e92502009-09-01 10:34:37 +0200353 },
354 {
Paul Turnera7a4f8a2010-11-15 15:47:06 -0800355 .procname = "sched_shares_window",
356 .data = &sysctl_sched_shares_window,
357 .maxlen = sizeof(unsigned int),
358 .mode = 0644,
359 .proc_handler = proc_dointvec,
360 },
361 {
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530362 .procname = "timer_migration",
363 .data = &sysctl_timer_migration,
364 .maxlen = sizeof(unsigned int),
365 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800366 .proc_handler = proc_dointvec_minmax,
Arun R Bharadwajbfdb4d92009-06-23 10:00:58 +0530367 .extra1 = &zero,
368 .extra2 = &one,
Arun R Bharadwajcd1bb942009-04-16 12:15:34 +0530369 },
Peter Zijlstra1fc84aa2007-08-25 18:41:52 +0200370#endif
Ingo Molnar1799e352007-09-19 23:34:46 +0200371 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100372 .procname = "sched_rt_period_us",
373 .data = &sysctl_sched_rt_period,
374 .maxlen = sizeof(unsigned int),
375 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800376 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100377 },
378 {
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100379 .procname = "sched_rt_runtime_us",
380 .data = &sysctl_sched_rt_runtime,
381 .maxlen = sizeof(int),
382 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800383 .proc_handler = sched_rt_handler,
Peter Zijlstra9f0c1e52008-02-13 15:45:39 +0100384 },
Mike Galbraith5091faa2010-11-30 14:18:03 +0100385#ifdef CONFIG_SCHED_AUTOGROUP
386 {
387 .procname = "sched_autogroup_enabled",
388 .data = &sysctl_sched_autogroup_enabled,
389 .maxlen = sizeof(unsigned int),
390 .mode = 0644,
Yong Zhang1747b212011-02-20 15:08:12 +0800391 .proc_handler = proc_dointvec_minmax,
Mike Galbraith5091faa2010-11-30 14:18:03 +0100392 .extra1 = &zero,
393 .extra2 = &one,
394 },
395#endif
Paul Turnerec12cb72011-07-21 09:43:30 -0700396#ifdef CONFIG_CFS_BANDWIDTH
397 {
398 .procname = "sched_cfs_bandwidth_slice_us",
399 .data = &sysctl_sched_cfs_bandwidth_slice,
400 .maxlen = sizeof(unsigned int),
401 .mode = 0644,
402 .proc_handler = proc_dointvec_minmax,
403 .extra1 = &one,
404 },
405#endif
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700406#ifdef CONFIG_PROVE_LOCKING
407 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700408 .procname = "prove_locking",
409 .data = &prove_locking,
410 .maxlen = sizeof(int),
411 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800412 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700413 },
414#endif
415#ifdef CONFIG_LOCK_STAT
416 {
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700417 .procname = "lock_stat",
418 .data = &lock_stat,
419 .maxlen = sizeof(int),
420 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800421 .proc_handler = proc_dointvec,
Peter Zijlstraf20786f2007-07-19 01:48:56 -0700422 },
423#endif
Ingo Molnar77e54a12007-07-09 18:52:00 +0200424 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700425 .procname = "panic",
426 .data = &panic_timeout,
427 .maxlen = sizeof(int),
428 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800429 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430 },
431 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 .procname = "core_uses_pid",
433 .data = &core_uses_pid,
434 .maxlen = sizeof(int),
435 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800436 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 },
438 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 .procname = "core_pattern",
440 .data = core_pattern,
Dan Aloni71ce92f2007-05-16 22:11:16 -0700441 .maxlen = CORENAME_MAX_SIZE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800443 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 },
Neil Hormana2939802009-09-23 15:56:56 -0700445 {
Neil Hormana2939802009-09-23 15:56:56 -0700446 .procname = "core_pipe_limit",
447 .data = &core_pipe_limit,
448 .maxlen = sizeof(unsigned int),
449 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800450 .proc_handler = proc_dointvec,
Neil Hormana2939802009-09-23 15:56:56 -0700451 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800452#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700453 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 .procname = "tainted",
Andi Kleen25ddbb12008-10-15 22:01:41 -0700455 .maxlen = sizeof(long),
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800456 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800457 .proc_handler = proc_taint,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700458 },
Theodore Ts'o34f5a392007-02-10 01:45:24 -0800459#endif
Arjan van de Ven97455122008-01-25 21:08:34 +0100460#ifdef CONFIG_LATENCYTOP
461 {
462 .procname = "latencytop",
463 .data = &latencytop_enabled,
464 .maxlen = sizeof(int),
465 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800466 .proc_handler = proc_dointvec,
Arjan van de Ven97455122008-01-25 21:08:34 +0100467 },
468#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469#ifdef CONFIG_BLK_DEV_INITRD
470 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 .procname = "real-root-dev",
472 .data = &real_root_dev,
473 .maxlen = sizeof(int),
474 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800475 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476 },
477#endif
Ingo Molnar45807a12007-07-15 23:40:10 -0700478 {
Ingo Molnar45807a12007-07-15 23:40:10 -0700479 .procname = "print-fatal-signals",
480 .data = &print_fatal_signals,
481 .maxlen = sizeof(int),
482 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800483 .proc_handler = proc_dointvec,
Ingo Molnar45807a12007-07-15 23:40:10 -0700484 },
David S. Miller72c57ed2008-09-11 23:29:54 -0700485#ifdef CONFIG_SPARC
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 .procname = "reboot-cmd",
488 .data = reboot_command,
489 .maxlen = 256,
490 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800491 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 },
493 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 .procname = "stop-a",
495 .data = &stop_a_enabled,
496 .maxlen = sizeof (int),
497 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800498 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 },
500 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 .procname = "scons-poweroff",
502 .data = &scons_pwroff,
503 .maxlen = sizeof (int),
504 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800505 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506 },
507#endif
David S. Miller08714202008-11-16 23:49:24 -0800508#ifdef CONFIG_SPARC64
509 {
David S. Miller08714202008-11-16 23:49:24 -0800510 .procname = "tsb-ratio",
511 .data = &sysctl_tsb_ratio,
512 .maxlen = sizeof (int),
513 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800514 .proc_handler = proc_dointvec,
David S. Miller08714202008-11-16 23:49:24 -0800515 },
516#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517#ifdef __hppa__
518 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519 .procname = "soft-power",
520 .data = &pwrsw_enabled,
521 .maxlen = sizeof (int),
522 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800523 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524 },
525 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 .procname = "unaligned-trap",
527 .data = &unaligned_enabled,
528 .maxlen = sizeof (int),
529 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800530 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531 },
532#endif
533 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 .procname = "ctrl-alt-del",
535 .data = &C_A_D,
536 .maxlen = sizeof(int),
537 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800538 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 },
Steven Rostedt606576c2008-10-06 19:06:12 -0400540#ifdef CONFIG_FUNCTION_TRACER
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200541 {
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200542 .procname = "ftrace_enabled",
543 .data = &ftrace_enabled,
544 .maxlen = sizeof(int),
545 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800546 .proc_handler = ftrace_enable_sysctl,
Steven Rostedtb0fc4942008-05-12 21:20:43 +0200547 },
548#endif
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500549#ifdef CONFIG_STACK_TRACER
550 {
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500551 .procname = "stack_tracer_enabled",
552 .data = &stack_tracer_enabled,
553 .maxlen = sizeof(int),
554 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800555 .proc_handler = stack_trace_sysctl,
Steven Rostedtf38f1d22008-12-16 23:06:40 -0500556 },
557#endif
Steven Rostedt944ac422008-10-23 19:26:08 -0400558#ifdef CONFIG_TRACING
559 {
Peter Zijlstra3299b4d2008-11-04 11:58:21 +0100560 .procname = "ftrace_dump_on_oops",
Steven Rostedt944ac422008-10-23 19:26:08 -0400561 .data = &ftrace_dump_on_oops,
562 .maxlen = sizeof(int),
563 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800564 .proc_handler = proc_dointvec,
Steven Rostedt944ac422008-10-23 19:26:08 -0400565 },
566#endif
Johannes Berga1ef5ad2008-07-08 19:00:17 +0200567#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 .procname = "modprobe",
570 .data = &modprobe_path,
571 .maxlen = KMOD_PATH_LEN,
572 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800573 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 },
Kees Cook3d433212009-04-02 15:49:29 -0700575 {
Kees Cook3d433212009-04-02 15:49:29 -0700576 .procname = "modules_disabled",
577 .data = &modules_disabled,
578 .maxlen = sizeof(int),
579 .mode = 0644,
580 /* only handle a transition from default "0" to "1" */
Eric W. Biederman6d456112009-11-16 03:11:48 -0800581 .proc_handler = proc_dointvec_minmax,
Kees Cook3d433212009-04-02 15:49:29 -0700582 .extra1 = &one,
583 .extra2 = &one,
584 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585#endif
Ian Abbott94f17cd2010-06-07 12:57:12 +0100586#ifdef CONFIG_HOTPLUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 .procname = "hotplug",
Kay Sievers312c0042005-11-16 09:00:00 +0100589 .data = &uevent_helper,
590 .maxlen = UEVENT_HELPER_PATH_LEN,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800592 .proc_handler = proc_dostring,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 },
594#endif
595#ifdef CONFIG_CHR_DEV_SG
596 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 .procname = "sg-big-buff",
598 .data = &sg_big_buff,
599 .maxlen = sizeof (int),
600 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800601 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 },
603#endif
604#ifdef CONFIG_BSD_PROCESS_ACCT
605 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 .procname = "acct",
607 .data = &acct_parm,
608 .maxlen = 3*sizeof(int),
609 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800610 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700611 },
612#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613#ifdef CONFIG_MAGIC_SYSRQ
614 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 .procname = "sysrq",
Ingo Molnar5d6f6472006-12-13 00:34:36 -0800616 .data = &__sysrq_enabled,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 .maxlen = sizeof (int),
618 .mode = 0644,
Dmitry Torokhov97f5f0c2010-03-21 22:31:26 -0700619 .proc_handler = sysrq_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620 },
621#endif
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700622#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 .procname = "cad_pid",
Cedric Le Goater9ec52092006-10-02 02:19:00 -0700625 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 .maxlen = sizeof (int),
627 .mode = 0600,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800628 .proc_handler = proc_do_cad_pid,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 },
Randy Dunlapd6f8ff72006-10-19 23:28:34 -0700630#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700632 .procname = "threads-max",
633 .data = &max_threads,
634 .maxlen = sizeof(int),
635 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800636 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 },
638 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639 .procname = "random",
640 .mode = 0555,
641 .child = random_table,
642 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643 {
Eric Paris17f60a72011-04-01 17:07:50 -0400644 .procname = "usermodehelper",
645 .mode = 0555,
646 .child = usermodehelper_table,
647 },
648 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649 .procname = "overflowuid",
650 .data = &overflowuid,
651 .maxlen = sizeof(int),
652 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800653 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654 .extra1 = &minolduid,
655 .extra2 = &maxolduid,
656 },
657 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658 .procname = "overflowgid",
659 .data = &overflowgid,
660 .maxlen = sizeof(int),
661 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800662 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 .extra1 = &minolduid,
664 .extra2 = &maxolduid,
665 },
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -0800666#ifdef CONFIG_S390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667#ifdef CONFIG_MATHEMU
668 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 .procname = "ieee_emulation_warnings",
670 .data = &sysctl_ieee_emulation_warnings,
671 .maxlen = sizeof(int),
672 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800673 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 },
675#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 .procname = "userprocess_debug",
Heiko Carstensab3c68e2010-05-17 10:00:21 +0200678 .data = &show_unhandled_signals,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700679 .maxlen = sizeof(int),
680 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800681 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700682 },
683#endif
684 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 .procname = "pid_max",
686 .data = &pid_max,
687 .maxlen = sizeof (int),
688 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800689 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700690 .extra1 = &pid_max_min,
691 .extra2 = &pid_max_max,
692 },
693 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694 .procname = "panic_on_oops",
695 .data = &panic_on_oops,
696 .maxlen = sizeof(int),
697 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800698 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699 },
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800700#if defined CONFIG_PRINTK
701 {
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800702 .procname = "printk",
703 .data = &console_loglevel,
704 .maxlen = 4*sizeof(int),
705 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800706 .proc_handler = proc_dointvec,
Joe Perches7ef3d2f2008-02-08 04:21:25 -0800707 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709 .procname = "printk_ratelimit",
Dave Young717115e2008-07-25 01:45:58 -0700710 .data = &printk_ratelimit_state.interval,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 .maxlen = sizeof(int),
712 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800713 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714 },
715 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700716 .procname = "printk_ratelimit_burst",
Dave Young717115e2008-07-25 01:45:58 -0700717 .data = &printk_ratelimit_state.burst,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718 .maxlen = sizeof(int),
719 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800720 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 },
Dave Youngaf913222009-09-22 16:43:33 -0700722 {
Dave Youngaf913222009-09-22 16:43:33 -0700723 .procname = "printk_delay",
724 .data = &printk_delay_msec,
725 .maxlen = sizeof(int),
726 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800727 .proc_handler = proc_dointvec_minmax,
Dave Youngaf913222009-09-22 16:43:33 -0700728 .extra1 = &zero,
729 .extra2 = &ten_thousand,
730 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731 {
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800732 .procname = "dmesg_restrict",
733 .data = &dmesg_restrict,
734 .maxlen = sizeof(int),
735 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700736 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800737 .extra1 = &zero,
738 .extra2 = &one,
739 },
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800740 {
741 .procname = "kptr_restrict",
742 .data = &kptr_restrict,
743 .maxlen = sizeof(int),
744 .mode = 0644,
Kees Cook620f6e82012-04-04 11:40:19 -0700745 .proc_handler = proc_dointvec_minmax_sysadmin,
Dan Rosenberg455cd5a2011-01-12 16:59:41 -0800746 .extra1 = &zero,
747 .extra2 = &two,
748 },
Joe Perchesdf6e61d2010-11-15 21:17:27 -0800749#endif
Dan Rosenbergeaf06b22010-11-11 14:05:18 -0800750 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 .procname = "ngroups_max",
752 .data = &ngroups_max,
753 .maxlen = sizeof (int),
754 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800755 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 },
Dan Ballard73efc032011-10-31 17:11:20 -0700757 {
758 .procname = "cap_last_cap",
759 .data = (void *)&cap_last_cap,
760 .maxlen = sizeof(int),
761 .mode = 0444,
762 .proc_handler = proc_dointvec,
763 },
Don Zickus58687ac2010-05-07 17:11:44 -0400764#if defined(CONFIG_LOCKUP_DETECTOR)
Don Zickus504d7cf2010-02-12 17:19:19 -0500765 {
Don Zickus58687ac2010-05-07 17:11:44 -0400766 .procname = "watchdog",
767 .data = &watchdog_enabled,
Don Zickus504d7cf2010-02-12 17:19:19 -0500768 .maxlen = sizeof (int),
769 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700770 .proc_handler = proc_dowatchdog,
771 .extra1 = &zero,
772 .extra2 = &one,
Don Zickus58687ac2010-05-07 17:11:44 -0400773 },
774 {
775 .procname = "watchdog_thresh",
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700776 .data = &watchdog_thresh,
Don Zickus58687ac2010-05-07 17:11:44 -0400777 .maxlen = sizeof(int),
778 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700779 .proc_handler = proc_dowatchdog,
Don Zickus58687ac2010-05-07 17:11:44 -0400780 .extra1 = &neg_one,
781 .extra2 = &sixty,
Don Zickus504d7cf2010-02-12 17:19:19 -0500782 },
Don Zickus2508ce12010-05-07 17:11:46 -0400783 {
784 .procname = "softlockup_panic",
785 .data = &softlockup_panic,
786 .maxlen = sizeof(int),
787 .mode = 0644,
788 .proc_handler = proc_dointvec_minmax,
789 .extra1 = &zero,
790 .extra2 = &one,
791 },
Don Zickus5dc30552010-11-29 17:07:17 -0500792 {
793 .procname = "nmi_watchdog",
794 .data = &watchdog_enabled,
795 .maxlen = sizeof (int),
796 .mode = 0644,
Mandeep Singh Baines586692a2011-05-22 22:10:22 -0700797 .proc_handler = proc_dowatchdog,
798 .extra1 = &zero,
799 .extra2 = &one,
Don Zickus5dc30552010-11-29 17:07:17 -0500800 },
801#endif
802#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
803 {
804 .procname = "unknown_nmi_panic",
805 .data = &unknown_nmi_panic,
806 .maxlen = sizeof (int),
807 .mode = 0644,
808 .proc_handler = proc_dointvec,
809 },
Don Zickus504d7cf2010-02-12 17:19:19 -0500810#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700811#if defined(CONFIG_X86)
812 {
Don Zickus8da5add2006-09-26 10:52:27 +0200813 .procname = "panic_on_unrecovered_nmi",
814 .data = &panic_on_unrecovered_nmi,
815 .maxlen = sizeof(int),
816 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800817 .proc_handler = proc_dointvec,
Don Zickus8da5add2006-09-26 10:52:27 +0200818 },
819 {
Kurt Garloff5211a242009-06-24 14:32:11 -0700820 .procname = "panic_on_io_nmi",
821 .data = &panic_on_io_nmi,
822 .maxlen = sizeof(int),
823 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800824 .proc_handler = proc_dointvec,
Kurt Garloff5211a242009-06-24 14:32:11 -0700825 },
Mitsuo Hayasaka55af7792011-11-29 15:08:36 +0900826#ifdef CONFIG_DEBUG_STACKOVERFLOW
827 {
828 .procname = "panic_on_stackoverflow",
829 .data = &sysctl_panic_on_stackoverflow,
830 .maxlen = sizeof(int),
831 .mode = 0644,
832 .proc_handler = proc_dointvec,
833 },
834#endif
Kurt Garloff5211a242009-06-24 14:32:11 -0700835 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836 .procname = "bootloader_type",
837 .data = &bootloader_type,
838 .maxlen = sizeof (int),
839 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800840 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 },
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100842 {
H. Peter Anvin50312962009-05-07 16:54:11 -0700843 .procname = "bootloader_version",
844 .data = &bootloader_version,
845 .maxlen = sizeof (int),
846 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800847 .proc_handler = proc_dointvec,
H. Peter Anvin50312962009-05-07 16:54:11 -0700848 },
849 {
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100850 .procname = "kstack_depth_to_print",
851 .data = &kstack_depth_to_print,
852 .maxlen = sizeof(int),
853 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800854 .proc_handler = proc_dointvec,
Chuck Ebbert0741f4d2006-12-07 02:14:11 +0100855 },
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100856 {
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100857 .procname = "io_delay_type",
858 .data = &io_delay_type,
859 .maxlen = sizeof(int),
860 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800861 .proc_handler = proc_dointvec,
Ingo Molnar6e7c4022008-01-30 13:30:05 +0100862 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863#endif
Luke Yang7a9166e2006-02-20 18:28:07 -0800864#if defined(CONFIG_MMU)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700866 .procname = "randomize_va_space",
867 .data = &randomize_va_space,
868 .maxlen = sizeof(int),
869 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800870 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871 },
Luke Yang7a9166e2006-02-20 18:28:07 -0800872#endif
Martin Schwidefsky0152fb32006-01-14 13:21:00 -0800873#if defined(CONFIG_S390) && defined(CONFIG_SMP)
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700874 {
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700875 .procname = "spin_retry",
876 .data = &spin_retry,
877 .maxlen = sizeof (int),
878 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800879 .proc_handler = proc_dointvec,
Martin Schwidefsky951f22d2005-07-27 11:44:57 -0700880 },
881#endif
Len Brown673d5b42007-07-28 03:33:16 -0400882#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
Pavel Machekc255d842006-02-20 18:27:58 -0800883 {
Pavel Machekc255d842006-02-20 18:27:58 -0800884 .procname = "acpi_video_flags",
Pavel Machek77afcf72007-07-19 01:47:41 -0700885 .data = &acpi_realmode_flags,
Pavel Machekc255d842006-02-20 18:27:58 -0800886 .maxlen = sizeof (unsigned long),
887 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800888 .proc_handler = proc_doulongvec_minmax,
Pavel Machekc255d842006-02-20 18:27:58 -0800889 },
890#endif
Jes Sorensend2b176e2006-02-28 09:42:23 -0800891#ifdef CONFIG_IA64
892 {
Jes Sorensend2b176e2006-02-28 09:42:23 -0800893 .procname = "ignore-unaligned-usertrap",
894 .data = &no_unaligned_warning,
895 .maxlen = sizeof (int),
896 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800897 .proc_handler = proc_dointvec,
Jes Sorensend2b176e2006-02-28 09:42:23 -0800898 },
Doug Chapman88fc2412009-01-15 10:38:56 -0800899 {
Doug Chapman88fc2412009-01-15 10:38:56 -0800900 .procname = "unaligned-dump-stack",
901 .data = &unaligned_dump_stack,
902 .maxlen = sizeof (int),
903 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800904 .proc_handler = proc_dointvec,
Doug Chapman88fc2412009-01-15 10:38:56 -0800905 },
Jes Sorensend2b176e2006-02-28 09:42:23 -0800906#endif
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800907#ifdef CONFIG_DETECT_HUNG_TASK
908 {
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800909 .procname = "hung_task_panic",
910 .data = &sysctl_hung_task_panic,
911 .maxlen = sizeof(int),
912 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800913 .proc_handler = proc_dointvec_minmax,
Mandeep Singh Bainese162b392009-01-15 11:08:40 -0800914 .extra1 = &zero,
915 .extra2 = &one,
916 },
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100917 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100918 .procname = "hung_task_check_count",
919 .data = &sysctl_hung_task_check_count,
Ingo Molnar90739082008-01-25 21:08:34 +0100920 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100921 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800922 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100923 },
924 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100925 .procname = "hung_task_timeout_secs",
926 .data = &sysctl_hung_task_timeout_secs,
Ingo Molnar90739082008-01-25 21:08:34 +0100927 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100928 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800929 .proc_handler = proc_dohung_task_timeout_secs,
Liu Hua96f6aea2014-04-07 15:38:57 -0700930 .extra2 = &hung_task_timeout_max,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100931 },
932 {
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100933 .procname = "hung_task_warnings",
934 .data = &sysctl_hung_task_warnings,
Ingo Molnar90739082008-01-25 21:08:34 +0100935 .maxlen = sizeof(unsigned long),
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100936 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800937 .proc_handler = proc_doulongvec_minmax,
Ingo Molnar82a1fcb2008-01-25 21:08:02 +0100938 },
Ravikiran G Thirumalaic4f3b632007-10-16 23:26:09 -0700939#endif
Andi Kleenbebfa102006-06-26 13:56:52 +0200940#ifdef CONFIG_COMPAT
941 {
Andi Kleenbebfa102006-06-26 13:56:52 +0200942 .procname = "compat-log",
943 .data = &compat_log,
944 .maxlen = sizeof (int),
945 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800946 .proc_handler = proc_dointvec,
Andi Kleenbebfa102006-06-26 13:56:52 +0200947 },
948#endif
Ingo Molnar23f78d42006-06-27 02:54:53 -0700949#ifdef CONFIG_RT_MUTEXES
950 {
Ingo Molnar23f78d42006-06-27 02:54:53 -0700951 .procname = "max_lock_depth",
952 .data = &max_lock_depth,
953 .maxlen = sizeof(int),
954 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800955 .proc_handler = proc_dointvec,
Ingo Molnar23f78d42006-06-27 02:54:53 -0700956 },
957#endif
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700958 {
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700959 .procname = "poweroff_cmd",
960 .data = &poweroff_cmd,
961 .maxlen = POWEROFF_CMD_PATH_LEN,
962 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800963 .proc_handler = proc_dostring,
Jeremy Fitzhardinge10a0a8d2007-07-17 18:37:02 -0700964 },
David Howells0b77f5b2008-04-29 01:01:32 -0700965#ifdef CONFIG_KEYS
966 {
David Howells0b77f5b2008-04-29 01:01:32 -0700967 .procname = "keys",
968 .mode = 0555,
969 .child = key_sysctls,
970 },
971#endif
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700972#ifdef CONFIG_RCU_TORTURE_TEST
973 {
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700974 .procname = "rcutorture_runnable",
975 .data = &rcutorture_runnable,
976 .maxlen = sizeof(int),
977 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800978 .proc_handler = proc_dointvec,
Paul E. McKenney31a72bc2008-06-18 09:26:49 -0700979 },
980#endif
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200981#ifdef CONFIG_PERF_EVENTS
Vince Weaveraa4a2212011-06-03 17:54:40 -0400982 /*
983 * User-space scripts rely on the existence of this file
984 * as a feature check for perf_events being enabled.
985 *
986 * So it's an ABI, do not remove!
987 */
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200988 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200989 .procname = "perf_event_paranoid",
990 .data = &sysctl_perf_event_paranoid,
991 .maxlen = sizeof(sysctl_perf_event_paranoid),
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200992 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -0800993 .proc_handler = proc_dointvec,
Peter Zijlstra1ccd1542009-04-09 10:53:45 +0200994 },
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200995 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200996 .procname = "perf_event_mlock_kb",
997 .data = &sysctl_perf_event_mlock,
998 .maxlen = sizeof(sysctl_perf_event_mlock),
Peter Zijlstrac5078f72009-05-05 17:50:24 +0200999 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001000 .proc_handler = proc_dointvec,
Peter Zijlstrac5078f72009-05-05 17:50:24 +02001001 },
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001002 {
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001003 .procname = "perf_event_max_sample_rate",
1004 .data = &sysctl_perf_event_sample_rate,
1005 .maxlen = sizeof(sysctl_perf_event_sample_rate),
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001006 .mode = 0644,
Peter Zijlstra163ec432011-02-16 11:22:34 +01001007 .proc_handler = perf_proc_update_handler,
Peter Zijlstraa78ac322009-05-25 17:39:05 +02001008 },
Peter Zijlstra1ccd1542009-04-09 10:53:45 +02001009#endif
Vegard Nossumdfec0722008-04-04 00:51:41 +02001010#ifdef CONFIG_KMEMCHECK
1011 {
Vegard Nossumdfec0722008-04-04 00:51:41 +02001012 .procname = "kmemcheck",
1013 .data = &kmemcheck_enabled,
1014 .maxlen = sizeof(int),
1015 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001016 .proc_handler = proc_dointvec,
Vegard Nossumdfec0722008-04-04 00:51:41 +02001017 },
1018#endif
Jens Axboecb684b52009-09-15 21:53:11 +02001019#ifdef CONFIG_BLOCK
Jens Axboe5e605b62009-08-05 09:07:21 +02001020 {
Jens Axboe5e605b62009-08-05 09:07:21 +02001021 .procname = "blk_iopoll",
1022 .data = &blk_iopoll_enabled,
1023 .maxlen = sizeof(int),
1024 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001025 .proc_handler = proc_dointvec,
Jens Axboe5e605b62009-08-05 09:07:21 +02001026 },
Jens Axboecb684b52009-09-15 21:53:11 +02001027#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001028#ifdef CONFIG_ARM
1029 {
1030 .procname = "boot_reason",
1031 .data = &boot_reason,
1032 .maxlen = sizeof(int),
1033 .mode = 0444,
1034 .proc_handler = proc_dointvec,
1035},
1036#endif
1037/*
1038 * NOTE: do not add new entries to this table unless you have read
1039 * Documentation/sysctl/ctl_unnumbered.txt
1040 */
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001041 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001042};
1043
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001044static struct ctl_table vm_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001045 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001046 .procname = "overcommit_memory",
1047 .data = &sysctl_overcommit_memory,
1048 .maxlen = sizeof(sysctl_overcommit_memory),
1049 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001050 .proc_handler = proc_dointvec_minmax,
1051 .extra1 = &zero,
1052 .extra2 = &two,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053 },
1054 {
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001055 .procname = "panic_on_oom",
1056 .data = &sysctl_panic_on_oom,
1057 .maxlen = sizeof(sysctl_panic_on_oom),
1058 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001059 .proc_handler = proc_dointvec_minmax,
1060 .extra1 = &zero,
1061 .extra2 = &two,
KAMEZAWA Hiroyukifadd8fb2006-06-23 02:03:13 -07001062 },
1063 {
David Rientjesfe071d72007-10-16 23:25:56 -07001064 .procname = "oom_kill_allocating_task",
1065 .data = &sysctl_oom_kill_allocating_task,
1066 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
1067 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001068 .proc_handler = proc_dointvec,
David Rientjesfe071d72007-10-16 23:25:56 -07001069 },
1070 {
David Rientjesfef1bdd2008-02-07 00:14:07 -08001071 .procname = "oom_dump_tasks",
1072 .data = &sysctl_oom_dump_tasks,
1073 .maxlen = sizeof(sysctl_oom_dump_tasks),
1074 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001075 .proc_handler = proc_dointvec,
David Rientjesfef1bdd2008-02-07 00:14:07 -08001076 },
1077 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001078 .procname = "overcommit_ratio",
1079 .data = &sysctl_overcommit_ratio,
1080 .maxlen = sizeof(sysctl_overcommit_ratio),
1081 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001082 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001083 },
1084 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001085 .procname = "page-cluster",
1086 .data = &page_cluster,
1087 .maxlen = sizeof(int),
1088 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001089 .proc_handler = proc_dointvec_minmax,
1090 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001091 },
1092 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001093 .procname = "dirty_background_ratio",
1094 .data = &dirty_background_ratio,
1095 .maxlen = sizeof(dirty_background_ratio),
1096 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001097 .proc_handler = dirty_background_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001098 .extra1 = &zero,
1099 .extra2 = &one_hundred,
1100 },
1101 {
David Rientjes2da02992009-01-06 14:39:31 -08001102 .procname = "dirty_background_bytes",
1103 .data = &dirty_background_bytes,
1104 .maxlen = sizeof(dirty_background_bytes),
1105 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001106 .proc_handler = dirty_background_bytes_handler,
Sven Wegenerfc3501d2009-02-11 13:04:23 -08001107 .extra1 = &one_ul,
David Rientjes2da02992009-01-06 14:39:31 -08001108 },
1109 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001110 .procname = "dirty_ratio",
1111 .data = &vm_dirty_ratio,
1112 .maxlen = sizeof(vm_dirty_ratio),
1113 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001114 .proc_handler = dirty_ratio_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001115 .extra1 = &zero,
1116 .extra2 = &one_hundred,
1117 },
1118 {
David Rientjes2da02992009-01-06 14:39:31 -08001119 .procname = "dirty_bytes",
1120 .data = &vm_dirty_bytes,
1121 .maxlen = sizeof(vm_dirty_bytes),
1122 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001123 .proc_handler = dirty_bytes_handler,
Andrea Righi9e4a5bd2009-04-30 15:08:57 -07001124 .extra1 = &dirty_bytes_min,
David Rientjes2da02992009-01-06 14:39:31 -08001125 },
1126 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001127 .procname = "dirty_writeback_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001128 .data = &dirty_writeback_interval,
1129 .maxlen = sizeof(dirty_writeback_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001130 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001131 .proc_handler = dirty_writeback_centisecs_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001132 },
1133 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001134 .procname = "dirty_expire_centisecs",
Bart Samwelf6ef9432006-03-24 03:15:48 -08001135 .data = &dirty_expire_interval,
1136 .maxlen = sizeof(dirty_expire_interval),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001137 .mode = 0644,
Petr Holasekcb16e952011-03-23 16:43:09 -07001138 .proc_handler = proc_dointvec_minmax,
1139 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001140 },
1141 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001142 .procname = "nr_pdflush_threads",
1143 .data = &nr_pdflush_threads,
1144 .maxlen = sizeof nr_pdflush_threads,
1145 .mode = 0444 /* read-only*/,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001146 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147 },
1148 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001149 .procname = "swappiness",
1150 .data = &vm_swappiness,
1151 .maxlen = sizeof(vm_swappiness),
1152 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001153 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001154 .extra1 = &zero,
1155 .extra2 = &one_hundred,
1156 },
1157#ifdef CONFIG_HUGETLB_PAGE
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001158 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001159 .procname = "nr_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001160 .data = NULL,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001161 .maxlen = sizeof(unsigned long),
1162 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001163 .proc_handler = hugetlb_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164 .extra1 = (void *)&hugetlb_zero,
1165 .extra2 = (void *)&hugetlb_infinity,
Lee Schermerhorn06808b02009-12-14 17:58:21 -08001166 },
1167#ifdef CONFIG_NUMA
1168 {
1169 .procname = "nr_hugepages_mempolicy",
1170 .data = NULL,
1171 .maxlen = sizeof(unsigned long),
1172 .mode = 0644,
1173 .proc_handler = &hugetlb_mempolicy_sysctl_handler,
1174 .extra1 = (void *)&hugetlb_zero,
1175 .extra2 = (void *)&hugetlb_infinity,
1176 },
1177#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001178 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001179 .procname = "hugetlb_shm_group",
1180 .data = &sysctl_hugetlb_shm_group,
1181 .maxlen = sizeof(gid_t),
1182 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001183 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001184 },
Mel Gorman396faf02007-07-17 04:03:13 -07001185 {
Mel Gorman396faf02007-07-17 04:03:13 -07001186 .procname = "hugepages_treat_as_movable",
1187 .data = &hugepages_treat_as_movable,
1188 .maxlen = sizeof(int),
1189 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001190 .proc_handler = hugetlb_treat_movable_handler,
Mel Gorman396faf02007-07-17 04:03:13 -07001191 },
Adam Litke54f9f802007-10-16 01:26:20 -07001192 {
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001193 .procname = "nr_overcommit_hugepages",
Andi Kleene5ff2152008-07-23 21:27:42 -07001194 .data = NULL,
1195 .maxlen = sizeof(unsigned long),
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001196 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001197 .proc_handler = hugetlb_overcommit_handler,
Andi Kleene5ff2152008-07-23 21:27:42 -07001198 .extra1 = (void *)&hugetlb_zero,
1199 .extra2 = (void *)&hugetlb_infinity,
Nishanth Aravamudand1c3fb12007-12-17 16:20:12 -08001200 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001201#endif
1202 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001203 .procname = "lowmem_reserve_ratio",
1204 .data = &sysctl_lowmem_reserve_ratio,
1205 .maxlen = sizeof(sysctl_lowmem_reserve_ratio),
1206 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001207 .proc_handler = lowmem_reserve_ratio_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001208 },
1209 {
Andrew Morton9d0243b2006-01-08 01:00:39 -08001210 .procname = "drop_caches",
1211 .data = &sysctl_drop_caches,
1212 .maxlen = sizeof(int),
1213 .mode = 0644,
1214 .proc_handler = drop_caches_sysctl_handler,
Petr Holasekcb16e952011-03-23 16:43:09 -07001215 .extra1 = &one,
1216 .extra2 = &three,
Andrew Morton9d0243b2006-01-08 01:00:39 -08001217 },
Mel Gorman76ab0f52010-05-24 14:32:28 -07001218#ifdef CONFIG_COMPACTION
1219 {
1220 .procname = "compact_memory",
1221 .data = &sysctl_compact_memory,
1222 .maxlen = sizeof(int),
1223 .mode = 0200,
1224 .proc_handler = sysctl_compaction_handler,
1225 },
Mel Gorman5e771902010-05-24 14:32:31 -07001226 {
1227 .procname = "extfrag_threshold",
1228 .data = &sysctl_extfrag_threshold,
1229 .maxlen = sizeof(int),
1230 .mode = 0644,
1231 .proc_handler = sysctl_extfrag_handler,
1232 .extra1 = &min_extfrag_threshold,
1233 .extra2 = &max_extfrag_threshold,
1234 },
1235
Mel Gorman76ab0f52010-05-24 14:32:28 -07001236#endif /* CONFIG_COMPACTION */
Andrew Morton9d0243b2006-01-08 01:00:39 -08001237 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001238 .procname = "min_free_kbytes",
1239 .data = &min_free_kbytes,
1240 .maxlen = sizeof(min_free_kbytes),
1241 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001242 .proc_handler = min_free_kbytes_sysctl_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001243 .extra1 = &zero,
1244 },
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001245 {
Rik van Riele13c80f2011-09-01 15:26:50 -04001246 .procname = "extra_free_kbytes",
1247 .data = &extra_free_kbytes,
1248 .maxlen = sizeof(extra_free_kbytes),
1249 .mode = 0644,
1250 .proc_handler = min_free_kbytes_sysctl_handler,
1251 .extra1 = &zero,
1252 },
1253 {
Arve Hjønnevågcde89492009-02-17 14:51:02 -08001254 .procname = "min_free_order_shift",
1255 .data = &min_free_order_shift,
1256 .maxlen = sizeof(min_free_order_shift),
1257 .mode = 0644,
1258 .proc_handler = &proc_dointvec
1259 },
1260 {
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001261 .procname = "percpu_pagelist_fraction",
1262 .data = &percpu_pagelist_fraction,
1263 .maxlen = sizeof(percpu_pagelist_fraction),
1264 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001265 .proc_handler = percpu_pagelist_fraction_sysctl_handler,
Rohit Seth8ad4b1f2006-01-08 01:00:40 -08001266 .extra1 = &min_percpu_pagelist_fract,
1267 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001268#ifdef CONFIG_MMU
1269 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001270 .procname = "max_map_count",
1271 .data = &sysctl_max_map_count,
1272 .maxlen = sizeof(sysctl_max_map_count),
1273 .mode = 0644,
WANG Cong3e261202009-12-17 15:27:05 -08001274 .proc_handler = proc_dointvec_minmax,
Amerigo Wang70da2342009-12-14 17:59:52 -08001275 .extra1 = &zero,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001276 },
Paul Mundtdd8632a2009-01-08 12:04:47 +00001277#else
1278 {
Paul Mundtdd8632a2009-01-08 12:04:47 +00001279 .procname = "nr_trim_pages",
1280 .data = &sysctl_nr_trim_pages,
1281 .maxlen = sizeof(sysctl_nr_trim_pages),
1282 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001283 .proc_handler = proc_dointvec_minmax,
Paul Mundtdd8632a2009-01-08 12:04:47 +00001284 .extra1 = &zero,
1285 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07001286#endif
1287 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001288 .procname = "laptop_mode",
1289 .data = &laptop_mode,
1290 .maxlen = sizeof(laptop_mode),
1291 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001292 .proc_handler = proc_dointvec_jiffies,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001293 },
1294 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001295 .procname = "block_dump",
1296 .data = &block_dump,
1297 .maxlen = sizeof(block_dump),
1298 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001299 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001300 .extra1 = &zero,
1301 },
1302 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001303 .procname = "vfs_cache_pressure",
1304 .data = &sysctl_vfs_cache_pressure,
1305 .maxlen = sizeof(sysctl_vfs_cache_pressure),
1306 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001307 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001308 .extra1 = &zero,
1309 },
1310#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
1311 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001312 .procname = "legacy_va_layout",
1313 .data = &sysctl_legacy_va_layout,
1314 .maxlen = sizeof(sysctl_legacy_va_layout),
1315 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001316 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001317 .extra1 = &zero,
1318 },
1319#endif
Christoph Lameter17436602006-01-18 17:42:32 -08001320#ifdef CONFIG_NUMA
1321 {
Christoph Lameter17436602006-01-18 17:42:32 -08001322 .procname = "zone_reclaim_mode",
1323 .data = &zone_reclaim_mode,
1324 .maxlen = sizeof(zone_reclaim_mode),
1325 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001326 .proc_handler = proc_dointvec,
Christoph Lameterc84db232006-02-01 03:05:29 -08001327 .extra1 = &zero,
Christoph Lameter17436602006-01-18 17:42:32 -08001328 },
Christoph Lameter96146342006-07-03 00:24:13 -07001329 {
Christoph Lameter96146342006-07-03 00:24:13 -07001330 .procname = "min_unmapped_ratio",
1331 .data = &sysctl_min_unmapped_ratio,
1332 .maxlen = sizeof(sysctl_min_unmapped_ratio),
1333 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001334 .proc_handler = sysctl_min_unmapped_ratio_sysctl_handler,
Christoph Lameter96146342006-07-03 00:24:13 -07001335 .extra1 = &zero,
1336 .extra2 = &one_hundred,
1337 },
Christoph Lameter0ff38492006-09-25 23:31:52 -07001338 {
Christoph Lameter0ff38492006-09-25 23:31:52 -07001339 .procname = "min_slab_ratio",
1340 .data = &sysctl_min_slab_ratio,
1341 .maxlen = sizeof(sysctl_min_slab_ratio),
1342 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001343 .proc_handler = sysctl_min_slab_ratio_sysctl_handler,
Christoph Lameter0ff38492006-09-25 23:31:52 -07001344 .extra1 = &zero,
1345 .extra2 = &one_hundred,
1346 },
Christoph Lameter17436602006-01-18 17:42:32 -08001347#endif
Christoph Lameter77461ab2007-05-09 02:35:13 -07001348#ifdef CONFIG_SMP
1349 {
Christoph Lameter77461ab2007-05-09 02:35:13 -07001350 .procname = "stat_interval",
1351 .data = &sysctl_stat_interval,
1352 .maxlen = sizeof(sysctl_stat_interval),
1353 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001354 .proc_handler = proc_dointvec_jiffies,
Christoph Lameter77461ab2007-05-09 02:35:13 -07001355 },
1356#endif
David Howells6e141542009-12-15 19:27:45 +00001357#ifdef CONFIG_MMU
Eric Parised032182007-06-28 15:55:21 -04001358 {
Eric Parised032182007-06-28 15:55:21 -04001359 .procname = "mmap_min_addr",
Eric Paris788084a2009-07-31 12:54:11 -04001360 .data = &dac_mmap_min_addr,
1361 .maxlen = sizeof(unsigned long),
Eric Parised032182007-06-28 15:55:21 -04001362 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001363 .proc_handler = mmap_min_addr_handler,
Eric Parised032182007-06-28 15:55:21 -04001364 },
David Howells6e141542009-12-15 19:27:45 +00001365#endif
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001366#ifdef CONFIG_NUMA
1367 {
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001368 .procname = "numa_zonelist_order",
1369 .data = &numa_zonelist_order,
1370 .maxlen = NUMA_ZONELIST_ORDER_LEN,
1371 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001372 .proc_handler = numa_zonelist_order_handler,
KAMEZAWA Hiroyukif0c0b2b2007-07-15 23:38:01 -07001373 },
1374#endif
Al Viro2b8232c2007-10-13 08:16:04 +01001375#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
Paul Mundt5c36e652007-03-01 10:07:42 +09001376 (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
Ingo Molnare6e54942006-06-27 02:53:50 -07001377 {
Ingo Molnare6e54942006-06-27 02:53:50 -07001378 .procname = "vdso_enabled",
1379 .data = &vdso_enabled,
1380 .maxlen = sizeof(vdso_enabled),
1381 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001382 .proc_handler = proc_dointvec,
Ingo Molnare6e54942006-06-27 02:53:50 -07001383 .extra1 = &zero,
1384 },
1385#endif
Bron Gondwana195cf452008-02-04 22:29:20 -08001386#ifdef CONFIG_HIGHMEM
1387 {
Bron Gondwana195cf452008-02-04 22:29:20 -08001388 .procname = "highmem_is_dirtyable",
1389 .data = &vm_highmem_is_dirtyable,
1390 .maxlen = sizeof(vm_highmem_is_dirtyable),
1391 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001392 .proc_handler = proc_dointvec_minmax,
Bron Gondwana195cf452008-02-04 22:29:20 -08001393 .extra1 = &zero,
1394 .extra2 = &one,
1395 },
1396#endif
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001397 {
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001398 .procname = "scan_unevictable_pages",
1399 .data = &scan_unevictable_pages,
1400 .maxlen = sizeof(scan_unevictable_pages),
1401 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001402 .proc_handler = scan_unevictable_handler,
Peter Zijlstra4be6f6b2009-04-13 14:39:33 -07001403 },
Andi Kleen6a460792009-09-16 11:50:15 +02001404#ifdef CONFIG_MEMORY_FAILURE
1405 {
Andi Kleen6a460792009-09-16 11:50:15 +02001406 .procname = "memory_failure_early_kill",
1407 .data = &sysctl_memory_failure_early_kill,
1408 .maxlen = sizeof(sysctl_memory_failure_early_kill),
1409 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001410 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001411 .extra1 = &zero,
1412 .extra2 = &one,
1413 },
1414 {
Andi Kleen6a460792009-09-16 11:50:15 +02001415 .procname = "memory_failure_recovery",
1416 .data = &sysctl_memory_failure_recovery,
1417 .maxlen = sizeof(sysctl_memory_failure_recovery),
1418 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001419 .proc_handler = proc_dointvec_minmax,
Andi Kleen6a460792009-09-16 11:50:15 +02001420 .extra1 = &zero,
1421 .extra2 = &one,
1422 },
1423#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001424 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001425};
1426
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001427#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001428static struct ctl_table binfmt_misc_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001429 { }
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001430};
1431#endif
1432
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001433static struct ctl_table fs_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001434 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001435 .procname = "inode-nr",
1436 .data = &inodes_stat,
1437 .maxlen = 2*sizeof(int),
1438 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001439 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001440 },
1441 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001442 .procname = "inode-state",
1443 .data = &inodes_stat,
1444 .maxlen = 7*sizeof(int),
1445 .mode = 0444,
Dave Chinnercffbc8a2010-10-23 05:03:02 -04001446 .proc_handler = proc_nr_inodes,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001447 },
1448 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001449 .procname = "file-nr",
1450 .data = &files_stat,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001451 .maxlen = sizeof(files_stat),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001452 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001453 .proc_handler = proc_nr_files,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001454 },
1455 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001456 .procname = "file-max",
1457 .data = &files_stat.max_files,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001458 .maxlen = sizeof(files_stat.max_files),
Linus Torvalds1da177e2005-04-16 15:20:36 -07001459 .mode = 0644,
Eric Dumazet518de9b2010-10-26 14:22:44 -07001460 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001461 },
1462 {
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001463 .procname = "nr_open",
1464 .data = &sysctl_nr_open,
1465 .maxlen = sizeof(int),
1466 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001467 .proc_handler = proc_dointvec_minmax,
Al Viroeceea0b2008-05-10 10:08:32 -04001468 .extra1 = &sysctl_nr_open_min,
1469 .extra2 = &sysctl_nr_open_max,
Eric Dumazet9cfe0152008-02-06 01:37:16 -08001470 },
1471 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001472 .procname = "dentry-state",
1473 .data = &dentry_stat,
1474 .maxlen = 6*sizeof(int),
1475 .mode = 0444,
Christoph Hellwig312d3ca2010-10-10 05:36:23 -04001476 .proc_handler = proc_nr_dentry,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001477 },
1478 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001479 .procname = "overflowuid",
1480 .data = &fs_overflowuid,
1481 .maxlen = sizeof(int),
1482 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001483 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001484 .extra1 = &minolduid,
1485 .extra2 = &maxolduid,
1486 },
1487 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001488 .procname = "overflowgid",
1489 .data = &fs_overflowgid,
1490 .maxlen = sizeof(int),
1491 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001492 .proc_handler = proc_dointvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001493 .extra1 = &minolduid,
1494 .extra2 = &maxolduid,
1495 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001496#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001497 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001498 .procname = "leases-enable",
1499 .data = &leases_enable,
1500 .maxlen = sizeof(int),
1501 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001502 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001503 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001504#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001505#ifdef CONFIG_DNOTIFY
1506 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001507 .procname = "dir-notify-enable",
1508 .data = &dir_notify_enable,
1509 .maxlen = sizeof(int),
1510 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001511 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001512 },
1513#endif
1514#ifdef CONFIG_MMU
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001515#ifdef CONFIG_FILE_LOCKING
Linus Torvalds1da177e2005-04-16 15:20:36 -07001516 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001517 .procname = "lease-break-time",
1518 .data = &lease_break_time,
1519 .maxlen = sizeof(int),
1520 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001521 .proc_handler = proc_dointvec,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001522 },
Thomas Petazzonibfcd17a2008-08-06 15:12:22 +02001523#endif
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001524#ifdef CONFIG_AIO
Linus Torvalds1da177e2005-04-16 15:20:36 -07001525 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001526 .procname = "aio-nr",
1527 .data = &aio_nr,
1528 .maxlen = sizeof(aio_nr),
1529 .mode = 0444,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001530 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001531 },
1532 {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001533 .procname = "aio-max-nr",
1534 .data = &aio_max_nr,
1535 .maxlen = sizeof(aio_max_nr),
1536 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001537 .proc_handler = proc_doulongvec_minmax,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001538 },
Thomas Petazzoniebf3f092008-10-15 22:05:12 -07001539#endif /* CONFIG_AIO */
Amy Griffis2d9048e2006-06-01 13:10:59 -07001540#ifdef CONFIG_INOTIFY_USER
Robert Love0399cb02005-07-13 12:38:18 -04001541 {
Robert Love0399cb02005-07-13 12:38:18 -04001542 .procname = "inotify",
1543 .mode = 0555,
1544 .child = inotify_table,
1545 },
1546#endif
Davide Libenzi7ef99642008-12-01 13:13:55 -08001547#ifdef CONFIG_EPOLL
1548 {
1549 .procname = "epoll",
1550 .mode = 0555,
1551 .child = epoll_table,
1552 },
1553#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -07001554#endif
Alan Coxd6e71142005-06-23 00:09:43 -07001555 {
Alan Coxd6e71142005-06-23 00:09:43 -07001556 .procname = "suid_dumpable",
1557 .data = &suid_dumpable,
1558 .maxlen = sizeof(int),
1559 .mode = 0644,
Eric W. Biederman6d456112009-11-16 03:11:48 -08001560 .proc_handler = proc_dointvec_minmax,
Matthew Wilcox8e654fb2009-04-02 16:58:33 -07001561 .extra1 = &zero,
1562 .extra2 = &two,
Alan Coxd6e71142005-06-23 00:09:43 -07001563 },
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001564#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1565 {
Eric W. Biederman2abc26f2007-02-14 00:34:07 -08001566 .procname = "binfmt_misc",
1567 .mode = 0555,
1568 .child = binfmt_misc_table,
1569 },
1570#endif
Jens Axboeb492e952010-05-19 21:03:16 +02001571 {
Jens Axboeff9da692010-06-03 14:54:39 +02001572 .procname = "pipe-max-size",
1573 .data = &pipe_max_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001574 .maxlen = sizeof(int),
1575 .mode = 0644,
Jens Axboeff9da692010-06-03 14:54:39 +02001576 .proc_handler = &pipe_proc_fn,
1577 .extra1 = &pipe_min_size,
Jens Axboeb492e952010-05-19 21:03:16 +02001578 },
Willy Tarreau53b4f1f2016-01-18 16:36:09 +01001579 {
1580 .procname = "pipe-user-pages-hard",
1581 .data = &pipe_user_pages_hard,
1582 .maxlen = sizeof(pipe_user_pages_hard),
1583 .mode = 0644,
1584 .proc_handler = proc_doulongvec_minmax,
1585 },
1586 {
1587 .procname = "pipe-user-pages-soft",
1588 .data = &pipe_user_pages_soft,
1589 .maxlen = sizeof(pipe_user_pages_soft),
1590 .mode = 0644,
1591 .proc_handler = proc_doulongvec_minmax,
1592 },
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001593 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001594};
1595
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001596static struct ctl_table debug_table[] = {
Heiko Carstensab3c68e2010-05-17 10:00:21 +02001597#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \
Chris Metcalf571d76a2011-05-16 14:23:44 -04001598 defined(CONFIG_S390) || defined(CONFIG_TILE)
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001599 {
Masoud Asgharifard Sharbianiabd4f752007-07-22 11:12:28 +02001600 .procname = "exception-trace",
1601 .data = &show_unhandled_signals,
1602 .maxlen = sizeof(int),
1603 .mode = 0644,
1604 .proc_handler = proc_dointvec
1605 },
1606#endif
Masami Hiramatsub2be84d2010-02-25 08:34:15 -05001607#if defined(CONFIG_OPTPROBES)
1608 {
1609 .procname = "kprobes-optimization",
1610 .data = &sysctl_kprobes_optimization,
1611 .maxlen = sizeof(int),
1612 .mode = 0644,
1613 .proc_handler = proc_kprobes_optimization_handler,
1614 .extra1 = &zero,
1615 .extra2 = &one,
1616 },
1617#endif
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001618 { }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001619};
1620
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001621static struct ctl_table dev_table[] = {
Eric W. Biederman6fce56e2009-04-03 02:30:53 -07001622 { }
Robert Love0eeca282005-07-12 17:06:03 -04001623};
Linus Torvalds1da177e2005-04-16 15:20:36 -07001624
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001625int __init sysctl_init(void)
Al Viro330d57f2005-11-04 10:18:40 +00001626{
Eric W. Biedermande4e83bd2012-01-06 03:34:20 -08001627 register_sysctl_table(sysctl_base_table);
Eric W. Biedermand912b0c2007-02-14 00:34:13 -08001628 return 0;
1629}
1630
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001631#endif /* CONFIG_SYSCTL */
1632
Linus Torvalds1da177e2005-04-16 15:20:36 -07001633/*
1634 * /proc/sys support
1635 */
1636
Eric W. Biedermanb89a8172006-09-27 01:51:04 -07001637#ifdef CONFIG_PROC_SYSCTL
Linus Torvalds1da177e2005-04-16 15:20:36 -07001638
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001639static int _proc_do_string(void* data, int maxlen, int write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001640 void __user *buffer,
Adrian Bunkb1ba4dd2006-10-02 02:18:05 -07001641 size_t *lenp, loff_t *ppos)
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001642{
1643 size_t len;
1644 char __user *p;
1645 char c;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001646
1647 if (!data || !maxlen || !*lenp) {
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001648 *lenp = 0;
1649 return 0;
1650 }
Oleg Nesterov8d060872007-02-10 01:46:38 -08001651
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001652 if (write) {
1653 len = 0;
1654 p = buffer;
1655 while (len < *lenp) {
1656 if (get_user(c, p++))
1657 return -EFAULT;
1658 if (c == 0 || c == '\n')
1659 break;
1660 len++;
1661 }
1662 if (len >= maxlen)
1663 len = maxlen-1;
1664 if(copy_from_user(data, buffer, len))
1665 return -EFAULT;
1666 ((char *) data)[len] = 0;
1667 *ppos += *lenp;
1668 } else {
1669 len = strlen(data);
1670 if (len > maxlen)
1671 len = maxlen;
Oleg Nesterov8d060872007-02-10 01:46:38 -08001672
1673 if (*ppos > len) {
1674 *lenp = 0;
1675 return 0;
1676 }
1677
1678 data += *ppos;
1679 len -= *ppos;
1680
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001681 if (len > *lenp)
1682 len = *lenp;
1683 if (len)
1684 if(copy_to_user(buffer, data, len))
1685 return -EFAULT;
1686 if (len < *lenp) {
1687 if(put_user('\n', ((char __user *) buffer) + len))
1688 return -EFAULT;
1689 len++;
1690 }
1691 *lenp = len;
1692 *ppos += len;
1693 }
1694 return 0;
1695}
1696
Linus Torvalds1da177e2005-04-16 15:20:36 -07001697/**
1698 * proc_dostring - read a string sysctl
1699 * @table: the sysctl table
1700 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001701 * @buffer: the user buffer
1702 * @lenp: the size of the user buffer
1703 * @ppos: file position
1704 *
1705 * Reads/writes a string from/to the user buffer. If the kernel
1706 * buffer provided is not large enough to hold the string, the
1707 * string is truncated. The copied string is %NULL-terminated.
1708 * If the string is being read by the user process, it is copied
1709 * and a newline '\n' is added. It is truncated if the buffer is
1710 * not large enough.
1711 *
1712 * Returns 0 on success.
1713 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001714int proc_dostring(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001715 void __user *buffer, size_t *lenp, loff_t *ppos)
1716{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001717 return _proc_do_string(table->data, table->maxlen, write,
Sam Vilainf5dd3d62006-10-02 02:18:04 -07001718 buffer, lenp, ppos);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001719}
1720
Amerigo Wang00b7c332010-05-05 00:26:45 +00001721static size_t proc_skip_spaces(char **buf)
1722{
1723 size_t ret;
1724 char *tmp = skip_spaces(*buf);
1725 ret = tmp - *buf;
1726 *buf = tmp;
1727 return ret;
1728}
Linus Torvalds1da177e2005-04-16 15:20:36 -07001729
Octavian Purdila9f977fb2010-05-05 00:26:55 +00001730static void proc_skip_char(char **buf, size_t *size, const char v)
1731{
1732 while (*size) {
1733 if (**buf != v)
1734 break;
1735 (*size)--;
1736 (*buf)++;
1737 }
1738}
1739
Amerigo Wang00b7c332010-05-05 00:26:45 +00001740#define TMPBUFLEN 22
1741/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001742 * proc_get_long - reads an ASCII formatted integer from a user buffer
Amerigo Wang00b7c332010-05-05 00:26:45 +00001743 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001744 * @buf: a kernel buffer
1745 * @size: size of the kernel buffer
1746 * @val: this is where the number will be stored
1747 * @neg: set to %TRUE if number is negative
1748 * @perm_tr: a vector which contains the allowed trailers
1749 * @perm_tr_len: size of the perm_tr vector
1750 * @tr: pointer to store the trailer character
Amerigo Wang00b7c332010-05-05 00:26:45 +00001751 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001752 * In case of success %0 is returned and @buf and @size are updated with
1753 * the amount of bytes read. If @tr is non-NULL and a trailing
1754 * character exists (size is non-zero after returning from this
1755 * function), @tr is updated with the trailing character.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001756 */
1757static int proc_get_long(char **buf, size_t *size,
1758 unsigned long *val, bool *neg,
1759 const char *perm_tr, unsigned perm_tr_len, char *tr)
1760{
1761 int len;
1762 char *p, tmp[TMPBUFLEN];
1763
1764 if (!*size)
1765 return -EINVAL;
1766
1767 len = *size;
1768 if (len > TMPBUFLEN - 1)
1769 len = TMPBUFLEN - 1;
1770
1771 memcpy(tmp, *buf, len);
1772
1773 tmp[len] = 0;
1774 p = tmp;
1775 if (*p == '-' && *size > 1) {
1776 *neg = true;
1777 p++;
1778 } else
1779 *neg = false;
1780 if (!isdigit(*p))
1781 return -EINVAL;
1782
1783 *val = simple_strtoul(p, &p, 0);
1784
1785 len = p - tmp;
1786
1787 /* We don't know if the next char is whitespace thus we may accept
1788 * invalid integers (e.g. 1234...a) or two integers instead of one
1789 * (e.g. 123...1). So lets not allow such large numbers. */
1790 if (len == TMPBUFLEN - 1)
1791 return -EINVAL;
1792
1793 if (len < *size && perm_tr_len && !memchr(perm_tr, *p, perm_tr_len))
1794 return -EINVAL;
1795
1796 if (tr && (len < *size))
1797 *tr = *p;
1798
1799 *buf += len;
1800 *size -= len;
1801
1802 return 0;
1803}
1804
1805/**
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001806 * proc_put_long - converts an integer to a decimal ASCII formatted string
Amerigo Wang00b7c332010-05-05 00:26:45 +00001807 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001808 * @buf: the user buffer
1809 * @size: the size of the user buffer
1810 * @val: the integer to be converted
1811 * @neg: sign of the number, %TRUE for negative
Amerigo Wang00b7c332010-05-05 00:26:45 +00001812 *
Randy Dunlap0fc377b2010-05-21 11:29:53 -07001813 * In case of success %0 is returned and @buf and @size are updated with
1814 * the amount of bytes written.
Amerigo Wang00b7c332010-05-05 00:26:45 +00001815 */
1816static int proc_put_long(void __user **buf, size_t *size, unsigned long val,
1817 bool neg)
1818{
1819 int len;
1820 char tmp[TMPBUFLEN], *p = tmp;
1821
1822 sprintf(p, "%s%lu", neg ? "-" : "", val);
1823 len = strlen(tmp);
1824 if (len > *size)
1825 len = *size;
1826 if (copy_to_user(*buf, tmp, len))
1827 return -EFAULT;
1828 *size -= len;
1829 *buf += len;
1830 return 0;
1831}
1832#undef TMPBUFLEN
1833
1834static int proc_put_char(void __user **buf, size_t *size, char c)
1835{
1836 if (*size) {
1837 char __user **buffer = (char __user **)buf;
1838 if (put_user(c, *buffer))
1839 return -EFAULT;
1840 (*size)--, (*buffer)++;
1841 *buf = *buffer;
1842 }
1843 return 0;
1844}
1845
1846static int do_proc_dointvec_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001847 int *valp,
1848 int write, void *data)
1849{
1850 if (write) {
1851 *valp = *negp ? -*lvalp : *lvalp;
1852 } else {
1853 int val = *valp;
1854 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001855 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001856 *lvalp = (unsigned long)-val;
1857 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001858 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001859 *lvalp = (unsigned long)val;
1860 }
1861 }
1862 return 0;
1863}
1864
Amerigo Wang00b7c332010-05-05 00:26:45 +00001865static const char proc_wspace_sep[] = { ' ', '\t', '\n' };
1866
Eric W. Biedermand8217f02007-10-18 03:05:22 -07001867static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001868 int write, void __user *buffer,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001869 size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001870 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001871 int write, void *data),
1872 void *data)
1873{
Amerigo Wang00b7c332010-05-05 00:26:45 +00001874 int *i, vleft, first = 1, err = 0;
1875 unsigned long page = 0;
1876 size_t left;
1877 char *kbuf;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001878
Amerigo Wang00b7c332010-05-05 00:26:45 +00001879 if (!tbl_data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001880 *lenp = 0;
1881 return 0;
1882 }
1883
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001884 i = (int *) tbl_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001885 vleft = table->maxlen / sizeof(*i);
1886 left = *lenp;
1887
1888 if (!conv)
1889 conv = do_proc_dointvec_conv;
1890
Linus Torvalds1da177e2005-04-16 15:20:36 -07001891 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00001892 if (left > PAGE_SIZE - 1)
1893 left = PAGE_SIZE - 1;
1894 page = __get_free_page(GFP_TEMPORARY);
1895 kbuf = (char *) page;
1896 if (!kbuf)
1897 return -ENOMEM;
1898 if (copy_from_user(kbuf, buffer, left)) {
1899 err = -EFAULT;
1900 goto free;
1901 }
1902 kbuf[left] = 0;
1903 }
1904
1905 for (; left && vleft--; i++, first=0) {
1906 unsigned long lval;
1907 bool neg;
1908
1909 if (write) {
1910 left -= proc_skip_spaces(&kbuf);
1911
J. R. Okajima563b0462010-05-25 16:10:14 -07001912 if (!left)
1913 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001914 err = proc_get_long(&kbuf, &left, &lval, &neg,
1915 proc_wspace_sep,
1916 sizeof(proc_wspace_sep), NULL);
1917 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001918 break;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001919 if (conv(&neg, &lval, i, 1, data)) {
1920 err = -EINVAL;
1921 break;
1922 }
1923 } else {
1924 if (conv(&neg, &lval, i, 0, data)) {
1925 err = -EINVAL;
1926 break;
1927 }
1928 if (!first)
1929 err = proc_put_char(&buffer, &left, '\t');
1930 if (err)
1931 break;
1932 err = proc_put_long(&buffer, &left, lval, neg);
1933 if (err)
1934 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001935 }
1936 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00001937
1938 if (!write && !first && left && !err)
1939 err = proc_put_char(&buffer, &left, '\n');
J. R. Okajima563b0462010-05-25 16:10:14 -07001940 if (write && !err && left)
Amerigo Wang00b7c332010-05-05 00:26:45 +00001941 left -= proc_skip_spaces(&kbuf);
1942free:
1943 if (write) {
1944 free_page(page);
1945 if (first)
1946 return err ? : -EINVAL;
1947 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001948 *lenp -= left;
1949 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00001950 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001951}
1952
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001953static int do_proc_dointvec(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001954 void __user *buffer, size_t *lenp, loff_t *ppos,
Amerigo Wang00b7c332010-05-05 00:26:45 +00001955 int (*conv)(bool *negp, unsigned long *lvalp, int *valp,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001956 int write, void *data),
1957 void *data)
1958{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001959 return __do_proc_dointvec(table->data, table, write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07001960 buffer, lenp, ppos, conv, data);
1961}
1962
Linus Torvalds1da177e2005-04-16 15:20:36 -07001963/**
1964 * proc_dointvec - read a vector of integers
1965 * @table: the sysctl table
1966 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07001967 * @buffer: the user buffer
1968 * @lenp: the size of the user buffer
1969 * @ppos: file position
1970 *
1971 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
1972 * values from/to the user buffer, treated as an ASCII string.
1973 *
1974 * Returns 0 on success.
1975 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001976int proc_dointvec(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001977 void __user *buffer, size_t *lenp, loff_t *ppos)
1978{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001979 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001980 NULL,NULL);
1981}
1982
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001983/*
Andi Kleen25ddbb12008-10-15 22:01:41 -07001984 * Taint values can only be increased
1985 * This means we can safely use a temporary.
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001986 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001987static int proc_taint(struct ctl_table *table, int write,
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001988 void __user *buffer, size_t *lenp, loff_t *ppos)
1989{
Andi Kleen25ddbb12008-10-15 22:01:41 -07001990 struct ctl_table t;
1991 unsigned long tmptaint = get_taint();
1992 int err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001993
Bastian Blank91fcd412007-04-23 14:41:14 -07001994 if (write && !capable(CAP_SYS_ADMIN))
Theodore Ts'o34f5a392007-02-10 01:45:24 -08001995 return -EPERM;
1996
Andi Kleen25ddbb12008-10-15 22:01:41 -07001997 t = *table;
1998 t.data = &tmptaint;
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07001999 err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
Andi Kleen25ddbb12008-10-15 22:01:41 -07002000 if (err < 0)
2001 return err;
2002
2003 if (write) {
2004 /*
2005 * Poor man's atomic or. Not worth adding a primitive
2006 * to everyone's atomic.h for this
2007 */
2008 int i;
2009 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2010 if ((tmptaint >> i) & 1)
2011 add_taint(i);
2012 }
2013 }
2014
2015 return err;
Theodore Ts'o34f5a392007-02-10 01:45:24 -08002016}
2017
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002018#ifdef CONFIG_PRINTK
Kees Cook620f6e82012-04-04 11:40:19 -07002019static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
Richard Weinbergerbfdc0b42011-03-23 16:43:11 -07002020 void __user *buffer, size_t *lenp, loff_t *ppos)
2021{
2022 if (write && !capable(CAP_SYS_ADMIN))
2023 return -EPERM;
2024
2025 return proc_dointvec_minmax(table, write, buffer, lenp, ppos);
2026}
2027#endif
2028
Linus Torvalds1da177e2005-04-16 15:20:36 -07002029struct do_proc_dointvec_minmax_conv_param {
2030 int *min;
2031 int *max;
2032};
2033
Amerigo Wang00b7c332010-05-05 00:26:45 +00002034static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2035 int *valp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002036 int write, void *data)
2037{
2038 struct do_proc_dointvec_minmax_conv_param *param = data;
2039 if (write) {
2040 int val = *negp ? -*lvalp : *lvalp;
2041 if ((param->min && *param->min > val) ||
2042 (param->max && *param->max < val))
2043 return -EINVAL;
2044 *valp = val;
2045 } else {
2046 int val = *valp;
2047 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002048 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002049 *lvalp = (unsigned long)-val;
2050 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002051 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002052 *lvalp = (unsigned long)val;
2053 }
2054 }
2055 return 0;
2056}
2057
2058/**
2059 * proc_dointvec_minmax - read a vector of integers with min/max values
2060 * @table: the sysctl table
2061 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002062 * @buffer: the user buffer
2063 * @lenp: the size of the user buffer
2064 * @ppos: file position
2065 *
2066 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2067 * values from/to the user buffer, treated as an ASCII string.
2068 *
2069 * This routine will ensure the values are within the range specified by
2070 * table->extra1 (min) and table->extra2 (max).
2071 *
2072 * Returns 0 on success.
2073 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002074int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002075 void __user *buffer, size_t *lenp, loff_t *ppos)
2076{
2077 struct do_proc_dointvec_minmax_conv_param param = {
2078 .min = (int *) table->extra1,
2079 .max = (int *) table->extra2,
2080 };
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002081 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002082 do_proc_dointvec_minmax_conv, &param);
2083}
2084
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002085static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002086 void __user *buffer,
2087 size_t *lenp, loff_t *ppos,
2088 unsigned long convmul,
2089 unsigned long convdiv)
2090{
Amerigo Wang00b7c332010-05-05 00:26:45 +00002091 unsigned long *i, *min, *max;
2092 int vleft, first = 1, err = 0;
2093 unsigned long page = 0;
2094 size_t left;
2095 char *kbuf;
2096
2097 if (!data || !table->maxlen || !*lenp || (*ppos && !write)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -07002098 *lenp = 0;
2099 return 0;
2100 }
Amerigo Wang00b7c332010-05-05 00:26:45 +00002101
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002102 i = (unsigned long *) data;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002103 min = (unsigned long *) table->extra1;
2104 max = (unsigned long *) table->extra2;
2105 vleft = table->maxlen / sizeof(unsigned long);
2106 left = *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002107
2108 if (write) {
2109 if (left > PAGE_SIZE - 1)
2110 left = PAGE_SIZE - 1;
2111 page = __get_free_page(GFP_TEMPORARY);
2112 kbuf = (char *) page;
2113 if (!kbuf)
2114 return -ENOMEM;
2115 if (copy_from_user(kbuf, buffer, left)) {
2116 err = -EFAULT;
2117 goto free;
2118 }
2119 kbuf[left] = 0;
2120 }
2121
Eric Dumazet27b3d802010-10-07 12:59:29 -07002122 for (; left && vleft--; i++, first = 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002123 unsigned long val;
2124
Linus Torvalds1da177e2005-04-16 15:20:36 -07002125 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002126 bool neg;
2127
2128 left -= proc_skip_spaces(&kbuf);
2129
2130 err = proc_get_long(&kbuf, &left, &val, &neg,
2131 proc_wspace_sep,
2132 sizeof(proc_wspace_sep), NULL);
2133 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002134 break;
2135 if (neg)
Linus Torvalds1da177e2005-04-16 15:20:36 -07002136 continue;
2137 if ((min && val < *min) || (max && val > *max))
2138 continue;
2139 *i = val;
2140 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002141 val = convdiv * (*i) / convmul;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002142 if (!first)
Amerigo Wang00b7c332010-05-05 00:26:45 +00002143 err = proc_put_char(&buffer, &left, '\t');
2144 err = proc_put_long(&buffer, &left, val, false);
2145 if (err)
2146 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002147 }
2148 }
2149
Amerigo Wang00b7c332010-05-05 00:26:45 +00002150 if (!write && !first && left && !err)
2151 err = proc_put_char(&buffer, &left, '\n');
2152 if (write && !err)
2153 left -= proc_skip_spaces(&kbuf);
2154free:
Linus Torvalds1da177e2005-04-16 15:20:36 -07002155 if (write) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002156 free_page(page);
2157 if (first)
2158 return err ? : -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002159 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07002160 *lenp -= left;
2161 *ppos += *lenp;
Amerigo Wang00b7c332010-05-05 00:26:45 +00002162 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002163}
2164
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002165static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002166 void __user *buffer,
2167 size_t *lenp, loff_t *ppos,
2168 unsigned long convmul,
2169 unsigned long convdiv)
2170{
2171 return __do_proc_doulongvec_minmax(table->data, table, write,
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002172 buffer, lenp, ppos, convmul, convdiv);
Kirill Korotaevfcfbd542006-10-02 02:18:23 -07002173}
2174
Linus Torvalds1da177e2005-04-16 15:20:36 -07002175/**
2176 * proc_doulongvec_minmax - read a vector of long integers with min/max values
2177 * @table: the sysctl table
2178 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002179 * @buffer: the user buffer
2180 * @lenp: the size of the user buffer
2181 * @ppos: file position
2182 *
2183 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2184 * values from/to the user buffer, treated as an ASCII string.
2185 *
2186 * This routine will ensure the values are within the range specified by
2187 * table->extra1 (min) and table->extra2 (max).
2188 *
2189 * Returns 0 on success.
2190 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002191int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002192 void __user *buffer, size_t *lenp, loff_t *ppos)
2193{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002194 return do_proc_doulongvec_minmax(table, write, buffer, lenp, ppos, 1l, 1l);
Linus Torvalds1da177e2005-04-16 15:20:36 -07002195}
2196
2197/**
2198 * proc_doulongvec_ms_jiffies_minmax - read a vector of millisecond values with min/max values
2199 * @table: the sysctl table
2200 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002201 * @buffer: the user buffer
2202 * @lenp: the size of the user buffer
2203 * @ppos: file position
2204 *
2205 * Reads/writes up to table->maxlen/sizeof(unsigned long) unsigned long
2206 * values from/to the user buffer, treated as an ASCII string. The values
2207 * are treated as milliseconds, and converted to jiffies when they are stored.
2208 *
2209 * This routine will ensure the values are within the range specified by
2210 * table->extra1 (min) and table->extra2 (max).
2211 *
2212 * Returns 0 on success.
2213 */
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002214int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002215 void __user *buffer,
2216 size_t *lenp, loff_t *ppos)
2217{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002218 return do_proc_doulongvec_minmax(table, write, buffer,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002219 lenp, ppos, HZ, 1000l);
2220}
2221
2222
Amerigo Wang00b7c332010-05-05 00:26:45 +00002223static int do_proc_dointvec_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002224 int *valp,
2225 int write, void *data)
2226{
2227 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002228 if (*lvalp > LONG_MAX / HZ)
2229 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002230 *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ);
2231 } else {
2232 int val = *valp;
2233 unsigned long lval;
2234 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002235 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002236 lval = (unsigned long)-val;
2237 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002238 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002239 lval = (unsigned long)val;
2240 }
2241 *lvalp = lval / HZ;
2242 }
2243 return 0;
2244}
2245
Amerigo Wang00b7c332010-05-05 00:26:45 +00002246static int do_proc_dointvec_userhz_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002247 int *valp,
2248 int write, void *data)
2249{
2250 if (write) {
Bart Samwelcba9f332006-03-24 03:15:50 -08002251 if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ)
2252 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002253 *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp);
2254 } else {
2255 int val = *valp;
2256 unsigned long lval;
2257 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002258 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002259 lval = (unsigned long)-val;
2260 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002261 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002262 lval = (unsigned long)val;
2263 }
2264 *lvalp = jiffies_to_clock_t(lval);
2265 }
2266 return 0;
2267}
2268
Amerigo Wang00b7c332010-05-05 00:26:45 +00002269static int do_proc_dointvec_ms_jiffies_conv(bool *negp, unsigned long *lvalp,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002270 int *valp,
2271 int write, void *data)
2272{
2273 if (write) {
2274 *valp = msecs_to_jiffies(*negp ? -*lvalp : *lvalp);
2275 } else {
2276 int val = *valp;
2277 unsigned long lval;
2278 if (val < 0) {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002279 *negp = true;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002280 lval = (unsigned long)-val;
2281 } else {
Amerigo Wang00b7c332010-05-05 00:26:45 +00002282 *negp = false;
Linus Torvalds1da177e2005-04-16 15:20:36 -07002283 lval = (unsigned long)val;
2284 }
2285 *lvalp = jiffies_to_msecs(lval);
2286 }
2287 return 0;
2288}
2289
2290/**
2291 * proc_dointvec_jiffies - read a vector of integers as seconds
2292 * @table: the sysctl table
2293 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002294 * @buffer: the user buffer
2295 * @lenp: the size of the user buffer
2296 * @ppos: file position
2297 *
2298 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2299 * values from/to the user buffer, treated as an ASCII string.
2300 * The values read are assumed to be in seconds, and are converted into
2301 * jiffies.
2302 *
2303 * Returns 0 on success.
2304 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002305int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002306 void __user *buffer, size_t *lenp, loff_t *ppos)
2307{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002308 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002309 do_proc_dointvec_jiffies_conv,NULL);
2310}
2311
2312/**
2313 * proc_dointvec_userhz_jiffies - read a vector of integers as 1/USER_HZ seconds
2314 * @table: the sysctl table
2315 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002316 * @buffer: the user buffer
2317 * @lenp: the size of the user buffer
Randy Dunlap1e5d5332005-11-07 01:01:06 -08002318 * @ppos: pointer to the file position
Linus Torvalds1da177e2005-04-16 15:20:36 -07002319 *
2320 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2321 * values from/to the user buffer, treated as an ASCII string.
2322 * The values read are assumed to be in 1/USER_HZ seconds, and
2323 * are converted into jiffies.
2324 *
2325 * Returns 0 on success.
2326 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002327int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002328 void __user *buffer, size_t *lenp, loff_t *ppos)
2329{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002330 return do_proc_dointvec(table,write,buffer,lenp,ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002331 do_proc_dointvec_userhz_jiffies_conv,NULL);
2332}
2333
2334/**
2335 * proc_dointvec_ms_jiffies - read a vector of integers as 1 milliseconds
2336 * @table: the sysctl table
2337 * @write: %TRUE if this is a write to the sysctl file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002338 * @buffer: the user buffer
2339 * @lenp: the size of the user buffer
Martin Waitz67be2dd2005-05-01 08:59:26 -07002340 * @ppos: file position
2341 * @ppos: the current position in the file
Linus Torvalds1da177e2005-04-16 15:20:36 -07002342 *
2343 * Reads/writes up to table->maxlen/sizeof(unsigned int) integer
2344 * values from/to the user buffer, treated as an ASCII string.
2345 * The values read are assumed to be in 1/1000 seconds, and
2346 * are converted into jiffies.
2347 *
2348 * Returns 0 on success.
2349 */
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002350int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002351 void __user *buffer, size_t *lenp, loff_t *ppos)
2352{
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002353 return do_proc_dointvec(table, write, buffer, lenp, ppos,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002354 do_proc_dointvec_ms_jiffies_conv, NULL);
2355}
2356
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002357static int proc_do_cad_pid(struct ctl_table *table, int write,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002358 void __user *buffer, size_t *lenp, loff_t *ppos)
2359{
2360 struct pid *new_pid;
2361 pid_t tmp;
2362 int r;
2363
Pavel Emelyanov6c5f3e72008-02-08 04:19:20 -08002364 tmp = pid_vnr(cad_pid);
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002365
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002366 r = __do_proc_dointvec(&tmp, table, write, buffer,
Cedric Le Goater9ec52092006-10-02 02:19:00 -07002367 lenp, ppos, NULL, NULL);
2368 if (r || !write)
2369 return r;
2370
2371 new_pid = find_get_pid(tmp);
2372 if (!new_pid)
2373 return -ESRCH;
2374
2375 put_pid(xchg(&cad_pid, new_pid));
2376 return 0;
2377}
2378
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002379/**
2380 * proc_do_large_bitmap - read/write from/to a large bitmap
2381 * @table: the sysctl table
2382 * @write: %TRUE if this is a write to the sysctl file
2383 * @buffer: the user buffer
2384 * @lenp: the size of the user buffer
2385 * @ppos: file position
2386 *
2387 * The bitmap is stored at table->data and the bitmap length (in bits)
2388 * in table->maxlen.
2389 *
2390 * We use a range comma separated format (e.g. 1,3-4,10-10) so that
2391 * large bitmaps may be represented in a compact manner. Writing into
2392 * the file will clear the bitmap then update it with the given input.
2393 *
2394 * Returns 0 on success.
2395 */
2396int proc_do_large_bitmap(struct ctl_table *table, int write,
2397 void __user *buffer, size_t *lenp, loff_t *ppos)
2398{
2399 int err = 0;
2400 bool first = 1;
2401 size_t left = *lenp;
2402 unsigned long bitmap_len = table->maxlen;
2403 unsigned long *bitmap = (unsigned long *) table->data;
2404 unsigned long *tmp_bitmap = NULL;
2405 char tr_a[] = { '-', ',', '\n' }, tr_b[] = { ',', '\n', 0 }, c;
2406
2407 if (!bitmap_len || !left || (*ppos && !write)) {
2408 *lenp = 0;
2409 return 0;
2410 }
2411
2412 if (write) {
2413 unsigned long page = 0;
2414 char *kbuf;
2415
2416 if (left > PAGE_SIZE - 1)
2417 left = PAGE_SIZE - 1;
2418
2419 page = __get_free_page(GFP_TEMPORARY);
2420 kbuf = (char *) page;
2421 if (!kbuf)
2422 return -ENOMEM;
2423 if (copy_from_user(kbuf, buffer, left)) {
2424 free_page(page);
2425 return -EFAULT;
2426 }
2427 kbuf[left] = 0;
2428
2429 tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
2430 GFP_KERNEL);
2431 if (!tmp_bitmap) {
2432 free_page(page);
2433 return -ENOMEM;
2434 }
2435 proc_skip_char(&kbuf, &left, '\n');
2436 while (!err && left) {
2437 unsigned long val_a, val_b;
2438 bool neg;
2439
2440 err = proc_get_long(&kbuf, &left, &val_a, &neg, tr_a,
2441 sizeof(tr_a), &c);
2442 if (err)
2443 break;
2444 if (val_a >= bitmap_len || neg) {
2445 err = -EINVAL;
2446 break;
2447 }
2448
2449 val_b = val_a;
2450 if (left) {
2451 kbuf++;
2452 left--;
2453 }
2454
2455 if (c == '-') {
2456 err = proc_get_long(&kbuf, &left, &val_b,
2457 &neg, tr_b, sizeof(tr_b),
2458 &c);
2459 if (err)
2460 break;
2461 if (val_b >= bitmap_len || neg ||
2462 val_a > val_b) {
2463 err = -EINVAL;
2464 break;
2465 }
2466 if (left) {
2467 kbuf++;
2468 left--;
2469 }
2470 }
2471
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002472 bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002473 first = 0;
2474 proc_skip_char(&kbuf, &left, '\n');
2475 }
2476 free_page(page);
2477 } else {
2478 unsigned long bit_a, bit_b = 0;
2479
2480 while (left) {
2481 bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
2482 if (bit_a >= bitmap_len)
2483 break;
2484 bit_b = find_next_zero_bit(bitmap, bitmap_len,
2485 bit_a + 1) - 1;
2486
2487 if (!first) {
2488 err = proc_put_char(&buffer, &left, ',');
2489 if (err)
2490 break;
2491 }
2492 err = proc_put_long(&buffer, &left, bit_a, false);
2493 if (err)
2494 break;
2495 if (bit_a != bit_b) {
2496 err = proc_put_char(&buffer, &left, '-');
2497 if (err)
2498 break;
2499 err = proc_put_long(&buffer, &left, bit_b, false);
2500 if (err)
2501 break;
2502 }
2503
2504 first = 0; bit_b++;
2505 }
2506 if (!err)
2507 err = proc_put_char(&buffer, &left, '\n');
2508 }
2509
2510 if (!err) {
2511 if (write) {
2512 if (*ppos)
2513 bitmap_or(bitmap, bitmap, tmp_bitmap, bitmap_len);
2514 else
Akinobu Mita5a04cca2012-03-28 14:42:50 -07002515 bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
Octavian Purdila9f977fb2010-05-05 00:26:55 +00002516 }
2517 kfree(tmp_bitmap);
2518 *lenp -= left;
2519 *ppos += *lenp;
2520 return 0;
2521 } else {
2522 kfree(tmp_bitmap);
2523 return err;
2524 }
2525}
2526
Jovi Zhang55610502011-01-12 17:00:45 -08002527#else /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002528
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002529int proc_dostring(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_dointvec(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
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002541int proc_dointvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002542 void __user *buffer, size_t *lenp, loff_t *ppos)
2543{
2544 return -ENOSYS;
2545}
2546
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002547int proc_dointvec_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002548 void __user *buffer, size_t *lenp, loff_t *ppos)
2549{
2550 return -ENOSYS;
2551}
2552
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002553int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002554 void __user *buffer, size_t *lenp, loff_t *ppos)
2555{
2556 return -ENOSYS;
2557}
2558
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002559int proc_dointvec_ms_jiffies(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002560 void __user *buffer, size_t *lenp, loff_t *ppos)
2561{
2562 return -ENOSYS;
2563}
2564
Alexey Dobriyan8d65af72009-09-23 15:57:19 -07002565int proc_doulongvec_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002566 void __user *buffer, size_t *lenp, loff_t *ppos)
2567{
2568 return -ENOSYS;
2569}
2570
Eric W. Biedermand8217f02007-10-18 03:05:22 -07002571int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
Linus Torvalds1da177e2005-04-16 15:20:36 -07002572 void __user *buffer,
2573 size_t *lenp, loff_t *ppos)
2574{
2575 return -ENOSYS;
2576}
2577
2578
Jovi Zhang55610502011-01-12 17:00:45 -08002579#endif /* CONFIG_PROC_SYSCTL */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002580
Linus Torvalds1da177e2005-04-16 15:20:36 -07002581/*
2582 * No sense putting this after each symbol definition, twice,
2583 * exception granted :-)
2584 */
2585EXPORT_SYMBOL(proc_dointvec);
2586EXPORT_SYMBOL(proc_dointvec_jiffies);
2587EXPORT_SYMBOL(proc_dointvec_minmax);
2588EXPORT_SYMBOL(proc_dointvec_userhz_jiffies);
2589EXPORT_SYMBOL(proc_dointvec_ms_jiffies);
2590EXPORT_SYMBOL(proc_dostring);
2591EXPORT_SYMBOL(proc_doulongvec_minmax);
2592EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax);